// JavaScript Document
	function addLoadEvent(func) 
	{ 
		var oldonload = window.onload; 
		if (typeof window.onload != 'function') 
		{ 
			window.onload = func; 
		} 
		else 
		{ 
			window.onload = function() { oldonload(); func; } 
		} 
	}
	
//KLE open new window, and center it	
function OpenNewWindow(url,w,h)
{
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);		
	var targetWin = window.open (url, "NewWindow", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
	

//open pop-up
function OpenWindow(url, w, h)
	{
		window.showModalDialog(url, this, 'center:yes; help:no; resizable:yes; status:no; dialogHeight:' + h + 'px; dialogWidth:' + w + 'px;');
	}
	
//check numeric
function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
   }
	 
function RemoveBad(strTemp) { 
    strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,""); 
    return strTemp;
} 	 

//validate email
function IsEmail(email)
{
	var pattern = /^[^@]+@([-\w]+\.)+[A-Za-z]{2,4}$/;
	
	if(pattern.exec(email) != null)
		return true;
	else
		return false;
}
	
