	// ***********************************************************************************************************************************
	// Form Validation Functions *********************************************************************************************************
	function valuevalidation(entered, min, max, alertbox, datatype) {
		checkvalue = parseFloat(entered.value);
		if (datatype) {
			smalldatatype = datatype.toLowerCase();
			if (smalldatatype.charAt(0) == "i") { checkvalue = parseInt(entered.value) };
		}
		if ((parseFloat(min) == min && checkvalue < min) || (parseFloat(max) == max && checkvalue > max) || entered.value != checkvalue) {
			if (alertbox != "") { alert(alertbox); } return false;
		} else {
			return true;
		}
	} 
	
	function selectvalidation(entered, alertbox) {
		if (entered.selectedIndex == 0) {
			if (alertbox != "") { alert(alertbox); } return false;
		} else {
			return true;
		}
	} 
	
	function checkedvalidation(entered, alertbox) {
	  myOption = -1;
	  for (i=0; i<entered.length; i++) {
	    if (entered[i].checked) {
	      myOption = i;
	    }
	  }
	  if (myOption == -1) {
	   	if (alertbox != "") { alert(alertbox); }
	   	return false;
	  } else {
			return true;
		}
	}
	
	function checkDate(myDayStr, myMonthStr, myYearStr) {
	 
		var myDateStr = myMonthStr.value + '/' +  myDayStr.value + '/' + myYearStr.value;
		var testDateStr = myMonthStr.value + '/1/' + myYearStr.value;
		var myDate = new Date( myDateStr );
		var testDate = new Date( testDateStr );
		var myDate_string = myDate.toGMTString();
		var testDate_string = testDate.toGMTString();
		
		/* Split the string at every space and put the values into an array so,
		using the previous example, the first element in the array is "Wed", the
		second element is "Jan", the third element is "1", etc. */
		var myDate_array = myDate_string.split( ' ' );
		var testDate_array = testDate_string.split( ' ' );
		
		/* If we entered "Feb 31, 1975" in the form, the "new Date()" function
		converts the value to "Mar 3, 1975". Therefore, we compare the month
		in the array with the month we entered into the form. If they match,
		then the date is valid, otherwise, the date is NOT valid. */
		if ( myDate_array[2] != testDate_array[2] ) {
		  alert( 'Please enter a valid date.' );
			return false;
		} else {
		  return true;
		}
	 
	} 
	

   var reEmail = /^.+\@.+\..+$/
   var reEmpty = /^\s+$/
   var errMsg = ""
   
	function formvalidation(thisform) {
		with (thisform) {
			if (selectvalidation(Gender,"Please select a Gender.") == false) { Gender.focus(); return false; }
			if (selectvalidation(Month,"Please select a birth Month.") == false) { Month.focus(); return false; }
			if (selectvalidation(Day,"Please select a birth Day.") == false) { Day.focus(); return false; }
			if (selectvalidation(Year,"Please select a birth Year.") == false) { Year.focus(); return false; }
			//if (checkDate(Day, Month, Year) == false) { Month.focus(); return false; }
			if (selectvalidation(State,"Please select a state.") == false) { State.focus(); return false; }
			if (!checkedvalidation(Tobacco,"Please answer the question regarding tobacco use.")) { return false; }
         
         var vEmail  = document.frmQuote.Email.value
         if (reEmpty.test(vEmail) || vEmail == "")
         {
            alert("Please enter an email address\n")
            return false;
         } else {
            if (!reEmail.test(vEmail)) 
            {
               alert( "Invalid Email.\nYou must enter the email address in the proper email address format with the \“@\” symbol \n and a dot before the domain extension such as johndoe@johndoewebsite.com \n")
               return false
            }
         }
		}
	} 

	// ***********************************************************************************************************************************
	// Pop Up Window Script **************************************************************************************************************
	var showWindow = null; 
	var windowWidth = 675;
	var windowHeight = 540;
	var totalWidth = screen.availWidth;
	var totalHeight = screen.availHeight;
	function winOpenNew(URL) {
	  showWindow = window.open(URL,'winProc','width=' + windowWidth + ',height=' + windowHeight + ',left=' + ((totalWidth - windowWidth - 10) * .5) + ',top=' + ((totalHeight - windowHeight - 30) * .5) + ',toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,');
	}

	// ***********************************************************************************************************************************
	// Verisign Seal Popup ***************************************************************************************************************
	function vs_popUp(url) {
		sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=720,height=450');
		self.name = "mainWin";
	}
	
   function Rcertify() 
   {
      popupWin = window.open('http://www.bbbonline.org/cks.asp?id=104021314234139766', 'Participant','location=yes,scrollbars=yes,width=450,height=300'); 
      window.name = 'opener';
   } 

	// ***********************************************************************************************************************************
	// Exit Popup Functions **************************************************************************************************************
	var exit=true;
	//Pop-under only once per browser session? (0=no, 1=yes)
	var once_per_session=1

	function exitWindow(){
		if ('yes' != '<%=Request.Cookies("popunder")%>'){
			loadpopunder()
		}
	}
	function loadpopunder(){
		var URL = 'exit.html';
		if (exit) {
			document.cookie="popunder=yes"
			win2=window.open(URL,'winProc','width=' + windowWidth + ',height=580,left=' + ((totalWidth - windowWidth - 10) * .5) + ',top=' + ((totalHeight - windowHeight - 30) * .5) + ',toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,');
			win2.blur()
			window.focus()
		}
	}
	
	function go_redirect(url) {
		exit = false;
		location.href = url;
	}	

function submitenter(myfield,e)
	{
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;

		if (keycode == 13)
		   {
		   return formvalidation(document.frmQuote);
		   return false;
		   }
		else
		   return true;
	}
	// ***********************************************************************************************************************************
	// ***********************************************************************************************************************************
	
