function leftnavcontrol(element,HasSubNav,CategoryID) {
	//grab the info from the top navigation bar nodes
liArray=document.getElementById("nav").childNodes; 
i=0; 
if (element) {
//loop through and set all the id's to nothing (thus clearing their style settings
while(liArray[i]){ 
liArray[i].id=""; 
i++; 
} 
//finally change the one we've actually clicked on to "current" so this is picked up by the css
element.id="current"; 
}

var menuliArray = document.getElementById("nav").getElementsByTagName("li"); 
//loop settings all diplsya to nothing
for (var j=0; j<menuliArray.length; j++) {
			var innerarray = menuliArray[j].getElementsByTagName("ul")
				for (var k = 0;k<innerarray.length; k++) {			
					innerarray[k].style.display = "none";
				}
}


//now we figure out what to show to the user
if (HasSubNav == "False") 
{
//just go to the products page
document.location="products.asp?CategoryID=" + CategoryID + "&SubCategoryID=0"
}
else
{
	//open up the inner sub cats for viewing
	document.getElementById("SubCatArea" + CategoryID).style.display = 'block';
	getSubCats(CategoryID);
}
	
	
}




var xmlHttp;
var rootpath;
 
rootpath = "";   // be sure to change this to your URL
 
function getSubCats(CategoryID)
{
	 var url=rootpath + "leftnav_subcat_lookup.asp?ProdCatID=" + CategoryID
     
    //xmlHttp=GetXmlHttpObject(stateChanged(str))
	xmlHttp=GetXmlHttpObject(function(){stateChanged(CategoryID)})
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
	
}
 
function stateChanged(CategoryID)
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
		
		
		document.getElementById("SubCatArea" + CategoryID).innerHTML=xmlHttp.responseText
		//document.getElementById('MemberArea" + MemberCount + "').innerHTML=xmlHttp.responseText
		
		 
		
    }
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
} 