<!-- Begin   (This script protects content and images on the site by disabling right mouse click)
function non(clic) {
var msg="Copyright  www.spellingbeeofcanada.ca";
if (navigator.appName == 'Netscape' && clic.which==3) {
alert(msg);
return false;}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
return true;
}
document.onmousedown = non;
// End -->
//function used in Bee Shop for continue Shopping
function beeshop()
{
	location="shop_canadawide.php"
}

var remove_msg = "Are you sure that you want to Remove this?";

var restore_msg = "Are you sure that you want to Restore this?";

var under_con_msg = "This Feature is UNDER CONSTRUCTION";

var cart_remove_msg= "Are you sure that you want to Remove this?";

var del_msg = "Are you sure that you want to Delete this?";

var w_msg = "Provincial Winner Management !";

var n_msg = "National Winner Management !";


//function which handle all pop up windows 
function popUp4all(URL,width,height,left,top) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+width+",height="+height+",left ="+left+",top ="+top+"');");
}

//function which handle all pop up windows 
function popUp4Game(URL,width,height,left,top) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left ="+left+",top ="+top+"');");
}

//function which handle all pop up windows (WITH SCROOL ON)
function popUp4all_s(URL,width,height,left,top) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+width+",height="+height+",left ="+left+",top ="+top+"');");
}

//function which handle pop up windows for EVENTS
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=470,left = 100,top = 25');");
}

//function which handle pop up windows for Provincial Winners 
function popUp_w(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=400,left = 100,top = 25');");
}
//function which handle pop up windows for Provincial Winners 
function popUp_n(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=530,left = 100,top = 10');");
}

//function which handle pop up windows for Provincial Winners 
function popUp_annual_reg(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=690,height=500,left = 100,top = 25');");
}

//function which handle pop up windows for Event Flayer
function popUp_event_flyer(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=505,height=375,left = 100,top = 25');");
}

//function-2(Not in use) which handle pop up windows for Event Flayer
function popUp_event_flyer2(page,PWidth,PHeight,id) {
 eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=1,scrollbars=1,location=1,status=1,menubars=1,resizable=1,width="+PWidth+",height="+PHeight+"')")
eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")
}


	//Following arra is used while adding winners from admin side	
	areas_copy = new Array("Agincourt", "Ajax/Pickering","Bancroft", "Brampton","Burlington","Cambridge",
				 "Carleton Place", "Don Valley", "East York", "Etobicoke","Guelph", "Hamilton",
				 "High Park","Kingston","Kitchener/Waterloo","London","Malvern/Rouge River","Markham","Mississauga",
				 "NE4 Family of Schools","NW2 Family of Schools","North York East","North York West",
				 "Niagara","Newmarket","Oakville","Ottawa","Oshawa/Whitby","Peterborough","Richmond Hill",
				 "Scarborough South East/West","Scarborough North East/West",
				 "Six Nations","St. Catharines","Sudbury","Smiths Falls","Thornhill",
				 "Toronto","Vaughan/Newmarket","Woodbridge/Maple","York");
	

	

// create an array of Ages
	var age_group = new Array("6", "7","8","9", "10","11","12","13","14");
	// sort array
	//countries.sort();
	
	// this function alters the states selections based on the countries chosen
	//for the billto side of the form - country and state selection boxes
	function printAges(x)
	{	
	
		var categories
		switch(x)
		{
			
			case 1:
				categories = new Array("Primary");
				//areas.sort();
			break;
			
			case 2:
				categories = new Array("Primary");
				//areas.sort();
			break;
			case 3:
				categories = new Array("Primary");
				//areas.sort();
			break;
			
			case 4:
				categories = new Array("Junior");
				//areas.sort();
			break;
			
			case 5:
				categories = new Array("Junior");
				//areas.sort();
			break;
			
			case 6:
				categories = new Array("Junior");
				//areas.sort();
			break;
			
			case 7:
				categories = new Array("Intermediate");
				//areas.sort();
			break;
			
			case 8:
				categories = new Array("Intermediate");
				//areas.sort();
			break;
			
			case 9:
				categories = new Array("Intermediate");
				//areas.sort();
			break;
												
			default:
				categories = new Array("none");
		}
		// make sure that the options array is empty.
		while(document.winners.category.options.length>categories.length)
		{
			for(i=document.winners.category.options.length;i>=0;i--)
			{
				// setting the value to null erases the array value
				document.winners.category.options[i]=null;
				//document.billto.shipto_state.options[i]=null;
			}
		}
		
		for(i=0;i<categories.length;i++)
		{
			// the new Option object will create a new option tag. The first parameter is the option text, the second is the option value
			document.winners.category.options[i]=new Option(categories[i], categories[i]);
			//document.billto.shipto_state.options[i]=new Option(states[i], states[i]);
		}
	}	
	
	
