// ---------------------------------------------------------
// PageNav.js 
// ---------------------------------------------------------
var gstHeaderName = "home";
//var gstLifePicsLink = "lifepics.html";

// ----------------------------------------------------------
// FUNCTION: MM_findObj(n, d)
// ----------------------------------------------------------
function MM_findObj(n, d) { //v3.0
  	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); 
	}
	return x;
}


// ----------------------------------------------------------
// FUNCTION: MM_swapImage()
// ----------------------------------------------------------
function MM_swapImage() { //v3.0
  var i,j=0,x;
  var 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: MM_swapImgRestore()
// ----------------------------------------------------------
function MM_swapImgRestore() { 
  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: Load_Tabs()
// ----------------------------------------------------------
function Load_HeaderPics(){
	
	if (document.images) {
  		home_f1 = new Image(160 ,30); home_f1.src = "../images/client/tab_home_f1.gif";			
		home_f2 = new Image(160 ,30); home_f2.src = "../images/client/tab_home_f2.gif";

		about_f1 = new Image(122 ,30); about_f1.src = "../images/client/tab_about_f1.gif";			
		about_f2 = new Image(122 ,30); about_f2.src = "../images/client/tab_about_f2.gif";

		lighthouses_f1 = new Image(122 ,30); lighthouses_f1.src = "../images/client/tab_lighthouses_f1.gif";			
		lighthouses_f2 = new Image(122 ,30); lighthouses_f2.src = "../images/client/tab_lighthouses_f2.gif";
		
		donate_f1 = new Image(175 ,30); donate_f1.src = "../images/client/tab_donate_f1.gif";			
		donate_f2 = new Image(175 ,30); donate_f2.src = "../images/client/tab_donate_f2.gif";

   		contact_f1 = new Image(122 ,30); contact_f1.src = "../images/client/tab_contact_f1.gif";			
		contact_f2 = new Image(122 ,30); contact_f2.src = "../images/client/tab_contact_f2.gif";		  		
	}	
}

// ----------------------------------------------------------
// FUNCTION: Write_HeaderItem(stName, stLink, stTip, stWidth)
// ----------------------------------------------------------
function Write_HeaderItem(stName, stLink, stTip, stWidth)
{
	if (gstHeaderName==stName){
	    document.write('<TD>');
		document.write('<IMG height="30" src="../images/client/tab_'+stName+'_f3.gif" width="'+stWidth+'" border=0" '); 
		document.writeln('name="'+stName+'" alt="'+stTip+'"></TD>');
	}
	else {				
	    document.write('<TD><A onmouseover="MM_swapImage(');
		document.write("'"+stName+"','','../images/client/tab_"+stName+"_f2.gif', 1); ");
		document.write('" onmouseout="MM_swapImgRestore();" href="'+stLink+'" target="_top">');
		document.write('<IMG height="30" src="../images/client/tab_'+stName+'_f1.gif" width="'+stWidth+'" border=0" '); 
		document.writeln('name="'+stName+'" alt="'+stTip+'"></A></TD>');
	}
}	

// ----------------------------------------------------------
// FUNCTION: Write_Header(stHeader)
// ----------------------------------------------------------
function Write_Header(stHeader, stCatName)
{
	Load_HeaderPics();
	gstHeaderName = stHeader;
	
	// alert(stCatName);

	//stRightSide = "../images/client/client_banner_right.jpg";
	

	document.writeln('<table height="150" width="100%" cellpadding="0" cellspacing="0" border="0" class="webhead">');

	//document.writeln('<table height="160" width="100%" cellpadding="0" cellspacing="0" border="0" ');
	//document.writeln('  background="../images/client/client_banner_bgnd.jpg">');
	
	document.writeln('  <tr><td width="100%" height="120" align="center"><img src="../images/client/client_logo.gif" ');
	document.writeln('          border="0" /></td>');
	//document.writeln('      <td width="377" height="140"><img src="'+stRightSide+'" ');
	//document.writeln('			width="377" height="140" border="0" /></td>');
	document.writeln('	</tr>');
	document.writeln('  <tr><td width="100%" height="30" align="right">');
	document.writeln('        <table height="30" cellpadding="0" cellspacing="0" border="0">');
	document.writeln('          <tr>');
	
	Write_HeaderItem('home', '../publish/default.shtml', 'Home', '122');
	Write_HeaderItem('about', '../publish/about.shtml', 'About Us', '122');
	Write_HeaderItem('lighthouses', '../publish/lighthouses.shtml', 'Lighthouses', '132');
	Write_HeaderItem('donate', '../publish/donate_online.shtml', 'Save A Lighthouse', '175');
	Write_HeaderItem('contact', '../publish/contact.shtml', 'Contact Us', '122');
	
	document.writeln('           </tr></table>');
	// end inner
	document.writeln('</td><td width="50"><img src="../images/client/spacer.gif" >');
	document.writeln('</tr></table>');
}