// Valid canadian postal code
var pcodeexp = /^[g,h,j,k,l,m,n,p,t,v][0-9][a-z][0-9][a-z][0-9]$/i ;
var iens6 = document.all || document.getElementById ? true : false;
var ns4 = document.layers ? true : false;
var preloadFlag = false;
function preloadImages()
{
if (document.images)
{
	pre_btn_order_on = newImage('../images/btn_order-on.gif');
	pre_btn_ctgiftcards_on = newImage('../images/btn_ctgiftcards-on.gif');
	pre_btn_enter_on = newImage('../images/btn_enter-on.gif');
	preloadFlag = true;
}
}
// Code for the popup windows
var popup;
function launchwindow(winURL,winName,w,h,winSpecs)
{
popup = window.open(winURL,winName,
		"Width=" + w + ",Height=" + h + "," + winSpecs);
popup.focus();
}
function BNB_mouseon(n)
	{
	if(browsok)
		{
		imageON = eval(n + "1.src");
		document [n].src = imageON;
		}
	}

function BNB_mouseoff(n)
	{
	if(browsok)
		{
		imageOFF = eval(n + "0.src");
		document [n].src = imageOFF;
		}
	}

//Place focus on the first form element
function placeFocus()
{
	if (document.forms.length > 0)
	{
		var field = document.forms[0];
		for (i = 0; i < field.length; i++)
		{
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
			document.forms[0].elements[i].focus();
			break;
         }
      }
   }
}
function Subscriber_onsubmit() 
{
 	//Verify the form fields
	if ( document.OnCall.FName.value == "")
	{
		window.alert("Please enter your first name.");
		document.OnCall.FName.focus();
		return false;
	}
	if ( document.OnCall.LName.value == "")
	{
		window.alert("Please enter your last name.");
		document.OnCall.LName.focus();
		return false;
	}
	if ( document.OnCall.Address.value == "")
	{
		window.alert("Please enter your address.");
		document.OnCall.Address.focus();
		return false;
	}
	if ( document.OnCall.City.value == "" )
	{
		window.alert("Please enter your city.");
		document.OnCall.City.focus();
		return false;
	}
	if ( document.OnCall.Province.selectedIndex == 0 )
	{
		window.alert("Please select your province.");
		document.OnCall.Province.focus();
		return false;
	}
	if ( document.OnCall.PostalCode.value == "" )
	{
		window.alert("Please enter a valid Postal Code.");
		document.OnCall.PostalCode.focus();
		return false;
	}
	if ( document.OnCall.Email.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.OnCall.Email.focus();
		return false;
	}
	var atsymbol = parseInt(document.OnCall.Email.value.indexOf("@"));
	var periodchar = parseInt(document.OnCall.Email.value.indexOf("."));
	var courriel_len = parseInt(document.OnCall.Email.value.length);
	if (document.OnCall.Email.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.OnCall.Email.focus();
			return (false);
		}
	}
	if ( document.OnCall.Email2.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.OnCall.Email2.focus();
		return false;
	}
	var atsymbol = parseInt(document.OnCall.Email2.value.indexOf("@"));
	var periodchar = parseInt(document.OnCall.Email2.value.indexOf("."));
	var courriel_len = parseInt(document.OnCall.Email2.value.length);
	if (document.OnCall.Email2.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.OnCall.Email2.focus();
			return (false);
		}
	}
	if ( document.OnCall.Email.value != document.OnCall.Email2.value )
	{
		window.alert("The email addresses entered do not match.");
		document.OnCall.Email2.focus();
		return false;
	}
}
function Donate_onsubmit() 
{
 	//Verify the form fields
	if ( document.Donate.FName.value == "")
	{
		window.alert("Please enter your first name.");
		document.Donate.FName.focus();
		return false;
	}
	if ( document.Donate.LName.value == "")
	{
		window.alert("Please enter your last name.");
		document.Donate.LName.focus();
		return false;
	}
	if ( document.Donate.Address.value == "")
	{
		window.alert("Please enter your address.");
		document.Donate.Address.focus();
		return false;
	}
	if ( document.Donate.City.value == "" )
	{
		window.alert("Please enter your city.");
		document.Donate.City.focus();
		return false;
	}
	if ( document.Donate.Province.selectedIndex == 0 )
	{
		window.alert("Please select your province.");
		document.Donate.Province.focus();
		return false;
	}
	if ( document.Donate.PostalCode.value == "" )
	{
		window.alert("Please enter a valid Postal Code.");
		document.Donate.PostalCode.focus();
		return false;
	}
	if ( document.Donate.HomeAreaCode.value == "" )
	{
		window.alert("Please enter your home phone number.");
		document.Donate.HomeAreaCode.focus();
		return false;
	}
	if ( document.Donate.HomePhone1.value == "" )
	{
		window.alert("Please enter your home phone number.");
		document.Donate.HomePhone1.focus();
		return false;
	}
	if ( document.Donate.HomePhone2.value == "" )
	{
		window.alert("Please enter your home phone number.");
		document.Donate.HomePhone2.focus();
		return false;
	}
	if ( document.Donate.Email.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.Donate.Email.focus();
		return false;
	}
	var atsymbol = parseInt(document.Donate.Email.value.indexOf("@"));
	var periodchar = parseInt(document.Donate.Email.value.indexOf("."));
	var courriel_len = parseInt(document.Donate.Email.value.length);
	if (document.Donate.Email.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.Donate.Email.focus();
			return (false);
		}
	}
	if ( document.Donate.DonationType.selectedIndex == 0 )
	{
		window.alert("What type of donation are you making?");
		document.Donate.DonationType.focus();
		return false;
	}	
	if ( document.Donate.DonationAmt.value == "" )
	{
		window.alert("Please enter the amount of your donation.");
		document.Donate.DonationAmt.focus();
		return false;
	}
	if ( document.Donate.cardholdername.value == "" )
	{
		window.alert("Please enter your name as it appears on the credit card.");
		document.Donate.cardholdername.focus();
		return false;
	}	
	if ( document.Donate.cardnumber.value == "" )
	{
		window.alert("Please enter a valid credit card number.");
		document.Donate.cardnumber.focus();
		return false;
	}	
	if ( document.Donate.expirydatemonth.selectedIndex == 0 )
	{
		window.alert("Please select the expiry month for your credit card.");
		document.Donate.expirydatemonth.focus();
		return false;
	}	
	if ( document.Donate.expirydateyear.selectedIndex == 0 )
	{
		window.alert("Please select the expiry year for your credit card.");
		document.Donate.expirydateyear.focus();
		return false;
	}	
    msg = "Are you sure you want to donate $" + document.Donate.DonationAmt.value + ".00?\n\n If this is correct donation amount, click 'OK'. Otherwise, click 'CANCEL'."
    return confirm(msg);
}
//Register for education events
function RegisterEducation_onsubmit() 
{
 	//Verify the form fields
	if ( document.Purchase.FName.value == "")
	{
		window.alert("Please enter your first name.");
		document.Purchase.FName.focus();
		return false;
	}
	if ( document.Purchase.LName.value == "")
	{
		window.alert("Please enter your last name.");
		document.Purchase.LName.focus();
		return false;
	}
	if ( document.Purchase.Address.value == "")
	{
		window.alert("Please enter your address.");
		document.Purchase.Address.focus();
		return false;
	}
	if ( document.Purchase.City.value == "" )
	{
		window.alert("Please enter your city.");
		document.Purchase.City.focus();
		return false;
	}
	if ( document.Purchase.Province.selectedIndex == 0 )
	{
		window.alert("Please select your province.");
		document.Purchase.Province.focus();
		return false;
	}
	if ( document.Purchase.PostalCode.value == "" )
	{
		window.alert("Please enter a valid Postal Code.");
		document.Purchase.PostalCode.focus();
		return false;
	}
	if ( document.Purchase.HomePhone.value == "" )
	{
		window.alert("Please enter your home phone number.");
		document.Purchase.HomePhone.focus();
		return false;
	}
	if ( document.Purchase.Email.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.Purchase.Email.focus();
		return false;
	}
	var atsymbol = parseInt(document.Purchase.Email.value.indexOf("@"));
	var periodchar = parseInt(document.Purchase.Email.value.indexOf("."));
	var courriel_len = parseInt(document.Purchase.Email.value.length);
	if (document.Purchase.Email.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.Purchase.Email.focus();
			return (false);
		}
	}
}
function Purchase_onsubmit() 
{
 	//Verify the form fields
	if ( document.Purchase.FName.value == "")
	{
		window.alert("Please enter your first name.");
		document.Purchase.FName.focus();
		return false;
	}
	if ( document.Purchase.LName.value == "")
	{
		window.alert("Please enter your last name.");
		document.Purchase.LName.focus();
		return false;
	}
	if ( document.Purchase.Address.value == "")
	{
		window.alert("Please enter your address.");
		document.Purchase.Address.focus();
		return false;
	}
	if ( document.Purchase.City.value == "" )
	{
		window.alert("Please enter your city.");
		document.Purchase.City.focus();
		return false;
	}
	if ( document.Purchase.Province.selectedIndex == 0 )
	{
		window.alert("Please select your province.");
		document.Purchase.Province.focus();
		return false;
	}
	if ( document.Purchase.PostalCode.value == "" )
	{
		window.alert("Please enter a valid Postal Code.");
		document.Purchase.PostalCode.focus();
		return false;
	}
	if ( document.Purchase.HomePhone.value == "" )
	{
		window.alert("Please enter your home phone number.");
		document.Purchase.HomePhone.focus();
		return false;
	}
	if ( document.Purchase.Email.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.Purchase.Email.focus();
		return false;
	}
	var atsymbol = parseInt(document.Purchase.Email.value.indexOf("@"));
	var periodchar = parseInt(document.Purchase.Email.value.indexOf("."));
	var courriel_len = parseInt(document.Purchase.Email.value.length);
	if (document.Purchase.Email.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.Purchase.Email.focus();
			return (false);
		}
	}
	if ( document.Purchase.EventID.selectedIndex == 0 )
	{
		window.alert("Which tickets do you wish to purchase?");
		document.Purchase.EventID.focus();
		return false;
	}	
	if ( document.Purchase.ticketqty.value == "" )
	{
		window.alert("How many of these tickets do you want?");
		document.Purchase.ticketqty.focus();
		return false;
	}		
	if ( document.Purchase.cardholdername.value == "" )
	{
		window.alert("Please enter the name of the card holder.");
		document.Purchase.cardholdername.focus();
		return false;
	}	
	if ( document.Purchase.cardnumber.value == "" )
	{
		window.alert("Please enter a valid credit card number.");
		document.Purchase.cardnumber.focus();
		return false;
	}	
	if ( document.Purchase.expirydatemonth.selectedIndex == 0 )
	{
		window.alert("Please select the expiry month for your credit card.");
		document.Purchase.expirydatemonth.focus();
		return false;
	}	
	if ( document.Purchase.expirydateyear.selectedIndex == 0 )
	{
		window.alert("Please select the expiry year for your credit card.");
		document.Purchase.expirydateyear.focus();
		return false;
	}	
}
function Bequest_onsubmit() 
{
 	//Verify the form fields
	if ( document.Bequest.FName.value == "")
	{
		window.alert("Please enter your first name.");
		document.Bequest.FName.focus();
		return false;
	}
	if ( document.Bequest.LName.value == "")
	{
		window.alert("Please enter your last name.");
		document.Bequest.LName.focus();
		return false;
	}
	if ( document.Bequest.Address.value == "")
	{
		window.alert("Please enter your address.");
		document.Bequest.Address.focus();
		return false;
	}
	if ( document.Bequest.City.value == "" )
	{
		window.alert("Please enter your city.");
		document.Bequest.City.focus();
		return false;
	}
	if ( document.Bequest.Province.selectedIndex == 0 )
	{
		window.alert("Please select your province.");
		document.Bequest.Province.focus();
		return false;
	}
	if ( document.Bequest.PostalCode.value == "" )
	{
		window.alert("Please enter a valid Postal Code.");
		document.Bequest.PostalCode.focus();
		return false;
	}
	if ( document.Bequest.Email.value == "" )
	{
		window.alert("Please enter a valid email address.");
		document.Bequest.Email.focus();
		return false;
	}
	var atsymbol = parseInt(document.Bequest.Email.value.indexOf("@"));
	var periodchar = parseInt(document.Bequest.Email.value.indexOf("."));
	var courriel_len = parseInt(document.Bequest.Email.value.length);
	if (document.Bequest.Email.value != "")
	{
		if (atsymbol < 0 || periodchar < 0 || periodchar == (atsymbol + 1) || (courriel_len - 1) == periodchar )  
		{
			alert("Please enter a valid email address");
			document.Bequest.Email.focus();
			return (false);
		}
	}
	if ( document.Bequest.Initials.value == "" )
	{
		window.alert("Please enter your initials.");
		document.Bequest.Initials.focus();
		return false;
	}
}
function checkLength(curr, next)
{
if (curr.value.length == curr.maxLength && iens6)
	{
	next.focus();
	}
}
//-->