// JavaScript Document

/*
*/	
	
	function CheckBlankValue(mes,obj)
	{
		
		if(obj.value=="")
		{
			obj.focus();
			alert(mes);
			return false;
		}
	}
	
	function checkNumber(obj,str)
	{
	  	userName = obj;
	  	len = obj.length;
	  	var valid = "1234567890";
	  	for(i = 0 ;i<len;i++)
	  	{
			j = i +1
			strValue = obj.substring(i,i+1)
			if(valid.indexOf(strValue) == "-1")
			{
				alert("Only numbers are accepted in " + str + " box");
				return false;
			}
	  	}
 	}
 
	function check_email(obj)
	{
		if ((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(obj.value)) == false)
		{
			alert("Please enter a valid email address")
			obj.focus();
			obj.select();
			return false;
		}
	}

	function name_validation(msg,obj)
	{
		var string1="qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP ";
		var val=obj.value;
		var op=new String();
		op.value=val;
		for(var i=0;i<op.value.length;i++)
		{
			if(string1.indexOf(op.value.charAt(i))==-1)
			{
				alert(msg);
				obj.focus();
				return false;
			}
		}
	}
function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}




function check_radio(elem,elem1,helperMsg){
	if(elem.checked == false && elem1.checked==false){
		alert(helperMsg);
		//elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}


function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9+]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphabet1(elem,elem2, helperMsg){
	if(elem.value==elem2.value){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function isAlphabetic(val)
	{
	    if (val.match(/^[a-zA-Z]+$/)){
	  		return true;
	 	}else{
	  		return false;
	 	} 
	}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z :space:]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}



function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}




function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}
	

