//Validating the index Form

function validate_indexform ()
{
    valid = true;
	var emailPat=/^(.+)@(.+)\.(.+)$/;

    if ( document.index.fname.value == "" )
    {
        alert ( "Please enter your Name" );
        valid = false;
    }
	
    else if ( document.index.email.value == "" )
    {
        alert ( "Please enter your Email Address" );
        valid = false;
    }
	else if (document.index.email.value.search(emailPat)==-1)
  	{
    alert ( "Please enter a valid Email Address" );
        valid = false;
 	}
      
	
   else if ( document.index.phone.value == "")
    {
        alert ( "Please enter your Phone Number" );
        valid = false;
    }
	else if (document.index.textarea.value == "" )
    {
        alert ( "Please enter your Questions" );
        valid = false;
    }
	 else if (document.index.security_code.value == "")
    {
        alert ( "Please enter Security Code" );
        valid = false;
    }
	else{
	alert("Thank you for contacting us, one of our Patient Coordinator will contact you shortly.");
	}
    return valid;
   
}

function validate_popupgreyboxform ()
{
    valid = true;
	var emailPat=/^(.+)@(.+)\.(.+)$/;

    if ( document.popupgreyboxform.fname.value == "" )
    {
        alert ( "Please enter your Name" );
		document.popupgreyboxform.fname.focus();
        valid = false;
    }
	
    else if ( document.popupgreyboxform.email.value == "" )
    {
        alert ( "Please enter your Email Address" );
		document.popupgreyboxform.email.focus();
        valid = false;
    }
	else if (document.popupgreyboxform.email.value.search(emailPat)==-1)
  	{
    alert ( "Please enter a valid Email Address" );
	document.popupgreyboxform.email.focus();
        valid = false;
 	}
      
	
   else if ( document.popupgreyboxform.phone.value == "")
    {
        alert ( "Please enter your Phone Number" );
		document.popupgreyboxform.phone.focus();
        valid = false;
    }
	else if (document.popupgreyboxform.textarea.value == "" )
    {
        alert ( "Please enter your Questions" );
		document.popupgreyboxform.textarea.focus();
        valid = false;
    }
	 else if (document.popupgreyboxform.security_code.value == "")
    {
        alert ( "Please enter Security Code" );
		document.popupgreyboxform.security_code.focus();
        valid = false;
    }
	else{
	alert("Thank you for contacting us, one of our Patient Coordinator will contact you shortly.");
	}
    return valid;
   
}

//Validating the Contact Us Form

function validate_contactform ()
{
    valid = true;
   	var emailPat=/^(.+)@(.+)\.(.+)$/;
     if ( document.contact_us.name.value == "" )
    {
        alert ( "Please enter your Name" );
        valid = false;
    }
	
    else if ( document.contact_us.email.value == "" )
    {
        alert ( "Please enter your Email Address" );
        valid = false;
    }
	else if (document.contact_us.email.value.search(emailPat)==-1)
  	{
    alert ( "Please enter a valid Email Address" );
        valid = false;
 	}
      
	
   else if ( document.contact_us.phone.value == "")
    {
        alert ( "Please enter your Phone Number" );
        valid = false;
    }
	
	else if ( document.contact_us.preferred.value == "")
    {
        alert ( "Please select any one of the Preferred Method");
        valid = false;
    }
	
	else if ( document.contact_us.city.value == "" )
    {
        alert ( "Please enter your City Name" );
        valid = false;
    }
	
	else if ( document.contact_us.zip.value == "" || document.contact_us.zip.value.search(num)==-1)
    {
        alert ( "Please enter your Zipcode");
        valid = false;
    }
	
	else if ( document.contact_us.ReferredFrom.value == "")
    {
        alert ( "Please select how did you hear about us ?");
        valid = false;
    }
	
	else if ( document.contact_us.textarea.value == "")
    {
        alert ( "Please enter your Comments");
        valid = false;
    }
	else{
	alert("Thank you for contacting us, one of our Patient Coordinator will contact you shortly.");
	}
			
    return valid;
   
}



// Menu Bar

function expand(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover";
  d.className = "menuHover";
}
function collapse(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal";
  d.className = "menuNormal";
}

function expandsub(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover_sub";
  d.className = "menuHover_sub";
}
function collapsesub(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal_sub";
  d.className = "menuNormal_sub";
}



function expandsubc(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover_subc";
  d.className = "menuHover_subc";
}
function collapsesubc(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal_subc";
  d.className = "menuNormal_subc";
}

