// ---------------------------------------------------------
// PageNav.js 
// ---------------------------------------------------------
var gstHeaderName = "welcome";
//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) {
  		welcome_f1 = new Image(163 ,30); welcome_f1.src = "../images/client/tab_welcome_f1.gif";			
		welcome_f2 = new Image(163 ,30); welcome_f2.src = "../images/client/tab_welcome_f2.gif";

		find_f1 = new Image(100 ,30); find_f1.src = "../images/client/tab_find_f1.gif";			
		find_f2 = new Image(100 ,30); find_f2.src = "../images/client/tab_find_f2.gif";

		mortgage_f1 = new Image(120 ,30); mortgage_f1.src = "../images/client/tab_mortgage_f1.gif";			
		mortgage_f2 = new Image(120 ,30); mortgage_f2.src = "../images/client/tab_mortgage_f2.gif";

		gomobile_f1 = new Image(100 ,30); gomobile_f1.src = "../images/client/tab_gomobile_f1.gif";			
		gomobile_f2 = new Image(100 ,30); gomobile_f2.src = "../images/client/tab_gomobile_f2.gif";

		value_f1 = new Image(120 ,30); value_f1.src = "../images/client/tab_value_f1.gif";			
		value_f2 = new Image(120 ,30); value_f2.src = "../images/client/tab_value_f2.gif";

		gomobile_f1 = new Image(100 ,30); gomobile_f1.src = "../images/client/tab_gomobile_f1.gif";			
		gomobile_f2 = new Image(100 ,30); gomobile_f2.src = "../images/client/tab_gomobile_f2.gif";

   		contact_f1 = new Image(160 ,30); contact_f1.src = "../images/client/tab_contact_f1.gif";			
		contact_f2 = new Image(160 ,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_rightside_1.jpg";
	if (stHeader=="find" || stCatName=="Current Listings" || stCatName=="F A Q s") {
		stRightSide = "../images/client/client_rightside_2.jpg";
	}
	if (stHeader=="mortgage" || stHeader=="gomobile" || stCatName=="Sold Listings" || stCatName=="Testimonials") {
		stRightSide = "../images/client/client_rightside_3.jpg";
	}
	if (stHeader=="value" || stCatName=="Our Team" || stCatName=="Related Links") {
		stRightSide = "../images/client/client_rightside_4.jpg";
	}
	if (stHeader=="contact" || stCatName=="Contact Us") {
		stRightSide = "../images/client/client_rightside_5.jpg";
	}
	document.writeln('<table width="100%" height="155" width="100%" cellpadding="0" cellspacing="0" border="0">');
	document.writeln('<tr><td>');

	document.writeln('	<table width="100%" height="125" width="100%" cellpadding="0" cellspacing="0" border="0" background="../images/client/client_banner_bgnd_top.jpg">');
	document.writeln('	  <tr>');
	document.writeln('	     <td width="100%" height="125" ><img src="../images/client/client_logo.gif" border="0" /></td>');
	document.writeln('	     <td height="125" align="right"><div align="right"><img src="'+stRightSide+'" width="377" height="125" border="0" /></div></td>');
	document.writeln('	  </tr>');
	document.writeln('	</table>');	
	document.writeln('</td></tr>');
	document.writeln('<tr><td>');
	document.writeln('	<table width="100%" height="30" cellpadding="0" cellspacing="0" border="0" background="../images/client/client_banner_bgnd_bottom.jpg">');
	document.writeln('	   <tr>');
	
	Write_HeaderItem('welcome', '../publish/default.shtml', 'Hanson Realty Central', '163');
	Write_HeaderItem('find', '../templates/find.html', 'Find Your Dream Home', '100');
	Write_HeaderItem('mortgage', '../templates/mortgage.html', 'Get a Great Mortgage', '120');
	Write_HeaderItem('value', '../publish/evaluation.shtml', 'Get a Free Online Home Evaluation', '120');
	Write_HeaderItem('gomobile', '../templates/gomobile.html', 'Get Homes Delivered to Your Cellphone', '100');
	Write_HeaderItem('contact', '../publish/contact.shtml', 'Contact Hanson Realty Group', '160');
	
	document.writeln('	     <td width="100%" height="30"><img src="../images/client/spacer.gif" border="0" /></td>');
	document.writeln('	  </tr>');
	document.writeln('  </table>');
	document.writeln('</td></tr>');
	document.writeln('</table>');

}