 // To open a popup window
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

// Newsletter Subscription Form
function Newsletter() {
  	mailid = document.newsMail.email
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}
}

// Feedback form validation
function Feedback() {

	firstName = document.fbForm.txtFirstname
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	lastName = document.fbForm.txtlastname
	if (lastName.value == "" || !isNaN(lastName.value))
	{
		alert("Please enter your last name");
		lastName.focus()
		return false		
	}

	mailid = document.fbForm.txtemail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	age = document.fbForm.cmbAgeRange
	if (age.options[age.selectedIndex].value == "")
	{
		alert("Please select your age group");
	age.focus()
	return false		
	}	

	sportsAct = document.fbForm.txtsports
	if (sportsAct.value != "" && !isNaN(sportsAct.value))
	{
		alert("Please enter Sports Activities");
		sportsAct.focus()
		return false		
	}

	comments = document.fbForm.txtComments
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.fbForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.fbForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}

// Appointments form validation
function Appointment()
{
if (document.frmAppointment.txtName.value=="" )
	{
	alert('Enter Your Name');
	document.frmAppointment.txtName.focus();
	return false;
	}
if (document.frmAppointment.txtaddress.value=="" )
	{
	alert('Enter Your Address');
	document.frmAppointment.txtaddress.focus();
	return false;
	}
if (document.frmAppointment.txtEmailAddress.value=="")
	{
	alert('Enter Email Address');
	document.frmAppointment.txtEmailAddress.focus();
	return false;
	}
	else if (document.frmAppointment.txtEmailAddress.value.indexOf("@")==-1 || document.frmAppointment.txtEmailAddress.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		document.frmAppointment.txtEmailAddress.focus()	   
		return false
	}	
if (document.frmAppointment.txtbilling.value=="" )
	{
	alert('Enter Your Billing Information');
	document.frmAppointment.txtbilling.focus();
	return false;
	}
if (document.frmAppointment.txtInsurance.value=="" )
	{
	alert('Enter Your Insurance Info');
	document.frmAppointment.txtInsurance.focus();
	return false;
	}	
if (document.frmAppointment.txtHomePhoneNumber.value=="" )
	{
	alert('Enter Your Phone No.');
	document.frmAppointment.txtHomePhoneNumber.focus();
	return false;
	}

	Practitioner = document.frmAppointment.cmbPractitioner
	if (Practitioner.options[Practitioner.selectedIndex].value == "")
	{
		alert("Please select your Practitioner");
	Practitioner.focus()
	return false		
	}		


	clinic = document.frmAppointment.cmbclinic
	if (clinic.options[clinic.selectedIndex].value == "")
	{
		alert("Please select your Clinic");
	clinic.focus()
	return false		
	}	
	
	
	datetime = document.frmAppointment.cmbdatetime
	if (datetime.options[datetime.selectedIndex].value == "")
	{
		alert("Please select your Date/Time");
	datetime.focus()
	return false		
	}	

	
	if (document.frmAppointment.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.frmAppointment.uword.focus();
	return false;
	}
	return jcap();
}



// Appointments form validation
function NewAppointment()
{
if (document.newAppointment.txtName.value=="" )
	{
	alert('Enter Your Name');
	document.newAppointment.txtName.focus();
	return false;
	}
if (document.newAppointment.txtaddress.value=="" )
	{
	alert('Enter Your Address');
	document.newAppointment.txtaddress.focus();
	return false;
	}
if (document.newAppointment.txtEmailAddress.value=="")
	{
	alert('Enter Email Address');
	document.newAppointment.txtEmailAddress.focus();
	return false;
	}
	else if (document.newAppointment.txtEmailAddress.value.indexOf("@")==-1 || document.newAppointment.txtEmailAddress.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		document.newAppointment.txtEmailAddress.focus()	   
		return false
	}	
if (document.newAppointment.txtbilling.value=="" )
	{
	alert('Enter Your Billing Information');
	document.newAppointment.txtbilling.focus();
	return false;
	}
if (document.newAppointment.txtInsurance.value=="" )
	{
	alert('Enter Your Insurance Info');
	document.newAppointment.txtInsurance.focus();
	return false;
	}	
if (document.newAppointment.txtHomePhoneNumber.value=="" )
	{
	alert('Enter Your Phone No.');
	document.newAppointment.txtHomePhoneNumber.focus();
	return false;
	}

	
	if (document.newAppointment.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.newAppointment.uword.focus();
	return false;
	}
	return jcap();
}



// Contact Us form validation
function Contactus() {
	
	firstName = document.cuForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.cuForm.txtEmail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	comments = document.cuForm.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.cuForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.cuForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}



