function getURL(url) {
	window.location.assign(url);
}

//ANTISPAM EMAIL LINKfunction antiSpam(id,domain) {
function antiSpam(id,domain) {
	document.write("<a href='mailto:" + id + "@" + domain + "'>" + id + "@" + domain + "</a>");
}

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
  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];}
}

function replaceHeight(h){
	var browser_type=navigator.appName
	
	setHeight = 'auto';
	a = navigator.appVersion.split(';');
	browser_version = parseInt(a[1].replace('MSIE ', ''));
	if (browser_type=="Microsoft Internet Explorer"&&browser_version<7)
		setHeight = h + 'px';
		
	return setHeight;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

//Navigation
function topNavigation(cs) {
	if(cs == "products") {
		document.write('<img src="images/topnav/products.jpg" width="346" height="50" border="0" usemap="#Map5">');
		document.write('<map name="Map5">');
		document.write('<area shape="poly" coords="177,19,249,19,267,35,266,47,187,47,188,29" href="processing.htm">');
		document.write('<area shape="poly" coords="322,24,332,36,333,46,269,46,267,33,253,21" href="healthsafety.htm">');
		document.write('<area shape="poly" coords="185,50,186,32,172,18,126,16,124,26,123,46" href="products.htm">');
		document.write('<area shape="poly" coords="1,-1,2,3,109,3,123,15,121,47,60,47" href="aboutus.htm">');
		document.write('</map>');
	}
	else if(cs == "processing") {
		document.write('<img src="images/topnav/processing.jpg" width="346" height="50" border="0" usemap="#Map4">');
		document.write('<map name="Map4">');
		document.write('<area shape="poly" coords="186,20,249,19,267,35,266,47,187,47,188,29" href="processing.htm">');
		document.write('<area shape="poly" coords="322,24,332,36,333,46,269,46,267,33,253,21" href="healthsafety.htm">');
		document.write('<area shape="poly" coords="19,16,103,16,118,27,118,50,62,48" href="aboutus.htm">');
		document.write('<area shape="poly" coords="185,50,187,15,171,3,86,0,121,26,121,47" href="products.htm">');
		document.write('</map>');
	}
	else if(cs == "healthsafety") {
		document.write('<img src="images/topnav/healthsafety.jpg" width="346" height="50" border="0" usemap="#Map2">');
		document.write('<map name="Map2">');
		document.write('<area shape="poly" coords="147,2,250,3,267,12,266,47,187,47,188,29" href="processing.htm">');
		document.write('<area shape="poly" coords="322,24,332,36,333,46,269,46,267,33,267,22" href="healthsafety.htm">');
		document.write('<area shape="poly" coords="19,16,103,16,118,27,118,50,62,48" href="aboutus.htm">');
		document.write('<area shape="poly" coords="185,50,186,32,172,18,106,15,121,26,121,47" href="products.htm">');
		document.write('</map>');
	}
	else if(cs == "aboutus") {
		document.write('<img src="images/topnav/aboutus.jpg" width="346" height="50" border="0" usemap="#Map1">');
		document.write('<map name="Map1">');
		document.write('<area shape="poly" coords="177,19,249,19,267,35,266,47,187,47,188,29" href="processing.htm">');
		document.write('<area shape="poly" coords="320,1,337,16,334,48,269,46,267,33,231,4" href="healthsafety.htm">');
		document.write('<area shape="poly" coords="19,16,103,16,118,27,118,50,62,48" href="aboutus.htm">');
		document.write('<area shape="poly" coords="185,50,186,32,172,18,106,15,121,26,121,47" href="products.htm">');
		document.write('</map>');
	}
	else {
		document.write('<img src="images/topnav/none.jpg" width="346" height="50" border="0" usemap="#Map3">');
		document.write('<map name="Map3">');
		document.write('<area shape="poly" coords="177,19,249,19,267,35,266,47,187,47,188,29" href="processing.htm">');
		document.write('<area shape="poly" coords="322,24,332,36,333,46,269,46,267,33,253,21" href="healthsafety.htm">');
		document.write('<area shape="poly" coords="19,16,103,16,118,27,118,50,62,48" href="aboutus.htm">');
		document.write('<area shape="poly" coords="185,50,186,32,172,18,106,15,121,26,121,47" href="products.htm">');
		document.write('</map>');
	}
}

function writeSubNav(ca, cp) {
	document.write('<ul>');
	for(i = 0; i < ca.length; i++) {
		setClass = "subNav";
		setShim = "subNavShim";
		setID = "subNav" + (i + 1);
		if(i < 9)
			setID = "subNav0" + (i + 1);

		if(ca[i] == cp) {
			setID += "Click";
			setShim += "Click";
			setClass += "Click";
		}
		document.write('<li id="' + setID + '" class="' + setClass + '" onclick="getURL(\'test.htm\');">' + ca[i] + '<img src="images/shim.gif" class="' + setShim + '" /></li>');
	}
	document.write('</ul>');
}

function subNavigation(cs, cp) {
	if(cs == "products") {
		productArray = new Array('Angles', 'Bars - HR/CR', 'Bar Grating', 'Beam', 'Beam - WF', 'Carbon Plate', 'Channel', 'Diamond Grip', 'Expanded Metal', 'Rebar/Mesh', 'Pipe', 'Tubing - ERW', 'Tubing - Round', 'Tubing - Rectangular', 'Tubing Square');
		writeSubNav(productArray, cp);
	}
}

function footerNavigation() {
	document.write('<ul>');
	document.write('<li><a href="index.htm" target="_self">Home</a></li>');
	document.write('<li><a href="employment.htm" target="_self">Employment</a></li>');
	document.write('<li><a href="contactus.htm" target="_self">Contact Us</a></li>');
	document.write('</ul>');
}
