function validateChar(ch){
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  var allValid = true;
  for (var j = 0;  j < checkOK.length;  j++)
     if (ch == checkOK.charAt(j)) break;
  if (j == checkOK.length) allValid = false;    
  return allValid;
}

function messup(str){
  var strReturn="";
  for(var i=0;i<str.length;i++)
	strReturn = strReturn + String.fromCharCode(str.charCodeAt(i)+3);
  return strReturn;
}

function rearrange(str){
  var strReturn="";
  for(var i=0;i<str.length;i++)
	strReturn = strReturn + String.fromCharCode(str.charCodeAt(i)-3);
  return strReturn;
}

function validatesymbol(a){
	if ((a == 34) || (a==39))
	  return false;
	return true;		
}

function validateInteger(ch){
  var checkOK = "0123456789.";
  var allValid = true;
  for (var j = 0;  j < checkOK.length;  j++)
     if (ch == checkOK.charAt(j)) break;
  if (j == checkOK.length) allValid = false;    
  return allValid;

}

function validateno(ch){
  var checkOK = "0123456789,-";
  var allValid = true;
  for (var j = 0;  j < checkOK.length;  j++)
     if (ch == checkOK.charAt(j)) break;
  if (j == checkOK.length) allValid = false;    
  return allValid;

}

function validateDecimal(ch){
  var checkOK = "0123456789.";
  var allValid = true;
  for (var j = 0;  j < checkOK.length;  j++)
     if (ch == checkOK.charAt(j)) break;
  if (j == checkOK.length) allValid = false;    
  return allValid;
}


function validatesymbolstring(a){
	if ((a == 34) || (a==39) || (a==38) || (a == 37) || (a==35)) 
	  return false;
	return true;		
}


function day_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validateInteger(a)) return false;
	return true;

}

function validate_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	b = a.charCodeAt(0);
	if (!validatesymbol(b)) return false;
	return true;
}

function frmChgKey_onsubmit(){
// client script function to validate the form... 
	var oldkey = document.frmChgKey.txtOldEncKey.value; 
	var newkey = document.frmChgKey.txtNewEncKey.value;
	var confirmkey = document.frmChgKey.txtNewConfirmkey.value; 
	if (oldkey =="") {alert("Please Enter the Old Encryption Key"); return false;}
	if (newkey =="") {alert("Please Enter the New Encryption Key"); return false;}
	if (confirmkey =="") {alert("Please Enter the Cofirm New Encryption Key"); return false;}
	if (newkey.length < 8){alert("The New Encryption Key must be more than 8 characters"); return false;}
	if (oldkey == newkey) {alert("Incompatible encryption key!\nNew key and Old key must not be the same."); return false;}
	if (confirmkey != newkey) {alert("Incompatible encryption key!\nNew Key and Confirm Key must be the same."); return false;}
	return true;
}

function txtNewEncKey_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validateChar(a)) return false;
	return true;
}

function txtNewConfirmkey_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validateChar(a)) return false;
	return true;
}

function integer_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validateDecimal(a)) return false;
	return true;
	
}

function noo_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validatechars(a)) return false;
	return true;
}
function no_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validateno(a)) return false;
	return true;
}
function alpha_onkeypress() {
	a = String.fromCharCode(event.keyCode);
	if (!validatealphabets(a)) return false;
	return true;
}
