var menuids=["menu1"] //Enter id(s) of Home UL menus, separated by commas
var strMenu = '<ul id="menu1"><li><a href="lms_login.aspx" id="evt0">Home</a></li>'+
				'<li><a href="intro.html" id="evt1">About Product</a><ul><li>' +
				'<a href="intro.html">Introduction &amp; Information</a></li><li>' +
				'<a href="benefits.html">Benefits</a></li><li>' +
				'<a href="curriculum.html">Curriculum</a></li></ul></li>'+
				'<li><a href="aboutus.html" id="evt2">About Us</a><ul><li>'+
				'<a href="aboutus.html">Company Info</a></li><li>'+
				'<a href="sgMath.html">Singapore Math Approach</a></li></ul></li>'+
				'<li><a href="contactus.html" id="evt3">Contacts</a></li></ul>';
				
var strFooter = '<div class="div_fcol"><h1>HOME</h1><a href="lms_login.aspx">Overview</a></div>'+
			'<div class="div_fcol"><h1>ABOUT PRODUCT</h1><a href="intro.html">Introduction &amp; Information</a><br><a href="benefits.html">Benefits</a><br><a href="curriculum.html">Curriculum</a></div>'+
			'<div class="div_fcol"><h1>ABOUT US</h1><a href="aboutus.html">Company Info</a><br><a href="sgMath.html">Singapore Math Approach</a></div>'+
			'<div class="div_fcol"><h1>CONTACTS</h1><a href="contactus.html">Contact Us</a></div>';

var strCopyRight ='<div class="div_copyright">Copyright &copy; 2011 MC Online Pte. Ltd.. All rights reserved.</div><div class="div_mclogo"><img src="/LEAD/LEADUI/images/login_us/mcgrey.png"></div>';	

function buildsubmenus_horizontal(){
	for (var i=0; i<menuids.length; i++){
		var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
		for (var t=0; t<ultags.length; t++){
			if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
				ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
				ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
			}
			else{ //else if this is a sub level menu (ul)
				ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    			ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
			}
			ultags[t].parentNode.onmouseover=function(){
				this.getElementsByTagName("ul")[0].style.visibility="visible"
			}
			ultags[t].parentNode.onmouseout=function(){
				this.getElementsByTagName("ul")[0].style.visibility="hidden"
			}
		}
	}
}
function NewWindow(mypage,myname,w,h,scroll,resizable){
	window.blur();
	window.focus();
	var winl=(screen.width-w)/2;
	var wint=(screen.height-h)/2;
	winprops="height="+h+",width="+w+",top="+wint+",left="+winl+",scrollbars="+scroll+", resizable=1";
	win=window.open(mypage,myname,winprops);
	if(parseInt(navigator.appVersion)>=4){
		win.window.focus();
	}
}
function setActive(n)
{
    var i=0; 
    while (document.getElementById("evt"+i) != null)
    {
        if (i==0)
	        document.getElementById("evt"+i).style.borderLeft="1px solid #F7A27B";
	    document.getElementById("evt"+i).style.borderRight="1px solid #F7A27B";
	    i++;
	}
	document.getElementById("evt"+n).style.backgroundImage = "url(/LEAD/LEADUI/images/login_us/login2.jpg)";
	document.getElementById("evt"+n).style.backgroundPosition = "-310px -42px";

	if (document.getElementById("div_char")!=null)
	    document.getElementById("div_char").innerHTML = '<img src="/LEAD/LEADUI/images/login_us/char'+getRandNum(0, 26)+'.png" />';
	if (document.getElementById("div_char1")!=null)
	    document.getElementById("div_char1").innerHTML = '<img src="/LEAD/LEADUI/images/login_us/char'+getRandNum(0, 26)+'.png" />';
	var agent = navigator.userAgent;
    if(agent.match(/MSIE/gi))
         document.getElementById("div_header").style.height = "115px";

}
function getRandNum(min, max)
{
    var ranNum=-1;
	while (ranNum<min || ranNum>max)
	{
	    ranNum = parseInt(((100*Math.random())%(max+1)),10);	   
	}
	return ranNum;
}
/*
function queryStr(name){  
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
	var regexS = "[\\?&]"+name+"=([^&#]*)";  
	var regex = new RegExp( regexS );  
	var results = regex.exec( window.location.href );  
	if( results == null )    return "";  
	else    return results[1];
}*/
