<!--

function validate()
{
var check1,check2,flag;
var url;
url=window.location.href;
//document.query.url.value=url;

var name = document.query.p_name.value;
var p_gender1;
var age = document.query.p_age.value;
var p_country = document.query.country.value;
var medical1 = document.query.medical.value;
var estimate1 = document.query.estimate.value;

flag=true;

// patient name validation
if(name=="")
{
	alert("Please enter Patient's Name");
	flag=false;	
	document.query.p_name.focus();
	return false;	
}
else
{
	flag=true;
}
//end patient name validation

//getting values of gender  radio buttons
for (i=0; i<document.query.p_gender.length; i++)
{
	if (document.query.p_gender[i].checked==true)
	{
	p_gender1 = document.query.p_gender[i].value;
	document.query.p_gender.value = p_gender1;
	break;
	}
}
//end getting values of gender radio buttons


// patient age validation
//if(age=="")
//{
//	alert("Please enter Patient's Age");
//	flag=false;	
//	document.query.P_age.focus();
//	return false;	
//}
//else
//{
//	flag=true;
//}

var digit = "0123456789";

  if (document.query.p_age.value== "")
  {
    alert("Please fill in your Age.");
	flag=false;
	document.query.p_age.focus();
	return false;
  }
 
  for (var i = 0; i < document.query.p_age.value.length; i++)
  {
    temp = document.query.p_age.value.substring(i, i+1)

    if (digit.indexOf(temp) == -1 && document.query.p_age.value != "")
    {
      alert("The Age must be a Number.");
	  flag=false;
	  document.query.p_age.value="";
	  document.query.p_age.focus();
	  return false;
      break;
    }
  } 
 if(document.query.p_age.value.length<1)
  {
	alert("Please enter a valid Age ");
	flag=false;
	document.query.p_age.focus();
	return false;
  }
//end patient p_age validation


// patient country validation
if(p_country==0)
{
	alert("Please enter Patient's Country");
	flag=false;	
	document.query.country.focus();
	return false;	
}
else
{
	flag=true;
}

//end patient country validation


// phone number validation
  var digits = "0123456789";

  if (document.query.p_phone.value== "")
  {
    alert("Please fill in a Phone Number.");
	flag=false;
	document.query.p_phone.focus();
	return false;
  }
 
  for (var i = 0; i < document.query.p_phone.value.length; i++)
  {
    temp = document.query.p_phone.value.substring(i, i+1)

    if (digits.indexOf(temp) == -1 && document.query.p_phone.value != "")
    {
      alert("The phone number must be a number.");
	  flag=false;
	  document.query.p_phone.value="";
	  document.query.p_phone.focus();
	  return false;
      break;
    }
  } 
 if(document.query.p_phone.value.length<8)
  {
	alert("Please enter a valid phone number( minimum 8 digits).");
	flag=false;
	document.query.p_phone.focus();
	return false;
  }
  
  //end phone validation
  
//email validation

var mail=document.query.hmail.value;

var invalidChar = " *|,\":<>/[]{}`\';()&$#%";


   for (var i = 0; i < mail.length; i++) 
   {
      if (invalidChar.indexOf(mail.charAt(i)) != -1)
      	{
         alert("Invalid Mail ID");
				flag=false;
				document.query.hmail.focus();
				return false;
       }
   }
			

if(mail!="")
	{
		check1=mail.indexOf("@");
		check2=mail.indexOf(".");
		if(check1==-1 || check2==-1)
			{
				alert("Invalid Mail ID");
				flag=false;
				document.query.hmail.focus();
				return false;
			}
		if((check1-check2)==1 || (check1-check2)==-1)
			{
				alert("Invalid Mail ID");
				flag=false;
				document.query.hmail.focus();
				return false;
			}
		
	}

if(mail=="")
{
				alert("Invalid Mail ID");
				flag=false;
				document.query.hmail.focus();
				return false;
}

//end email validation


// patient pntclnstat validation
if(medical1==0)
{
	alert("Please enter About your Medical Condition ");
	flag=false;	
	document.query.medical.focus();
	return false;	
}
else
{
	flag=true;
}
//end patient pntclnstat validation

// Anticipated Travel Dates validation
if(estimate1=="")
{
	alert("Please enter Estimate Requested for? .");
	flag=false;	
	document.query.estimate.focus();
	return false;	
}
else
{
	flag=true;
}
//Anticipated Travel Dates validation

if(flag==true)
	{
		
		document.query.submit();
	}
}


// end the hiding comment --> 
