function validateSiteAssistance(theForm, e){

	var emailSubject = "";
	var conditions = "true";
	var errorMsg = "Please fill-in all the required fields, marked by * ";
	var errorMsgOther = "Please fill-in the Comments field ";		
	var emailErrorMsg = "Please enter valid email address.";
	var phoneErrorMsg = "Please enter valid phone number.";

	document.getElementById("error_div").style.display = 'none';

	if (theForm.emailName.value.trim() == "" || 
	    theForm.emailComments.value.trim() == "" || 
	    theForm.emailSender.value.trim() == ""	)
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}

	if ((conditions != "false") && (theForm.emailSender.value != "" )){
		if(!validateEmail(theForm.emailSender.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 
			conditions = "false";		
		}
	}
	for (i=0; i<theForm.elements.length; i++){
		if(theForm.elements[i].type == "select-one"){
			if(theForm.elements[i].name == "emailSubject"){
				emailSubject = theForm.emailSubject.options[theForm.emailSubject.selectedIndex].value;
			}
		}
	}	
 	if((conditions != "false") && (emailSubject == "")){
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
 	} 	
 	
		if((emailSubject != "")&&(((emailSubject.toLowerCase()).indexOf("other")) != -1)){
			if(theForm.emailComments.value == ""){
				displayErrorMsg(errorMsgOther);
				window.location.hash="topPage"; 
				conditions = "false";			
			}
		}

 	if(conditions != "false"){
		routeToEmailServlet(theForm);
	}
	
	e.preventDefault();	
	e.stopPropagation();

	return false;
}    

function validateContactProvNomAndEmail(theForm, e){
	var url1 = "";
	stateName = "";
	var conditions = "true";
	var errorMsg = "Please fill-in all the required fields. ";
	var emailErrorMsg = "Please enter valid email address.";
	var phoneErrorMsg = "Please enter valid phone number.";
	
	
	if (theForm.emailPhysicianFirstName.value.trim() == "" ||
		theForm.emailPhysicianLastName.value.trim() == "" ||	
	    theForm.phone.value.trim() == "" ||
	    theForm.emailAddress1.value.trim() == "" ||
	    theForm.emailCity.value.trim() == "" ||
	    theForm.emailZIP.value.trim() == "" ||
	    theForm.emailOfcContact.value.trim() == "" ||
	    theForm.emailSpecialty.value.trim() == "" ||
	    theForm.emailTaxID.value.trim() == "" || 
	    theForm.emailSender.value.trim() == "" || 
	    theForm.emailNPI.value.trim() == "" || 
   	    theForm.emailHospital.value.trim() == ""
	)
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}
	
	if ((conditions != "false") && (theForm.phone.value != "" )){
		if(!validatePhone(theForm.phone.value)){
			displayErrorMsg(phoneErrorMsg);
			window.location.hash="topPage"; 
			conditions = "false";		
		}
	}

	if ((conditions != "false") && (theForm.emailSender.value != "" )){
		if(!validateEmail(theForm.emailSender.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 			
			conditions = "false";		
		}
	}	

	   	  var groupName = theForm.emailGroupName.value;
	   	  
		for (var i=0; i < theForm.emailGroup.length; i++)
		   {
		   if (theForm.emailGroup[i].checked)
      		{
		      var emailGroup = theForm.emailGroup[i].value;
      		}
		   }

		if(((emailGroup.toLowerCase()).indexOf("yes")) != -1){
			if(groupName == ""){
				displayErrorMsg(errorMsg);
				window.location.hash="topPage"; 
				conditions = "false";
			}
		}	
	for (i=0; i<theForm.elements.length; i++){
		if(theForm.elements[i].type == "select-one"){
			if(theForm.elements[i].name == "emailState"){
				stateName = theForm.emailState.options[theForm.emailState.selectedIndex].value;
			}
		}
	}		
<!--			window.alert(url1);-->
<!--			window.alert(theForm.claimantState.options[theForm.claimantState.selectedIndex].value);	-->

 	if(stateName.trim() == ""){
				displayErrorMsg(errorMsg);
				window.location.hash="topPage"; 
				conditions = "false";
 	} 	

 	if(conditions != "false"){
		routeToEmailServlet(theForm);
	}

	e.preventDefault();	
	e.stopPropagation();

	return false;	

}    

