function submitform(Form)
{
	//For first name
if((Form.name.value=="")||(Form.name.value=="Name")||!isNaN(Form.name.value))
{
alert("Kindly fill in Name!");
Form.name.focus();
return false;
}
if(containsdigit(Form.name.value)==true)
{
alert("Name contains numbers!");
Form.name.focus();
return false;
}
if(specialchar(Form.name.value)==true)
{
alert("Name should not contain special characters!")
Form.name.focus();
return false;
}
//for date
if(Form.dd.value=="nil")
{
alert("Kindly select date of Birth!");
Form.dd.focus();
return false;
}
if(Form.mm.value=="nil")
{
alert("Kindly select month of Birth!");
Form.mm.focus();
return false;
}
if(Form.yyyy.value=="nil")
{
alert("Kindly select year of Birth!");
Form.yyyy.focus();
return false;
}
////for std
if((Form.std.value=='')&&(Form.phone.value!=''))
{
alert("Enter STD No.!");
Form.std.focus();
return false;
}
if(containsalph(Form.std.value)==true)
{
alert("STD Number contains characters!");
Form.std.focus();
return false;
}
////for phone no
if((Form.phone.value=='')&&(Form.std.value!=''))
{
alert("Enter Phone No.!");
Form.phone.focus();
return false;
}
if(containsalph(Form.phone.value)==true)
{
alert("Residence or Office Tel Number contains characters!");
Form.phone.focus();
return false;
}
////for mobile
//if((Form.mobile.value=='')||(Form.mobile.value=='Mobile No.')||(Form.mobile.value.length<10))
//{
//alert("Kindly fill in 10 digit Mobile Number (Numeric Only)!");
//Form.mobile.focus();
//return false;
//}
if(containsalph(Form.mobile.value)==true)
{
alert("Mobile Number contains characters!");
Form.mobile.focus();
return false;
}
if(Form.mobile.value!="" && (foundstdcode(Form.mobile.value)==false))
{
alert("Kindly fill in correct Mobile no (Starting from 9)");
Form.mobile.select();
return false;
}
if(Form.mobile.value!="" && (Form.mobile.value.length!=10))
{
alert("Kindly fill in 10 digit Mobile no");
Form.mobile.select();
return false;
}
//Atleast one contact number
if((Form.std.value=='')&&(Form.phone.value=='')&&(Form.mobile.value==''))
{
alert("Please enter your mobile or landline number!");
Form.mobile.focus();
return false;
}
//for email
if(Form.email.value=='')
{
alert("Kindly fill in Email ID!");
Form.email.focus();
return false;
}
if( (Form.email.value!='') && (validateemailv2(Form.email.value)==false) )
{
alert("Enter valid Email ID!");
Form.email.focus();
return false;
}
//for city
if(Form.city.value=='nil') 
{
alert("Please select city!");
Form.city.focus();
return false;
}
//for hospital
if(Form.hospital.value=='nil') 
{
alert("Please select nearest Fortis Hospital!");
Form.hospital.focus();
return false;
}
//for check up date
if(Form.checkdd.value=="nil")
{
alert("Kindly select preferred check up date!");
Form.checkdd.focus();
return false;
}
if(Form.checkmm.value=="nil")
{
alert("Kindly select month of preferred check up date!");
Form.checkmm.focus();
return false;
}
if(Form.checkyyyy.value=="nil")
{
alert("Kindly select year of preferred check up date!");
Form.checkyyyy.focus();
return false;
}
if((Form.checkdd.value!="nil") || (Form.checkmm.value!="nil") || (Form.checkyyyy.value!="nil"))
{
		var pDay=Form.checkdd.value;
		var pMonth=Form.checkmm.value-1;
		var pYear=Form.checkyyyy.value;
		var preferedDate=new Date(pYear,pMonth,pDay);
		var messageAlert;
		messageAlert=dateCheck(preferedDate);
		if(messageAlert!="yes")
		{
			alert(messageAlert);
			return false;
		}
		else
		{
		    Form.submit();
		}
		
}
else 
{
	Form.submit();    
}
}

function foundstdcode(param)
{temp = new String(param);phone = temp.substr(0,1);
if(phone==9) // || 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 dateCheck(preferedDate)
{
	var date=new Date();
	var day=date.getDate();
	var month=date.getMonth();
	var year=date.getFullYear();
	
	var currentDate=new Date(year,month,day);
	var checkCurrentDate=new Date(year,month,day+7);
	
	var checkNovDate=new Date();
	checkNovDate.setFullYear(2009,11,10);		

	if(preferedDate <= currentDate)
	{
		var alert1="Please select the date greater than today's date.";	
		return alert1;		
	}
	else if(preferedDate >currentDate && preferedDate < checkCurrentDate)
	{
		var alert2="Kindly enter the Appointment date  7 days from today.";	
		return alert2;	
	}

	else if(preferedDate > checkNovDate)
	{
		var alert3=" Appointment date should be within 10th December 2009";
		return alert3;
	}
	var alert4="yes";
	return alert4;
	
	
}