var basehref='http://www.wheelhouseinn.com';

if(document.all)
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="' + basehref + '/wheelhouseIE.css">');
else 
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="' + basehref + '/wheelhouseNS.css">');



function preload(imgObj, imgSrc){
        if(document.images){
                eval(imgObj + '= new Image()');
                eval(imgObj + '.src = "' + imgSrc + '"');
        }
} // Preloads an image with name 'imgObj' and src 'imgSrc'.  Ex. preload('myimageA','image2.gif')



function changeImage(layer, imgName, imgObj){
        if(document.layers && layer!=null) {
		eval('document.' + layer + '.document.images["' + imgName + '"].src = ' + imgObj + '.src');
	}
	else {
		document.images[imgName].setAttribute("src",eval(imgObj + ".src"));
	}
} // Changes the image, imgName, to the image defined by imgObj (defined in preload() function).





function layerWrite(id,nestref,text) {
	if (document.layers) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.['+id+'].document') : document.layers[id].document;
		lyr.open();
		lyr.write(text);
		lyr.close();
	}
	else if (document.all) {
		document.all[id].innerHTML = text
	}
        else if (document.getElementById(id)) {
                tnode = document.getElementById(id);
                while (tnode.hasChildNodes()) tnode.removeChild(tnode.lastChild);
                var range = document.createRange();
                range.selectNodeContents(tnode);
                tnode.appendChild(range.createContextualFragment(text));
        }
}



function loadnavbar(){
	var text="";

	//Preload all required images here:
	preload('home1',basehref + '/navbar/home.jpg');
	preload('home2',basehref + '/navbar/home2.jpg');
	preload('amenities1',basehref + '/navbar/amenities.jpg');
	preload('amenities2',basehref + '/navbar/amenities2.jpg');
	preload('policies1',basehref + '/navbar/policies.jpg');
	preload('policies2',basehref + '/navbar/policies2.jpg');
	preload('photos1',basehref + '/navbar/photos.jpg');
	preload('photos2',basehref + '/navbar/photos2.jpg');
	preload('location1',basehref + '/navbar/location.jpg');
	preload('location2',basehref + '/navbar/location2.jpg');
	preload('rates1',basehref + '/navbar/rates.jpg');
	preload('rates2',basehref + '/navbar/rates2.jpg');
	preload('reviews1',basehref + '/navbar/reviews.jpg');
	preload('reviews2',basehref + '/navbar/reviews2.jpg');
	preload('contact1',basehref + '/navbar/contact.jpg');
	preload('contact2',basehref + '/navbar/contact2.jpg');

	text = text + "<CENTER>";
	text = text + "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=763>";
	text = text + "   <TR>";
	text = text + "      <TD ROWSPAN=4><IMG SRC=\"" + basehref + "/navbar/left.gif\" WIDTH=183  HEIGHT=120></TD>";
	text = text + "      <TD COLSPAN=2><IMG SRC=\"" + basehref + "/navbar/top.gif\" WIDTH=574 HEIGHT=5></TD>";
	text = text + "      <TD ROWSPAN=4><IMG SRC=\"" + basehref + "/navbar/right.gif\" WIDTH=6 HEIGHT=120></TD>";
	text = text + "   </TR>";
	text = text + "   <TR>";
	text = text + "      <TD BGCOLOR=\"#2767A6\" WIDTH=80 HEIGHT=65><a href=\"" + basehref + "/index.html\"  onMouseOver=\"changeImage('navbardiv','home','home2');\" onMouseOut=\"changeImage('navbardiv','home','home1');\"><img src=\"" + basehref + "/navbar/home.jpg\" name=\"home\" alt=\"home\" border=0></a></TD>";
	text = text + "      <TD BGCOLOR=\"#2767A6\"><IMG SRC=\"" + basehref + "/navbar/midright.gif\"></TD>";
	text = text + "   </TR>";
	text = text + "   <TR>";
	text = text + "      <TD COLSPAN=2 bgcolor=\"#2767A6\" WIDTH=574 HEIGHT=45><center>";
	text = text + "<a href=\"" + basehref + "/amenities.html\"  onMouseOver=\"changeImage('navbardiv','amenities','amenities2');\" onMouseOut=\"changeImage('navbardiv','amenities','amenities1');\"><img src=\"" + basehref + "/navbar/amenities.jpg\" name=\"amenities\" alt=\"amenities\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/policies.html\"  onMouseOver=\"changeImage('navbardiv','policies','policies2');\" onMouseOut=\"changeImage('navbardiv','policies','policies1');\"><img src=\"" + basehref + "/navbar/policies.jpg\" name=\"policies\" alt=\"policies\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/photoalbum/photos.html\"  onMouseOver=\"changeImage('navbardiv','photos','photos2');\" onMouseOut=\"changeImage('navbardiv','photos','photos1');\"><img src=\"" + basehref + "/navbar/photos.jpg\" name=\"photos\" alt=\"photos\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/location.html\"  onMouseOver=\"changeImage('navbardiv','location','location2');\" onMouseOut=\"changeImage('navbardiv','location','location1');\"><img src=\"" + basehref + "/navbar/location.jpg\" name=\"location\" alt=\"location\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/rates.html\"  onMouseOver=\"changeImage('navbardiv','rates','rates2');\" onMouseOut=\"changeImage('navbardiv','rates','rates1');\"><img src=\"" + basehref + "/navbar/rates.jpg\" name=\"rates\" alt=\"rates\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/reviews.html\"  onMouseOver=\"changeImage('navbardiv','reviews','reviews2');\" onMouseOut=\"changeImage('navbardiv','reviews','reviews1');\"><img src=\"" + basehref + "/navbar/reviews.jpg\" name=\"reviews\" alt=\"reviews\" border=0></a>";
	text = text + "<a href=\"" + basehref + "/contact.html\"  onMouseOver=\"changeImage('navbardiv','contact','contact2');\" onMouseOut=\"changeImage('navbardiv','contact','contact1');\"><img src=\"" + basehref + "/navbar/contact.jpg\" name=\"contact\" alt=\"contact\" border=0></a>";
	text = text + "</center></TD>";
	text = text + "   </TR>";
	text = text + "   <TR>";
	text = text + "      <TD COLSPAN=2 WIDTH=585 HEIGHT=5><IMG SRC=\"" + basehref + "/navbar/bottom.gif\" WIDTH=574 HEIGHT=5></TD>";
	text = text + "   </TR>";
	text = text + "</TABLE>";
	text = text + "</CENTER>";

	layerWrite("navbardiv",null,text);
}
