



var JS_SEARCH_MISSING_ERROR  = "Please enter your search terms.";
var JS_SEARCH_FORMAT_ERROR  = "Please enter only letters and/or numerals.";
var JS_YOUR_NAME_MISSING_ERROR = "Please enter your name.";
var JS_FRIEND_NAME_MISSING_ERROR = "Please enter the name of the person you want to send this to.";
var JS_YOUR_EMAIL_MISSING_ERROR = "Please enter your e-mail address.";
var JS_FRIEND_EMAIL_MISSING_ERROR = "Please enter the e-mail address of the person you want to send this to.";
var JS_YOUR_NAME_FORMAT_ERROR = "Please use only letters and/or numerals.";
var JS_FRIEND_NAME_FORMAT_ERROR = "Please use only letters and/or numerals.";
var JS_EMAILADDRESS_MISSING_ERROR = "Please enter your e-mail address.";
var JS_EMAILADDRESS_FORMAT_ERROR  = "Please enter a valid e-mail address.";
var JS_COMMENTS_MESSAGE_TOO_LONG = "Sorry, your comments cannot exceed 500 characters.";
var JS_FIRSTNAME_MISSING_ERROR = "Please enter your first name.";
var JS_FIRSTNAME_FORMAT_ERROR = "Please enter only letters and/or numerals.";
var JS_LASTNAME_MISSING_ERROR = "Please enter your last name.";
var JS_LASTNAME_FORMAT_ERROR = "Please use only letters and/or numerals.";
var JS_ADDRESS_MISSING_ERROR = "Please enter your address.";
var JS_ADDRESS_FORMAT_ERROR = "Please enter only letters and/or numerals.";
var JS_CITY_MISSING_ERROR = "Please enter your city.";
var JS_CITY_FORMAT_ERROR = "Please enter only letters and/or numerals.";
var JS_STATE_MISSING_ERROR = "Please select your state.";
var JS_ZIP_MISSING_ERROR = "Please enter your zip code.";
var JS_ZIP_FORMAT_ERROR = "Please enter a valid zip code.";
var JS_AREACODE_MISSING_ERROR = "Please enter area code of your phone number.";
var JS_PREFIX_PHONE_MISSING_ERROR = "Please enter the first three digits of your phone number.";
var JS_SUFFIX_PHONE_MISSING_ERROR = "Please enter last four digits of your phone number.";
var JS_PHONE_FORMAT_ERROR = "Please enter a valid phone number.";
var JS_METHOD_MIN_ERROR = "Invalid minimum number of characters.";
var JS_METHOD_MAX_ERROR = "Invalid maximum number of characters.";
var JS_POSTALCODE_MISSING_ERROR = "";
var JS_POSTALCODE_FORMAT_ERROR = "";
var JS_PROVINCE_MISSING_ERROR = "";
var JS_PROVINCE_FORMAT_ERROR = "";






var JS_CHECKANSER_ERROR = "You will need to select at least one question.";
var JS_PAGE_PRINT_MESSAGE = "Select 'File' and 'Print' to print this page.";
var JS_METHOD_MAX_ERROR = "You may only select up to 2 methods.";
var JS_METHOD_MIN_ERROR = "You will need to select at least one method.";
var JS_SURVEY_ANSWER_LEAST_ONE = "You must answer at least one question to continue.";
var JS_GET_FLASH_MESSAGE = "<table border=0 cellpadding=10 cellspacing=5><tr><td><p>The minimum requirement to view this interactive feature is Flash 6. <a href=http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&P5_Language=English target=_blank>Click here</a> if you need to download the player.  After downloading the flash player, please close this window and click on the link again to view the flash video.</p></td></tr></table>";
var JS_PROMPT_LOGIN = "Sorry, you have to login in first.";
var JS_PUBLICATION_FORMAT_ERROR = "Please enter only letters and/or numerals.";
var JS_FAXAREACODE_MISSING_ERROR = "Please enter area code of your fax number.";
var JS_PREFIX_FAX_MISSING_ERROR = "Please enter the first three digits of your fax number.";
var JS_SUFFIX_FAX_MISSING_ERROR = "Please enter last four digits of your fax number.";
var JS_FAX_FORMAT_ERROR = "Please enter a valid fax number.";
var JS_INTERNATIONALSITES_CONFIRM_MSG = "Thank you for visiting NuvaRing.com.  Please note that\n the international sites listed below have been developed\n for an international audience. They are not intended for\n U.S. residents.\n\nNote: these sites will appear in a new browser window.\n";
var JS_CITY_DOCTOR_FORMAT_ERROR = "Please enter letters only.";
var JS_FULLNAME_DOCTOR_MISSING_ERROR = "Please enter your doctor's name.";
var JS_CITY_DOCTOR_MISSING_ERROR = "Please enter a city.";
var JS_STATE_DOCTOR_MISSING_ERROR = "Please enter your state.";
var JS_STATE_FORMAT_ERROR = "Please enter a valid state.";
var JS_ZIP_DOCTOR_MISSING_ERROR = "Please enter a zip code.";
var JS_ADDRESS_DOCTOR_MISSING_ERROR = "Please enter an address.";



