////////////////////////////////////////////////////////
//Global utility variables 
////////////////////////////////////////////////////////

//Browser utilities

// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var isNav  	= (	   (agt.indexOf('mozilla')!=-1) 
				&& (agt.indexOf('spoofer')==-1)
            	&& (agt.indexOf('compatible') == -1) 
				&& (agt.indexOf('opera')==-1)
            	&& (agt.indexOf('webtv')==-1) 
				&& (agt.indexOf('hotjava')==-1)
			  );

var isNav4 	= (isNav && (parseInt(navigator.appVersion) == 4));
var isNav6  = (isNav && (parseInt(navigator.appVersion) >= 5));


var isIE    = (    (agt.indexOf("msie") != -1) 
				&& (agt.indexOf("opera") == -1)
			  );

var isIE4	= (isIE && (agt.indexOf("msie 4.")!=-1));
var isIE5   = (isIE && (agt.indexOf("msie 5.")!=-1) );
var isIE55  = (isIE && (agt.indexOf("msie 5.5")!=-1) );
var isIE6   = (isIE && (agt.indexOf("msie 6.")!=-1) );

var isKDE   = ((agt.indexOf('mozilla')!=-1) 
				&& (agt.indexOf('konqueror')!=-1) )
				
var isKDE3  = (isKDE && (agt.indexOf("3.")!=-1) );

var isDOM 	= (isNav6 || isIE5 || isIE55 || isIE6 || isKDE3);

var isMac 	= (agt.indexOf("mac")!=-1);


				

//Abstract wierd stylistic conventions
if (isNav4) {
	visible = "show";
	hidden = "hide";
} else {
	visible = "visible";
	hidden = "hidden";
}



/*
 popup
 
 Displays a new browser window with the specified URL.
 Using this function ensures that the new window is 
 always in focus on the OS.
*/
var myWin;
function popup(URL, Target, Options) {
	
	if ((! myWin) || (myWin.closed)) {
		myWin = window.open(URL, Target, Options);
	}  else	{
		if (isIE) {
			myWin.navigate(URL);
		} else {
			myWin.location=URL;
		}
	}
	
	myWin.focus();
	
	//return false so that href click is not followed!
	return false;
}

