function submitform(Form)
{
if((Form.name.value=="")||(Form.name.value=="Name"))
{
alert("Kindly fill in your Name!");
Form.name.focus();
return false;
}
else if(containsdigit(Form.name.value)==true)
{
alert("Name should not contain numbers!");
Form.name.focus();
return false;
}
else if(specialchar(Form.name.value)==true)
{
alert("Name should not contain special characters!")
Form.name.focus();
return false;
}

else if(Form.dobdd.value==0)
{
alert("Kindly select Day from the list!");
Form.dobdd.focus();
return false;
}
else if(Form.dobmm.value==0)
{
alert("Kindly select Month from the list!");
Form.dobmm.focus();
return false;
}
else if(Form.dobyyyy.value==0)
{
alert("Kindly select Year from the list!");
Form.dobyyyy.focus();
return false;
}


else if(Form.email.value=='')
{
alert("Kindly fill in your Email Id!");
Form.email.focus();
return false;
}
else if( (Form.email.value!='') && (validateemailv2(Form.email.value)==false) )
{
alert("Kindly fill in a valid Email Id!");
Form.email.focus();
return false;
}


else if(((Form.phone.value=='')||(Form.phone.value=="Telephone No.")) &&((Form.mobile.value=='')||(Form.mobile.value=='Mobile No.')))
{
alert("Kindly fill either Landline or Mobile Number!");
return false;
}
else if((Form.mobile.value=='Mobile No.')&&(containsalph(Form.phone.value)==true))
{
alert("Kindly fill Numeric values for Landline");
return false;
}
else if((Form.phone.value!='Telephone No.')&&(Form.stdcode.value=='STD Code'))
{
	alert("Kindly fill STD Code for Telephone No.");
	Form.stdcode.focus();
	return false;
}
else if((Form.stdcode.value!='STD Code')&&(containsalph(Form.stdcode.value)==true))
{
	alert("Kindly fill Numeric values for STD Code");
	Form.stdcode.focus();
	return false;
}
else if(((Form.mobile.value=='')||(containsalph(Form.mobile.value)==true)||(foundstdcode(Form.mobile.value)==false)||(Form.mobile.value.length<10))&&((Form.phone.value=='')||(Form.phone.value=="Telephone No.")))
{
alert("Kindly fill in 10 digit Mobile number Starting with 9XXX or 8XXX");
return false;
}

else if(Form.education.value=='nil')
{
alert("Kindly select your Qualification from the list");
Form.education.focus();
return false;
}

else if(Form.city.value=='nil')
{
alert("Kindly select the City name from the list");
Form.city.focus();
return false;
}
else if(Form.verif_box.value=='Verification Code')
{
alert("Kindly Enter the Image Verification Code");
Form.verif_box.focus();
return false;
}


else {
Form.submit();
}
}
function foundstdcode(param)
{temp = new String(param);phone = temp.substr(0,1);
if((phone==9)|| (phone==8))
{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 checkemailid(Form)
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	  if(ajaxRequest.readyState == 4)
	  {
		//frmcat.status.value=ajaxRequest.responseText;
		document.getElementById('page-loader').style.display='none';
		document.getElementById('texthint').style.display='block';
		document.getElementById("texthint").innerHTML=ajaxRequest.responseText;
		if(ajaxRequest.responseText)
		{
			Form.email.value="";
			Form.email.focus();
		}
	  }
	}
    //alert("Please product category...........\n \t\t Its mandatory");	
    //document.form1.subcatl.focus();   
    var email = Form.email.value;
	if(email!="Email")
	{
		var queryString = "?email=" + email;
		document.getElementById('page-loader').style.display='block';
		ajaxRequest.open("GET", "checkusr.php" + queryString, true);
		ajaxRequest.send(null); 
	}
}