<!--
//THIS FILE HOLDS THE VARIOUS FORM FIELD VALIDATION
//ALL REQUIRED FIELDS THAT ARE USED ON THE SITE
//ARE INCLUDED IN THIS FILE. EACH FIELD IS CHECKED TO
//SEE IF IT BELONGS ON THE FORM. IF IT IS THEN THE FIELD
//WILL BE CHECKED
//

//Declare variables
blanks = " \t\n\r"; 
phoneNumberDelimiters = "()- ";
invalidChar="`!@#$%^&*||~?<>:;\"{}()[]\\/,";
period =".";
underscore="_";
dash ="-";
empty='';
open_bracket="(";
close_bracket=")";
slash="/";
space=" ";
apostrophe ="'";
intCharSet = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"

function validateForm(theForm){

			//check if the form has an email address field (used in newsletter registration)
			if(theForm.emailaddress){	
			
				if(theForm.emailaddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.emailaddress.focus();
					return false;				
				}else{
					if(!isValidEmail(theForm.emailaddress.value)){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.emailaddress.focus();
						return false;
					}
					theForm.emailaddress.value = trim(theForm.emailaddress.value);
				}
			}			

			//check if the form has a firstname field
			if(theForm.textFirstName){
				if(trim(theForm.textFirstName.value) == ""){
					alert(JS_FIRSTNAME_MISSING_ERROR);
					theForm.textFirstName.focus();
					return false;
				}else{
					if(!isAlphaNumeric(theForm.textFirstName.value)){
						alert(JS_FIRSTNAME_FORMAT_ERROR);
						theForm.textFirstName.focus();
						return false;
					}
				theForm.textFirstName.value = trim(theForm.textFirstName.value);
						
				}
			}
			
			//check if the form has a last name field
			if(theForm.textLastName){
				if(trim(theForm.textLastName.value) == ""){
					alert(JS_LASTNAME_MISSING_ERROR);
					theForm.textLastName.focus();
					return false;
				}else{
					if(!isAlphaNumeric(theForm.textLastName.value)){
						alert(JS_LASTNAME_FORMAT_ERROR);
						theForm.textLastName.focus();
						return false;
					}	
				theForm.textLastName.value = trim(theForm.textLastName.value);
				}
			}
			
			
			//validate the address field
			if(theForm.textAddress){
				if(trim(theForm.textAddress.value) == ""){
					alert(JS_ADDRESS_MISSING_ERROR);
					theForm.textAddress.focus();
					return false;
				}else{
					if(!isValidAddress(theForm.textAddress.value)){
						alert(JS_ADDRESS_FORMAT_ERROR);
						theForm.textAddress.focus();
						return false;
					}
				theForm.textAddress.value = trim(theForm.textAddress.value)
				}
			}
			
			if(theForm.textAptNo){	
				if(trim(theForm.textAptNo.value) != ""){
					if(!isWhateverDoesNotFitInAnother(theForm.textAptNo.value)){
						alert(JS_ADDRESS_FORMAT_ERROR);
						theForm.textAptNo.focus();
						return false;
					}
				theForm.textAptNo.value = trim(theForm.textAptNo.value);
				}
			}
			
			//validate the city field
			if(theForm.textCity){
				if(trim(theForm.textCity.value) == ""){
					alert(JS_CITY_MISSING_ERROR);
					theForm.textCity.focus();
					return false;
				}else{
					if(theForm.textCity.value == "-"){
						alert(JS_CITY_FORMAT_ERROR);
						theForm.textCity.focus();
						return false;
					}else if(!isAlphaNumeric(theForm.textCity.value)){
						alert(JS_CITY_FORMAT_ERROR);
						theForm.textCity.focus();
						return false;
					}
				theForm.textCity.value = trim(theForm.textCity.value);
				}
			}
			
			
			if(theForm.selectState){
				//validate the sate
				if(theForm.selectState.selectedIndex=="0"){
					alert(JS_STATE_MISSING_ERROR);
					theForm.selectState.focus();
					return false;
				}
			}
			
			//validate the zip code
			if(theForm.textZip){
				if(trim(theForm.textZip.value) == ""){
					alert(JS_ZIP_MISSING_ERROR);
					theForm.textZip.focus();
					return false;
				}else {
					if(!isZipCode(theForm.textZip.value)){
						alert(JS_ZIP_FORMAT_ERROR);
						theForm.textZip.focus();
						return false;
					}
				theForm.textZip.value = trim(theForm.textZip.value);
				}	
			}
						
			
			//validate phone number
			if((theForm.textAreaCode) && (theForm.textPhone) && (theForm.textSuffix)){
				var phoneNumber = theForm.textAreaCode.value + "" + theForm.textPhone.value + "" + theForm.textSuffix.value;
				if(theForm.textAreaCode.value.length < 3){
						alert(JS_AREACODE_MISSING_ERROR);
						theForm.textAreaCode.focus();
						return false;				
				}else if(theForm.textPhone.value.length < 3){
					alert(JS_PREFIX_PHONE_MISSING_ERROR);
					theForm.textPhone.focus();
					return false;
				}else if(theForm.textSuffix.value.length < 4){
					alert(JS_SUFFIX_PHONE_MISSING_ERROR);
					theForm.textSuffix.focus();
					return false;
				}else{
					if(!isPhone(phoneNumber)){
						alert(JS_PHONE_FORMAT_ERROR);
						theForm.textAreaCode.focus();
						return false;
					}
				theForm.textAreaCode.value = trim(theForm.textAreaCode.value);
				theForm.textPhone.value = trim(theForm.textPhone.value);
				theForm.textSuffix.value = trim(theForm.textSuffix.value);
				}
			}		
				
			//check if the form has an email address field
			if(theForm.textEmailAddress){	
			
				if(theForm.textEmailAddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.textEmailAddress.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textEmailAddress.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textEmailAddress.focus();
						return false;
					}
					theForm.textEmailAddress.value = trim(theForm.textEmailAddress.value);
				}
			}
			
			
		//check the method comparitor
			if(theForm.checkMethod){
			
				counter = 0
				for(i=0; i<theForm.elements.length; i++){
					if(theForm.elements[i].checked){
						counter += 1;
				}
			}
			if(counter == 0){
				alert(JS_METHOD_MIN_ERROR);
				return false;
			}
			if(counter > 2){
				alert(JS_METHOD_MAX_ERROR);
				return false;
			}
		}

			
			//check if the form has an email address field- for Unity Email
			if(theForm.EmailAddress){	
			
				if(theForm.EmailAddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.EmailAddress.focus();
					return false;				
				}else{
					if(!isValidEmail(theForm.EmailAddress.value)){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.EmailAddress.focus();
						return false;
					}
					theForm.EmailAddress.value = trim(theForm.EmailAddress.value);
				}
			}			
		
				
		//check sending page - friend name		
		if(theForm.textFriendName){
				if(trim(theForm.textFriendName.value) == ""){
					alert(JS_FRIEND_NAME_MISSING_ERROR);
					theForm.textFriendName.focus();
					return false;
				}				
				else{
				if(!isAlphaNumeric(trim(theForm.textFriendName.value))){
					alert(JS_YOUR_NAME_FORMAT_ERROR);
					theForm.textFriendName.focus();
					return false;
				}
				theForm.textFriendName.value = trim(theForm.textFriendName.value);
			}
		}				

			//check sending page - your email
		if(theForm.textFriendEmail){	
			
				if(trim(theForm.textFriendEmail.value) == ""){
					alert(JS_FRIEND_EMAIL_MISSING_ERROR);
					theForm.textFriendEmail.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textFriendEmail.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textFriendEmail.focus();
						return false;
					}
					theForm.textFriendEmail.value = trim(theForm.textFriendEmail.value);
				}
			}
		//check sending page - your name					
		if(theForm.textYourName){
			if(trim(theForm.textYourName.value) == ""){
				alert(JS_YOUR_NAME_MISSING_ERROR);
				theForm.textYourName.focus();
				return false;
				}				
				else{
				if(!isAlphaNumeric(trim(theForm.textYourName.value))){
					alert(JS_YOUR_NAME_FORMAT_ERROR);
					theForm.textYourName.focus();
					return false;
				}
				theForm.textYourName.value = trim(theForm.textYourName.value);
			}
		}		
		
		//check sending page - your email
		if(theForm.textYourEmail){	
			
				if(trim(theForm.textYourEmail.value) == ""){
					alert(JS_YOUR_EMAIL_MISSING_ERROR);
					theForm.textYourEmail.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textYourEmail.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textYourEmail.focus();
						return false;
					}
					theForm.textYourEmail.value = trim(theForm.textYourEmail.value);
				}
			}
		
		if(theForm.textMessage){	
			
				if (!isMessageCommentLengthOK(trim(theForm.textMessage.value),500)){
					alert(JS_COMMENTS_MESSAGE_TOO_LONG);
					theForm.textMessage.focus();
					return false;				
				}
			}
			
		//checks search string input
		if(theForm.qu){
			if(trim(theForm.qu.value)==""){
				alert(JS_SEARCH_MISSING_ERROR);
				theForm.qu.focus();
				return false;
			}else{
				if(!isAlphaNumeric(trim(theForm.qu.value))){
					alert(JS_SEARCH_FORMAT_ERROR);
					theForm.qu.focus();
					return false;
				}
			}
		}
		return true;
}
	
