function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0

  //if we didn't just come out of a current flynav selection and the arg is NOT '1', then execute function
  //if(!Selectout && MM_swapImage.arguments[1] != '1') {
  //
  if(Selectout && MM_swapImage.arguments[1] == '1') {
	 return false;
  }
  else {
     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];}
  }
   
   //reset the flag to default 'false'
   Selectout = false;	 
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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) {
		    if(obj.id == 'gtnwcompfive' && v == 'show' && screen.availHeight == 572) {
		       obj.style.top = adjustFlyNavHeight(obj.id);
		    }
			if(obj.id == 'gtnwcompeight' && v == 'show' && screen.availHeight == 572) {
		       obj.style.top = adjustFlyNavHeight(obj.id);
		    }
			if(obj.id == 'nbcompfive' && v == 'show' && screen.availHeight == 572) {
		       obj.style.top = adjustFlyNavHeight(obj.id);
		    }
			if(obj.id == 'nbcompeight' && v == 'show' && screen.availHeight == 572) {
		       obj.style.top = adjustFlyNavHeight(obj.id);
		    }
		    obj=obj.style;
		    v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		 }
         obj.visibility=v;
      }
}

function sub_nav_off() {
	MM_showHideLayers('layeronezero','','hide','layertwozero','','hide','layerthreezero','','hide','layerfourzero','','hide','layerfivezero','','hide');
}

function home_sub_nav_off() {
	MM_showHideLayers('subabout','','hide','subops','','hide','subinvest','','hide','substeward','','hide','subnews','','hide');
}

function left_nav_off(section) {
	switch(section) {
		case '1': MM_showHideLayers('leftonesix','','hide');
		case '2': MM_showHideLayers('lefttwoone','','hide','lefttwofour','','hide','lefttwofive','','hide');
		case '3': MM_showHideLayers('leftthreethree','','hide','leftthreefour','','hide','leftthreefive','','hide','leftthreesix','','hide');
		case '4': MM_showHideLayers();
		case '5': MM_showHideLayers('leftfivetwo','','hide','leftfivethree','','hide');
		case '6': MM_showHideLayers('leftnuclearlayer','','hide');
		case 'gtnw': MM_showHideLayers('gtnwone','','hide','gtnwtwo','','hide','gtnwthree','','hide');
		case 'gtnwcomp': MM_showHideLayers('gtnwcompone','','hide','gtnwcomptwo','','hide','gtnwcompthree','','hide','gtnwcompfour','','hide','gtnwcompfive','','hide','gtnwcompsix','','hide','gtnwcompseven','','hide','gtnwcompeight','','hide');
		case 'nb': MM_showHideLayers('nbone','','hide','nbtwo','','hide','nbthree','','hide');
		case 'nbcomp': MM_showHideLayers('nbcompone','','hide','nbcomptwo','','hide','nbcompthree','','hide','nbcompfour','','hide','nbcompfive','','hide','nbcompsix','','hide','nbcompseven','','hide','nbcompeight','','hide');
		case 'northbaja_span': MM_showHideLayers('left_northbaja_span_one','','hide','left_northbaja_span_two','','hide');
	}
}

function popup(url,wid,hei) {

    //if the browser is Netscape....
	if(navigator.appName.indexOf("Netscape") != -1) {
	   window.open(url,'emailalert','width=' + wid + ',height=' + hei + ',screenY=166,screenX=160,resizable=yes');
	}   
	else {
	   window.open(url,'emailalert','width=' + wid + ',height=' + hei + ',top=179,left=160,resizable=yes');   
	}      	    
	   
}

function home_nav_off() {
	MM_showHideLayers('dropabout','','hide','dropops','','hide','dropinvest','','hide','dropnews','','hide','dropsteward','','hide');
}

function home_swap(tsection) {
	home_nav_off();
	if (tsection == '1') {
		MM_showHideLayers('dropabout','','show');
	}
	else if (tsection == '2') {
		MM_showHideLayers('dropops','','show');
	}
	else if (tsection == '3') {
		MM_showHideLayers('dropinvest','','show');
	}
	else if (tsection == '4') {
		MM_showHideLayers('dropnews','','show');
	}
	else if (tsection == '5') {
		MM_showHideLayers('dropsteward','','show');
	}
}