// Contact Us form validation
function Request() {
	
	firstName = document.curequest.txtName
	if (firstName.value == "")
	{
		alert("Please enter your name");
		firstName.focus()
		return false		
	}

	CompanyName = document.curequest.txtCompany
	if (CompanyName.value == "")
	{
		alert("Please enter Company Name");
		CompanyName.focus()
		return false		
	}
	
	Address = document.curequest.txtaddress
	if (Address.value == "")
	{
		alert("Please enter your Address");
		Address.focus()
		return false		
	}
	
	
	Phone = document.curequest.txtPhone
	if (Phone.value == "")
	{
		alert("Please enter your Phone Number");
		Phone.focus()
		return false		
	}
	
	mailid = document.curequest.txtEmail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}



	
	subject = document.curequest.txtSubject
	if (subject.value == "" )
	{
		alert("Please add your subject");
		subject.focus()
		return false		
	}	
	
	comments = document.curequest.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.curequest.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.curequest.uword.focus();
	return false;
	}
	return jcap();
	
	
}


// Priscription Refill form validation
function Prescription()
{
if (document.frmPrescription.txtPatientPhone.value=="")
	{
	alert('Enter Patient Phone Number');
	document.frmPrescription.txtPatientPhone.focus();
	return false;
	}
if (document.frmPrescription.txtPharmacyPhone.value=="")
	{
	alert('Enter Pharmacy Phone Number');
	document.frmPrescription.txtPharmacyPhone.focus();
	return false;
	}
if (document.frmPrescription.txtPatientLastName.value=="" || !isNaN(document.frmPrescription.txtPatientLastName.value) )
	{
	alert('Enter Patient Last Name');
	document.frmPrescription.txtPatientLastName.focus();
	return false;
	}
	
	
	
if (document.frmPrescription.txtPatientFirstName.value=="" || !isNaN(document.frmPrescription.txtPatientFirstName.value))
	{
	alert('Enter Patient FirstName');
	document.frmPrescription.txtPatientFirstName.focus();
	return false;
	}
if (document.frmPrescription.txtDOB.value=="")
	{
	alert('Enter Patient Date of Birth');
	document.frmPrescription.txtDOB.focus();
	return false;
	}
if (document.frmPrescription.txtPhysician.value=="" || !isNaN(document.frmPrescription.txtPhysician.value) )
	{
	alert('Enter Patient Physician Name');
	document.frmPrescription.txtPhysician.focus();
	return false;
	}
if (document.frmPrescription.txtNameofMedicine.value=="" || !isNaN(document.frmPrescription.txtNameofMedicine.value))
	{
	alert('Enter Name of Medicine');
	document.frmPrescription.txtNameofMedicine.focus();
	return false;
	}
if (document.frmPrescription.txtNameofPharmacy.value=="" || !isNaN(document.frmPrescription.txtNameofPharmacy.value))
	{
	alert('Enter Name of Pharmacy');
	document.frmPrescription.txtNameofPharmacy.focus();
	return false;
	}
if (document.frmPrescription.textDrugAllergies.value=="" || !isNaN(document.frmPrescription.textDrugAllergies.value) )
	{
	alert('Enter Drug Allergies');
	document.frmPrescription.textDrugAllergies.focus();
	return false;
	}
	
	if (document.frmPrescription.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.frmPrescription.uword.focus();
	return false;
	}
	return jcap();
}




// Index Page Register form validation
function register() {

	 
	{
	var radio_choice = false;
	for (counter = 0; counter < rgForm.radio_button.length; counter++)
	{
	if (rgForm.radio_button[counter].checked)
	radio_choice = true; 
	}
if (!radio_choice)
		{
	alert("Are you?")
	return (false);
		}
	
	}
	
	
	
	firstName = document.rgForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.rgForm.txtEmail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}
	
if (document.rgForm.txtBusinessPhoneNumber.value=="" )
	{
	alert('Enter a valid Phone Number');
	document.rgForm.txtBusinessPhoneNumber.focus();
	return false;
	}

	
}




function ReferPatient() {
	
	
	
	if (document.frmrefer.txtphysicianName.value=="" )
	{
	alert('Enter Your Physician Name');
	document.frmrefer.txtphysicianName.focus();
	return false;
	}
	
	if (document.frmrefer.txtContact.value=="" )
	{
	alert('Enter Your Physician Contact Number');
	document.frmrefer.txtContact.focus();
	return false;
	}
	
	if (document.frmrefer.txtName.value=="" )
	{
	alert('Enter Your Name');
	document.frmrefer.txtName.focus();
	return false;
	}
	
	if (document.frmrefer.txtaddress.value=="" )
	{
	alert('Enter Your Address');
	document.frmrefer.txtaddress.focus();
	return false;
	}
	
	if (document.frmrefer.txtEmailAddress.value=="")
	{
	alert('Enter Email Address');
	document.frmrefer.txtEmailAddress.focus();
	return false;
	}
	else if (document.frmrefer.txtEmailAddress.value.indexOf("@")==-1 || document.frmrefer.txtEmailAddress.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		document.frmrefer.txtEmailAddress.focus()	   
		return false
	}	
	
	if (document.frmrefer.txtPhoneNumber.value=="" )
	{
	alert('Enter Your Phone Numeber');
	document.frmrefer.txtPhoneNumber.focus();
	return false;
	}
	

	if (document.frmrefer.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.frmrefer.uword.focus();
	return false;
	}
	return jcap();
	
	
}




