    function createRequestObject() {  

       var requestObject;
     
       if(window.XMLHttpRequest){  
          requestObject = new XMLHttpRequest();  
       } else if(window.ActiveXObject) {  
          requestObject = new ActiveXObject("Microsoft.XMLHTTP");  
       } else {  
          alert('Error creating XMLHttpRequest object');  
       }  
     
       return requestObject;  
     
    }  
     
    var http = createRequestObject(); 
    var tabStop = 0;
    var openTab = "";
    var timer; 
    var timer2;
    var timer3;
    var currentNav = "";
    var currentTimer2 = "";
    var currentTimer3 = "";
    var boxName;
    var response;
    
    function sendRequest(category, area, location) {
        if (document.getElementById(location).innerHTML.length < 70) {
	       http.open('post', '/content.jsp?q='+category+'&d='+area+'&o=1');
	       boxName = location;
	       http.onreadystatechange = handleResponse;  
	       http.send(null);
       }
    }  
    
    function getNavContent(location) {
          http.abort();
          clearTimeout(timer);
          timer=window.setTimeout("sendRequest('"+location+"','navigation','"+location+"')", 100);
      }

    function handleResponse() {
       if (http.readyState == 4 && http.status == 200){  
          response = http.responseText;  
          if (response) { 
             document.getElementById(boxName).innerHTML = response;
          }  
          
       }
    }
    
    function addNavTimer(num, location) {
    	if (window['currentTimer' + num].match(location) != location) {
    		window['currentTimer' + num] += location;
    	}
    }
    
    function removeNavTimer(num, location) {
    	var re = new RegExp(location, 'g');
    	window['currentTimer' + num] = window['currentTimer' + num].replace(re,'');
    }
    
    function showDelayThis(location) {
    	if (currentTimer2 != "") {
    		clearTimeout(timer2);
    		currentTimer2="";
    	}
        timer2=window.setTimeout(function () { if (currentTimer3.match(location) != location) { getNavContent('content-' + location);showThis('tab-'+location); } removeNavTimer('2',location); }, 700);
        addNavTimer('2',location);
    }
    
    function hideDelayThis(location) {
    	timer3=window.setTimeout(function () { if (currentTimer2.match(location) != location) { clearTimeout(timer);hideThis('tab-'+location); } removeNavTimer('3',location); }, 700);
        addNavTimer('3',location);
    }
    
    function showNavContent(location) {
    	getNavContent('content-' + location);
    	showDelayThis('tab-' + location);
    }
    
    function showNavThis(location,content) {
    	if (currentTimer2 != "") {
    		clearTimeout(timer2);
    		currentTimer2="";
    	}
    	timer2=window.setTimeout(function () { showNavAction(location,content);removeNavTimer('2',location); }, 700);
        addNavTimer('2',location);
    }
    	
    function showNavAction(location,content) {
    	 if (currentTimer3.match(location) != location) {
	    	if (document.getElementById(location).className.indexOf("showfirsttab") == -1) {
	    	 document.getElementById(location).className += "showfirsttab";
	    	}
	    	showNavContent(content);
	    	showThis(location);
    	 }
    }

    function hideNavThis(location) {
     	document.getElementById(location).className = document.getElementById(location).className.replace(/\bshowfirsttab\b/,'');
        hideDelayThis(location);
    }
    
    function showThis(location) {
       if (document.getElementById(location).style.display != "block") {
          document.getElementById(location).style.display="block";	
       }
    }

    function hideThis(location) {
        if (document.getElementById(location).style.display != "none") {
        	document.getElementById(location).style.display="none";
        }
     }