/* Procedure Menu*/

function expandsubp(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover_subp";
  d.className = "menuHover_subp";
}
function collapsesubp(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal_subp";
  d.className = "menuNormal_subp";
}



function expandsubr(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover_subr";
  d.className = "menuHover_subr";
}
function collapsesubr(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal_subr";
  d.className = "menuNormal_subr";
}

/* About Menu*/

function expandabout(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover_ser";
  d.className = "menuHover_ser";
}
function collapseabout(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  td.className = "menuNormal_ser";
  d.className = "menuNormal_ser";
}


// Appointment

function validate_appointmentform ()
{
    valid = true;
    var emailPat=/^(.+)@(.+)\.(.+)$/;
	
    if ( document.appointment.name.value == "" )
    {
        alert ( "Please enter your Name." );
        valid = false;
    }
	
    else if ( document.appointment.email.value == "" )
    {
        alert ( "Please enter your Email id." );
        valid = false;
    }
	else if (document.appointment.email.value.search(emailPat)==-1)
  	{
    alert ( "Please enter a valid Email id." );
        valid = false;
 	}
      
	
   else if ( document.appointment.phone.value == "")
    {
        alert ( "Please enter your Phone Number" );
        valid = false;
    }
	
	else if (!document.appointment.status[0].checked && !document.appointment.status[1].checked)
	{

        alert("Please select are you an existing OCDental Center Customer");
        return false;
	}
	else if ( document.appointment.time.value == "" )
    {
        alert ( "Please select preferable time of the day to contact." );
        valid = false;
    }
	else if ( document.appointment.day.value == "" )
    {
        alert ( "Please select preferable day of the week to contact." );
        valid = false;
    }
	else if ( document.appointment.month.value == "" )
    {
        alert ( "Please select preferable Month." );
        valid = false;
    }
	else if ( document.appointment.referal.value == "" )
    {
        alert ( "Please select how did you hear about us." );
        valid = false;
    }
	else if ( document.appointment.textarea.value == "" )
    {
        alert ( "Please write your comments or special requests ." );
        valid = false;
    }
	
	else{
	alert("Thank you for contacting us, one of our Patient Coordinator will contact you shortly.");
	}
    return valid;
   a
}


// Survery

function validate_surveyform ()
{
    valid = true;
	var emailPat=/^(.+)@(.+)\.(.+)$/;

    if ( document.survey.name.value == "" )
    {
        alert ( "Please enter your Name" );
        valid = false;
    }
	
    else if ( document.survey.email.value == "" )
    {
        alert ( "Please enter your Email id" );
        valid = false;
    }
	else if (document.survey.email.value.search(emailPat)==-1)
  	{
    alert ( "Please enter a valid Email Address" );
        valid = false;
 	}
    
 
	else if (!document.survey.rate_visit[0].checked && !document.survey.rate_visit[1].checked && !document.survey.rate_visit[2].checked && !document.survey.rate_visit[3].checked )
    {
        alert ( "Please select how would you rate your overall visit." );
        valid = false;
    }
    
	else if (!document.survey.dental_situation[0].checked && !document.survey.dental_situation[1].checked && !document.survey.dental_situation[2].checked)
    {
        alert ( "Please select did you have a good understanding of your dental situation." );
        valid = false;
    }

	else if (!document.survey.financial_options[0].checked && !document.survey.financial_options[1].checked && !document.survey.financial_options[2].checked)
    {
        alert ( "Please select were your financial options explained to you." );
        valid = false;
    }

    else if (!document.survey.wait[0].checked && !document.survey.wait[1].checked && !document.survey.wait[2].checked && !document.survey.wait[3].checked)
    {
        alert ( "Please select the time you had to wait after the appointment time" );
        valid = false;
    }

    else if (!document.survey.greet[0].checked && !document.survey.greet[1].checked && !document.survey.greet[2].checked)
    {
        alert ( "Please select did the staff greet you to your satisfaction" );
        valid = false;
    }

     else if (!document.survey.refer[0].checked && !document.survey.refer[1].checked && !document.survey.refer[2].checked)
    {
        alert ( "Please enter would you refer your friends and family to us" );
        valid = false;
    }
   
	else if ( document.survey.textarea.value == "" )
    {
        alert ( "Please enter your comments." );
        valid = false;
    }
	else{
	alert("Thank you for your time for completing our survey");
	}
    return valid;
   
}
