window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var NS3 = (bName == "Netscape" && bVer < 4);
var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
var details = null;

//Function To Open Window
function popup(url, width, height, scroll) {
	if (isNaN(width)) {
		width=350;
	}
	if (isNaN(height)) {
		height=365;
	}

	var window_left = (screen.width-width)/2;
	var window_top = (screen.height-height)/2;
	
	details = window.open(url,'details','width='+width+',height='+height+',resizable=no,scrollbars='+scroll+',top=' + window_top + ',left=' + window_left + '');
	details.window.focus();
}

function css_class_change(who, method, basecolor, highlightcolor, selectedcolor) {
	var currentcolor = who.style.backgroundColor;
	var newcolor;
	
	if(currentcolor == basecolor || currentcolor == '') {
		if(method == 'highlight') {
			newcolor = highlightcolor;
		} else if(method == 'select') {
			newcolor = selectedcolor;
		}
	} else if(currentcolor == highlightcolor) {
		if(method == 'highlight') {
			newcolor = basecolor;
		} else if(method == 'select') {
			newcolor = selectedcolor;
		}
	} else if(currentcolor == selectedcolor) {
		if(method == 'highlight') {
			newcolor = currentcolor;
		} else if(method == 'select') {
			newcolor = highlightcolor;
		}
	}
	
	who.style.backgroundColor = newcolor; 
}

//Function To Open Gallery Window
function gallery_popup(url, width, height, scroll) {
	var window_left = (screen.width - width)/2;
	var window_top = (screen.height - height)/2;


	if(IE4) {
		if(details) {
			details.close();
			details = null;
		}

		details = window.open('','details','width=' + width + ',height=' + height + ',resizable=yes,scrollbars='+scroll+',top=' + window_top + ',left=' + window_left + '');
		details.document.write("<HTML><HEAD></HEAD><BODY TOPMARGIN='0' LEFTMARGIN='0' MARGINHEIGHT='0' MARGINWIDTH='0'>");
		details.document.write("<IMG SRC='" + url + "'>");
		details.document.write("</BODY></HTML>");
	} else {
		details = window.open(url,'details','width=' + width + ',height=' + height + ',resizable=yes,scrollbars='+scroll+',top=' + window_top + ',left=' + window_left + '');
	}

	details.window.focus();
}

function tooltip ( id ) {
	thistooltip = document.getElementById( id ).style;

	if( thistooltip.display == "none") {
		thistooltip.display = "";
	} else {
		thistooltip.display = "none";
	}
}