/// <reference path="jquery-1.2.6-vsdoc.js" />
var root = "/GTX/";
var pagehref = window.location;
var pageurl = pagehref.toString();
var url = pageurl.toLowerCase();

$(document).ready(function(){
closetimer = 0;
	if($("#nav")) {
		$("#nav b").mouseover(function() {
		clearTimeout(closetimer);
			if(this.className.indexOf("clicked") != -1) {
				$(this).parent().next().slideUp(500);
				$(this).removeClass("clicked");
			}
			else {
				$("#nav b").removeClass();
				$(this).addClass("clicked");
				$("#nav ul:visible").slideUp(500);
				$(this).parent().next().slideDown(500);
			}
			return false;
		});
		$("#nav").mouseover(function() {
		clearTimeout(closetimer);
		});
		$("#nav").mouseout(function() {
			closetimer = window.setTimeout(function(){
			$("#nav ul:visible").slideUp(500);
			$("#nav b").removeClass("clicked");
			}, 1000);
		}); 
	}    
	doRollOver();
	setLeftNavActive();
	setMainNavActive();
});



function setLeftNavActive(){
if(document.getElementById("leftnav")!=null){
var objNav = document.getElementById("leftnav");
var navAnchor = objNav.getElementsByTagName("a");

for(i=0; i<navAnchor.length; i++)
        {
         var link = navAnchor[i].getAttribute("href").toString();
         var llink = link.toLowerCase()
			 if (url.indexOf(llink) != -1)
			 {
				 navAnchor[i].parentNode.className = "active";
			 }
		}
}
}

function setMainNavActive(){
var objNav = document.getElementById("mainnav");
var navAnchor = objNav.getElementsByTagName("a");

for(i=0; i<navAnchor.length; i++)
        {
         var link = navAnchor[i].getAttribute("href").toString();
         var llink = link.toLowerCase()
			 if (url.indexOf(llink) != -1 &&  navAnchor[i].parentNode.className == "level1")
			 {
			 navAnchor[i].childNodes[0].childNodes[0].src = navAnchor[i].childNodes[0].childNodes[0].src.replace("-off","-on");
			 }
			 else if(url.indexOf(llink) != -1 &&  navAnchor[i].parentNode.parentNode.className == "level2")
			 {				 
				 navAnchor[i].parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].src = navAnchor[i].parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].src.replace("-off","-on");
				 navAnchor[i].parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].onmouseout = "";
			 }
		}
}

function doRollOver(){
$("#nav img").hover(function(){
this.src = this.src.replace("-off","-on");
},
function(){
this.src = this.src.replace("-on","-off");
});
}