function validateForm_Media(theForm){
			//check if the form has an email address field
			if(theForm.textEmailAddress){	
			
				if(theForm.textEmailAddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.textEmailAddress.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textEmailAddress.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textEmailAddress.focus();
						return false;
					}
					theForm.textEmailAddress.value = trim(theForm.textEmailAddress.value);
				}
			}

			//check if the form has a firstname field
			if(theForm.textFirstName){
				if(trim(theForm.textFirstName.value) != ""){
					if(!isAlphaNumeric(theForm.textFirstName.value)){
						alert(JS_FIRSTNAME_FORMAT_ERROR);
						theForm.textFirstName.focus();
						return false;
					}
				theForm.textFirstName.value = trim(theForm.textFirstName.value);
						
				}
			}
			
			//check if the form has a last name field
			if(theForm.textLastName){
				if(trim(theForm.textLastName.value) != ""){
					if(!isAlphaNumeric(theForm.textLastName.value)){
						alert(JS_LASTNAME_FORMAT_ERROR);
						theForm.textLastName.focus();
						return false;
					}	
				theForm.textLastName.value = trim(theForm.textLastName.value);
				}
			}
			
			//check if the form has a last name field
			if(theForm.textPublication){
				if(trim(theForm.textPublication.value) != ""){
					if(!isAlphaNumeric(theForm.textPublication.value)){
						alert(JS_PUBLICATION_FORMAT_ERROR);
						theForm.textPublication.focus();
						return false;
					}	
				theForm.textPublication.value = trim(theForm.textPublication.value);
				}
			}			
			
			//validate phone number
			if((theForm.textAreaCode) && (theForm.textPhone) && (theForm.textSuffix)){
				var phoneNumber = theForm.textAreaCode.value + "" + theForm.textPhone.value + "" + theForm.textSuffix.value;
				if ((theForm.textAreaCode.value!="") || (theForm.textPhone.value!="") || (theForm.textSuffix.value!="")) {				
					if(theForm.textAreaCode.value.length < 3){
						alert(JS_AREACODE_MISSING_ERROR);
						theForm.textAreaCode.focus();
						return false;				
					}else if(theForm.textPhone.value.length < 3){
						alert(JS_PREFIX_PHONE_MISSING_ERROR);
						theForm.textPhone.focus();
						return false;
					}else if(theForm.textSuffix.value.length < 4){
						alert(JS_SUFFIX_PHONE_MISSING_ERROR);
						theForm.textSuffix.focus();
						return false;
					}else{
						if(!isPhone(phoneNumber)){
							alert(JS_PHONE_FORMAT_ERROR);
							theForm.textAreaCode.focus();
							return false;
						}
					theForm.textAreaCode.value = trim(theForm.textAreaCode.value);
					theForm.textPhone.value = trim(theForm.textPhone.value);
					theForm.textSuffix.value = trim(theForm.textSuffix.value);
					}
				}		
			}			
				
			//validate phone number
			if((theForm.textFaxAreaCode) && (theForm.textFaxPhone) && (theForm.textFaxSuffix)){
				var faxNumber = theForm.textFaxAreaCode.value + "" + theForm.textFaxPhone.value + "" + theForm.textFaxSuffix.value;


				if ((theForm.textFaxAreaCode.value!="") || (theForm.textFaxPhone.value!="") || (theForm.textFaxSuffix.value!="")) {								
					if(theForm.textFaxAreaCode.value.length < 3){
						alert(JS_FAXAREACODE_MISSING_ERROR);
						theForm.textFaxAreaCode.focus();
						return false;				
					}else if(theForm.textFaxPhone.value.length < 3){
						alert(JS_PREFIX_FAX_MISSING_ERROR);
						theForm.textFaxPhone.focus();
						return false;
					}else if(theForm.textFaxSuffix.value.length < 4){
						alert(JS_SUFFIX_FAX_MISSING_ERROR);
						theForm.textFaxSuffix.focus();
						return false;
					}else{
						if(!isPhone(faxNumber)){
							alert(JS_FAX_FORMAT_ERROR);
							theForm.textFaxAreaCode.focus();
							return false;
					}
					theForm.textFaxAreaCode.value = trim(theForm.textFaxAreaCode.value);
					theForm.textFaxPhone.value = trim(theForm.textFaxPhone.value);
					theForm.textFaxSuffix.value = trim(theForm.textFaxSuffix.value);
					}
				}
			}		
										
			
			//validate the address field
			if(theForm.textAddress){
				if(trim(theForm.textAddress.value) != ""){
					if(!isValidAddress(theForm.textAddress.value)){
						alert(JS_ADDRESS_FORMAT_ERROR);
						theForm.textAddress.focus();
						return false;
					}
				theForm.textAddress.value = trim(theForm.textAddress.value)
				}
			}
			
			if(theForm.textAptNo){	
				if(trim(theForm.textAptNo.value) != ""){
					if(!isWhateverDoesNotFitInAnother(theForm.textAptNo.value)){
						alert(JS_ADDRESS_FORMAT_ERROR);
						theForm.textAptNo.focus();
						return false;
					}
				theForm.textAptNo.value = trim(theForm.textAptNo.value);
				}
			}
			
			//validate the city field
			if(theForm.textCity){
				if(trim(theForm.textCity.value) != ""){
					if(theForm.textCity.value == "-"){
						alert(JS_CITY_FORMAT_ERROR);
						theForm.textCity.focus();
						return false;
					}else if(!isAlphaNumeric(theForm.textCity.value)){
						alert(JS_CITY_FORMAT_ERROR);
						theForm.textCity.focus();
						return false;
					}
				theForm.textCity.value = trim(theForm.textCity.value);
				}
			}
			
			
			//if(theForm.selectState){
			//	//validate the sate
			//	if(theForm.selectState.selectedIndex=="0"){
			//		alert(JS_STATE_MISSING_ERROR);
			//		theForm.selectState.focus();
			//		return false;
			//	}
			//}
			
			//validate the zip code
			if(theForm.textZip){
				if(trim(theForm.textZip.value) != ""){
					if(!isZipCode(theForm.textZip.value)){
						alert(JS_ZIP_FORMAT_ERROR);
						theForm.textZip.focus();
						return false;
					}
				theForm.textZip.value = trim(theForm.textZip.value);
				}	
			}
		return true;
}
	
