// desk menu helpers

function show(s)
{
	s.firstChild.firstChild.style.visibility="visible";
	document.getElementById("label").innerHTML = s.firstChild.firstChild.alt;

}

function hide(s)
{	
	s.firstChild.firstChild.style.visibility="hidden";
	document.getElementById("label").innerHTML = "";
}


/* Ajax helpers
These are meant to be able to accomodate any number of tabs.
*/

function getXMLHTTPRequest(){
        var req = false;
        if(window.XMLHttpRequest){
		req = new XMLHttpRequest();
	}
	else if (window.ActiveXObject){
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if(!http){
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
        return req;
}

http = getXMLHTTPRequest();


function switchToTab(s,contentPage){
        var lis = s.parentNode.parentNode.getElementsByTagName("li");
        for(var i=0; i<lis.length; i++){
		//lis[i].className='inactiveTab';
		lis[i].style.border="1px dashed firebrick";
		lis[i].style.borderBottom="0";
		lis[i].style.color="gray";
        }                       
        //s.parentNode.className='activeTab';
        s.parentNode.style.border="1px solid firebrick";
	s.parentNode.style.borderBottom="5px solid white";
	s.parentNode.style.color="black";
        http.open("GET",contentPage+"?param="+s.innerHTML, true);
        http.onreadystatechange = useHttpResponse;
        http.send(null);
}

function useHttpResponse(){
        if(http.readyState == 4){
                if(http.status == 200){
                        document.getElementById('text').innerHTML = http.responseText;
                }
        }
}

