// JavaScript Document




	function returnDirectory(){
		var dirs=window.location.href.split('/'),
		cdir=dirs[dirs.length-2];
		return cdir;
	}
	
	function returnDocument() {
        var file_name = document.location.href;
        var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
        return file_name.substring(file_name.lastIndexOf("/")+1, end);
    } 
	function setlink(){
		var file=returnDocument();
		var pref="faq_";
		file = pref+file;
		return file;
	}
	function backswitch(){
		//alert("TESTING");
		var doc = new Array("about","portfolio","services","client","map","links","contact");
		for(var i = 0; i<doc.length; i++){
			if(returnDocument().match(doc[i]+".html") != null || returnDocument().match(doc[i]+".php") != null){
				var x = document.getElementById(doc[i]);
				//alert("IN HERE "+doc[i]);
				//alert("url(images/nav/"+doc[i]+"_btn_over.gif) \nurl(images/nav/about_btn_over.gif)")
				x.style.backgroundImage = "url(images/nav/"+doc[i]+"_btn_over.gif)"
			}
		}
	}
	function linkme(){
		var files = Array("bamboo.html","rapid_loc.html","engwood.html");
		var files2 = Array("faq_bamboo.html","faq_rapid_loc.html","faq_engwood.html");
		if("faq_gen.html" == returnDocument()){
				document.write("<a href='../js/faq.html' id='thelink'>View Main FAQ Page</a>");
			}
		for(var i = 0; i<files.length; i++){
			if(files[i] == returnDocument()){ 
				document.write("<a href='../js/"+setlink()+"' id='thelink'>View The Product Faq</a>");
			}
			else if(files2[i] == returnDocument()){
				var filelink=strip(files2[i]);
				document.write("<a href='../js/"+filelink+"' id='thelink'>View The Product Page</a>");
			}			
		}
	}
	function strip(str){
		var f = str.replace(".html","");
		return f;		
	}
	
	function load()
	{
		window.status="Page is loaded";
		alert("loaded")
	}


   function hidediv(thediv) {
		if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(thediv).style.display= 'none'
		}
		else {
			if (document.layers) { // Netscape 4
			document.thediv.display= 'none'
			}
			else { // IE 4
			document.all.thediv.style.display= 'none'
			}
		}
	}
	function showdiv(thediv) {
		if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(thediv).style.display = 'block';
		}
		else {
			if (document.layers) { // Netscape 4
			document.thediv.display = 'block';
			}
			else { // IE 4
			document.all.thediv.style.display = 'block';
			}
		}
	}
	function setStyle2(thediv){
			document.getElementById(thediv).className="blank";
	}
	function setStyle(thediv){
			document.getElementById(thediv).className="arrow";
	}
	function showHide(show){
			var ids = new Array("core","undercut","uneven","arbor","wobble","loss","short","slow","overheating");
			var i;
			for(i = 0; i<ids.length; i++)
			{
				var active = ids[i];
				hidediv(active); 
				setStyle2(active+"id")
			}
			showdiv(show);
			setStyle(show+"id");
	}
	
	function getElementHeight(Elem) {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
			xPos = elem.offsetHeight;
		return xPos;
}

function setElementHeight(Elem,height) {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
			elem.style.height = height;
			alert("HEIGHT IS "+height);
			var xpos = getElementHeight(Elem);
			alert("XPOS IS "+xpos);
		return xpos;
}

function getElementWidth(Elem) {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
			xPos = elem.offsetWidth;
		return xPos;
}

function setEqualHeight(){
	var left = getElementHeight("nav");
	var right = getElementHeight("main");
	alert("Nav is "+left+"\nMain is "+right);
	if(left > right){
		alert("Main is less");
		right=setElementHeight("main",left);
	}
	else if(left < right){
		alert("Nav is less");
		left=setElementHeight("nav",right);
	}
	alert("Nav is "+left+"\nMain is "+right);
}


function link_switch(id){
if(returnDocument() == id){
	document.write("<span class='green'>");}
else{
	document.write("<span class='white'>");
}
}

