function foundstdcode(param)
{temp = new String(param);phone = temp.substr(0,1);
if(phone==9 || phone==8) // || phone==9)
{return true;}
else{return false;
}
}
function containsdigit(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)=="0") || (param.charAt(i)=="1") || (param.charAt(i)=="2") || (param.charAt(i)=="3") || (param.charAt(i)=="4") || (param.charAt(i)=="5") || (param.charAt(i)=="6") || (param.charAt(i)=="7") || (param.charAt(i)=="8") || (param.charAt(i)=="9"))
{
return true;

}

}

return false;

}

function specialchar(param)

{

mystrLen = param.length;

for(i=0;i<mystrLen;i++)

{

if((param.charAt(i)==".") || (param.charAt(i)=="'")||(param.charAt(i)=="/")||(param.charAt(i)=="*")||(param.charAt(i)=="#")||(param.charAt(i)=="$")||(param.charAt(i)=="%")||(param.charAt(i)=="@")||(param.charAt(i)=="!"))

{return true;}

}return false;}



function validateemailv2(email)

{

// a very simple email validation checking.

// you can add more complex email checking if it helps

var splitted = email.match("^(.+)@(.+)$");

if(splitted == null) return false;

if(splitted[1] != null )

{

var regexp_user=/^\"?[\w-_\.]*\"?$/;

if(splitted[1].match(regexp_user) == null) return false;

}

if(splitted[2] != null)

{

var regexp_domain=/^[\w-\.]*\.[a-za-z]{2,4}$/;

if(splitted[2].match(regexp_domain) == null)

{

var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;

if(splitted[2].match(regexp_ip) == null) return false;

}

return true;

}

return false;

}

function containsalph(param)

{

mystrLen = param.length;

for(i=0;i<mystrLen;i++)

{

if((param.charAt(i)<"0")||(param.charAt(i)>"9"))

{

return true;

}

}

return false;

}

function Trim(strValue) {

var j=strValue.length-1;i=0;

while(strValue.charAt(i++)==' ');

while(strValue.charAt(j--)==' ');

return strValue.substr(--i,++j-i+1);

}

function cleanup(fname)

{

	document.frmsubmit.elements[fname].value="";

}

function recover(fname,value1)

{

	if(document.frmsubmit.elements[fname].value=="")

	{

		document.frmsubmit.elements[fname].value=value1;

	}

}





function checkFrm(Form)
{
	if((Form.name1.value=="")||(Form.name1.value=="Name"))
	{
		alert("Kindly fill in your Name!");
		Form.name1.focus();
		return false;
	}
	else if(containsdigit(Form.name1.value)==true)
	{
		alert("Name should not contain numbers!");
		Form.name1.focus();
		return false;
	}
	else if(specialchar(Form.name1.value)==true)
	{
		alert("Name should not contain special characters!")
		Form.name1.focus();
		return false;
	}
	/*else if((Form.address.value==""))
	{
		alert("Please fill in your Permanent address!");
		Form.address.focus();
		return false;
	}
	else if((Form.phone.value=='')||(Form.phone.value=="Telephone No."))
	{
		alert("Please fill Telephone No.!");
		return false;
	}
	else if((Form.phone.value!='')&&(containsalph(Form.phone.value)==true))
	{
		alert("Kindly fill Numeric values for Telephone No.");
		return false;
	}*/
	else if((Form.mobile.value=='')||(Form.mobile.value=='Mobile No.')||(Form.mobile.value.length<10))
	{
		alert("Kindly fill in your 10 digit Mobile Number (Numeric Only)!");
		Form.mobile.focus();
		return false;
	}
	else if(containsalph(Form.mobile.value)==true)
	{
		alert("Mobile Number contains characters!");
		Form.mobile.focus();
		return false;
	}
	else if((Form.mobile.value!=9) && (foundstdcode(Form.mobile.value)==false))
	{
		alert("Kindly fill in your correct Mobile no (Starting from 9 or 8)");
		Form.mobile.select();
		return false;
	}
	else if(Form.emailid.value=='')
	{
		alert("Kindly fill in your Email Id!");
		Form.emailid.focus();
		return false;
	}
	else if( (Form.emailid.value!='') && (validateemailv2(Form.emailid.value)==false) )
	{
		alert("Kindly fill in a valid Email Id!");
		Form.emailid.focus();
		return false;
	}
	else if(Form.location.value=='')
	{
		alert("Kindly fill in your Location!");
		Form.location.focus();
		return false;
	}
	else if(containsdigit(Form.location.value)==true)
	{
		alert("Location should not contain numbers!");
		Form.location.focus();
		return false;
	}
	else {
	Form.submit();
	}
}



