<!--
// set expiration date
function fix_mac_date(date) {
	var base = new Date(0);
	var skew = base.getTime(); // dawn of (Unix) time - should be 0
	if (skew > 0)  // Except on the Mac - ahead of its time
		date.setTime (date.getTime() - skew);
}
function set_cookie_date(no_days){
	var c_date = new Date ();
	fix_mac_date (c_date); // Correct for Mac date bug - call only once for given Date object!
	c_date.setTime (c_date.getTime() + (no_days*24 * 60 * 60 * 1000));
	return c_date.toGMTString();  
}
// default expiration date for all cookies
c_days		= 7
c_expdate	= set_cookie_date(c_days)
c_today		= set_cookie_date(1)

// to use:	create_cookie("example",12) for temp cookie - 1st 2 args are required, rest are optional in order
//	or, create_cookie("example",12,c_expdate) for cookie expires 7 days from now
//	or, create_cookie("example",12,c_expdate,"/docfolder",null,true)
function create_cookie (name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires	: "") +
	((path) ? "; path=" + path		: ";path=/") +
	((domain) ? "; domain=" + domain	: "") +
	((secure) ? "; secure"			: "");
}
// to use: delete_cookie("example") - others are optional
function delete_cookie (c_name,path,domain) {
	if (read_cookie(c_name)) {
		document.cookie = c_name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		 "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
function read_cookie(c_name){
	if (document.cookie.length>0)  {
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1)    { 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1)
				c_end=document.cookie.length
				return unescape(document.cookie.substring(c_start,c_end))
		} 
  	}
	return null
}
function check_refer_cookie(){
	if (read_cookie('refer_start')==null){
		create_cookie('refer_start',c_today,c_expdate)
		create_cookie('refer_url',document.referrer,c_expdate)
		create_cookie('refer_entrypage',document.location.toString(),c_expdate)
	}
	var id_ad=js_get_querystring('ad')
	if (id_ad!=null){
		create_cookie('id_ad',id_ad,c_expdate)
	}
}

var submitcount=0;