//function to check empty Search Field	
function validate_search(f)
{
	
	//search
	if(f.search.value=="")
	{
		alert("Please Enter Keyword");
		f.search.focus();
		return false;
	}
	
	
}

//function to check empty upload field	
function validate_upload(f)
{
	//userfile
	if(f.region.value=="")
	{
		alert("Select The Region");
		f.region.focus();
		return false;
	}//userfile
	//userfile
	if(f.userfile.value=="")
	{
		alert("Select The Image");
		f.userfile.focus();
		return false;
	}//userfile
}	
//function to check empty upload field	
function validate_upload_2(f)
{
	//userfile
	if(f.userfile.value=="")
	{
		alert("Select The Image");
		f.userfile.focus();
		return false;
	}//userfile
}	


//function to check empty Winner Information	
function validate_winner(f)
{
	
	//first name
	if(f.first_name.value=="")
	{
		alert("Enter First Name");
		f.first_name.focus();
		return false;
	}
	
	//last name
	if(f.last_name.value=="")
	{
		alert("Enter Last Name");
		f.last_name.focus();
		return false;
	}
	
	//last name
	if(f.age.value=="")
	{
		alert("Select Age");
		f.age.focus();
		return false;
	}

}

function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password"||tempobj.type=="radio"||tempobj.type=="file")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
//function to check Emails of Subscribers
function validate_email(f)
{	
	var requiredemail = f.requiredemail.value
   // E-mail address must match the following criteria:
   // starts with a letter or underscore
   // followed by one or more letter, number, underscore, or period
   // followed by single @ symbol
   // followed by at least one letter, number or underscore
   // followed by one or more periods
   // followed by one or more letters
   var chkEmail = /[A-Za-z_]{1,}[\w._]{1,}@{1}[\w]{1,}[.]{1,}/;
	
	//firstname  name
	if(f.requiredname.value=="")
	{
		alert("Enter Your Full Name");
		f.requiredname.focus();
		return false;
	}
	//email
   if(!chkEmail.test(requiredemail)) {
      alert("Please enter a valid e-mail address");
      f.requiredemail.focus();
      return false;
   }
   //message
	if(f.requiredemail2.value=="")
	{
		alert("Please Re Type email.");
		f.requiredemail2.focus();
		return false;
	}	
}
//*****************************CHECK OUT for Bee Shop******************************************************************************
//var countries = new Array("Canada", "United States", "Australia", "United Kingdom");
var countries = new Array("Canada", "United States");
	// sort array
	countries.sort();
	
	// this function alters the states selections based on the countries chosen
	//for the billto side of the form - country and state selection boxes
	function printStates1(x)
	{	
	
		var states
		switch(x)
		{
			// Australia
			//case 1:
				//states = new Array("Australian Capital Territory", "New South Wales", "Northern Territory", "Queensland", "South Australia", "Tasmania", "Victoria", "Western Australia");
				//states.sort();
			//break;
			// Canada
			case 1:
				states = new Array("Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland", "Northwest Territories", "Nova Scotia", "Nunavut", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon Territory" );
				states.sort();
			break;
			
			// United Kingdom
			//case 3:
				//states = new Array("England", "Northern Island", "Scotland", "Wales");
				//states.sort();
			//break;
			
			// United States
			case 2:
				states = new Array("Alabama", "Alaska", "Arizona", "Arkansas", "Armed Forces Asia", "Armed Forces Europe", "Armed Forces Pacific", "California", "Colorado", "Connecticut", "Delware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Lowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennesee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyonming");
				states.sort();
			break;
									
			default:
				states = new Array("none");
		}
		// make sure that the options array is empty.
		while(document.billto.state.options.length>states.length)
		{
			for(i=document.billto.state.options.length;i>=0;i--)
			{
				// setting the value to null erases the array value
				document.billto.state.options[i]=null;
				document.billto.shipto_state.options[i]=null;
			}
		}
		
		for(i=0;i<states.length;i++)
		{
			// the new Option object will create a new option tag. The first parameter is the option text, the second is the option value
			document.billto.state.options[i]=new Option(states[i], states[i]);
			document.billto.shipto_state.options[i]=new Option(states[i], states[i]);
		}
	}
	
	
	//for the shipto side of the form - country and state selection boxes
	function print_shiptoStates(x)
	{	
	
		var states
		switch(x)
		{
			// Australia
			//case 1:
				//states = new Array("Australian Capital Territory", "New South Wales", "Northern Territory", "Queensland", "South Australia", "Tasmania", "Victoria", "Western Australia");
				//states.sort();
			//break;
			// Canada
			case 1:
				states = new Array("Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland", "Northwest Territories", "Nova Scotia", "Nunavut", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon Territory" );
				states.sort();
			break;
			
			// United Kingdom
			//case 3:
				//states = new Array("England", "Northern Island", "Scotland", "Wales");
				//states.sort();
			//break;
			
			// United States
			case 2:
				states = new Array("Alabama", "Alaska", "Arizona", "Arkansas", "Armed Forces Asia", "Armed Forces Europe", "Armed Forces Pacific", "California", "Colorado", "Connecticut", "Delware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Lowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennesee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyonming");
				states.sort();
			break;
									
			default:
				states = new Array("none");
		}
		// make sure that the options array is empty.
		while(document.billto.shipto_state.options.length>states.length)
		{
			for(i=document.billto.shipto_state.options.length;i>=0;i--)
			{
				// setting the value to null erases the array value
				document.billto.shipto_state.options[i]=null;
			}
		}
		
		for(i=0;i<states.length;i++)
		{
			// the new Option object will create a new option tag. The first parameter is the option text, the second is the option value
			document.billto.shipto_state.options[i]=new Option(states[i], states[i]);
		}
	}
//function to copy infromation from bill to side to sipto side if both are same
	function copyBillTo2ShipTo()
    {       
      document.billto.shipto_firstname.value          = document.billto.firstname.value;
      document.billto.shipto_lastname.value      = document.billto.lastname.value;
      document.billto.shipto_address.value        = document.billto.address.value;
	  document.billto.shipto_country.value        = document.billto.country.value;
      //document.billto.shipto_country.selected  = document.billto.country.selectedIndex;
	  document.billto.shipto_state.value        = document.billto.state.value;
      //document.billto.shipto_state.selected = document.billto.state.selectedIndex; 
      document.billto.shipto_city.value = document.billto.city.value;
      document.billto.shipto_zipcode.value       = document.billto.zipcode.value; 
	  document.billto.shipto_area.value = document.billto.area.value;
	  document.billto.shipto_phone1.value = document.billto.phone1.value;
      document.billto.shipto_phone2.value = document.billto.phone2.value;
      document.billto.shipto_email.value      = document.billto.email.value;
   }   
   //function to validate email checking length and @ and . in it
   function checkEmailFormat(tag)
   {
   		var len = document.billto.elements[tag].length;      
     	 // Theoretically, the shortest email address is:
     	 // x@x.xx  Therefore, length MUST be >= 6
     	if(len < 6 ||  document.billto.elements[tag].value.indexOf("@") == -1 || document.billto.elements[tag].value.indexOf(".") == -1 )       
        return false;
		else return true;
	}   
   //function to validate zipcode american way
   function validateZipCode(control) 
    {
	var zip;
    zip = control.value;
	if (zip.length!=5) 	
	return false;
	}
	//auto tab function
	function autotab(original,destination)
	{
		if(original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
		destination.focus()
	}
 
function validate(f)
{
	//return false;
	firstname=f.firstname.value;
	//ccname=f.ccname.value;
	//ccnum=f.ccnum1.value+"-"+f.ccnum2.value+"-"+f.ccnum3.value+"-"+f.ccnum4.value;
	lastname=f.lastname.value;
	address=f.address.value;
	phone=f.area.value+"-"+f.phone1.value+"-"+f.phone2.value;
	var chkName, chkccname,chkccnum,chkAddress, chkEmail, chkPhone;
	chkfirstName=/^[A-Za-z]{1,}/;
	//chkccname=/^[A-Za-z]{1,}/;
	chklastName=/^[A-Za-z]{1,}/;
	//chkAddress=/^\d{1,}\s[A-Za-z]{1,}/;
	chkAddress=/^\d{1,}\s/;
	chkPhone=/\d{3}-\d{3}-\d{4}/;
	//chkccnum=/\d{4}-\d{4}-\d{4}-\d{4}/;
	// test for empty values on each form element to see if the visitor has completed all required fields
				
	// firstName
	if(firstname =="")
	{
		alert("Please enter your first name.");
		f.firstname.focus();				
		return false;// return false tells the browser not to submit the form
	}
	
	if(!chkfirstName.test(firstname))
	{
		alert("Please enter your first name correctly!");
		f.firstname.focus();
		return false;			
	}
	
	// lastName
	if(f.lastname.value=="")
	{
		alert("Please enter your last name.");
		f.lastname.focus();
		return false;
	}
	
	if(!chklastName.test(lastname))
	{
		alert("Please enter your last name correctly!");
		f.lastname.focus();
		return false;
	}
	// address
	if(f.address.value=="")
	{
		alert("Please enter your address.");
		f.address.focus();
		return false;
	}
	
	if(!chkAddress.test(address))
	{
		alert("Please enter your full address correctly!");
		f.address.focus();
		return false;
	}
	
	// country
	if(f.country.value=="none")
	{
		alert("Please enter country.");
		f.country.focus();
		return false;
	}
	
	// state
	if(f.state.value=="none")
	{
		alert("Please enter state.");
		f.state.focus();
		return false;
	}
	
	// city
	if(f.city.value=="")
	{
		alert("Please enter city.");
		f.city.focus();
		return false;
	}
	
	// zip code
	if(f.zipcode.value=="")
	{
		alert("Please enter your zip code.");
		f.zipcode.focus();
		return false;
	}
	
	if(f.area.value+"-"+f.phone1.value+"-"+f.phone2.value=="")
	{
		alert("Please enter your phone number.");
		f.area.focus();
		return false;
	}
	
	if(!chkPhone.test(phone))
	{
		alert("Please enter a valid phone number!");
		f.area.focus();
		return false;
	}
	
		
	// email
	if(f.email.value=="")
	{
		alert("Please enter your email address.");
		f.email.focus();
		return false;
	}
		
	// valid email format that must have at least one @ and .
	if(!checkEmailFormat('email'))
	{
	  alert( "The email address format is invalid, please re-enter" );
	  f.email.focus();
	  return false;
	}
	
	
	//repeating the function under this conditional statement
	if(f.sameas_billto.checked!=true)
	{
		shipto_firstname=f.shipto_firstname.value;
		shipto_lastname=f.shipto_lastname.value;
		shipto_address=f.shipto_address.value;
		shipto_phone=f.shipto_area.value+"-"+f.shipto_phone1.value+"-"+f.shipto_phone2.value;
		var chkName, chkAddress, chkEmail, chkPhone;
		chkfirstName=/^[A-Za-z]{1,}/;
		chklastName=/^[A-Za-z]{1,}/;
		chkAddress=/^\d{1,}\s[A-Za-z]{1,}/;
		chkPhone=/\d{3}-\d{3}-\d{4}/;
		// test for empty values on each form element to see if the visitor has completed all required fields
				
		// firstName
		if(shipto_firstname =="")
		{
			alert("Please enter your first name.");
			f.shipto_firstname.focus();				
			return false;// return false tells the browser not to submit the form
		}
	
		if(!chkfirstName.test(shipto_firstname))
		{
			alert("Please enter your first name correctly!");
			f.shipto_firstname.focus();
			return false;			
		}
	
		// lastName
		if(f.shipto_lastname.value=="")
		{
			alert("Please enter your last name.");
			f.shipto_lastname.focus();
			return false;
		}
	
		if(!chklastName.test(shipto_lastname))
		{
			alert("Please enter your last name correctly!");
			f.shipto_lastname.focus();
			return false;
		}
		
		// address
		if(f.shipto_address.value=="")
		{
			alert("Please enter your address.");
			f.shipto_address.focus();
			return false;
		}
	
		if(!chkAddress.test(shipto_address))
		{
			alert("Please enter your full address correctly!");
			f.shipto_address.focus();
			return false;
		}
	
		// country
		if(f.shipto_country.value=="none")
		{
			alert("Please enter country.");
			f.shipto_country.focus();
			return false;
		}
	
		// state
		if(f.shipto_state.value=="none")
		{
			alert("Please enter state.");
			f.shipto_state.focus();
			return false;
		}
	
		// city
		if(f.shipto_city.value=="")
		{
			alert("Please enter city.");
			f.shipto_city.focus();
			return false;
		}
	
		// zip code
		if(f.shipto_zipcode.value=="")
		{
			alert("Please enter your zip code.");
			f.shipto_zipcode.focus();
			return false;
		}
				
		// phone
		if(f.shipto_area.value+"-"+f.shipto_phone1.value+"-"+f.shipto_phone2.value=="")
		{
			alert("Please enter your phone number.");
			f.shipto_phone.focus();
			return false;
		}
	
		if(!chkPhone.test(shipto_phone))
		{
			alert("Please enter a valid phone number!");
			f.shipto_area.focus();
			return false;
		}
	
		// email
		if(f.shipto_email.value=="")
		{
			alert("Please enter your email address.");
			f.shipto_email.focus();
			return false;
		}
	
	    // valid email format that must have at least one @ and .
		if(!checkEmailFormat(document.billto.shipto_email.value))
		{
			alert( "The email address format is invalid, please re-enter" );
			document.billto.shipto_email.focus();
			return false;
		}		
		
	}
	
	/*check the credit card name
	if(ccname =="")
	{
		alert("Please enter the name on your card.");
		f.ccname.focus();				
		return false;// return false tells the browser not to submit the form
	}
	
	if(!chkccname.test(ccname))
	{
		alert("Please enter your the name on yoiur card!");
		f.ccname.focus();
		return false;			
	}
	
	//check the credit card number
	if(f.ccnum1.value+"-"+f.ccnum2.value+"-"+f.ccnum3.value+"-"+f.ccnum4.value=="")
	{
		alert("Please enter your correct credit card number.");
		f.ccnum1.focus();
		return false;
	}
	
	if(!chkccnum.test(ccnum))
	{
		alert("Please enter your correct credit card number.");
		f.ccnum1.focus();
		return false;
	}

	if(f.country.value=="none")
	{
		alert("Please enter country.");
		f.country.focus();
		return false;
	}
	
	//check for the credit crd type
	if(f.cctype.value=="none")
	{
		alert("Please choose credit.");
		f.country.focus();
		return false;
	}
	
	//check for the month
	if(f.ccmonth.value=="none")
	{
		alert("Please choose a month.");
		f.ccmonth.focus();
		return false;
	}
	
	//check for the year
	if(f.ccyear.value=="none")
	{
		alert("Please choose a year.");
		f.ccyear.focus();
		return false;
	} */
}

//*****************************CHECK OUT for Bee Shop******************************************************************************