/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

if (document.getElementById){
	//DynamicDrive.com change
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('.submenu_open{display: block;}\n')
	document.write('</style>\n')
}

function SwitchMenu(obj, inLeaveOther, moveToMouse){
	if(document.getElementById){
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			if (!inLeaveOther) {
				for (var i=0; i<ar.length; i++){
					if (ar[i].className=="submenu" || ar[i].className=="submenu_open") //DynamicDrive.com change
					ar[i].style.display = "none";
				}
			}
			el.style.left = tempX;
			el.style.top = tempY;
			el.style.display = "block";
		} else {
			el.style.display = "none";
		}
	}
}

function SwitchVisible(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		if (el.style.visibility != "hidden") {
			el.style.visibility = "hidden";
		} else {
			el.style.visibility = "visible";
		}
	}
}

/** Code from http://www.codelifter.com/main/javascript/capturemouseposition1.html - Modified by unlimited FX **/
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

  return true
}