function validateForm_ClubNuvaRegistration(theForm){
		//check sending page - your name					
		if(theForm.textYourName){
			if(trim(theForm.textYourName.value) == ""){
				alert(JS_YOUR_NAME_MISSING_ERROR);
				theForm.textYourName.focus();
				return false;
				}				
				else{
				if(!isAlphaNumeric(trim(theForm.textYourName.value))){
					alert(JS_YOUR_NAME_FORMAT_ERROR);
					theForm.textYourName.focus();
					return false;
				}
				theForm.textYourName.value = trim(theForm.textYourName.value);
			}
		}		


			//check if the form has an email address field
			if(theForm.textEmailAddress){	
			
				if(theForm.textEmailAddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.textEmailAddress.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textEmailAddress.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textEmailAddress.focus();
						return false;
					}
					theForm.textEmailAddress.value = trim(theForm.textEmailAddress.value);
				}
			}
		return true;
}

function validateForm_ClubNuvaEditProfile(theForm){
		//check sending page - your name					
		if(theForm.textYourName){
			if(trim(theForm.textYourName.value) == ""){
				alert(JS_YOUR_NAME_MISSING_ERROR);
				theForm.textYourName.focus();
				return false;
				}				
				else{
				if(!isAlphaNumeric(trim(theForm.textYourName.value))){
					alert(JS_YOUR_NAME_FORMAT_ERROR);
					theForm.textYourName.focus();
					return false;
				}
				theForm.textYourName.value = trim(theForm.textYourName.value);
			}
		}		


			//check if the form has an email address field
			if(theForm.textEmailAddress){	
			
				if(theForm.textEmailAddress.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.textEmailAddress.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textEmailAddress.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textEmailAddress.focus();
						return false;
					}
					theForm.textEmailAddress.value = trim(theForm.textEmailAddress.value);
				}
			}
		return true;
}
	
