var win 		= (navigator.userAgent.indexOf('Win') != -1 ) ? 1 : 0;
var MacNN4      = (ns4 && (navigator.userAgent.indexOf('Mac') != -1) && !win ) ? 1 : 0;
var MacIE4      = (ie4 && (navigator.userAgent.indexOf('Mac') != -1) && !win ) ? 1 : 0;
var jsOn        = (navigator.javaEnabled()) ? true: false;
var ns4         = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var ie4         = (document.all) ? 1 : 0;
var MinIE5      = (ie4 && navigator.appVersion.indexOf("5.")  >= 0) ? 1 : 0;
var MinIE55     = (MinIE5 && navigator.appVersion.indexOf("5.5") >= 0) ? 1 : 0;
var ns6         = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) == 6) ? 1 : 0;
var newDom      = ( ns6 || MinIE55 ) ? true : false ; 
var ms					= ( ie4 || MinIE5 || MinIE55 )? true : false ;


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function show(object) {
	MM_showHideLayers(object,'','show');
}   				

function hide(object) {																									
	MM_showHideLayers(object,'','hide');
}

/* Show  nav bg */
function showIndex( index ) {
	for ( i = 1; i <= 6; i++ ) {
		if ( i == index ) {
			show("mainNav"+i+"BG");
		}
		else {
			hide("mainNav"+i+"BG");
			hide("subNav"+i+"T");
			show("isHomeImageOff");
			show( "isHomeContent" );					
		}
	}	
}

function showSubNav( index ){
	var active = 1;
	for ( i = 1; i <= 6; i++ ) {
		if ( i == index) {
			show( "subNav"+i+"T" );
			show("isHomeImageOn");
			show("mainNav"+i+"BG");
			hide("isHomeImageOff");
			hide("isHomeContent");
		}
		else{
			hide( "subNav"+i+"T" );
		}
	}
}	

/* hide nav bg */
function hideIndex( index ) {
	for ( i = 1; i <= 6; i++ ) {
		if ( i == index ) {
			hide("mainNav"+i+"BG");
		}
	}	
}


// Preload Images
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

// Change Image Over
function changeImage(imgName,imgObj) {
	MM_swapImage(imgName,'','../img/general/'+ imgObj +".gif");
	
	/*
	MM_swapImage('areapic','','/images/areas/news.jpg',1);
	if (document.images) {
		if (ns4 && layer!=null){ 
			eval('document.'+layer+'.document.images["'+imgName+'"].src = document.images["'+imgObj+'"].src ' );
		} else { 
			document.images[imgName].src = document.images[imgObj].src
		}
	}
	*/
}	

function openPopup (theURL){
	var theHeight = 555;
	var theWidth = 730;
	var leftpos = 296;	
		if (openPopup.arguments.length == 3){
		theWidth = openPopup.arguments[2];
		theHeight = openPopup.arguments[3];
		}
		window.open (theURL+".html", 'infowindow','width='+theWidth+',height='+theHeight+',left='+leftpos+',top=250,location=no,resizable=no,menubar=no,status=no,toolbar=no,scrollbars=yes');
}
function closePopup (){
	window.close();
	window.opener.document.location.reload();
}

