var timerID = 0;
var tStart  = null;
var xWhichDropDown = '';

function showDropDown(whichDropdown){
	document.getElementById(whichDropdown).style.display = 'block';
	tStart  = null;
	}
	
function hideDropDown(whichDropdown){
	xWhichDropdown = whichDropdown;
	Reset();
	Start();
	}

function  hideProducts(){
	 document.getElementById("dropNavProducts").style.display = 'none';
	 //document.getElementById("dropNavProductsTab").style.display = 'none';
	}

function UpdateTimer() {
   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();

   tDate.setTime(tDiff);
   

	   
   //document.theTimer.theTime.value = "" 
    //                               + tDate.getMinutes() + ":" 
   //                                + tDate.getSeconds();
   
   timerID = setTimeout("UpdateTimer()", 1);
   
      if((tDate.getSeconds()/10) >= parseFloat(0.1)){
	   //alert(tDate.getSeconds()/10);
	   Stop();
	   Reset();
	   
	   document.getElementById(xWhichDropdown).style.display = 'none';
	   //document.getElementById("dropNavProductsTab").style.display = 'none';
	   }
   
   
}

function Start() {
   tStart   = new Date();

   //document.theTimer.theTime.value = "00:00";

   timerID  = setTimeout("UpdateTimer()", 1);

   
}

function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }

   tStart = null;
}

function Reset() {
   tStart = null;

   //document.theTimer.theTime.value = "00:00";
}


/* =========== mouse coords ==============*/
function detectMouseCoordinates(e){
    posx=0;
    posy=0;
   //alert("ad");
    if(!e) var e=window.event;
	    if(e.pageX||e.pageY){
          posx=e.pageX;
          posy=e.pageY;
    	}
	 else if(e.clientX||e.clientY){
        posx = e.clientX + document.documentElement.scrollLeft;
        posy = e.clientY + document.documentElement.scrollTop;
    }
}