function validateForm_ClubNuvaLogin(theForm){

			//check if the form has an email address field
			if(theForm.textLoginEmail){	
			
				if(theForm.textLoginEmail.value == ""){
					alert(JS_EMAILADDRESS_MISSING_ERROR);
					theForm.textLoginEmail.focus();
					return false;				
				}else{
					if(!isValidEmail(trim(theForm.textLoginEmail.value))){
						alert(JS_EMAILADDRESS_FORMAT_ERROR);
						theForm.textLoginEmail.focus();
						return false;
					}
					theForm.textLoginEmail.value = trim(theForm.textLoginEmail.value);
				}
			}
		return true;
}	
	
function validateSurveyForm(form)
{
	counter = 0;
	for(i=0; i<form.elements.length; i++)
	{
		if(form.elements[i].checked)
		{
			counter += 1;
		}
	}
	if (counter < 1)
	{
		alert(JS_SURVEY_ANSWER_LEAST_ONE);
		return false;
	}
	return true;
}
	

//Declare variables
blanks = " \t\n\r"; 

// Removes leading blank chars (as defined by blanks) from s

function stripLeadingBlanks(s)
  { 
  var i = 0;
  while ((i < s.length) && (blanks.indexOf(s.charAt(i)) != -1))
     i++;
  return s.substring(i, s.length);
  }


// Removes trailing blank chars (as defined by blanks) from s

function stripTrailingBlanks(s)
  { 
  var i = s.length - 1;
  while ((i >= 0) && (blanks.indexOf(s.charAt(i)) != -1))
     i--;
  return s.substring(0, i+1);
  }


// Removes leading+trailing blank chars (as defined by blanks) from s

function stripLeadingTrailingBlanks(s)
  { 
  s = stripLeadingBlanks(s);
  s = stripTrailingBlanks(s);
  return s;
  }



// This function checks the postive integer entry
function isPositiveInteger(inte2){
	 inte=stripLeadingTrailingBlanks(inte2)
	 ok=true;
	 if (inte.length==0)
	 { ok=false;
	 }
	  for (i=0;i<inte.length;i++ )
	  { 
		   theChar=inte.charAt(i);
		   if ((theChar<"0")||(theChar>"9"))
		   {
			   ok=false;
			   break;
		   } 
		   if (eval(inte)<=0)
		   {
			   ok=false;
			   break;
		   }
	  }
	  return ok;
}


//check if the passed string is vaid email address characters
function isEmailChars(str){
	var theText = /^[\@\.a-z0-9_-]+$/gi;
		var result = str.match(theText);
		if(result != null){
			return true;			
		}else{
			return false;
		}

}

// check if the passed string is vaid email address 
function isValidEmail(strEmail){
   if (trim(strEmail)=='')
	{
	return false;
	}

   if (!isEmailChars(strEmail))
	{  
	return false;
	}
   var emailPattern = /^[a-z0-9]+([_.-][a-z0-9]+)*@[a-z0-9]+([-.][a-z0-9]+)*[.]{1}[a-z]{2,}$/gi;
   var result = strEmail.match(emailPattern);
   if(result != null)
	{
	return true;
	} else 
	{
	return false; 
	}		
}



//This function checks leap year
function isLeapYear(intYear) {
	if (intYear % 100 == 0){
		if (intYear % 400 == 0) {
			return true; 
		}
    }  else {
		if ((intYear % 4) == 0) { 
			return true; 
		}
    } //end if
	return false;
} //end function


//This checks that if valid date range checked
function isValidDate(smonth,sday,syear){
	if ((smonth=='')||(sday=='')||(syear==''))
	{
		return false;
	}
    if (((smonth==4)||(smonth==6)||(smonth==9)||(smonth==11))&&(sday>30)){
	return false;
	}
	
	//check leap year and Feb. entry
	if (smonth==2){
	  if ((isLeapYear(syear))&&(sday>29)){
	    return false;
	   } 
	    if ((!isLeapYear(syear))&&(sday>28)){
	    return false;
	   } 
	}	
   return true;
}

function isDigit(str){
	var theText = /^[0-9]+$/;
		var result = str.match(theText);
		if(result != null){
			//isValid=true;
			return true;
			
		}else{
			return false;
		}
}

//check alpha only
function isAlpha(str){
	var theText = /^[\'\sa-zA-Z_-]+$/;
		var result = str.match(theText);
		if(result != null){
			//isValid=true;
			return true;
			
		}else{
			return false;
		}

}



function isValidAddress(str){

	var theText =  /^([ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿa-zA-Z0-9]+[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ\'\#\,\'\s\.a-zA-Z0-9_-]*)$/;
	var result = str.match(theText);
		if(result != null){
			return true;
			
		}else{
			return false;
		}

}



//check alphanumeric 
function isAlphaNumeric(str){
	var theText = /^([ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿa-zA-Z0-9]+[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ\'\s\.a-zA-Z0-9_-]*)$/;
		var result = str.match(theText);
		if(result != null){
			return true;
			
		}else{
			return false;
		}

}

//check length of a field
function isFieldLengthOK (strField,min, max){
	if ((trim(strField).length<=max) && (trim(strField).length>=min))
	{
		return true;
	} else {
		return false;
	}
}


//check alphanumeric 
function isWhateverDoesNotFitInAnother(str){
	var theText = /^[\'\s\.#a-zA-Z0-9_-]+$/;
		var result = str.match(theText);
		if(result != null){
			//isValid=true;
			return true;
			
		}else{
			return false;
		}

}

//check valid password entry
function isPassword(str){
	var theText = /^[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!@#\$%^&*\(\)a-zA-Z0-9_-]+$/;
		var result = str.match(theText);
		if(result != null){
			
			return true;
			
		}else{
			return false;
		}

}

function isZipCode(str){

	if(str.length == 5){
		var theDigit = /\d{5}/;
	}else if(str.length == 9){
		var theDigit = /\d{9}/;
	}else if(str.length == 10){
		var theDigit = /\d{5}-\d{4}/;
	}else{
		return false
	}
		var result = str.match(theDigit);
		if(result != null){
			//isValid=true;
			return true;
			
		}else{
			return false;
		}
}

function isPhone(str){
	if(str.length == 10){
		var theFormat = /\d{10}/;
		var result = str.match(theFormat);
		if(result != null){
			return true;
		}else{
			return false;
		}
	}
}

// This function check if the string is a valid search input
function isValidInternationlSearch(strName){
	strName=stripLeadingTrailingBlanks(strName);
	if ((strName==empty)||(strName==dash)||(strName==underscore)||(strName==apostrophe))
	{
		return false;
	} else {
		for (i=0;i<strName.length;i++ )
		{ 
			badChar=strName.charAt(i);
			invalidChar2=invalidChar+period;
			if (invalidChar2.indexOf(badChar)!=-1)
			{
            return false;
			break;
			}
		}
		return true;
	}
}

// This function check the comments/message length
function isMessageCommentLengthOK(strComment,len){
	if ((trim(strComment)).length>len){
		return false;
	}
	return true;
}


function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also
   // removes consetrimive spaces and replaces it with one space.
   
   var returnValues = inputString;
   var ch = returnValues.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      returnValues = returnValues.substring(1, returnValues.length);
      ch = returnValues.substring(0, 1);
   }
   ch = returnValues.substring(returnValues.length-1, returnValues.length);
   while (ch == " ") { // Check for spaces at the end of the string
      returnValues = returnValues.substring(0, returnValues.length-1);
      ch = returnValues.substring(returnValues.length-1, returnValues.length);
   }
   while (returnValues.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      returnValues = returnValues.substring(0, returnValues.indexOf("  ")) + returnValues.substring(returnValues.indexOf("  ")+1, returnValues.length); // Again, there are two spaces in each of the strings
   		
   }
   
   
   return returnValues; // Return the trimmed string back to the user
} // Ends the "trim" function



//print from javascript
function printWindow(){
	if (window.print){
		window.print()		
	}else{
		alert("You will need to use File->Print from the menu bar.")
	}
}


// cbeck contact us form entry
function checkContactUsFormEntry(form){
	if (trim(form.textFirstName.value)=='')
	{	
		alert (JS_FIRSTNAME_MISSING_ERROR);
		form.textFirstName.focus();
		return false;
	}
	if (trim(form.textLastName.value)=='')
	{	
		alert (JS_LASTNAME_MISSING_ERROR);
		form.textLastName.focus();
		return false;
	}	
	
	if (trim(form.textEmail.value)=='')
	{
		alert (JS_EMAILADDRESS_MISSING_ERROR);
		form.textEmail.focus();
		return false;
	}
	
	if (!isValidEmail(form.textEmail.value))
	{
		alert (JS_EMAILADDRESS_FORMAT_ERROR);
		form.textEmail.focus();
		return false;
	}
	if (trim(form.textareaMessage.value)=='')
	{	
		alert (JS_SMS_CONTACT_US_MESSAGE_MISSING);
		form.textareaMessage.focus();
		return false;
	}else if (!isMessageCommentLengthOK(form.textareaMessage.value,500)){
		alert (JS_COMMENTS_MESSAGE_TOO_LONG);
		form.textareaMessage.focus();
		return false;
	}

}

// Function for segment navigation
function changeUrl(url){

	window.location.href=url;
}


// Start code for sendToFriend
function sendToFriend(objLink) {
	// get the url of the document being sent
	var strCurrentUrl = escape ( parent.document.URL ) ;
	// get the page <title> of the document being sent
	var strPageTitle = escape( parent.document.title );

	var strURLParams = '?pageToSend=' + strCurrentUrl + '&pageTitle=' + strPageTitle + '&mode=submitted'
	var strURL = objLink.href + strURLParams
	var strWindowProperties = 'width=392,height=460,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=0,left=0'
	
	// open the window
	openWindow(strURL ,'send_to_a_friend', strWindowProperties);
	
	// prevent any further code from executing
	return false;
}

// End code for sendToFriend

var popupWin;
function openWindow(URL, Name, Args) {
	popupWin = window.open(URL, Name, Args) ;
	popupWin.focus() ;
}

//This function will apply a background color 
//of white to two selected elements.
//The elements must be called by id.
//This will work in IE 4+ and Netscape 6, not in Netscape 4.

function changeBgColor(elem1ID,elem2ID) {

if (document.all) {
	docObj = 'document.all.';
	styleObj = '.style';
	obj1 = eval(docObj + elem1ID + styleObj);
	obj2 = eval(docObj + elem2ID + styleObj);
	
	obj1.backgroundColor = '#fff370';
	obj2.backgroundColor = '#fff370';
	}
	
else if (document.getElementById) {
	docObj = 'document.getElementById';
	styleObj = '.style';
	obj1 = eval(docObj + "('" + elem1ID + "')" + styleObj);
	obj2 = eval(docObj + "('" + elem2ID + "')" + styleObj);
	
	obj1.backgroundColor = '#fff370';
	obj2.backgroundColor = '#fff370';
	}
	
}

//This function will remove the background color 
//from two selected elements. Called restore because 
//it's being used to reverse the previous function.

function restoreBgColor(elem1ID,elem2ID) {

var strBackgroundColor = '#ffffff';

if (window.location.href.indexOf('/antagonBasics/') != -1) {
	strBackgroundColor = '#ffffff';
}

if (document.all) {
	docObj = 'document.all.';
	styleObj = '.style';
	obj1 = eval(docObj + elem1ID + styleObj);
	obj2 = eval(docObj + elem2ID + styleObj);
	
	obj1.backgroundColor = strBackgroundColor;
	obj2.backgroundColor = strBackgroundColor;
	}
	
else if (document.getElementById) {
	docObj = 'document.getElementById';
	styleObj = '.style';
	obj1 = eval(docObj + "('" + elem1ID + "')" + styleObj);
	obj2 = eval(docObj + "('" + elem2ID + "')" + styleObj);
	
	obj1.backgroundColor = strBackgroundColor;
	obj2.backgroundColor = strBackgroundColor;
	}
	
}

//This function will remove the background color 
//from two selected elements. Called restore because 
//it's being used to reverse the previous function.

function restoreBgColorSub(elem1ID,elem2ID) {

var strBackgroundColor = '#ffffff';

if (document.all) {
	docObj = 'document.all.';
	styleObj = '.style';
	obj1 = eval(docObj + elem1ID + styleObj);
	obj2 = eval(docObj + elem2ID + styleObj);
	
	obj1.backgroundColor = strBackgroundColor;
	obj2.backgroundColor = strBackgroundColor;
	}
	
else if (document.getElementById) {
	docObj = 'document.getElementById';
	styleObj = '.style';
	obj1 = eval(docObj + "('" + elem1ID + "')" + styleObj);
	obj2 = eval(docObj + "('" + elem2ID + "')" + styleObj);
	
	obj1.backgroundColor = strBackgroundColor;
	obj2.backgroundColor = strBackgroundColor;
	}
	
}

//This changes a single element

function changeBgColorS(elem1ID) {

if (document.all) {
	docObj = 'document.all.';
	styleObj = '.style';
	obj1 = eval(docObj + elem1ID + styleObj);
	
	obj1.backgroundColor = '#fff370';
	}
	
else if (document.getElementById) {
	docObj = 'document.getElementById';
	styleObj = '.style';
	obj1 = eval(docObj + "('" + elem1ID + "')" + styleObj);
	
	obj1.backgroundColor = '#fff370';
	}
	
}

//Single Element

function restoreBgColorS(elem1ID) {

if (document.all) {
	docObj = 'document.all.';
	styleObj = '.style';
	obj1 = eval(docObj + elem1ID + styleObj);
	
	obj1.backgroundColor = '#ffffff';
	}
	
else if (document.getElementById) {
	docObj = 'document.getElementById';
	styleObj = '.style';
	obj1 = eval(docObj + "('" + elem1ID + "')" + styleObj);
	
	obj1.backgroundColor = '#ffffff';
	}
}

// Start code for printQuestion
function printQuestion(form) 
{
	var strURL = "printQuestion.asp?num=" + form.num.value + "&";
	if (form.source.value != "")
	{
		strURL = strURL + "source=" + form.source.value + "&";
	}
	
	var strURLParams = "";
	var strWindowProperties = "";
	
	for (i=0; i<form.num.value; i++) 
	{
		if (form.elements[i].checked)
		{
			strURLParams = strURLParams + "ques" + i + "=" + form.elements[i].value + "&";
		}
	}
	
	if(strURLParams.length == 0)
	{
		alert(JS_CHECKANSER_ERROR);
	}
	else
	{
		strURL = strURL + strURLParams;
		strWindowProperties = "width=409,height=460,scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=yes,resizable=yes,top=0,left=0";
	
		// open the window
		openWindow(strURL ,'printQuestions', strWindowProperties);
	}
	return false;
}

// Start code for sendToFriend
function sendToFriend_onPage(form) {
	// get the url of the document being sent

	var strCurrentUrl = escape ( parent.document.URL ) ;
	var strSendUrl = "/Consumer/global/SendPageConfirmation.asp";
	var strURLParams = '?pageToSend=' + strCurrentUrl + '&textFriendEmail=' + form.textFriendEmail.value + '&textYourEmail=' + form.textYourEmail.value + '&mode=submitted';
	var strURL = strSendUrl + strURLParams;
	var strWindowProperties = 'width=409,height=460,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=0,left=0';
	//alert(strURL);
	
	// open the window
	openWindow(strURL ,'send_to_a_friend', strWindowProperties);
	
	// prevent any further code from executing
	return true;
}
// End code for sendToFriend

function sendCheck(form)
{
	if (validateForm(form))
	{ 
		return sendToFriend_onPage(form);
	}
	return false;
}

function popSurvey()
{
	return false;
}

function backtoparent(strURL)
{
	if (!document.all || navigator.platform == "MacPPC")
	{
		if (document.all)
		{
			window.open(strURL, '_blank','toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=,height=,top=0,left=0')
		}
		else
		{
			window.open(strURL);
		}
	}
	else
	{
		if (window.opener.closed)
		{
			window.open(strURL);
		}
		else
		{
			window.opener.location.href = strURL;
		}
	}
	
	self.close();
}

function printPage(){
	if (window.print){
		window.print()
		
	}else{
		alert("You will need to use File->Print from the menu bar.")
	}
	}

function print_it()
{
	if (window.print)
	    	window.print();
	else
		alert(JS_PAGE_PRINT_MESSAGE);
}

function openflash(strURL)
{
	var strWindowProperties = "width=380,height=240,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=0,left=0";
	openWindow(strURL, 'flash', strWindowProperties);
}

function longmessage_confirm(strLongMessage,strURL)
{
	var blnConfirmed;
	var w = 480, h = 340;
	var popW = 480, popH = 340;
	//var strWindowProperties = "width=380,height=240,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=0,left=0";
	var strWindowProperties = "";
	var leftPos = 0, topPos=0;

	//if (document.all || document.layers) {
   //	w = screen.availWidth;
	// h = screen.availHeight;
	//}

	if (document.all) {
   	/* the following is only available after onLoad */
		w = document.body.clientWidth;
   	h = document.body.clientHeight;
   	leftPos = window.screenLeft;
   	topPos = window.screenTop;
	}
	else if (document.layers) {
   	w = window.outerWidth;
	   h = window.outerHeight;
	   leftPos = window.screenX;
	   topPos = window.screenY;
	}
	popW=w;
	popH=h;
	//leftPos = (w-popW)/2, topPos = (h-popH)/2;

	//strWindowProperties = "width=" + popW + ",height=" + popH + ",scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes,top=" + topPos + ",left=" + leftPos
	strWindowProperties = "scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes,top=0,left=0";
	
	blnConfirmed = window.confirm(strLongMessage);
	if (blnConfirmed) {
		GATag(strURL);
		openWindow(strURL, 'international_sites', strWindowProperties);
		//return true;
	}
	//else {
	//	return false;
	//}	
}

function opensizedwindow(strURL,iWidth,iHeight)
{
	var w=600,h=480;
	var popW,popH,leftPos,topPos;
	popW = iWidth;
	popH=iHeight;
	
	if (document.all || document.layers) {
   	w = screen.availWidth;
		h = screen.availHeight;
	}	
	leftPos = (w-popW)/2;
	topPos = (h-popH)/2;
	
	//var strWindowProperties = "width=" + popW + ",height=" + popH + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=" + topPos + ",left=" + leftPos;
	var strWindowProperties = "width=" + popW + ",height=" + popH + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=0,left=0";
	openWindow(strURL, '_blank', strWindowProperties);
}

function setFriendEmail(sendForm){
	if (sendForm.value == 'friend\'s e-mail'){
		sendForm.value = '';
	}
}

function restoreFriendEmail(sendForm){
	if (sendForm.value == ''){
		sendForm.value = 'friend\'s e-mail';
	}
}
	
function setEmail(sendForm){	
	if (sendForm.value == 'your e-mail'){
		sendForm.value = '';
	}
}

function restoreEmail(sendForm){	
	if (sendForm.value == ''){
		sendForm.value = 'your e-mail';
	}
}

function homeRolloverCTA(thisID, newClass){
	document.getElementById(thisID).setAttribute("class", newClass);
	document.getElementById(thisID).setAttribute("className", newClass);
}
	
function homeRolloffCTA(thisID, newClass){
	document.getElementById(thisID).setAttribute("class", newClass);
	document.getElementById(thisID).setAttribute("className", newClass);
}
//-->


