/**
 * Variable to output javascript debugging information.
 */
var debug=false;

/**
 * Function to allow a user to bookmark a page
 *
 * Works only in IE. Mozilla users should hit CTRL+D
 */
function bookmark(url, description) {
	netscape="Mozilla Users please hit CTRL+D to add a bookmark to this site."
	if (navigator.appName=='Microsoft Internet Explorer') {
		window.external.AddFavorite(url, description);
	} else if (navigator.appName=='Netscape') {
		alert(netscape);
	}
}
function hide_reload(id) {
	hide(id);
	f = document.getElementById(id+'_iframe');
	f.src = f.src;
}
function reveal(id) {
	document.getElementById(id).style.visibility='visible';
}
function hide(id) {
	document.getElementById(id).style.visibility='hidden';
}

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}
	debug_alert('Query Variable ' + variable + ' not found');
	return "";
}

function debug_alert(message) {
	if (debug) {
		alert(message);
	}
}

function ajaxLoader(url,id)
	{
		if (document.getElementById) {
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			}
			if (x)
				{
			x.onreadystatechange = function()
					{
				if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(id);
						el.innerHTML = x.responseText;
						alert(x.responseText);
					}
					}
				x.open("GET", url, true);
				x.send(null);
				}
	    }


function resize(which, max) {
  var elem = document.getElementById(which);
  if (elem == undefined || elem == null) return false;
  if (max == undefined) max = 48;
  if (elem.width > elem.height) {
    if (elem.width > max) elem.width = max;
  } else {
    if (elem.height > max) elem.height = max;
  }
} 