function validateReqForInfo(theForm, e){

	stateName = "";
	var conditions = "true";
	var errorMsg = "Please fill-in all the required fields, marked by * ";
	var emailErrorMsg = "Please enter valid email address.";
	var phoneErrorMsg = "Please enter valid phone number.";


	if (theForm.FirstName.value.trim() == "" ||
	    theForm.LastName.value.trim() == "" ||	
	    theForm.CommentBox.value.trim() == ""  
	    )
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}
	
	var r_subject1 = "";

     	for(i=0; i<theForm.r_subject.length; i++){
    		if(theForm.r_subject[i].checked){
	    		r_subject1 = "yes";
    		}
    	}	
    	
	if (r_subject1.trim() == "") 
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}
	
	    	
	
	var contactMe = "";
	
    	for(i=0; i<theForm.contactMe.length; i++){
    		if(theForm.contactMe[i].checked){
	    		contactMe = theForm.contactMe[i].value;
    		}
    	}
    	
  	if((conditions != "false") && contactMe=="email" && theForm.r_email.value == "")	
	{
		displayErrorMsg(emailErrorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}    	
  	if((conditions != "false") && contactMe=="phone" && theForm.r_phone.value == "")	
	{
		displayErrorMsg(phoneErrorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}    		

	if ((conditions != "false") && (theForm.r_phone.value != "" )){
		if(!validatePhone(theForm.r_phone.value)){
			displayErrorMsg(phoneErrorMsg);
			window.location.hash="topPage"; 
			conditions = "false";		
		}
	}
	
	if ((conditions != "false") && (theForm.r_email.value != "" )){
		if(!validateEmail(theForm.r_email.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 			
			conditions = "false";		
		}
	}	
	
 
 	if(conditions != "false"){
		routeToEmailServlet(theForm);
	}

	e.preventDefault();	
	e.stopPropagation();

	
	return false;	

}    

function decideSelectQuestion(theForm){

	var r_subject = "";
	var subject = "";	
 
     	for(i=0; i<theForm.r_subject.length; i++){
    		if(theForm.r_subject[i].checked){
	    		r_subject = theForm.r_subject[i].value;
    		}
    	}

	if(r_subject.indexOf("Claim Inquiry") != -1){	
		theForm.CommentBox.value = "\r\n Claim Inquiry/Status Request:\r\n Contact Name:\r\n Date of Service:\r\n Total Billed Charges:\r\n Employer/Client Name:\r\n How may we help you?:";
	}
	if(r_subject.indexOf("Provider Inquiry") != -1){
		theForm.CommentBox.value = "\r\n Provider Inquiry/Status Request:\r\n Provider's name:\r\n address/state and zip code:\r\n Provider Specialty Type:\r\n Provider Phone:\r\n How may we help you?:";
	}
	if(r_subject.indexOf("Sales") != -1){	
		theForm.CommentBox.value = "";	
	}
	if(r_subject.indexOf("Other") != -1){
		theForm.CommentBox.value = "";		
	}

}

function validateEmailPage(theForm, e){
	var url1 = "";
	stateName = "";
	var conditions = "true";
	var errorMsg = "Please fill-in all the required fields";
	var emailErrorMsg = "Please enter valid email address.";
	
	var sourceUrlIdentifier	= theForm.sourceUrlIdentifier.value;
	
	if(sourceUrlIdentifier.indexOf('chcsample') != -1){
		theForm.sourceUrl.value = "http://www.chcsample.cvty.com" + theForm.sourceUrlRef.value;
	}
	if(sourceUrlIdentifier.indexOf('chcnevada') != -1){
		theForm.sourceUrl.value = "http://www.chcnevada.cvty.com" + theForm.sourceUrlRef.value;
	}	

	if (theForm.fromAddress.value.trim() == "" ||
	    theForm.to.value.trim() == ""
	)
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}
	
	if ((conditions != "false") && (theForm.fromAddress.value != "" )){
		if(!validateEmail(theForm.fromAddress.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 			
			conditions = "false";		
		}
	}		
	if ((conditions != "false") && (theForm.to.value != "" )){
		if(!validateEmail(theForm.to.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 			
			conditions = "false";		
		}
	}			

 	if(conditions != "false"){
		routeToEmailServlet(theForm);
	}

	e.preventDefault();	
	e.stopPropagation();

	return false;	

}    


function validateFeeScheduleReq(theForm, e){

	stateName = "";
	var conditions = "true";
	var errorMsg = "Please fill-in all the required fields, marked by * ";
	var emailErrorMsg = "Please enter valid email address.";

	document.getElementById("error_div").style.display = 'none';

	if (theForm.FullName.value.trim() == "" || 
	    theForm.AddressLine1.value.trim() == "" || 
	    theForm.City.value.trim() == "" || 
	    theForm.emailZIP.value.trim() == "" || 
	    theForm.TaxID.value.trim() == "" || 
	    theForm.LicID.value.trim() == "" || 
	    theForm.emailSender.value.trim() == "" 
	   )
	{
		displayErrorMsg(errorMsg);
		window.location.hash="topPage"; 
		conditions = "false";
	}

	if ((conditions != "false") && (theForm.emailSender.value != "" )){
		if(!validateEmail(theForm.emailSender.value)){
			displayErrorMsg(emailErrorMsg);	
			window.location.hash="topPage"; 
			conditions = "false";		
		}
	}

	for (i=0; i<theForm.elements.length; i++){
		if(theForm.elements[i].type == "select-one"){
			if(theForm.elements[i].name == "emailState"){
				stateName = theForm.emailState.options[theForm.emailState.selectedIndex].value;
			}
		}
	}		

 	if(stateName.trim() == ""){
				displayErrorMsg(errorMsg);
				window.location.hash="topPage"; 
				conditions = "false";
 	} 	


 	if(conditions != "false"){
		routeToEmailServlet(theForm);
	}
	
	e.preventDefault();	
	e.stopPropagation();

	return false;
}    



function routeToEmailServlet(theForm){
	var w = window.open('about:blank','Popup_Window','width=660,height=434,top=243,left=25');

	theForm.target = 'Popup_Window';
	theForm.action = "https://www.firsthealth.com/cmsEmail/thankyou.jsp"; 	 	
	theForm.submit();
}

function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}

function displayErrorMsg(errorMsg)

{
    document.getElementById("error_div").style.display = 'block';
    document.getElementById("errorDD_div").innerHTML = errorMsg;
    new Effect.Appear(document.getElementById("errorDD_div"), {duration: .75})
}

