// JavaScript Document
// JavaScript Document
function getKeyCharCode(event) 
{
	var key = null;
	if (window.event) {
		//ie
		key = window.event.keyCode;
	} else if (event.which) {
		key = event.which;
	}
	return key;
}
function IsNumeric(event)
    {
      /* var key=(evt.which) ? evt.which : event.keyCode
       if ((key >= 48) && (key <58) || (key == 46) || (key==8) || (key==127))
       {
       return true;
       }
       else
       {
       return false;
       }*/
			var isMozilla = false;
			if (!window.event && event.which) 
			{
				isMozilla = true;
			}
			var key = getKeyCharCode(event);
			var isNumeric = false;
			if (key != null) 
			{
				if (key >= 48 && key <= 58)	 
				{
					// key is numeric
					isNumeric = true;
				} 
				else if (key == 46) 
				{
					// key is a decimal point
					isNumeric = true;
				} 
				else if (key == 13) 
				{
					//13 is a return
					isNumeric = true;
				} 
				else if (key == 8 && isMozilla) 
				{
					//8 is a backspace with mozilla
					isNumeric = true;
				}
			} 
			else 
			{
				isNumeric = true;
			}
			return isNumeric;
	   /////
  }
function IsNumericMobile(event)
    {
      /* var key=(evt.which) ? evt.which : event.keyCode
       if ((key >= 48) && (key <58) || (key == 46) || (key==8) || (key==127))
       {
       return true;
       }
       else
       {
       return false;
       }*/
			var isMozilla = false;
			if (!window.event && event.which) 
			{
				isMozilla = true;
			}
			var key = getKeyCharCode(event);
			var isNumeric = false;
			if (key != null) 
			{
				if (key >= 48 && key <= 58)	 
				{
					// key is numeric
					isNumeric = true;
				} 
				else if (key ==43 || key ==44) 
				{
					// key is a decimal point
					isNumeric = true;
				} 
				else if (key == 13) 
				{
					//13 is a return
					isNumeric = true;
				} 
				else if (key == 8 && isMozilla) 
				{
					//8 is a backspace with mozilla
					isNumeric = true;
				}
			} 
			else 
			{
				isNumeric = true;
			}
			return isNumeric;
	   /////
  }
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid Email")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid Email")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid Email")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid Email")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email")
		    return false
		 }

 		 return true					
	}

function chkEmail(obj){
	var emailID=obj
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }