window.onerror = killErrors;
function Pop(filename,s_height,s_width) {
	window.open(filename,"","top=0,left=0,height=" + s_height + ",width=" + s_width + "resizable=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0,copyhistory=0,status=1");
}
function ShowStatus(msg){
	window.status = unescape(msg)
	return true;
}
function MM_displayStatusMsg(msgStr)  { //v3.0
	status=msgStr; 
	document.MM_returnValue = true;
	return true;
}
function validate_check(DocName, DocVal, Desc)
{
	if (Trim(document.forms[DocName].elements[DocVal].value) == "")
		{
		document.forms[DocName].elements[DocVal].value = Trim(document.forms[DocName].elements[DocVal].value);
		document.forms[DocName].elements[DocVal].focus();		
		alert(Desc);
		return false;
		}
	else
		return true;
}
function validate_email(DocName, DocVal, Desc){
	if (Trim(document.forms[DocName].elements[DocVal].value) != ""){
		var field = document.forms[DocName].elements[DocVal];  
		var str = field.value;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
		if (reg1.test(str) || !reg2.test(str)){
			document.forms[DocName].elements[DocVal].focus();
			alert(Desc);
			return true;
		}
	}	
	else{
	    return false;
	}	
}
function LTrim(str){
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1){
		var j=0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
		j++;
		s = s.substring(j, i);
	}
	return s;
}

function RTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1){  
	    var i = s.length - 1;  
	    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
	        i--;
	    s = s.substring(0, i+1);
	}
	return s;
}

function Trim(str)
{
	return RTrim(LTrim(str));
}

function isDigit(str){	
  if (str.length == 0){	
     return false;	
  }	
  for (var i=0;i < str.length;i++){	
     if ((str.substring(i,i+1)<'0')||(str.substring(i,i+1)>'9')){	
       return false;	
     }	
  }	
  return true;	
}

function killErrors(){
	return true;
}

function click(){
	if (event.button==2){
		alert('Due to security reasons this operation has been cancelled.')
	}
}
document.onmousedown = click;