// Global Javascript
// Last Update: 5/12/03


// BROWSER CHECK variables: ie, nn, nn++
var brow = (document.layers) ? "nn":"ie";
if (navigator.appName.indexOf("Netscape") > -1 && navigator.appVersion >= "5") brow = "nn+";

// NAVIGATION variables
var open_sub = false;
var open_mask = false;




// Variables to control layer visibility
if( brow == "nn" ){
	var show = "show";
	var hide = "hide";
	var frstr = "document.";
	var bkstr = "";
	var bg = "bgColor";
}

if ( brow == "nn+" ) {
	var show = "visible";
	var hide = "hidden";
	var frstr = 'document.getElementById("';
	var bkstr = '").style';
	var bg = "backgroundColor";
}

if( brow == "ie" ){
	var show = "visible";
	var hide = "hidden";
	var frstr = "";
	var bkstr = ".style";
	var bg = "backgroundColor";
}

function formatForBrowser( the_object ){
	var formattedObj = frstr + the_object + bkstr;
	return eval( formattedObj );
}



// swapImage for rollovers
function swapImage( img_name, img_state ) {
		var imgRef = "menu_" + img_name;
    document[imgRef].src = eval( img_name + img_state + ".src" );
}

// ROLLOVERS FOR DYNAMIC MENU
function rollMe( the_div, the_color ){
	
	the_div = "menu_" + the_div
	var the_layer = formatForBrowser( the_div );
	the_layer[ bg ] = the_color;
}


function openSub( section, the_mask, subSection, RO_color, US_color  ){

	if( open_sub ){
		closeSub( US_color );
	}
	if( the_mask =="pol_mask" ){
		rollMe( section, RO_color );
	}
	
	if( subSection ){
		open_sub = section;
		open_mask = the_mask;
		toggleVisible( formatForBrowser( "sub_" + open_sub ), true );
		toggleVisible( formatForBrowser( open_mask ), true );
	}
}

function closeSub( US_color ){
	if( ( open_mask == false ) && ( open_sub == false ) ){
		return true;
	}else{
		if( open_mask == "pol_mask" ){
			rollMe( open_sub, US_color );
		}
		toggleVisible( formatForBrowser( "sub_" + open_sub ), false );
		toggleVisible( formatForBrowser( open_mask ), false );
		open_sub = false;
		open_mask = false;
	}
}


function toggleVisible( the_object, is_visible ){
	if( is_visible ){
		the_object.visibility = show;
	}else{
		the_object.visibility = hide;
	}
}

function openChat(theUser) {
	var chatWindow = window.open('/chat/index.asp?user='+theUser,'chatWindow','width=312,height=408,scrollbars=no,status=yes,resizable=yes');
	chatWindow.focus();
}

function jumpMenu(targ,selObj,restore){ 

	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MiscMenu1(theLink) {
	var PRWindow = window.open('+theLink.options[theLink.selectedIndex].value+','PRWindow','width=312,height=408,scrollbars=no,status=yes,resizable=yes');
	PRWindow.focus();
}

function openFlash(thefile) {
	var flashWindow = window.open('/flash/'+thefile+'/'+thefile+'.html','flashWindow','width=760,height=500,scrollbars=no,status=yes,resizable=yes');
	flashWindow.focus();
}

