var chkDrop='none';

function checkBrowser() {
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns   = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
  this.ns2  = (this.ns && (this.major == 2));
  this.ns3  = (this.ns && (this.major == 3));
  this.ns4b = (this.ns && (this.minor < 4.04));
  this.ns4  = (this.ns && (this.major >= 4));
  this.ns6 = (this.ns && (this.major >= 5));
  this.ie   = (agent.indexOf("msie") != -1);
  this.ie3  = (this.ie && (this.major == 2));
  this.ie4  = (this.ie && (this.major >= 4));
  this.ie45 = (this.ie && (navigator.appVersion.indexOf("4.5")!=-1));
  this.op3  = (agent.indexOf("opera") != -1);
  this.win  = (agent.indexOf("win")!=-1);
  this.mac  = (agent.indexOf("mac")!=-1);
  this.unix = (agent.indexOf("x11")!=-1);
}

var chk = new checkBrowser();

div1drops = 2
div1width = 120
div1start =169

div2drops = 0
div2width = 120
div2start =300

div3drops = 2
div3width = 120
div3start =400

div4drops = 4
div4width = 120
div4start =480




function showHideDiv(id,show){
  if(chk.ie4){
    whatdiv=eval('document.all.'+id);}
  if(chk.ns6){
    whatdiv=eval('document.getElementById("'+id+'")');}
  if(chk.ns4){
    whatdiv=eval('document.'+id);}

  if(show){
    if(chk.ie4||chk.ns6){
	  if (document.all.drop1.style.visibility == 'visible'){
		document.all.drop1.style.visibility='hidden';}
	  if (document.all.drop2.style.visibility == 'visible'){
		document.all.drop2.style.visibility='hidden';}
	  if (document.all.drop3.style.visibility == 'visible'){
		document.all.drop3.style.visibility='hidden';}
	  if (document.all.drop4.style.visibility == 'visible'){
		document.all.drop4.style.visibility='hidden';}

		
			 
      whatdiv.style.visibility='visible';}
    if(chk.ns4){
	  if (document.drop1.visibility == 'show'){
		document.drop1.visibility='hide';}
	  if (document.drop2.visibility == 'show'){
		document.drop2.visibility='hide';}
	  if (document.drop3.visibility == 'show'){
		document.drop3.visibility='hide';}
	  if (document.drop4.visibility == 'show'){
		document.drop4.visibility='hide';}
		 
      whatdiv.visibility='show';}
	chkDrop=id;
  }
  if(!show){
    if(chk.ie4||chk.ns6){
      whatdiv.style.visibility='hidden';}
    if(chk.ns4){
      whatdiv.visibility='hide';}
	chkDrop='none';
  }
}

function getMenuPos(pix){
  if(chk.ie){
	winwidth=document.body.clientWidth;
	if(winwidth<780){
      menupos=pix+7;}
	else {
	  menupos=Math.round(pix-3+((winwidth-760)/2));}
  }
  if(chk.ns6){
    whatdiv=eval('document.getElementById("'+obj+'")');}
  if(chk.ns4){
    winwidth=window.innerWidth;
	if(winwidth<780){
      menupos=pix+5;}
	else {
	  menupos=Math.round(pix-11+((winwidth-760)/2));}
  }
  
  if(chk.ns){
    return menupos}
  else{
    return menupos}
}

function menu(){
  if(chk.ie){
    div1=eval('document.all.drop1.style');
	div2=eval('document.all.drop2.style');
	div3=eval('document.all.drop3.style');
	div4=eval('document.all.drop4.style');

	
    pos1=getMenuPos(div1start);
	pos2=getMenuPos(div2start);
	pos3=getMenuPos(div3start);
	pos4=getMenuPos(div4start);

	
    div1.pixelLeft=pos1;
	div2.pixelLeft=pos2;
	div3.pixelLeft=pos3;
	div4.pixelLeft=pos4;
	
	div1.pixelTop424;
	div2.pixelTop424;
	div3.pixelTop424;
	div4.pixelTop424;

	
	}
  if(chk.ns6){
    drop1=eval('document.getElementById("drop1")');}
  if(chk.ns4){
    div1=eval('document.drop1');
	div2=eval('document.drop2');
	div3=eval('document.drop3');
	div4=eval('document.drop4');

	
    pos1=getMenuPos(div1start);
	pos2=getMenuPos(div2start);
	pos3=getMenuPos(div3start);
	pos4=getMenuPos(div4start);

	
    div1.left=pos1;
	div2.left=pos2;
	div3.left=pos3;
	div4.left=pos4;
	}  
return true
}

function checkMouse(e){
  if(chk.ie){
    pos1=getMenuPos(div1start);
	pos2=getMenuPos(div2start);
	pos3=getMenuPos(div3start);
	pos4=getMenuPos(div4start);
	
	
	xpos=event.x+document.body.scrollLeft;
    ypos=event.y+document.body.scrollTop;
	//status='X= '+xpos+', Y= '+ypos
	if(chkDrop=='drop1'){
	  if(xpos<pos1||xpos>pos1+div1width+5||ypos<22||ypos>(18*div1drops)+48){
	  	showHideDiv('drop1',false)}
	}
	if(chkDrop=='drop2'){
	  if(xpos<pos2||xpos>pos2+div2width+5||ypos<22||ypos>(18*div2drops)+48){
	  	showHideDiv('drop2',false)}
	}
	if(chkDrop=='drop3'){
	  if(xpos<pos3||xpos>pos3+div3width+5||ypos<22||ypos>(18*div3drops)+48){
	  	showHideDiv('drop3',false)}
	}
	if(chkDrop=='drop4'){
	  if(xpos<pos4||xpos>pos4+div4width+5||ypos<22||ypos>(18*div4drops)+48){
	  	showHideDiv('drop4',false)}
	}

	 
  }
  if(chk.ns){
	pos1=getMenuPos(div1start);
	pos2=getMenuPos(div2start);
	pos3=getMenuPos(div3start);
	pos4=getMenuPos(div4start);


	xpos=e.pageX;
    ypos=e.pageY;
	//status='X= '+xpos+', Y= '+ypos
	if(chkDrop=='drop1'){
	  if(xpos<pos1||xpos>pos1+div1width+5||ypos<22||ypos>(18*div1drops)+48){
	  	showHideDiv('drop1',false)}
	}
	if(chkDrop=='drop2'){
	  if(xpos<pos2||xpos>pos2+div2width+5||ypos<22||ypos>(18*div2drops)+48){
	  	showHideDiv('drop2',false)}
	}
	if(chkDrop=='drop3'){
	  if(xpos<pos3||xpos>pos3+div3width+5||ypos<22||ypos>(18*div3drops)+48){
	  	showHideDiv('drop3',false)}
	}
	if(chkDrop=='drop4'){
	  if(xpos<pos4||xpos>pos4+div4width+5||ypos<22||ypos>(18*div4drops)+48){
	  	showHideDiv('drop4',false)}
	}
	
	  
  }
  return true
}

function init(){
  if(chk.ns){
	document.captureEvents(Event.MOUSEMOVE)
  }
  document.onmousemove = checkMouse
}

