//encodeURIComponent
// JavaScript Document
function isblank(strval) {
   	var len = strval.length;
	for (var i = 0; i < len; i++) {
      if (strval.charAt(i) != " ") {
	     return false;				// If the is any non-space character, isblank() returns false
      }
   }
   return true;
}

function validEmail(Paddress) {
	var Vre;
	var Vret;
	Vre = /^[a-zA-Z0-9_\-\.]+@([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,3}$/;
	Vret = Paddress.search(Vre);
	if(Vret == 0) {
		return true;
	} else {
		return false;
	}

}

function isnumeric(strval) {
	var bool = isNaN(strval);
	return (!bool);
}

function isInteger (s) {
  var i;
  for (i = 0; i < s.length; i++) {
	 var c = s.charAt(i);
	 if (!isDigit(c)) return false;
  }
  return true;
}

function isEmpty(s) {
  return ((s == null) || (s.length == 0))
}

function isDigit (c) {
  return ((c >= "0") && (c <= "9"))
}

function dateValidate(day, month, year) {
	var leap = 0;
	var bool = true;
	if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
	  leap = 1;
	}
	if ((month == 2) && (leap == 1) && (day > 29)) {
	  bool = false;
	} else if ((month == 2) && (leap != 1) && (day > 28)) {
	  bool = false;
	} else if ((day > 31) && ((month == "1") || (month == "3") || (month == "5") || (month == "7") || (month == "8") || (month == "10") || (month == "12"))) {
		bool = false;
	} else if ((day > 30) && ((month == "4") || (month == "6") || (month == "9") || (month == "11"))) {
	  bool = false;
	}
	return bool;
}
//function referesh_Show()
function clearBox()
{
		document.getElementById('errMsgId').innerHTML='';
		document.frmpass.old_pass.value='';
		document.frmpass.password.value='';
		document.frmpass.re_pass.value='';
}
function chkUserPassword()
{
		if(document.frmpass.old_pass.value=='')
		{document.getElementById('errMsgId').innerHTML="Please type the old password";
		document.frmpass.old_pass.focus();
		return false;
		}
		
		if(document.frmpass.password.value=='')
		{document.getElementById('errMsgId').innerHTML="Please type the password";
		document.frmpass.password.focus();
		return false;
		}
		if(document.frmpass.re_pass.value=='')
		{document.getElementById('errMsgId').innerHTML="Please re-type the password";
		document.frmpass.re_pass.focus();
		return false;
		}
	
		if(document.frmpass.password.value!=document.frmpass.re_pass.value)
		{document.getElementById('errMsgId').innerHTML="Password doesn't match.";
		 document.frmpass.password.focus();
		 return false;
		}
		document.getElementById('errMsgId').innerHTML='<img src="images/loading.gif" border="0" />';
		chngUserPassword(document.frmpass.old_pass.value,document.frmpass.password.value);	
}
