// JavaScript Document// JavaScript Document


function Trim(nStr)
{
	return nStr.replace(/(^\s*)|(\s*$)/g, "");
}

function isNull(obj,str)
{
	if (Trim(obj.value)=="") 
	{
  		alert("You must enter your " + str);
		obj.focus();
	    return true;	
 	}
	else
	return  false;
}


function emailVal(obj,str)
{
	Email=obj.value;
	a=Email.indexOf("@");
	b=Email.lastIndexOf(".");
	if(a==-1 || b==-1)
	{
		alert("Plz enter a valid E-Mail Address!!");
		return true;
	}
	else 
		
		return false;
}


function ToCellValidate(objMobileNo,str)
{
	if(objMobileNo.value!="")
	{
		var incomingString=objMobileNo.value;
		if(trimSpace(incomingString).length > 15 || incomingString.search(/[^0-9\-()+]/g) != -1 )
		{
			alert('Please enter valid mobile number');
			objMobileNo.focus();
			objMobileNo.value="";
			return false;
		}
			else
		return true; 
	}
}

function chkNum(obj,str)
{ 
//exp=/^\d[[\d]*[\-]{0,1}[\d]*]*\d$/ //format:0422-2403838,2403838
exp=/^[0-9 ]+$/; //format:044-044-044,0422-2403838,2403838
//exp=/^[\d]{3}[\-][\d]{3}-[\d]{4}$/

	if (!exp.test(obj.value))
	{
		alert("Invalid " +str+". Please enter a valid "+str);
		obj.focus();
		return true;
	}
	else
		return false;
}




function notChecked(obj,str)
{
	checked = false;
	if(obj.length)
	{
		for(i=0;i<obj.length;i++)
		{
			if(obj[i].checked)
			{checked = true;break;}
		}
	}
	else if(obj.checked)
		checked = true;

	if(!(checked))
	{
		alert("Please select the "+str);
		if(obj.length)
			obj[0].focus();
		else
			obj.focus();
		return true;
	}
}



