// Draw Clock
function wait(fl)
{
  var x,y;
  if (self.innerHeight)
  {// all except Explorer
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else 
  if (document.documentElement && document.documentElement.clientHeight)
  {// Explorer 6 Strict Mode
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  if (document.body)
  {// other Explorers
   x = document.body.clientWidth;
   y = document.body.clientHeight;
  }

  var el=document.getElementById('DIV_DESKTOP');
	if(null!=el)
	{
		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.width = x + "px";
		el.style.height = y + "px";
		el.style.zIndex = 1;
		//document.style.cursor="progress";
	}

	var el=document.getElementById('loader');
	if(null!=el)
	{
		var top = (y/2) - 50;
		var left = (x/2) - 200;
		if( left<=0 ) left = 10;

		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.left = left + "px"
		el.style.top = top + "px";
		el.style.zIndex = 2;
	}
}
//=================================================
function selectAll(SelectAll,fields){
	if(fields!=null){
		var i=0;
		while(fields[i]!=null){
			fields[i].checked=SelectAll.checked;
			i++;
		}
		if(i==0)
			fields.checked=SelectAll.checked;
	}
}
function siteLoaded(){
	//startTextScroll();
	wait(0);
}

function setBult(id,status){
	document.getElementById(id).style.display=status;
}
function logOut(){
	document.login .submit ();
}
function popUp(URL,WindowName,resizable,scrollbars,width,height){
	window.open (URL,WindowName,"tollbar=0,resizable="+resizable+",scrollbars="+scrollbars+",width="+width+",height="+height+",left="+(screen.width-width)/2+",top="+(screen.height-height)/2+"");}
function rowColor(id,ON){
	if(ON)
		document.getElementById(id).style.backgroundColor ='#D6E1EB';
	else
		document.getElementById(id).style.backgroundColor ='';
}
	var head="display:''"
	img1=new Image()
	img1.src= up+"images/plus.gif"
	img2=new Image()
	img2.src=up+"images/minus.gif"
	function hideOld(i){
		if (oldIndex!=-1) {
			document.all[oldIndex].style.display="none";
		}
			oldIndex=i;
	}
	function change(){
	   if(!document.all)
	      return
	   if (event.srcElement.id=="foldheader") {
	     var srcIndex = event.srcElement.sourceIndex
	     var nested = document.all[srcIndex+1]
	     if (nested.style.display=="none") {
	         nested.style.display=''
	         event.srcElement.style.listStyleImage="url("+up+"images/minus.gif)"
	      }
	      else {
	         nested.style.display="none"
	         event.srcElement.style.listStyleImage="url("+up+"images/plus.gif)"
	      }
	   }
	}

document.onclick=change



function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
}function popUp(URL,WindowName,resizable,scrollbars,width,height){
	window.open (URL,WindowName,"tollbar=0,resizable="+resizable+",scrollbars="+scrollbars+",width="+width+",height="+height+",left="+(screen.width-width)/2+",top="+(screen.height-height)/2+"");}
function dialog(URL,WindowName,resizable,scrollbars,width,height){
	window.showModelessDialog(URL, WindowName, "dialogHeight: "+height+"px; dialogWidth: "+width+"px; dialogTop: "+(screen.height-height)/2+"px; dialogLeft: "+(screen.width-width)/2+"px; edge: Sunken; center: Yes; help: No; resizable: "+resizable+"; status: No;");	
}
function validateRequired(field,Msg){
	try{
		if(trim(field.value)==""){
			alert(Msg);
			field.focus();
			return false;
		}
	}catch(e){
		try{
			if(field.options.selectedIndex==0){
				alert(Msg);
				field.focus();
				return false;
			}
		}
		catch(ee){}
	}
	return true;
}
function validateInt(field,Msg){
	if(field.value!="" && isNaN(field.value)){
		alert(Msg);
		field.focus();
		return false;
	}
	return true;
}

function validateNumeric(field,Msg){
	if(field.value!="" && isNaN(field.value)){
		alert(Msg);
		field.focus();
		return false;
	}
	return true;
}

function ValidateEmail(field) {
	var strEmail=field.value;
	if (strEmail=="")return;
	var blnValid;
	var goodEmail = strEmail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	if (!goodEmail){
		alert('Please enter a valid email address ['+strEmail+']');
		field.focus();
		return false;
	}
	return goodEmail;
}
function validateEmail(field,Msg) {
	var strEmail=field.value;
	if (strEmail=="")return;
	var blnValid;
	var goodEmail = strEmail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	if (!goodEmail){
		alert(Msg);
		field.focus();
		return false;
	}
	return goodEmail;
}
