
function displayRow(id)
{
	var thisRow = document.getElementById(id);

	thisRow.style.display = '';
}

function hideRow(id)
{
	var thisRow = document.getElementById(id);

	thisRow.style.display = 'none';
}

function checkRegion()
{
	 var selbox = document.survey.purchase_region;
	 
	 if (selbox.selectedIndex != 0)
	 {
	 	survey.submit();
	 }
	 else 
	 {
	 	alert('Please select a store location');
	 }
}


function setOptions(chosen) {
	var selbox = document.survey.purchase_region;
	 
	selbox.options.length = 0;
	if (chosen == " ") {
	  selbox.options[selbox.options.length] = new Option('Please select store location',' ');
	}
	if (chosen == "British Columbia") {
	  selbox.options[selbox.options.length] = new Option('Please select store location','Please select store location');
	  selbox.options[selbox.options.length] = new Option('Annacis','Annacis');
	  selbox.options[selbox.options.length] = new Option('Coquitlam','Coquitlam');
	  selbox.options[selbox.options.length] = new Option('Kelowna','Kelowna');
	  selbox.options[selbox.options.length] = new Option('Langley','Langley');  
	  selbox.options[selbox.options.length] = new Option('Richmond','Richmond');
	  selbox.options[selbox.options.length] = new Option('Surrey','Surrey');    
	  selbox.options[selbox.options.length] = new Option('Vancouver','Vancouver');
	  selbox.options[selbox.options.length] = new Option('Victoria','Victoria');  
	}
	if (chosen == "Alberta") {
	  selbox.options[selbox.options.length] = new Option('Please select store location','Please select store location');
	  selbox.options[selbox.options.length] = new Option('Calgary North','Calgary North');
	  selbox.options[selbox.options.length] = new Option('Calgary South','Calgary South');
	  selbox.options[selbox.options.length] = new Option('Edmonton North','Edmonton North');
	  selbox.options[selbox.options.length] = new Option('Edmonton South','Edmonton South');
	  selbox.options[selbox.options.length] = new Option('Red Deer','Red Deer');
	}
}

function validatePage1()
{
	var formValid = true;
	var formErrors = "";

	/////////////////////////////////////////////////////////////////
	// Check to see if at least one contact point has been filled out
	if ((document.survey.phone_home.value == "") && (document.survey.phone_work.value == "") && (document.survey.email.value == ""))
	{
		formValid = false;
		formErrors = formErrors + "You must specify at least one point of contact: Phone (Home), Phone (Work), Email Address";
	}
	// Check to see if the user has chosen a region
	else if (document.survey.purchase_region.selectedIndex == 0)
	{
		formValid = false;
		formErrors = "You must select a Province and Region.";
	}

	/////////////////////////////////////
	// Submit the form or show the errors
	if (formValid == false)
	{
		alert(formErrors);
	}
	else
	{
		document.survey.submit();
	}

}

function MM_openBrWindow(theURL,winName,features) {
	alert("Got Here");
	window.open(theURL,winName,features);
}
function closeMe() {
	window.close();
}