var Selectout = false

function setSelectFlag() {
   //alert("in setSelectFlag");
   //just came out of a current flynav link...
   Selectout = true;
   
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function revertStyle(style) {

   if(style.search(/select/i) > 1 ) {
   
      return "#993333";
   
   }
   else {
      return "#ffffff";
   }	  

}

function setCarat(id) {

   alert("id name: " + id);


}




//this function is used to communicate between the separate frames, controlling the visibility of the 
//layers between the frames..
function interFrameControl(frame, section, visibility) {

   
      switch (frame) {
   
         case 'header':
	        parent.frames[0].topFrame(section, visibility);
	     case 'main':	
            parent.frames[2].mainFrame(section, visibility);
	     case 'both':
	        parent.frames[0].topFrame(section, visibility);
		    parent.frames[2].mainFrame(section, visibility);
		 case 'main-left':
	        parent.frames[1].sideFrame(section, visibility);
		    parent.frames[2].mainFrame(section, visibility);
		 case 'left':
		    parent.frames[1].sideFrame(section, visibility);		
         }

}

//use this to access the styles in the header frame from within the main frame...
function headerStyle(section, colorInput) {

   parent.frames[0].document.all.item(section).style.color=colorInput;

}

function setYPos(layerID, from) {

   var holder;

   if (from == 'top') {
      holder = parent.frames[2].document.body.scrollTop + -35;  
   }
   if (layerID == 'lefttwoone') {
      holder = parent.frames[2].document.body.scrollTop + 15;
   }
   if (layerID == 'lefttwofour') {
      holder = parent.frames[2].document.body.scrollTop + 34;
   }
   if (layerID == 'lefttwofive') {
      holder = parent.frames[2].document.body.scrollTop + 52;
   }
   
   	  
   
   parent.frames[2].document.getElementById(layerID).style.top = holder;
   //alert("Yo: " + parent.frames[2].document.getElementById(layerID).style.top);
   //alert("Yo: " + document.body.scrollTop);
   
}

function handOff() {

MM_showHideLayers('layeronezero','','hide','layertwozero','','show','layerthreezero','','hide','layerfourzero','','hide','layerfivezero','','hide')

}


function swapstyle(idInput, colorInput) {
  
  var obj;
  if(navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.indexOf("4") != -1 ) {
     obj = document.ids.idInput;
  }
  else {
     obj = document.getElementById(idInput);
  }
  
  
  //used to keep the selected link color orange in all cases...
  if (obj.className == 'headertextselect') {
     if(navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.indexOf("4") != -1 ) {
        obj.color = '#993333';
     }
	 else {
	    obj.style.color = '#993333';
	 }
  }
  else {
     if(navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.indexOf("4") != -1 ) {	 
	    obj.color = colorInput;
	 }
	 else {
	    obj.style.color = colorInput;
	 }	
  }	 

}


//*****************This is to make flyout's Netscape 4 compatible!!!! *********************


//if the browser is Netscape and version 4...
if(navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.indexOf("4") != -1 ) {

document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);

   
   //this function is for handling MouseOver events
   document.onmouseover = function( e ) {
      if ( e.target.toString() == '[object Layer]' ) {
         
         switch ( e.target.name ) {
            case 'layeronezero':
               swapstyle('aboutus','#993333');
               MM_showHideLayers('layeronezero','','show','layertwozero','','hide','layerthreezero','','hide','layerfourzero','','hide','layerfivezero','','hide');
               break;
			case 'layertwozero':
               swapstyle('operations','#993333');
               MM_showHideLayers('layeronezero','','hide','layertwozero','','show','layerthreezero','','hide','layerfourzero','','hide','layerfivezero','','hide');
               break;
			case 'layerthreezero':
               swapstyle('investors','#993333');
               MM_showHideLayers('layeronezero','','hide','layertwozero','','hide','layerthreezero','','show','layerfourzero','','hide','layerfivezero','','hide');
               break;
			case 'layerfourzero':
               swapstyle('stewardship','#993333');
               MM_showHideLayers('layeronezero','','hide','layertwozero','','hide','layerthreezero','','hide','layerfourzero','','show','layerfivezero','','hide');
               break;
			case 'layerfivezero':
               swapstyle('news','#993333');
               MM_showHideLayers('layeronezero','','hide','layertwozero','','hide','layerthreezero','','hide','layerfourzero','','hide','layerfivezero','','show');
               break;
			case 'leftonesix':
			   MM_swapImage('lnav_1_6','1','/images/lnav_1_6_on.gif',1);
			   MM_showHideLayers('leftonesix','','show');
			   break;
			case 'lefttwoone':
			   MM_swapImage('lnav_2_1','1','/images/lnav_2_1_sub_on.gif',1);
			   MM_showHideLayers('lefttwoone','','show','lefttwofour','','hide','lefttwofive','','hide');
			   break;
			case 'lefttwofour':
			   MM_swapImage('lnav_2_4','1','/images/lnav_2_4_on.gif',1);
			   MM_showHideLayers('lefttwoone','','hide','lefttwofour','','show','lefttwofive','','hide');
			   break;
			case 'lefttwofive':
			   MM_swapImage('lnav_2_5','1','/images/lnav_2_5_on.gif',1);
			   MM_showHideLayers('lefttwoone','','hide','lefttwofour','','hide','lefttwofive','','show');
			   break;
			case 'leftthreethree':
			   MM_swapImage('lnav_3_3','1','/images/lnav_3_3_on.gif',1);
			   MM_showHideLayers('leftthreethree','','show','leftthreefour','','hide');
			   break;
			case 'leftthreefour':
			   MM_swapImage('lnav_3_4','1','/images/lnav_3_4_on.gif',1);
			   MM_showHideLayers('leftthreethree','','hide','leftthreefour','','show');
			   break;
			case 'leftfivetwo':
			   MM_swapImage('lnav_4_1','1','/images/lnav_4_1_on.gif',1);
			   MM_showHideLayers('leftfivetwo','','show','leftfivethree','','hide');
			   break;
			case 'leftfivethree':
			   MM_swapImage('lnav_4_4','1','/images/lnav_4_4_on.gif',1);
			   MM_showHideLayers('leftfivetwo','','hide','leftfivethree','','show');
			   break;
			case 'leftnuclearlayer':
			   MM_swapImage('lnav_2_5_1_4_1','1','/images/lnav_2_5_1_4_1_on.gif',1);
			   MM_showHideLayers('leftnuclearlayer','','show');
			   break;
         }
      }

      routeEvent( e );
   }


   document.onmouseout = function( e ) {
      if ( e.target.toString() == '[object Layer]' ) {
      
         if ( e.target.name.indexOf( "left" ) != -1 ) {
		 
		    switch ( e.target.name ) {
			   case 'leftonesix':
			      MM_swapImgRestore();
				  left_nav_off('1');
				  break;
			   case 'lefttwoone':
			      MM_swapImgRestore();
				  left_nav_off('2');
				  break;
			   case 'lefttwofour':
			      MM_swapImgRestore();
				  left_nav_off('2');
				  break;
			   case 'lefttwofive':
			      MM_swapImgRestore();
				  left_nav_off('2');
				  break;
			   case 'leftthreethree':
			      MM_swapImgRestore();
				  left_nav_off('3');
				  break;
			   case 'leftthreefour':
			      MM_swapImgRestore();
				  left_nav_off('3');
				  break;
			   case 'leftfivetwo':
			      MM_swapImgRestore();
				  left_nav_off('5');
				  break;
			   case 'leftfivethree':
			      MM_swapImgRestore();
				  left_nav_off('5');
				  break;
			   case 'leftnuclearlayer':
			      MM_swapImgRestore();
				  left_nav_off('6');
				  break;
			} 
		 }
		 else {
		    MM_swapImgRestore();
            sub_nav_off();
		 }	
       
      }
      routeEvent( e );
   }
}


/*function adjustFlyout() {

   alert("Nelly: " + screen.availHeight);

}*/

//this is used to push up the bottom-most flynav of gtnw and north baja for low resolution screens
function adjustFlyNavHeight(flynav) {

   switch(flynav) {
      case 'gtnwcompfive': return 170; break;
      case 'gtnwcompeight': return 230; break;
	  case 'nbcompfive': return 170; break;
	  case 'nbcompeight': return 230; break;	  
   
   }
   

}