// All scripting is original work and copywright protected by Michael McKenzie (c) 2003
// ARR - Use only by permission - mnlee@pacbell.net


// builds the side nav categories and menus for each

var thismenu = new Array;

function showmenu(cat) {
	if(thismenu[cat]==null){
		thismenu[cat]=1;
		document.getElementById(cat).innerHTML = subcat[cat];
		}else{
		if(thismenu[cat]==0){
			thismenu[cat]=1;
			document.getElementById(cat).innerHTML = subcat[cat]
			}else{
			thismenu[cat]=0;
			document.getElementById(cat).innerHTML = "";
			}
		}
	}

var mynav = "<table border=0 width=115 bgcolor=#FFFFFF cellspacing=1 cellpadding=4>";
mynav +="<tr><td bgcolor=#FFFFFF background=images/table_cnr_top2.gif height=20><spacer type=block height=10 width=100%></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(0);\"><b><a class=nav href=javascript:showmenu(0); onClick=javascript:showmenu(0);>Company Info</a></b></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=0 id=0></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(1);\"><a class=nav href=javascript:showmenu(1); onClick=javascript:showmenu(1);>Fencing</a></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=1 id=1></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(2);\"><a class=nav href=javascript:showmenu(2); onClick=javascript:showmenu(2);>Railing</a></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=2 id=2></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(3);\"><a class=nav href=javascript:showmenu(3); onClick=javascript:showmenu(3);>Accessories</a></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=3 id=3></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(4);\"><a class=nav href=javascript:showmenu(4); onClick=javascript:showmenu(4);>Pictures</a></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=4 id=4></div></td></tr>";
mynav +="<tr><td style=\"background-color: #0000FF\" onmouseover=\"this.style.backgroundColor= '#6688FF';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#0000FF'\" onclick=\"javascript:showmenu(5);\"><a class=nav href=javascript:showmenu(5); onClick=javascript:showmenu(5);>Service</a></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF><div name=5 id=5></div></td></tr>";
mynav +="<tr><td bgcolor=#FFFFFF background=images/table_cnr_bottom2.gif height=20><spacer type=block height=10 width=100%></td></tr>";
mynav +="</table>";

var subcat = new Array(
	"<!-- Home --><font size=2><a href=default.htm>Home</a><BR><a href=about.html>About</a><BR><a href=contact.html>Contact</a></font>",
	"<!-- Fencing --><font size=2><a href=picketneweng.html>Picket</a><BR><a href=privacyfence.html>Privacy</a><br><a href=semiprivacy.html>Semi-Privacy</a><br><a href=agfence.html>Agricultural</a><br><a href=woodgrfence.html>Wood Grain</a><br><a href=universalfence.html>Universal</a></font>",
	"<!-- Railing --><font size=2><a href=alumfence.html>Aluminum</a><br><a href=ornamentalrailing.html>Ornamental</a>",
	"<!-- Pictures --><font size=2><a href=specialties.html>Specialty</a><br><a href=gates.html>Gates</a></font>",
	"<!-- Pictures --><font size=2><a href=photoalbum.html>Photo Album</a></font>",
	"<!-- Service --><font size=2><a href=warranty.html>Warranty</a></font>"
	);





// builds the image tour functions and array with images


var thisimage = 0;

var getim = new Array(
	"http://www.ultrafencing.com/images/pics/3railag.jpg",
	"http://www.ultrafencing.com/images/pics/pickets-n-roses.jpg",
	"http://www.ultrafencing.com/images/pics/bull-n-geld.jpg",
	"http://www.ultrafencing.com/images/pics/panelprivacylatticed.jpg",
	"http://www.ultrafencing.com/images/pics/pic-house1.jpg",
	"http://www.ultrafencing.com/images/pics/privacypicketgarden.jpg",
	"http://www.ultrafencing.com/images/pics/pic-prpan.jpg"
	);

var thistitle = new Array(
	"3 Rail Agricultural Fence",
	"New England Picket [<a href=javascript:zoomimage();>Detailed Image</a>]", 
	"Red Bluff Bull and Gelding Show",
	"Panel Privacy with Latice [<a href=javascript:zoomimage();>Detailed Image</a>]",
	"New England Scalloped Wide Picket - 3 1/2 in. to 3 in.",
	"Privacy Picket [<a href=javascript:zoomimage();>Detailed Image</a>]",
	"Tongue and Groove - with and without Lattice"
	);

var zoomthis = new Array(
	"pics/image11%20a",
	"pics/pickets-n-roses_large",
	"pics/Bull%20&%20Geld",
	"pics/panelprivacylatticed_large",
	"pics/pic-house1",
	"pics/privacypicketgarden_large",
	"pics/pic-prpan"
	);


function getimagetitle(){
	document.getElementById("picture").innerHTML = "<img src="+getim[thisimage]+" border=0>";
	document.getElementById("title").innerHTML = "<b>"+thistitle[thisimage]+"</b>";
	}

function nextimage(){ 
	thisimage = thisimage + 1;
	if(thisimage >= getim.length-1){thisimage = getim.length-1;}
	getimagetitle(); 
	}

function lastimage(){ 
	thisimage = thisimage - 1;
	if(thisimage <= 0){thisimage = 0;}
	getimagetitle();
	}

function zoomimage(){
	window.open("pictureit.html?"+zoomthis[thisimage],"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600");
	}








// A Quick and easy banner ad swapping script (not yet compatable for NS)


var getad = new Array(
	"http://www.foo.com/test.gif"
	);

var linkto = new Array(
	"http://www.foo.com"
	);

var now = new Date();
var random = now.getSeconds() % 10;
var page = random

function selectpage(){
	window.open(linkto[page]);
	}

function loadbanner(){ 
	document.banner.src = getad[page];
	}


