	/* DHTML Menu Script for Education World
	   Duleepa Wijayawardhana
	   Works for ie4+ and ns6+ */
	
	
	function Is() {
    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.ns3 = (this.ns && (this.major == 3));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns4 = (this.ns && (this.major >= 4) && (this.major < 5) && (this.minor > 4.01));
	this.ns6 = (this.ns && (this.major >= 5));
    this.ie  = (agent.indexOf("msie") != -1);
	this.ie4up = (this.ie && !(this.major < 4));
    this.ie4  = (this.ie && (agent.indexOf("msie 4.")!=-1));
	this.ie5  = (this.ie && (agent.indexOf("msie 5.")!=-1));
	this.ie6  = (this.ie && (agent.indexOf("msie 6.")!=-1));
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
	}

	is = new Is;
	
	//arrays to contain the information for the menus. Each item must correspond
	var m_title = new Array("Jobs in Education","Library","WorldFacts","Web Directory","Forums","Bookstore");
	var m_link = new Array("http://www.educationworld.net/jobs.html","http://library.educationworld.net/","http://worldfacts.educationworld.net/","http://dirs.educationworld.net/","http://forums.educationworld.net/","http://bookstore.educationworld.net/");
	var offset=0;
	//var m_height=0;
	//approximate height of the menu block
	var m_height=(30+(m_title.length*25));
	

	
	//Add the various event listeners to capture the mouse cursor position
	function mousecheck() {
		if (is.ie4up) {
			document.onmousemove = menuwalk;
		} else if (is.ns6) {
			document.addEventListener("mousemove",menuwalk,true);
		}
	}
	
	function menuwalk(evt) {
	//Read the x and y coordinates into variables to be used
		if (is.ie4up) {
			xvalue = window.event.clientX;
			yvalue = window.event.clientY;
				
		} else if (is.ns6) {
			xvalue = evt.pageX;
			yvalue = evt.pageY;
			
		}
	
							
	//Hide the menu layer when not in the cursor display area
		if (!((xvalue<578 && xvalue>449) && (yvalue>0 && yvalue<m_height))) {
			if (is.ns6) {
				document.getElementById("menu").style.visibility="hidden";
			} else if (is.ie4up) {
				document.all.menu.style.visibility="hidden";
		
			}
	
		} 
		
		if (is.ns6) {
				if (document.getElementById("menu").style.visibility=="visible") {
					msOver('two',2); 
				} else {
					msOut('two',2);
				}
				
		} else if (is.ie4up) {
			
				if (document.all.menu.style.visibility=="visible") {
					msOver('two',2); 
				} else {
					msOut('two',2);
				}
		
		}
		
	}
	
	//Initially display the layer and then call on the mouse capturing
	function showLayer() {
		if (is.ns6) {
			document.getElementById("menu").style.visibility="visible";
		} else if (is.ie4up) {
			document.all.menu.style.visibility="visible";
		}
		if (is.ns6 || is.ie4up) mousecheck();
	}
	
	function menuwrite() {
	
		if (is.ns6 || is.ie4up) {
			document.write ("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"120\">");
			
			for (var i=0;i<m_title.length;i++) {
			
			document.write ("<tr><td colspan=\"5\" bgcolor=\"#000000\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td></tr>");
			document.write ("<tr><td bgcolor=\"#000000\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>");
			document.write ("<td bgcolor=\"#822010\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"10\" height=\"1\" border=\"0\" alt=\"\"></td>");
			document.write ("<td width=\"100%\" bgcolor=\"#DADD8C\" class=\"menus\"  onmouseover=\"this.style.backgroundColor='999900';this.style.color='ffffff';\" onmouseout=\"this.style.backgroundColor='DADD8C';this.style.color='000000';\">&nbsp;<a href=\""+m_link[i]+"\" class=\"menus\" onmouseover=\"this.style.color='ffffff';\" onmouseout=\"this.style.color='000000';\">"+m_title[i]+"</a></td>");
			document.write ("<td bgcolor=\"#000000\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td></tr>");
			document.write ("<tr><td colspan=\"5\" bgcolor=\"#000000\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td></tr>");
			document.write ("<tr><td colspan=\"5\"><img src=\"http://www.educationworld.net/images/sp.gif\" width=\"1\" height=\"3\" border=\"0\" alt=\"\"></td></tr>");
			
			}
			
			document.write("</table>");
		}
	}