function CheckForm( theform )
{
	var bMissingFields = false;
	var strFields = "";
	if( theform.contact_name.value == '' ){
		bMissingFields = true;	strFields += "     Contact Name\n";}
	if( theform.email.value == '' ){
		bMissingFields = true;	strFields += "     Email\n";}
	if( theform.coverage_date_effective.value == '' ){
		bMissingFields = true;	strFields += "     Effective Coverage Date\n";}
	if( theform.policyholder_name.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder Name\n";}
	if( theform.policyholder_organization_type.selectedIndex == 0 ){
		bMissingFields = true;	strFields += "     Policyholder Organization Type\n";}
	if( theform.policyholder_address.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder Address\n";}
	if( theform.policyholder_city.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder City\n";}
	if( theform.policyholder_state.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder State\n";}
	if( bMissingFields ) {
		alert( "I'm sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	else {
		if (submitcount == 0){
			submitcount++;

			theform.z_refer_url.value		= read_cookie('refer_url');
			theform.z_refer_entrypage.value	= read_cookie('refer_entrypage');
			theform.z_refer_start.value		= read_cookie('refer_start');
			theform.z_id_ad.value		= read_cookie('id_ad');
			theform.subject.value		= theform.subject.value+
							"-"+theform.policyholder_state.value+
							"-"+theform.coverage_date_effective.value+
							"-"+theform.contact_name.value;
			return true;
		}
		else{
			alert("This form has already been submitted.  Thanks!");
			return false;
      		}
   	}
}

function CheckFormEvents( theform )
{
	var bMissingFields = false;
	var strFields = "";
	if( theform.contact_name.value == '' ){
		bMissingFields = true;	strFields += "     Contact Name\n";}
	if( theform.email.value == '' ){
		bMissingFields = true;	strFields += "     Email\n";}
	if( theform.policyholder_name.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder Name\n";}
	if( theform.policyholder_organization_type.selectedIndex == 0 ){
		bMissingFields = true;	strFields += "     Policyholder Organization Type\n";}
	if( theform.policyholder_address.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder Address\n";}
	if( theform.policyholder_city.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder City\n";}
	if( theform.policyholder_state.value == '' ){
		bMissingFields = true;	strFields += "     Policyholder State\n";}
	if( theform.ops_event_basic_name.value == '' ){
		bMissingFields = true;	strFields += "     Name of Event\n";}
	if( theform.ops_event_basic_description.value == '' ){
		bMissingFields = true;	strFields += "     Description of Event\n";}
	if (( theform.ops_event_lighting_temporary_lighting_involved[0].checked == false )
	  &&( theform.ops_event_lighting_temporary_lighting_involved[1].checked == false )){
		bMissingFields = true;	strFields += "     Is Temporary Lighting Involved\n";}
	if (( theform.ops_event_tent_involved[0].checked == false )
	  &&( theform.ops_event_tent_involved[1].checked == false )){
		bMissingFields = true;	strFields += "     Is a Tent Involved\n";}
	if (( theform.ops_event_ushers_used[0].checked == false )
	  &&( theform.ops_event_ushers_used[1].checked == false )){
		bMissingFields = true;	strFields += "     Are Ushers Used\n";}
	if (( theform.ops_event_fooddrink_liquor_sold[0].checked == false )
	  &&( theform.ops_event_fooddrink_liquor_sold[1].checked == false )){
		bMissingFields = true;	strFields += "     Is Liquor Sold at the Event\n";}
	if (( theform.ops_event_fireworks_exist[0].checked == false )
	  &&( theform.ops_event_fireworks_exist[1].checked == false )){
		bMissingFields = true;	strFields += "     Are Fireworks Used\n";}
	if (( theform.ops_event_parade_involved[0].checked == false )
	  &&( theform.ops_event_parade_involved[1].checked == false )){
		bMissingFields = true;	strFields += "     Is a Parade Involved\n";}
	if (( theform.ops_event_overnight_accommodations_provided[0].checked == false )
	  &&( theform.ops_event_overnight_accommodations_provided[1].checked == false )){
		bMissingFields = true;	strFields += "     Are there Overnight Accommodations\n";}
	if (( theform.ops_event_experience_event_held_before[0].checked == false )
	  &&( theform.ops_event_experience_event_held_before[1].checked == false )){
		bMissingFields = true;	strFields += "     Has this Event been held before\n";}

	if( bMissingFields ) {
		alert( "I'm sorry, but you must provide the following field(s) before continuing:\n" + strFields );
		return false;
	}
	else {
		if (submitcount == 0){
			submitcount++;

			theform.z_refer_url.value		= read_cookie('refer_url');
			theform.z_refer_entrypage.value	= read_cookie('refer_entrypage');
			theform.z_refer_start.value		= read_cookie('refer_start');
			theform.z_id_ad.value		= read_cookie('id_ad');
			theform.subject.value		= theform.subject.value+
							"-"+theform.policyholder_state.value+
							"-"+theform.coverage_date_effective.value+
							"-"+theform.contact_name.value;
			return true;
		}
		else{
			alert("This form has already been submitted.  Thanks!");
			return false;
      		}
   	}
}

// Overture Services Inc. 07/15/2003
var cc_tagVersion = "1.0";
var cc_accountID = "2370946120";
var cc_marketID =  "0";
var cc_protocol="http";
var cc_subdomain = "convctr";
if(location.protocol == "https:")
{
    cc_protocol="https";
     cc_subdomain="convctrs";
}
var cc_queryStr = "?" + "ver=" + cc_tagVersion + "&aID=" + cc_accountID +
"&mkt=" + cc_marketID +"&ref=" + escape(document.referrer);
var cc_imageUrl = cc_protocol + "://" + cc_subdomain +
".overture.com/images/cc/cc.gif" + cc_queryStr;
var cc_imageObject = new Image();
cc_imageObject.src = cc_imageUrl;
// Overture END

function js_get_querystring(qs_variable) {
	var query	= window.location.search.substring(1);
 	var vars	= query.split("&");
 	for (var i=0;i<vars.length;i++) {
		var pair	= vars[i].split("=");
		if (pair[0] == qs_variable) {return pair[1];}
  	} 
	return null;
}

// -->

