/* Copyright NetCore 1997-2008. Licenced to Ash Alom. ash [AT] netcore [Dot COM]
*******************************************************************************/

var menuids=["Menus"];

function BuildSubMenus(){
	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.left=ultags[t].parentNode.offsetWidth+"px"; //dynamically position first level submenus to be width of main menu item
			}else{ //else if this is a sub level submenu (ul)
				ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
			}
			if(ultags[t].id!="Active"){
				ultags[t].parentNode.onmouseover=function(){
					this.getElementsByTagName("ul")[0].style.display="block";
					this.getElementsByTagName("a")[0].style.background='#A0CFEB URL(pic/Menu_Background.gif) 0 -84px No-Repeat';
				}
				ultags[t].parentNode.onmouseout=function(){
					this.getElementsByTagName("ul")[0].style.display="none";
					this.getElementsByTagName("a")[0].style.background='#A0CFEB URL(pic/Menu_Background.gif) 0 0 No-Repeat';

				}
			}else{
				ultags[t].parentNode.onmouseover=function(){
					this.getElementsByTagName("ul")[0].style.display="block";
					this.getElementsByTagName("a")[0].style.background='#A0CFEB URL(pic/Menu_Background.gif) 0 -84px No-Repeat';
				}
				ultags[t].parentNode.onmouseout=function(){
					this.getElementsByTagName("ul")[0].style.display="none";
					this.getElementsByTagName("a")[0].style.background='#A0CFEB URL(pic/Menu_Background.gif) 0 -56px No-Repeat';
				}
			}
		}
		for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
			ultags[t].style.visibility="visible";
			ultags[t].style.display="none";
		}
	}
}


function ValidateeMail(DOM){
	var NetCore
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})$/
	if (filter.test(DOM)){
		NetCore=true
	}else{
		NetCore=false
	}
	return (NetCore)
}


if (window.addEventListener){
	window.addEventListener("load", BuildSubMenus, false);
}else if (window.attachEvent){
	window.attachEvent("onload", BuildSubMenus);
}


function Logout(){
	self.focus();
	if(confirm("Do you want to Logout?")){
		top.document.location.href="logout.php";
		return false;
	}
	return false;
}

function CenterWindow(URL,WindowName,Width,Height,ScrollBars,Resizable,MenuBar,ToolBar,Location,Directories,Status){
 if (!WindowName) {var WindowName='Copyright_NetCore_AshAlom_DL2'}
 if (!Width) {var Width=550}
 if (!Height) {var Height=350}
 if (!ScrollBars) {var ScrollBars=0}
 if (!Resizable) {var Resizable=0}
 if (!MenuBar) {var MenuBar=0}
 if (!ToolBar) {var ToolBar=0}
 if (!Location) {var Location=0}
 if (!Directories) {var Directories=0}
 if (!Status) {var Status=0}
  var winl = (screen.width - Width) / 2;
  var wint = (screen.height - Height) / 2;
  winprops = 'height='+Height+',width='+Width+',top='+wint+',left='+winl+',toolbar='+ToolBar+',location='+Location+',status='+Status+',menubar='+MenuBar+',scrollbars='+ScrollBars+',resizable='+Resizable+'';
  win = window.open(URL, WindowName, winprops);
  if(!win){alert("ERROR!\nUnable to launch browser window.\n\nYou need to disable your popup blocker to continue.");}
  if(parseInt(navigator.appVersion)>=4){win.window.focus();}
}
