// JavaScript Document

function nav_top(menuID) {
	if (document.getElementById(menuID)) {
	var elem = document.getElementById(menuID)
	var ul_elem = elem.getElementsByTagName("UL")[0];
	var allLi_arr = ul_elem.getElementsByTagName("LI");
	var li_arr = new Array();
	
	for(e in allLi_arr) {
		
		if (allLi_arr[e].className == "lev1") {
			li_arr.push(allLi_arr[e])
			allLi_arr[e].onmouseover = function() {
			if(this.getElementsByTagName('div')[0]){
				this.getElementsByTagName('div')[0].style.visibility = "visible";}
				
				if(this.getElementsByTagName('li')[0]){
				this.getElementsByTagName('li')[0].style.color = "231f20";
				}
			}
			allLi_arr[e].onmouseout = function() {
			if(this.getElementsByTagName('div')[0])		
			this.getElementsByTagName('div')[0].style.visibility = "hidden";
				if(this.getElementsByTagName('li')[0])
				this.getElementsByTagName('li')[0].style.color = "FFFFFF";
			}				
		}		
		}
	} 
}

function popUpWin(w, h, page, winname){
	//var left = Math.floor( (screen.width - w) / 2);
	//var top = Math.floor( (screen.height - h) / 2);
	var left = 0; var top = 0;
	var winParms = "top=" + top + ",left=" + left + ",height="+ h +",width="+ w +",scrollbars=yes, resizable=yes";
	var win = window.open(page, winname, winParms);
	win.focus();
	ww = screen.width
	hh = screen.height
	win.resizeTo(ww,hh)
}

function checkField(inp, fld){

	var xmlhttp =  getHttpRequest();
	url = 'checkField.php?val='+ inp.value +'&fld='+ fld	
	xmlhttp.open('GET', url, false);
	xmlhttp.onreadystatechange = function(){endPost(xmlhttp);}
	xmlhttp.setRequestHeader('Content-Type', 'text/html; charset=windows-1255');
	xmlhttp.send(null);
	//alert(xmlhttp.responseText)
	return xmlhttp.responseText;
}

function endPost(req){
    if(req.readyState!=4){
        return ;
    }
}

function getHttpRequest(){
	if(window.XMLHttpRequest){
		var req = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		var req = false;
		alert("xmlHttp Not Suported");
	}

	return req;
}

function getObject(objId){
	if(document.getElementById(objId))
	return document.getElementById(objId);
	else{
		alert(objId +" is not an object");
		return false;
	}
}
