<!--

var Debug_Mode = false; //this variable sets the debug mode for cookies

//function MM_preloadImages
//task: preload images
function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

//function MM_swapImgRestore
//task: restore the image at its original state
function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}

//function MM_findObj
//task: performs a some kind of search?
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//function MM_swapImage
//task: swap images being displayed
function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//function notice_e
//task: launch a notice to the user 
function notice_e(e) {
	var isNav = (navigator.appName.indexOf("Netscape") != -1);
	//(IE had a problem where if any key were pressed while a link was
	//         selected, it would open up the confirm box.  This corrects it.)
	if (!isNav) {
		e = window.event;
		if (e.keyCode) {
			e.cancelBubble = true;
			if (e.keyCode!=13)
				return false;
		}
		
		// added timeout; for whatever reason, it opened up the confirm box twice when <enter> was pressed.
		if (notice_e.timeoutid) return true;
		notice_e.timeoutid = setTimeout("notice_e.timeoutid=0;",100);
	}
	return confirm("You are now leaving the Codes Web site. Please be advised that rules and regulations governing Government of Canada Web sites, including official languages requirements, do not apply beyond this point.");
}

//function notice_f
//task: launch a notice to the user in french
function notice_f(e) {
	var isNav = (navigator.appName.indexOf("Netscape") != -1);
	//(IE had a problem where if any key were pressed while a link was
	//         selected, it would open up the confirm box.  This corrects it.)
	if (!isNav) {
		e = window.event;
		if (e.keyCode) {
			e.cancelBubble = true;
			if (e.keyCode!=13)
				return false;
		}
		
		// added timeout; for whatever reason, it opened up the confirm box twice when <enter> was pressed.
		if (notice_f.timeoutid) return true;
		notice_f.timeoutid = setTimeout("notice_f.timeoutid=0;",100);
	}
	return confirm("Vous allez bientôt quitter le site des codes. Veuillez noter que les règlements qui régissent les sites Web du gouvernement du Canada, notamment les exigences concernant les langues officielles, ne s'appliquent pas au-delà de ce point.");
}

var quickurl; // new URL
// function quick
// task: change the URL to the new one specified
// input: quickurl: string: URL to display in window
// output: none
function quick(quickurl){
	if (quickurl != "ncd_home_e.shtml"){
		location.replace(quickurl);
	}
}

//funciton GetCookie
//task: read the cookie file and extract the requested value
//input: name: string: property in the cookie to extract the value from
//output: string: value of the cookie
function GetCookie(name){
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen){
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg){
				var endstr = document.cookie.indexOf (";", j);
				if (endstr == -1) { endstr = document.cookie.length; }
				return unescape(document.cookie.substring(j, endstr));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i==0) break;
	}
	return null;
}

//function DeleteCookie
//task: set the expiry date of the cookie in the past so it is deleted
function DeleteCookie (path,domain) {
	if (GetCookie(name)) {
		document.cookie = "page=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

//function SetCookie_
//task: set a cookie
//input: name: string: name of the property to set
//       value: string: value of the named property
//       path: string: path of availability of the cookie
//       domain: string: domain of availability of the cookie
//output: none
function SetCookie_(name,value,path,domain)
{
	var CookieString = name + "=" + escape(value);
	if (path) CookieString += ";path=" + path;
	if (domain) CookieString += "domain="+domain;
	
	document.cookie = CookieString;
}

//function SetCookie
//task: use SetCookie_ to set a cookie, perform some debug-related test(s)
//input: name: string: name of the property to set
//       value: string: value of the named property
//       path: string: path of availability of the cookie
//       domain: string: domain of availability of the cookie
//output: none
function SetCookie (name,value,path,domain) {
if (Debug_Mode)
{
	alert ("Attempting cookie = " + value);
	SetCookie_(name,value,path,domain);
	alert("Cookie set to "+ GetCookie(name));
}
else
	SetCookie_(name,value,path,domain);
}


//function: langToggle
//task: replaces Jump_To_French and Jump_To_English - both left in for transition
//input: none
//output: true or false (true means it will try the cgi script; false means javascript is adequate)
function langToggle()
{
	var q= ""+location;  // convert the object to a string

	if ( (where= q.indexOf("_e.")) == -1 )   // if position of '_e.' in location is -1 (isn't there)
	    if ( (where= q.indexOf("_f.")) == -1 )  // if '_f.' is not found either, return and try the cgi script
			return true;
		else
			location= q.substring(0,where)+"_e."+q.substring(where+3,q.length);
	else
		location= q.substring(0,where)+"_f."+q.substring(where+3,q.length);
	return false;
}


//function: Jump_To_French
//task: get the url of an English page and change it to the French equivalent, then go to that page
//input: none
//output: none
function Jump_To_French()
{
	var query = location + ""; //double quotes are used to convert the variable to a string
	for (var i = 0; i < query.length; i++) //loop through all characters in the url
	{
		if (query.charAt(i) == "_")
		{
			if (query.charAt(i + 1) == "e") //only make change if there is a _e in the title
			{
				if (query.charAt(i + 2) == ".") //only make change if there is a _e in the title
				{
					start = query.substring(0, i+1); //contains entire path up to "_"
					end = query.substring(i+2, query.length); //contains .<extension>
					query = start + "f" + end; //contains path + f + .<extension>
					location = query; //goes to the path contained in query
				}
			}
		}
	}
	return false;
}

//function: Jump_To_English
//task: get the url of a French page and change it to the English equivalent, then go to that page
//input: none
//output: none
function Jump_To_English()
{
	var query = location + "";
	for (var i = 0; i < query.length; i++)
	{
		if (query.charAt(i) == "_")
		{
			if (query.charAt(i + 1) == "f")
			{
				if (query.charAt(i + 2) == ".")
				{
					start = query.substring(0, i+1);
					end = query.substring(i+2, query.length);
					query = start + "e" + end;
					location = query;
				}
			}
		}
	}
	return false;
}

//Make sure that search is filled out correctly
//Milosz Sikora #9094
function search_verify_e(form) {
	var flag1 = "";
	var flag2 = "";
	if (form.query.value == "")	{
		flag1 = "\nEnter a search query.";
	}
	if (form.ul[1].checked) {
		flag2 = "\nSpecify which parts of the site you wish to focus your search.";
		for (var i=2; i<14; i++) {
			if (form.ul[i].checked == true) {
				flag2 = "";
			}
		}
	}
	var flag = "" + flag1 + flag2;
	if (flag != "")	{
		alert("WARNING:" + flag);
		return false;
	}
	//format the query based on the option chosen
	setQuery(form);
	return true;
}
function search_verify_f(form) {
	var flag1 = "";
	var flag2 = "";
	if (form.query.value == "")	{
		flag1 = "\nSaisissez des critères de recherche.";
	}
	if (form.focus_opt[1].checked) {
		flag2 = "\nIndiquez à quelle(s) partie(s) du site Web vous souhaitez limiter la recherche.";
		for (var i=2; i<13; i++) {
			if (form.ul[i].checked == true) {
				flag2 = "";
			}
		}
	}
	var flag = "" + flag1 + flag2;
	if (flag != "")	{
		alert("ATTENTION:" + flag);
		return false;
	}
	//format the query based on the option chosen
	setQuery(form);
	return true;
}

//Set the quesry based on the search options selected called by serach verify
//Milosz Sikora #9094
function setQuery(form) {
	var q = form.query.value;
	//if AND operator is selected, don't do anything. It is the default
	if (form.option[0].checked) {
		form.im.value ="";
	}
	//if OR operator is selected
	if (form.option[1].checked) {
		//change any white space to the or operator, |.
		q = q.replace(/\s+/g, "|");
	}
	//if phrase searching is selected
	else if (form.option[2].checked) {
		//change field im's value to p
		form.im.value = "p"
	}
	//now make the field iq (query passed into the CGI script) be q.
	form.iq.value = q;
} 

//Uncheck all the check boxes in Focus your Search
//Milosz Sikora #9094
function clearChkBoxes(form) {
	for (var i=0; i<13; i++) {
		form.ul[i].checked = false;
	}
	form.ul.value = "http://www.nationalcodes.ca/%";
}
//Choose 'Search only these parts:" when a checkbox is checked
//Milosz Sikora #9094
function focusSearch(form) {
	form.focus_opt[0].checked = true;
	for (var i=0; i<13; i++) {
		if (form.ul[i].checked == true) {
			form.focus_opt[1].checked = true;
			break;
		}
	}
}

//function: Inquiry_Form_Check
//task: Checks to see that required fields have been filled in.
//input: the form object (contains all form fields)
//output: alert box if a required field has not been filled in.
function Inquiry_Form_Check(form, alert_message, alert_value, alert_check)
{
	var counter = 0;

	if (form.question.value == "")
	{
		alert_value[10] = "Question";
		alert_message[10] = 1;
		alert_check = 1;
	}
	if (alert_check == 1) //in here if at least one required field is empty
	{ //set the message to the value of alert_string
		var alert_string = "The following fields must be filled out: ";
		for (var i = 0; i < 11; i++) //one iteration for each field (11 in total)
		{
			if (alert_message[i] == 1) //if message is set to on
			{
				if (counter == 0)
				{ //add another message to the alert string
					alert_string += "\n* " + alert_value[i];
				}
				else
				{
					alert_string += "\n* " + alert_value[i];
				}
				counter++;
			}
		}
		alert(alert_string); //sends an alert box containing the message
		return false;
	}
	return true;
}

//function: Inquiry_Form_Check_f - french
//task: Checks to see that required fields have been filled in.
//input: the form object (contains all form fields)
//output: alert box if a required field has not been filled in.
function Inquiry_Form_Check_f(form, alert_message, alert_value, alert_check)
{
	var counter = 0;

	if (form.question.value == "")
	{
		alert_value[10] = "Question";
		alert_message[10] = 1;
		alert_check = 1;
	}
	if (alert_check == 1) //in here if at least one required field is empty
	{ //set the message to the value of alert_string
		var alert_string = "Vous devez remplir les zones suivantes :";
		for (var i = 0; i < 11; i++) //one iteration for each field (11 in total)
		{
			if (alert_message[i] == 1) //if message is set to on
			{
				if (counter == 0)
				{ //add another message to the alert string
					alert_string += "\n* " + alert_value[i];
				}
				else
				{
					alert_string += "\n* " + alert_value[i];
				}
				counter++;
			}
		}
		alert(alert_string); //sends an alert box containing the message
		return false;
	}
	return true;
}

//function: Code_Change_Request_Form_Check
//task: Checks to see that required fields have been filled in.
//input: the form object (contains all form fields)
//output: alert box if a required field has not been filled in.
function Code_Change_Request_Form_Check(form, alert_message, alert_value, alert_check)
{
	var counter = 0;
	//Code Reference of the Requested Change check is here
	//if button[0] is selected, text must be entered in reference textbox
	if (form.code_reference_button[0].checked == true && 
		(form.code_name.options[form.code_name.selectedIndex].value == "" || 
		form.reference.value == ""))
	{
		alert_value[10] = "Document, Reference when Existing Code Reference is selected";
		alert_message[10] = 1;
		alert_check = 1;	
	}
	//if button[1] is selected, text box must be empty
	else if (form.code_reference_button[1].checked == true && form.reference.value != "")
	{
		alert_value[10] = "For the Code Reference of the Requested Change section do one of the following:\n  Select 'To the existing code provision' or\n  Delete the content in the field under 'Article, Sentence, etc.'";
		alert_message[10] = 1;
		alert_check = 1;
	}
	//check that the Subject field is filled in
	if( form.subject_field.value == "")
	{
		alert_value[11] = "Subject";
		alert_message[11] = 1;
		alert_check = 1;
	}
	//Determines if the Problem text area is empty 
	if (form.problem.value == "" ) //&& form.problem_box.checked == false)
	{
		alert_value[12] = "Problem";
		alert_message[12] = 1;
		alert_check = 1;	
	}
	if (form.proposed_change_addition.value == "")
	{
		alert_value[13] = "Requested Change/Addition";
		alert_message[13] = 1;
		alert_check = 1;	
	}
	if (form.justification_explanation.value == "")
	{
		alert_value[14] = "Justification/Explanation";
		alert_message[14] = 1;
		alert_check = 1;	
	}
//Objectives are not mandatory
//	if (form.code_reference_button[0].checked == true &&
//		(	(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Building Code") ||
//			(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Fire Code") ||
//			(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Plumbing Code")	) &&
//		form.objective_list.selectedIndex == -1 )
//	{
//		alert_value[14] = "Select at least one objective from the list";
//		alert_message[14] = 1;
//		alert_check = 1;
//	}
	if (form.cost_implications.value == "")
	{
		alert_value[15] = "Cost/Benefit Implications";
		alert_message[15] = 1;
		alert_check = 1;	
	}
	if (form.enforcement_implications.value == "") //&& form.enforcement_implications_box.checked == false)
	{
		alert_value[16] = "Enforcement Implications";
		alert_message[16] = 1;
		alert_check = 1;	
	}
	//Check for an empty documentation field if there is an attached file
	if ((form.user_file1.value != "" || form.user_file2.value != "" || form.user_file3.value != "" || 
		form.user_file4.value != "" || form.user_file5.value != "") && 
		form.supporting_documentation.value == "")
	{
		alert_value[17] = "Supporting Documentation";
		alert_message[17] = 1;
		alert_check = 1;	
	}
	if (alert_check == 1) //at least one required field is empty
	{
		var alert_string = "The following fields must be filled out: ";
		for (var i = 0; i < 18; i++)
		{
			if (alert_message[i] == 1)
			{
				if (counter == 0)
				{
					alert_string += "\n* " + alert_value[i];
				}
				else
				{
					alert_string += "\n* " + alert_value[i];
				}
				counter++;
			}
		}
		alert(alert_string);
		return false;
	}
	return true;
}

//function: Code_Change_Request_Form_Check
//task: Checks to see that required fields have been filled in.
//input: the form object (contains all form fields)
//output: alert box if a required field has not been filled in.
function Code_Change_Request_Form_Check_f(form, alert_message, alert_value, alert_check)
{
	var counter = 0;
	//Determines if the required fields are filled out for an existing code reference
	if (form.code_reference_button[0].checked == true && 
		(form.code_name.options[form.code_name.selectedIndex].value == "" || 
		form.reference.value == ""))
	{
		alert_value[10] = "Nom du document et numéro d'exigence si l'option Modification à une exigence existante est sélectionnée";
		alert_message[10] = 1;
		alert_check = 1;	
	}
	//Determines if 'New' or 'Don't Know' were checked along with filling out the reference for
	//an existing code change
	else if (form.code_reference_button[1].checked == true && form.reference.value != "")
	{
		alert_value[10] = "Dans la section Modification demandée :\n  Sélectionnez l'option Modification à une exigence existante ou\n Supprimez le contenu de la zone Article, paragraphe, etc.";
		alert_message[10] = 1;
		alert_check = 1;
	}
	//check that the Subject field is filled in
	if( form.subject_field.value == "")
	{
		alert_value[11] = "Sujet";
		alert_message[11] = 1;
		alert_check = 1;
	}
	//Determines if the check box is unchecked and the text area is empty 
	if (form.problem.value == "" )
	{
		alert_value[12] = "Problème";
		alert_message[12] = 1;
		alert_check = 1;	
	}
	if (form.proposed_change_addition.value == "")
	{
		alert_value[13] = "Modification ou ajout proposé";
		alert_message[13] = 1;
		alert_check = 1;	
	}
	if (form.justification_explanation.value == "")
	{
		alert_value[14] = "Justification - explication";
		alert_message[14] = 1;
		alert_check = 1;	
	}
//Objectives are not mandatory
//	if (form.code_reference_button[0].checked == true &&
//		(	(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Building Code") ||
//			(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Fire Code") ||
//			(form.code_name.options[form.code_name.selectedIndex].value == "2005 National Plumbing Code")	) &&
//		form.objective_list.selectedIndex == -1 )
//	{
//		alert_value[14] = "Vous devez choisir au moins un objectif";
//		alert_message[14] = 1;
//		alert_check = 1;
//	}
	if (form.cost_implications.value == "")
	{
		alert_value[15] = "Répercussions sur les coûts";
		alert_message[15] = 1;
		alert_check = 1;	
	}
	if (form.enforcement_implications.value == "" )
	{
		alert_value[16] = "Répercussions sur la mise en application";
		alert_message[16] = 1;
		alert_check = 1;	
	}
	//Check for an empty documentation field if there is an attached file
	if ((form.user_file1.value != "" || form.user_file2.value != "" || form.user_file3.value != "" || 
		form.user_file4.value != "" || form.user_file5.value != "") && 
		form.supporting_documentation.value == "")
	{
		alert_value[17] = "Documents justificatifs";
		alert_message[17] = 1;
		alert_check = 1;	
	}
	if (alert_check == 1) //at least one required field is empty
	{
		var alert_string = "Vous devez remplir les zones suivantes :";
		for (var i = 0; i < 18; i++)
		{
			if (alert_message[i] == 1)
			{
				if (counter == 0)
				{
					alert_string += "\n* " + alert_value[i];
				}
				else
				{
					alert_string += "\n* " + alert_value[i];
				}
				counter++;
			}
		}
		alert(alert_string);
		return false;
	}
	return true;
}

function Form_Check(form)
{
	var Response_Type = ""; //will be e-mail, fax, or mail
	var Checker = 0, alert_check = 0;
	//alert_message is an array containing 1 for not filled in and 0 for filled in fields
	//alert_value is an array of strings describing what fields have not been filled out
	var alert_message = new Array(), alert_value = new Array();

	//j indicates which radio button it is and .checked tells us if it has been checked


	if (form.name.value == "") //determines if the name field is empty
	{
		alert_value[0] = "Name"; //the value of the first message
		alert_message[0] = 1; //sets the first message to on
		alert_check = 1; //notification that at least one required field is empty
	}
	if (form.address.value == "")
	{
		alert_value[1] = "Address";
		alert_message[1] = 1;
		alert_check = 1;
	}
	if (form.city.value == "")
	{
		alert_value[2] = "City";
		alert_message[2] = 1;
		alert_check = 1;
	}
	if ((form.country.value == "CA") || (form.country.value == "US"))
	{
		if (form.province.value == "N/A")
		{
			alert_value[3] = "Province";
			alert_message[3] = 1;
			alert_check = 1;
		}
		if (form.postal_code.value == "")
		{
			alert_value[4] = "Postal Code";
			alert_message[4] = 1;
			alert_check = 1;
		}
	}
	
	if (form.country.value == "")
	{
		alert_value[5] = "Country";
		alert_message[5] = 1;
		alert_check = 1;
	}
	//Three fields make up the phone number so a message is sent if any of the three fields
	//are empty
	if (form.phone_number_1.value == "" || form.phone_number_2.value == "" || 
		form.phone_number_3.value == "")
	{
		alert_value[6] = "Phone Number";
		alert_message[6] = 1;
		alert_check = 1;
	}
	//If they choose to receive e-mail notification they must enter an e-mail address
	if ((form.email.value == "" || !isEmail(form.email.value)) && form.notify_button.checked == true)
	{
		alert_value[7] = "Email";
		alert_message[7] = 1;
		alert_check = 1;
	}
	//The fax number is the same format as the phone number and all three fields must be
	//filled in if they choose to be notified by fax
	/*if (form.fax_1.value == "" || form.fax_2.value == "" || form.fax_3.value == "")
	{
		alert_value[8] = "Fax Number";
		alert_message[8] = 1;
		alert_check = 1;
	}*/
	//There are six check boxes and a field for other options.  A message is sent only if
	//all six check boxes are unchecked and the field is empty
	if (form.area_of_work_1.checked == false && form.area_of_work_2.checked == false &&
		form.area_of_work_3.checked == false && form.area_of_work_4.checked == false &&
		form.area_of_work_5.checked == false && form.area_of_work_6.checked == false &&
		form.other.value == "")
	{
		alert_value[9] = "Function";
		alert_message[9] = 1;
		alert_check = 1;
	}
	//Determine which form is being used
	if (form.subject.value == "Inquiry Form")
	{ //pass the form as well as the three variables for determining if there will be an alert
		//message and what it will be
		return Inquiry_Form_Check(form, alert_message, alert_value, alert_check);
	}
	else if (form.subject.value == "Code Change Request Form")
	{
		return Code_Change_Request_Form_Check(form, alert_message, alert_value, alert_check);
	}
	return false;
}

function Form_Check_f(form)
{
	var Response_Type = ""; //will be e-mail, fax, or mail
	var Checker = 0, alert_check = 0;
	//alert_message is an array containing 1 for not filled in and 0 for filled in fields
	//alert_value is an array of strings describing what fields have not been filled out
	var alert_message = new Array(), alert_value = new Array();

	//j indicates which radio button it is and .checked tells us if it has been checked
	//form.notify_button[j].checked == true)


	if (form.name.value == "") //determines if the name field is empty
	{
		alert_value[0] = "Nom"; //the value of the first message
		alert_message[0] = 1; //sets the first message to on
		alert_check = 1; //notification that at least one required field is empty
	}
	if (form.address.value == "")
	{
		alert_value[1] = "Adresse";
		alert_message[1] = 1;
		alert_check = 1;
	}
	if (form.city.value == "")
	{
		alert_value[2] = "Ville";
		alert_message[2] = 1;
		alert_check = 1;
	}
	
	if ((form.country.value == "CA") || (form.country.value == "US"))
	{
		if (form.province.value == "pays")
		{
			alert_value[3] = "Province ou état";
			alert_message[3] = 1;
			alert_check = 1;
		}
		if (form.postal_code.value == "")
		{
			alert_value[4] = "Code postal";
			alert_message[4] = 1;
			alert_check = 1;
		}
	}
	
	if (form.country.value == "")
	{
		alert_value[5] = "Pays";
		alert_message[5] = 1;
		alert_check = 1;
	}
	//Three fields make up the phone number so a message is sent if any of the three fields
	//are empty
	if (form.phone_number_1.value == "" || form.phone_number_2.value == "" || 
		form.phone_number_3.value == "")
	{
		alert_value[6] = "Numéro de téléphone";
		alert_message[6] = 1;
		alert_check = 1;
	}
	//If they choose to receive e-mail notification they must enter an e-mail address
	if (form.email.value == "")
	{
		alert_value[7] = "Adresse électronique";
		alert_message[7] = 1;
		alert_check = 1;
	}
	//The fax number is the same format as the phone number and all three fields must be
	//filled in if they choose to be notified by fax
	else if (form.fax_1.value == "" || form.fax_2.value == "" || form.fax_3.value == "")
	{
		alert_value[8] = "Numéro de télécopieur";
		alert_message[8] = 1;
		alert_check = 1;
	}
	//There are six check boxes and a field for other options.  A message is sent only if
	//all six check boxes are unchecked and the field is empty
	if (form.area_of_work_1.checked == false && form.area_of_work_2.checked == false &&
		form.area_of_work_3.checked == false && form.area_of_work_4.checked == false &&
		form.area_of_work_5.checked == false && form.area_of_work_6.checked == false &&
		form.other.value == "")
	{
		alert_value[9] = "Poste";
		alert_message[9] = 1;
		alert_check = 1;
	}
	//Determine which form is being used
	if (form.subject.value == "Inquiry Form")
	{ //pass the form as well as the three variables for determining if there will be an alert
		//message and what it will be
		return Inquiry_Form_Check_f(form, alert_message, alert_value, alert_check);
	}
	else if (form.subject.value == "Code Change Request Form")
	{
		return Code_Change_Request_Form_Check_f(form, alert_message, alert_value, alert_check);
	}
	return false;
}

var downStrokeField;
function jumpTo_keyDown()
{
	this.beforeLength=this.value.length;
        downStrokeField=this;
}

function jumpTo_keyUp()
{
        if (    (this == downStrokeField) &&
                (this.value.length > this.beforeLength) && 
                (this.value.length >= 3)        )
        {
                this.nextField.focus();
                this.nextField.select();
        }
        downStrokeField=null;
}

function jumpTo_doubleCheck()
{
}
function jumpTo(fieldName,nextFieldName)
{
        var myForm=document.forms[document.forms.length - 1];
        var myField=myForm.elements[fieldName];
        myField.nextField=myForm.elements[nextFieldName];

        myField.onkeydown=jumpTo_keyDown;
        myField.onkeyup=jumpTo_keyUp;
}

// Task: Check that required fields on the OBC Questionnaire are filled in
//        and alert the user, if necessary.
//  PJ Mueller #8699
function obc_quest_checkForm_e(form) {
	var errorMsg = "";
	
	// checking required fields
	if (form.name.value=="") errorMsg+= "* Name\n";
	if (form.address.value=="") errorMsg+= "* Address\n";
	if (form.city.value=="") errorMsg+= "* City\n";
	if (form.country.value=="CA" || form.country.value=="US") 
	{
		if (form.province.selectedIndex==0 || form.province.selectedIndex==14) errorMsg+= "* Province/State\n";
		if (form.postal_code.value=="") errorMsg+= "* Postal Code\n";
	}
	if (form.country.value=="") errorMsg+= "* Country\n";
	
	if ((form.notify_button[0].checked == false) && (form.notify_button[1].checked == false) &&
			(form.notify_button[2].checked == false) && (form.notify_button[3].checked == false))
					errorMsg+="* Notification Preferences\n";
	
	// if email was chosen,
	if (form.notify_button[0].checked==true)
	{	//but left blank
		if (form.email.value=="")
		{	errorMsg+= "* E-mail (chosen as method of notification,\n\tbut was left blank)\n";
		}
		//but conatins invlaid chars
		else if (!isEmail(form.email.value))
		{	errorMsg+= "* E-mail (contains invalid characters and/or spaces)";
		}
	}

	// if phone was chosen, but left blank
	if (form.notify_button[1].checked==true && 
		(form.phone_number_1.value=="" ||
			form.phone_number_2.value=="" ||
				form.phone_number_3.value=="") )
					errorMsg+= "* Phone (chosen as prefered method of notification,\n\tbut was left blank)\n";

	// if fax was chosen, but left blank
	if (form.notify_button[2].checked==true && 
		(form.fax_1.value=="" ||
			form.fax_2.value=="" ||
				form.fax_3.value=="") )
					errorMsg+= "* Fax (chosen as prefered method of notification,\n\tbut was left blank)\n";
	
	//if no functions were chosen
	if ((form.area_of_work_1.checked == false) && (form.area_of_work_2.checked == false) &&
			(form.area_of_work_3.checked == false) && (form.area_of_work_4.checked == false) &&
				(form.area_of_work_5.checked == false) && (form.area_of_work_6.checked == false) &&
					(form.other.value == ""))
						errorMsg+= "* Function\n";
	
	//How often do you use each code?
	//if the NBC part is not chosen
	if ((form.nbc_button[0].checked == false) && (form.nbc_button[1].checked == false) && 
			(form.nbc_button[2].checked == false) && (form.nbc_button[3].checked == false))
				errorMsg+= "* How often do you use each code? (NBC)\n";
	
	//if the NFC part is not chosen
	if ((form.nfc_button[0].checked == false) && (form.nfc_button[1].checked == false) && 
			(form.nfc_button[2].checked == false) && (form.nfc_button[3].checked == false))
				errorMsg+= "* How often do you use each code? (NFC)\n";
	
	//if the NPC part is not chosen
	if ((form.npc_button[0].checked == false) && (form.npc_button[1].checked == false) && 
			(form.npc_button[2].checked == false) && (form.npc_button[3].checked == false))
				errorMsg+= "* How often do you use each code? (NPC)\n";
	
	// if errors found...
	if (errorMsg!="") {
		location= "#title";
		alert("The following must be filled out:\n\n"+errorMsg);

		// then don't submit
		return false;  
	}

	//write the cookie file
	writeCookie(form);
	// then submit
	return true;
}
//-->

// Task: Check that required fields on the OBC Questionnaire are filled in
//        and alert the user, if necessary.
//  PJ Mueller #8699
function obc_quest_checkForm_f(form) {
	var errorMsg = "";
	
	// checking required fields
	if (form.name.value=="") errorMsg+= "* Nom\n";
	if (form.address.value=="") errorMsg+= "* Adresse\n";
	if (form.city.value=="") errorMsg+= "* Ville\n";
	if (form.country.value=="CA" || form.country.value=="US") 
	{
		if (form.province.selectedIndex==0 || form.province.selectedIndex==14) errorMsg+= "* Province/State\n";
		if (form.postal_code.value=="") errorMsg+= "* Code postal\n";
	}
	if (form.country.value=="") errorMsg+= "* Pays\n";
	
	// if email was chosen
	if (form.notify_button[0].checked==true)
	{	//but left blank
		if (form.email.value=="")
		{	errorMsg+= "* Courriel (préférence pour recevoir les avis, \n\tmais le champ est vide)\n";
		}
		//but contains invalid chars
		else if (!isEmail(form.email.value))
		{	errorMsg+= "* Courriel (contient des espaces et/ou des caractères non valides)";
		}
	}
	
	//if no notification method was chosen
	if ((form.notify_button[0].checked == false) && (form.notify_button[1].checked == false) && 
			(form.notify_button[2].checked == false) && (form.notify_button[3].checked == false))
					errorMsg+="* Préférences relatives aux avis\n";
					 			
			
	// if phone was chosen, but left blank
	if (form.notify_button[1].checked==true && 
		(form.phone_number_1.value=="" ||
			form.phone_number_2.value=="" ||
				form.phone_number_3.value=="") )
					errorMsg+= "* Téléphone (préférence pour recevoir les avis, \n\tmais le champ est vide)\n ";

	// if fax was chosen, but left blank
	if (form.notify_button[2].checked==true && 
		(form.fax_1.value=="" ||
			form.fax_2.value=="" ||
				form.fax_3.value=="") )
					errorMsg+= "* Télécopieur (préférence pour recevoir les avis, \n\tmais le champ est vide)\n";
	
	//if no functions were chosen
	if ((form.area_of_work_1.checked == false) && (form.area_of_work_2.checked == false) &&
			(form.area_of_work_3.checked == false) && (form.area_of_work_4.checked == false) &&
				(form.area_of_work_5.checked == false) && (form.area_of_work_6.checked == false) &&
					(form.other.value == ""))
						errorMsg+= "* Catégorie d'utilisateur\n";
	
	//How often do you use each code?
	//if the NBC part is not chosen
	if ((form.nbc_button[0].checked == false) && (form.nbc_button[1].checked == false) && 
			(form.nbc_button[2].checked == false) && (form.nbc_button[3].checked == false))
				errorMsg+= "* À quelle fréquence utilisez-vous chaque code? (CNB)\n";
	
	//if the NFC part is not chosen
	if ((form.nfc_button[0].checked == false) && (form.nfc_button[1].checked == false) && 
			(form.nfc_button[2].checked == false) && (form.nfc_button[3].checked == false))
				errorMsg+= "* À quelle fréquence utilisez-vous chaque code? (CNPI)\n";
	
	//if the NPC part is not chosen
	if ((form.npc_button[0].checked == false) && (form.npc_button[1].checked == false) && 
			(form.npc_button[2].checked == false) && (form.npc_button[3].checked == false))
				errorMsg+= "* À quelle fréquence utilisez-vous chaque code? (CNP)\n";
	
	// if errors found..
	if (errorMsg!="") {
		location= "#title";
		alert("Les champs suivants sont obligatoires :\n\n"+errorMsg);

		// then don't submit
		return false;  
	}

	// then submit
	return true;
}

//Task:	Check to make sure all the fields in the Training Questionnaire are filled
//		in and are correct.
//		Milosz Sikora #9094
function train_checkForm_e(form) {
	//variables for formatting the error message.
	var errorMsg1="";
	var errorMsg2="";
	var errorMsg3="";
	var errorMsg4="";
	var section1="";
	var section2="";
	var section3="";
	var section4="";
	
	//Section 1: Respondent Info.

	//check that group has been selected.
	if (form.grp_number[0].checked==false && form.grp_number[1].checked==false && form.grp_number[2].checked==false) {
		errorMsg1 += "\tA) A group number has not been specified.\n";
		section1="Section I:\n";
	}
	
	//check that only the jobs that are under the checked group have been checked
	if (form.grp_number[0].checked==false) {
		if (form.grp11.checked || form.grp12.checked || form.grp13.checked ||
			form.grp14.checked || form.other1.checked) {
			errorMsg1+= "\tA) GROUP ONE occupations have been selected, yet GROUP ONE itself has not been selected.\n";
			section1="Section I:\n";
		}
	} 
	if (form.grp_number[1].checked==false) {
		if (form.grp21.checked || form.grp22.checked || form.grp23.checked ||
			form.grp24.checked || form.grp25.checked || form.grp26.checked || 
			form.grp27.checked || form.other2.checked) {
			errorMsg1+= "\tA) GROUP TWO occupations have been selected, yet GROUP TWO itself has not been selected.\n";
			section1="Section I:\n";
		}
	}
	if (form.grp_number[2].checked==false) {
		if (form.grp31.checked || form.grp32.checked || form.grp33.checked ||
			form.grp34.checked || form.other3.checked) {
			errorMsg1+= "\tA) GROUP THREE occupations have been selected, yet GROUP THREE itself has not been selected.\n";
			section1="Section I:\n";
		}
	} 
	
	//check that if other was selected, then a description was specified.
	if (form.other1.checked && form.other1txt.value=="") {
		errorMsg1 += "\tA) occupation 'Other' has been selected in GROUP ONE, but no description has been provided.\n";
		section1="Section I:\n";
	}
	if (form.other2.checked && form.other2txt.value=="") {
		errorMsg1 += "\tA) occupation 'Other' has been selected in GROUP TWO, but no description has been provided.\n";
		section1="Section I:\n";
	}
	if (form.other3.checked && form.other3txt.value=="") {
		errorMsg1 += "\tA) occupation 'Other' has been selected in GROUP THREE, but no description has been provided.\n";
		section1="Section I:\n";
	}
	
	
	
	if (form.pop[0].checked==false && form.pop[1].checked==false &&
			form.pop[2].checked==false && form.pop[3].checked==false &&
				form.pop[4].checked==false && form.pop[5].checked==false &&
					form.pop[6].checked==false) {
		errorMsg1 += "\tB) A community population has not been selected.\n";
		section1="Section I:\n";
	}	

	if (form.prov.selectedIndex==0) {
		errorMsg1+= "\tC) A province has not been selected.\n";
		section1 = "Section I:\n";
	}
	
	//Section 2: Training and Development Needs
	//check that each question has been answered.
	
	//Q.1.
	if (form.top1a[0].checked==false && form.top1a[1].checked==false &&
			form.top1a[2].checked==false && form.top1a[3].checked==false &&
				form.top1a[4].checked==false) {
		errorMsg2 += "\t1. a) An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top1a[4].checked == false) {
		if (form.top1b[0].checked==false && form.top1b[1].checked==false &&
				form.top1b[2].checked==false && form.top1b[3].checked==false &&
					form.top1b[4].checked==false && form.top1b[5].checked==false &&
						form.top1b[6].checked==false) {
			errorMsg2 += "\t1. b) An answer has not been selected.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.2.
	if (form.top2a[0].checked==false && form.top2a[1].checked==false &&
			form.top2a[2].checked==false && form.top2a[3].checked==false &&
				form.top2a[4].checked==false) {
		errorMsg2 += "\t2. a) An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top2a[4].checked == false) {
		if (form.top2b[0].checked==false && form.top2b[1].checked==false &&
				form.top2b[2].checked==false && form.top2b[3].checked==false &&
					form.top2b[4].checked==false && form.top2b[5].checked==false &&
						form.top2b[6].checked==false) {
			errorMsg2 += "\t2. b) An answer has not been selected.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.3.
	if (form.top3a[0].checked==false && form.top3a[1].checked==false &&
			form.top3a[2].checked==false && form.top3a[3].checked==false &&
				form.top3a[4].checked==false) {
		errorMsg2 += "\t3. a) An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top3a[4].checked == false) {
		if (form.top3b[0].checked==false && form.top3b[1].checked==false &&
				form.top3b[2].checked==false && form.top3b[3].checked==false &&
					form.top3b[4].checked==false && form.top3b[5].checked==false &&
						form.top3b[6].checked==false) {
			errorMsg2 += "\t3. b) An answer has not been selected.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.4.
	if (form.top4a[0].checked==false && form.top4a[1].checked==false &&
			form.top4a[2].checked==false && form.top4a[3].checked==false &&
				form.top4a[4].checked==false) {
		errorMsg2 += "\t4. a) An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top4a[4].checked == false) {
		if (form.top4b[0].checked==false && form.top4b[1].checked==false &&
				form.top4b[2].checked==false && form.top4b[3].checked==false &&
					form.top4b[4].checked==false && form.top4b[5].checked==false &&
						form.top4b[6].checked==false) {
			errorMsg2 += "\t4. b) An answer has not been selected.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.5.
	if (form.top5a[0].checked==false && form.top5a[1].checked==false &&
			form.top5a[2].checked==false && form.top5a[3].checked==false &&
				form.top5a[4].checked==false) {
		errorMsg2 += "\t5. a) An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top5a[4].checked == false) {
		if (form.top5b[0].checked==false && form.top5b[1].checked==false &&
				form.top5b[2].checked==false && form.top5b[3].checked==false &&
					form.top5b[4].checked==false && form.top5b[5].checked==false &&
						form.top5b[6].checked==false) {
			errorMsg2 += "\t5. b) An answer has not been selected.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.6.
	if (form.top6[0].checked==false && form.top6[1].checked==false &&
			form.top6[2].checked==false && form.top6[3].checked==false &&
				form.top6[4].checked==false) {
		errorMsg2 += "\t6. An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.7.
	if (form.obc_topics.value=="") {
		errorMsg2 += "\t7. An answer has not been entered.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.8. Nake sure that 1-4 was properly filled out.
	var nums = new Array(form.top8a.value, form.top8b.value, form.top8c.value, form.top8d.value);
	var toBreak = false;
	for (var i=0; i<nums.length-1; i++) {
		if (toBreak==true) break;	
		for (var j=i+1; j<nums.length; j++) {
			//checks that each field has been filled out
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg2 += "\t8. A field has been left blank.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg2 += "\t8. Two separate parts have been ranked the same.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 4) || (nums[j] < 1) || (nums[j] > 4)) {
				errorMsg2 += "\t8. A number has been entered that is not between 1 and 4.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
		}
	}
	
	//Q.9.
	if (form.top9[0].checked==false && form.top9[1].checked==false && form.top9[2].checked==false) {
		errorMsg2 += "\t9. An answer has not been selected.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.10. Make sure that 1-4 was properly filled out.
	var nums = new Array(form.top10a.value, form.top10b.value, form.top10c.value, form.top10d.value);
	var toBreak = false;
	for (var i=0; i<nums.length-1; i++) {
		if (toBreak==true) break;	
		for (var j=i+1; j<nums.length; j++) {
			//checks that each field has been filled out
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg2 += "\t10. A field has been left blank.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg2 += "\t10. Two separate parts have been ranked the same.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 4) || (nums[j] < 1) || (nums[j] > 4)) {
				errorMsg2 += "\t10. A number has been entered that is not between 1 and 4.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
		}
	}
	
	//Section III: Tools and Support Material Needs
	//Q.11. Make sure that 1-4 was properly filled out.
	var nums = new Array(form.top11a.value, form.top11b.value, form.top11c.value, form.top11d.value, form.top11e.value);
	var toBreak = false;
	for (var i=0; i<nums.length-1; i++) {
		if (toBreak==true) break;
		for (var j=i+1; j<nums.length; j++) {
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg3 += "\t11. A field has been left blank.\n";
				section3 = "\nSection III:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg3 += "\t11. Two separate parts have been ranked the same.\n";
				section3 = "\nSection III:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 5) || (nums[j] < 1) || (nums[j] > 5)) {
				errorMsg3 += "\t11. A number has been entered that is not between 1 and 5.\n";
				section3 = "\nSection III:\n";
				toBreak=true;
				break;
			}
		}
	}
	
	//Q.12.
	if (form.top12txt.value=="") {
		errorMsg3 += "\t12. An answer has not been entered.\n";
		section3 = "Section III:\n";
	}
	
	//Q.13.
	if (form.top13txt.value=="") {
		errorMsg3 += "\t13. An answer has not been entered.\n";
		section3 = "Section III:\n";
	}
	
	//check that email is valid if entered
	if (form.email.value != "") {
		if (!isEmail(form.email.value)) {
			errorMsg4 += "The email address contains spaces and/or invalid characters.\n";
			section4 = "\nSection IV:\n";
		}
	}
	
	var errorMsg = "" + section1 + errorMsg1 + section2 + errorMsg2 + section3 + errorMsg3 + section4 + errorMsg4;
	if (errorMsg != "") {
		errorMsg = "The following fields have been filled out incorrectly.\nPlease correct them and try submitting again.\n\n" + errorMsg;
		alert(errorMsg);
		return false;
	}
	
	return true;
}

//Task:	Check to make sure all the fields in the Training Questionnaire are filled
//		in and are correct.
//		Milosz Sikora #9094
function train_checkForm_f(form) {
	//variables for formatting the error message.
	var errorMsg1="";
	var errorMsg2="";
	var errorMsg3="";
	var errorMsg4="";
	var section1="";
	var section2="";
	var section3="";
	var section4="";
	
	//Section 1: Respondent Info.

	//check that group has been selected.
	if (form.grp_number[0].checked==false && form.grp_number[1].checked==false && form.grp_number[2].checked==false) {
		errorMsg1 += "\tA) Aucun numéro de groupe n'a été spécifé.\n";
		section1="Section I:\n";
	}
	
	//check that only the jobs that are under the checked group have been checked
	if (form.grp_number[0].checked==false) {
		if (form.grp11.checked || form.grp12.checked || form.grp13.checked ||
			form.grp14.checked || form.other1.checked) {
			errorMsg1+= "\tA) Des postes figurant dans le GROUPE UN ont été sélectionnés,\n\tmais le GROUPE UN lui-même n'a pas été sélectionné.\n";
			section1="Section I:\n";
		}
	} 
	if (form.grp_number[1].checked==false) {
		if (form.grp21.checked || form.grp22.checked || form.grp23.checked ||
			form.grp24.checked || form.grp25.checked || form.grp26.checked || 
			form.grp27.checked || form.other2.checked) {
			errorMsg1+= "\tA) Des postes figurant dans le GROUPE UN ont été sélectionnés,\n\tmais le GROUPE UN lui-même n'a pas été sélectionné.\n";
			section1="Section I:\n";		
		}
	}
	if (form.grp_number[2].checked==false) {
		if (form.grp31.checked || form.grp32.checked || form.grp33.checked ||
			form.grp34.checked || form.other3.checked) {
			errorMsg1+= "\tA) Des postes figurant dans le GROUPE UN ont été sélectionnés,\n\tmais le GROUPE UN lui-même n'a pas été sélectionné.\n";
			section1="Section I:\n";
		}
	}
	
		//check that if other was selected, then a description was specified.
	if (form.other1.checked && form.other1txt.value=="") {
		errorMsg1 += "\tA) L'option Autre a été sélectionnée dans le GROUPE UN, mais aucune description n'a été fournie.\n";
		section1="Section I:\n";
	}
	if (form.other2.checked && form.other2txt.value=="") {
		errorMsg1 += "\tA) L'option Autre a été sélectionnée dans le GROUPE DEUX, mais aucune description n'a été fournie.\n";
		section1="Section I:\n";
	}
	if (form.other3.checked && form.other3txt.value=="") {
		errorMsg1 += "\tA) L'option Autre a été sélectionnée dans le GROUPE TROIS, mais aucune description n'a été fournie.\n";
		section1="Section I:\n";
	} 
	
	if (form.pop[0].checked==false && form.pop[1].checked==false &&
			form.pop[2].checked==false && form.pop[3].checked==false &&
				form.pop[4].checked==false && form.pop[5].checked==false &&
					form.pop[6].checked==false) {
		errorMsg1 += "\tB) La population de la collectivité n'a pas été sélectionnée.\n";
		section1="Section I:\n";
	}	
	
	if (form.prov.selectedIndex==0) {
		errorMsg1+= "\tC) Aucune province n'a été sélectionnée.\n";
		section1 = "Section I:\n";
	}	
	
	//Section 2: Training and Development Needs
	//check that each question has been answered.
	
	//Q.1.
	if (form.top1a[0].checked==false && form.top1a[1].checked==false &&
			form.top1a[2].checked==false && form.top1a[3].checked==false &&
				form.top1a[4].checked==false) {
		errorMsg2 += "\t1. a) Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n"
	}
	if (form.top1a[4].checked == false) {
		if (form.top1b[0].checked==false && form.top1b[1].checked==false &&
				form.top1b[2].checked==false && form.top1b[3].checked==false &&
					form.top1b[4].checked==false && form.top1b[5].checked==false &&
						form.top1b[6].checked==false) {
			errorMsg2 += "\t1. b) Aucune réponse n'a été sélectionnée.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.2.
	if (form.top2a[0].checked==false && form.top2a[1].checked==false &&
			form.top2a[2].checked==false && form.top2a[3].checked==false &&
				form.top2a[4].checked==false) {
		errorMsg2 += "\t2. a) Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top2a[4].checked == false) {
		if (form.top2b[0].checked==false && form.top2b[1].checked==false &&
				form.top2b[2].checked==false && form.top2b[3].checked==false &&
					form.top2b[4].checked==false && form.top2b[5].checked==false &&
						form.top2b[6].checked==false) {
			errorMsg2 += "\t2. b) Aucune réponse n'a été sélectionnée.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.3.
	if (form.top3a[0].checked==false && form.top3a[1].checked==false &&
			form.top3a[2].checked==false && form.top3a[3].checked==false &&
				form.top3a[4].checked==false) {
		errorMsg2 += "\t3. a) Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top3a[4].checked == false) {
		if (form.top3b[0].checked==false && form.top3b[1].checked==false &&
				form.top3b[2].checked==false && form.top3b[3].checked==false &&
					form.top3b[4].checked==false && form.top3b[5].checked==false &&
						form.top3b[6].checked==false) {
			errorMsg2 += "\t3. b) Aucune réponse n'a été sélectionnée.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.4.
	if (form.top4a[0].checked==false && form.top4a[1].checked==false &&
			form.top4a[2].checked==false && form.top4a[3].checked==false &&
				form.top4a[4].checked==false) {
		errorMsg2 += "\t4. a) Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top4a[4].checked == false) {
		if (form.top4b[0].checked==false && form.top4b[1].checked==false &&
				form.top4b[2].checked==false && form.top4b[3].checked==false &&
					form.top4b[4].checked==false && form.top4b[5].checked==false &&
						form.top4b[6].checked==false) {
			errorMsg2 += "\t4. b) Aucune réponse n'a été sélectionnée.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.5.
	if (form.top5a[0].checked==false && form.top5a[1].checked==false &&
			form.top5a[2].checked==false && form.top5a[3].checked==false &&
				form.top5a[4].checked==false) {
		errorMsg2 += "\t5. a) Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	if (form.top5a[4].checked == false) {
		if (form.top5b[0].checked==false && form.top5b[1].checked==false &&
				form.top5b[2].checked==false && form.top5b[3].checked==false &&
					form.top5b[4].checked==false && form.top5b[5].checked==false &&
						form.top5b[6].checked==false) {
			errorMsg2 += "\t5. b) Aucune réponse n'a été sélectionnée.\n";
			section2 = "\nSection II:\n";
		}
	}
	
	//Q.6.
	if (form.top6[0].checked==false && form.top6[1].checked==false &&
			form.top6[2].checked==false && form.top6[3].checked==false &&
				form.top6[4].checked==false) {
		errorMsg2 += "\t6. Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.7.
	if (form.obc_topics.value=="") {
		errorMsg2 += "\t7. Aucune réponse n'a été saisie.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.8. Nake sure that 1-4 was properly filled out.
	var nums = new Array(form.top8a.value, form.top8b.value, form.top8c.value, form.top8d.value);
	var toBreak = false;
	for (var i=0; i<nums.length-1; i++) {
		if (toBreak==true) break;	
		for (var j=i+1; j<nums.length; j++) {
			//checks that each field has been filled out
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg2 += "\t8. Une zone est restée vide.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg2 += "\t8. Le même degré d'importance a été attribué à deux éléments.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 4) || (nums[j] < 1) || (nums[j] > 4)) {
				errorMsg2 += "\t8. Un chiffre qui n'est pas compris entre 1 et 4 a été saisi.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
		}
	}
		
	//Q.9.
	if (form.top9[0].checked==false && form.top9[1].checked==false && form.top9[2].checked==false) {
		errorMsg2 += "\t9. Aucune réponse n'a été sélectionnée.\n";
		section2 = "\nSection II:\n";
	}
	
	//Q.10. Make sure that 1-4 was properly filled out.
	var nums = new Array(form.top10a.value, form.top10b.value, form.top10c.value, form.top10d.value);
	var toBreak = false;
	for (var j=i+1; j<nums.length; j++) {
		if (toBreak==true) break;	
		for (var j=i+1; j<nums.length; j++) {
			//checks that each field has been filled out
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg2 += "\t10. Une zone est restée vide.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg2 += "\t10. Le même degré d'importance a été attribué à deux éléments.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 4) || (nums[j] < 1) || (nums[j] > 4)) {
				errorMsg2 += "\t10. Un chiffre qui n'est pas compris entre 1 et 4 a été saisi.\n";
				section2 = "\nSection II:\n";
				toBreak=true;
				break;
			}
		}
	}
	
	//Section III: Tools and Support Material Needs
	//Q.11. Make sure that 1-5 was properly filled out.
	var nums = new Array(form.top11a.value, form.top11b.value, form.top11c.value, form.top11d.value, form.top11e.value);
	var toBreak = false;
	for (var j=i+1; j<nums.length; j++) {
		if (toBreak==true) break;	
		for (var j=i+1; j<nums.length; j++) {
			//checks that each field has been filled out
			if ((nums[i] == "") || (nums[j] == "")) {
				errorMsg3 += "\t11. Une zone est restée vide.\n";
				section3 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is unique
			if (nums[i] == nums[j]) {
				errorMsg3 += "\t11. Le même degré d'importance a été attribué à deux éléments.\n";
				section3 = "\nSection II:\n";
				toBreak=true;
				break;
			}
			// checks that each number is between 1 and 4.
			else if ((nums[i] < 1) || (nums[i] > 5) || (nums[j] < 1) || (nums[j] > 5)) {
				errorMsg3 += "\t11. Un chiffre qui n'est pas compris entre 1 et 5 a été saisi.\n";
				section3 = "\nSection II:\n";
				toBreak=true;
				break;
			}
		}
	}
	
	//Q.12.
	if (form.top12txt.value=="") {
		errorMsg3 += "\t12. Aucune réponse n'a été saisie.\n";
		section3 = "\nSection III:\n";
	}
	
	//Q.13.
	if (form.top13txt.value=="") {
		errorMsg3 += "\t13. Aucune réponse n'a été saisie.\n";
		section3 = "\nSection III:\n";
	}
	
	//check that email is valid if entered
	if (form.email.value != "") {
		if (!isEmail(form.email.value)) {
			errorMsg4 += "Le courriel contient des espaces et/ou des caractères non valides.\n";
			section4 = "\nSection IV:\n";
		}
	}
	
	var errorMsg = "" + section1 + errorMsg1 + section2 + errorMsg2 + section3 + errorMsg3 + section4 + errorMsg4;
	if (errorMsg != "") {
		errorMsg = "Les zones suivantes n'ont pas été remplies adéquatement.\nVeuillez les corriger et essayer de soumettre de nouveau le questionnaire.\n\n" + errorMsg;
		alert(errorMsg);
		return false;
	}
	
	return true;
}

// ******************************************************************
// This function accepts a string variable and verifies if it is in
// the proper format for an e-mail address or not.

// The function returns true if the format is valid, false if not.
// ******************************************************************

function isEmail(email) {
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";

    // Check for null
    if (email == "") {
        return true;
    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
}//end of isEmail

//Cookie functions for OBC comment form

//Task: Check if there is a cookie for the user,
//if there is, use the saved field settings
//else: use blank settings.
function checkCookie()	{

	var name, email, org, title, address, city, province, pcode, phone, fax;

	if (document.cookie == "") { 
		alert("cookie NOT found");	
		name = ""; 
		org = "";
		title= "";
		address = "";
		city = "";
		province = "";
		pcode = "";
		country = "";
		email = "";
		notify = "";
		phone1 = "";
		phone2 = "";
		phone3 = "";
		fax1 = "";
		fax2 = "";
		fax3 = "";
		pref_language = "";
		area1 = "";
		area2 = "";
		area3 = "";
		area4 = "";
		area5 = "";
		area6 = "";
		other = "";
		nbc_button = "";
		nfc_button = "";
		npc_button = "";

	}  else {
		name = readCookie("name");
		org = readCookie("org");
		title = readCookie("title");
		address = readCookie("address");
		city = readCookie("city");
		province = readCookie("province");
		pcode = readCookie("pcode");
		country = readCookie("country");
		notify = readCookie("notify");
		email = readCookie("email");
		phone1 = readCookie("phone1");
		phone2 = readCookie("phone2");
		phone3 = readCookie("phone3");
		fax1 = readCookie("fax1");
		fax2 = readCookie("fax2");
		fax3 = readCookie("fax3");
		pref_language = readCookie("pref_language");
		area1 = readCookie("area1");
		area2 = readCookie("area2");
		area3 = readCookie("area3");
		area4 = readCookie("area4");
		area5 = readCookie("area5");
		area6 = readCookie("area6");
		other = readCookie("other");
		nbc_button = readCookie("nbc_button");
		nfc_button = readCookie("nfc_button");
		npc_button = readCookie("npc_button");
	}
}


//Task: Check if the given field is checked
function isChecked(a){
	var formObj = a;
	var chk = "";
	for (var i = 0; i < formObj.length ; i++) {
		if (formObj[i].checked) {
			chk = formObj[i].value;
		}
	}
	return chk;
}
// ---------------------------------------------------------------------------------
//Task: Check if the given field is selected
function isSelected(a){
	var formObj = a;
	for (var i = 0; i < formObj.length ; i++) {
		if (formObj[i].selected) {
			var selected = formObj[i].value;
		}
	}
	return selected;
}
// ---------------------------------------------------------------------------------
//Task: make a cookie for the user
function writeCookie(form){
	
	var name = form.name.value;
	var title = form.title.value;
	var org = form.organization.value;

	var address = form.address.value;
	var city = form.city.value;
	var province = isSelected(form.province);
	var pcode = form.postal_code.value;
	var country = isSelected(form.country);

	var notify = isChecked(form.notify_button);
		
	var email = form.email.value;
	var phone1 = form.phone_number_1.value;
	var phone2 = form.phone_number_2.value;
	var phone3 = form.phone_number_3.value;

	var fax1 = form.fax_1.value;
	var fax2 = form.fax_2.value;
	var fax3 = form.fax_3.value;
	
	var pref_language = isSelected(form.pref_language);

	var area1 = "";
	var area2 = "";
	var area3 = "";
	var area4 = "";
	var area5 = "";
	var area6 = "";
	
	if (form.area_of_work_1.checked) {
		var area1 = form.area_of_work_1.value;
	} 
	if (form.area_of_work_2.checked) {
		var area2 = form.area_of_work_2.value;
	} 
	if (form.area_of_work_3.checked) {
		var area3 = form.area_of_work_3.value;
	} 
	if (form.area_of_work_4.checked) {
		var area4 = form.area_of_work_4.value;
	} 
	if (form.area_of_work_5.checked) {
		var area5 = form.area_of_work_5.value;
	} 
	if (form.area_of_work_6.checked) {
		var area6 = form.area_of_work_6.value;
	} 

	var other = form.other.value;
		
	var nbc_button = isChecked(form.nbc_button);
	var nfc_button = isChecked(form.nfc_button);
	var npc_button = isChecked(form.npc_button);
	
	document.cookie = "user=name:" + escape(name) + "&org:" + escape(org) + "&title:" + escape(title)  + "&email:" + escape(email)  + "&phone1:" + escape(phone1)+ "&phone2:" + escape(phone2)+ "&phone3:" + escape(phone3)  + "&fax1:" + escape(fax1)  + "&fax2:" + escape(fax2)  + "&fax3:" + escape(fax3)  + "&address:" + escape(address)  + "&city:" + escape(city)  + "&province:" + escape(province)  + "&pcode:" + escape(pcode)  + "&country:" + escape(country) + "&notify:" + escape(notify)+ "&pref_language:" + escape(pref_language) + "&area1:" + escape(area1)+ "&area2:" + escape(area2)+ "&area3:" + escape(area3)+ "&area4:" + escape(area4)+ "&area5:" + escape(area5)+ "&area6:" + escape(area6) + "&other:" + escape(other) + "&nbc_button:" + escape(nbc_button) + "&nfc_button:" + escape(nfc_button) + "&npc_button:" + escape(npc_button) + "; path=/" + "; expires=Thursday, 15-May-2003 00:00:00";
	
	return true;
}
// ---------------------------------------------------------------------------------
//Task: Read the cookie for a specific parameter
function readCookie(g){
	var valueRead = g;

	var value = " ";
	var allCookie = document.cookie;

	var cookieBits = allCookie.split(";");
	var userCookie = cookieBits[0].split("=");

	var cookieUserVal = userCookie[1].split("&");

	for (var i = 0; i < cookieUserVal.length; i++){
		var cookiePair = cookieUserVal[i].split(":");

		if (cookiePair[0] == valueRead){
			value = unescape(cookiePair[1]);
		}
	}

	return value;
}

function provinceField(province) {
	prov_option = new Array();
	prov_option[0]=" ";
	prov_option[1]="Alberta";
	prov_option[2]="British Columbia";
	prov_option[3]="Manitoba";
	prov_option[4]="New Brunswick";
	prov_option[5]="Newfoundland";
	prov_option[6]="Northwest Territories";
	prov_option[7]="Nova Scotia";
	prov_option[8]="Nunavut";
	prov_option[9]="Ontario";
	prov_option[10]="Prince Edward Island";
	prov_option[11]="Quebec";
	prov_option[12]="Saskatchewan";
	prov_option[13]="Yukon Territory";
	prov_option[14]="---------------";
	prov_option[15]="Alabama";
	prov_option[16]="Alaska";
	prov_option[17]="Arizona";
	prov_option[18]="Arkansas";
	prov_option[19]="California";
	prov_option[20]="Colorado";
	prov_option[21]="Connecticut";
	prov_option[22]="Delaware";
	prov_option[23]="District of Columbia";
	prov_option[24]="Florida";
	prov_option[23]="Georgia";
	prov_option[25]="Hawaii";
	prov_option[26]="Idaho";
	prov_option[27]="Illinois";
	prov_option[28]="Indiana";
	prov_option[29]="Iowa";
	prov_option[30]="Kansas";
	prov_option[31]="Kentucky";
	prov_option[32]="Louisiana";
	prov_option[33]="Maine";
	prov_option[34]="Maryland";
	prov_option[35]="Massachusetts";
	prov_option[36]="Michigan";
	prov_option[37]="Minnesota";
	prov_option[38]="Mississippi";
	prov_option[39]="Missouri";
	prov_option[40]="Montana";
	prov_option[41]="Nebraska";
	prov_option[42]="Nevada";
	prov_option[43]="New Hampshire";
	prov_option[44]="New Jersey";
	prov_option[45]="New Mexico";
	prov_option[46]="New York";
	prov_option[47]="North Carolina";
	prov_option[48]="North Dakota";
	prov_option[49]="Ohio";
	prov_option[50]="Oklahoma";
	prov_option[51]="Oregon";
	prov_option[52]="Pennsylvania";
	prov_option[53]="Rhode Island";
	prov_option[54]="South Carolina";
	prov_option[55]="South Dakota";
	prov_option[56]="Tennessee";
	prov_option[57]="Texas";
	prov_option[58]="Utah";
	prov_option[59]="Vermont";
	prov_option[60]="Virginia";
	prov_option[61]="Washington";
	prov_option[62]="West Virginia";
	prov_option[63]="Wisconsin";
	prov_option[64]="Wyoming";
	
	for (var i = 0; i < prov_option.length; i++) {
		var select_mark = "";
		if (prov_option[i] == province) {
			select_mark = " selected";
		}
		document.write("<option value=\""+prov_option[i]+"\" "+ select_mark + ">" + prov_option[i] + "\n");
	}
}

function countryField(country) {
	country_option = new Array();

	country_option[0] ="Canada";
	country_option[1] ="United States";
	country_option[2] = "---------------------";
	country_option[3] = "Afghanistan";
	country_option[4] = "Albania";
	country_option[5] = "Algeria";
	country_option[6] = "American Samoa";
	country_option[7] = "Andorra";
	country_option[8] = "Angola";
	country_option[9] = "Anguilla";
	country_option[10] = "Antarctica";
	country_option[11] = "Antigua and Barbuda";
	country_option[12] = "Argentina";
	country_option[13] = "Armenia";
	country_option[14] = "Aruba";
	country_option[15] = "Australia";
	country_option[16] = "Austria";
	country_option[17] = "Azerbaijan";
	country_option[18] = "Bahamas";
	country_option[19] = "Bahrain";
	country_option[20] = "Bangladesh";
	country_option[21] = "Barbados";
	country_option[22] = "Belarus";
	country_option[23] = "Belgium";
	country_option[24] = "Belize";
	country_option[25] = "Benin";
	country_option[26] = "Bermuda";
	country_option[27] = "Bhutan";
	country_option[28] = "Bolivia";
	country_option[29] = "Bosnia and Herzegovina";
	country_option[30] = "Botswana";
	country_option[31] = "Bouvet Island";
	country_option[32] = "Brazil";
	country_option[33] = "British Indian Ocean Territory";
	country_option[34] = "Brunei";
	country_option[35] = "Bulgaria";
	country_option[36] = "Burkina Faso";
	country_option[37] = "Burundi";
	country_option[38] = "Cambodia";
	country_option[39] = "Cameroon";
	country_option[40] = "Cape Verde";
	country_option[41] = "Cayman Islands";
	country_option[42] = "Central African Republic";
	country_option[43] = "Chad";
	country_option[44] = "Chile";
	country_option[45] = "China";
	country_option[46] = "Christmas Island";
	country_option[47] = "Cocos (Keeling) Islands";
	country_option[48] = "Colombia";
	country_option[49] = "Comoros";
	country_option[50] = "Congo";
	country_option[51] = "Cook Islands";
	country_option[52] = "Costa Rica";
	country_option[53] = "C&ocirc;te d'Ivoire";
	country_option[54] = "Croatia (Hrvatska)";
	country_option[55] = "Cuba";
	country_option[56] = "Cyprus";
	country_option[57] = "Czech Republic";
	country_option[58] = "Congo (DRC)";
	country_option[59] = "Denmark";
	country_option[60] = "Djibouti";
	country_option[61] = "Dominica";
	country_option[62] = "Dominican Republic";
	country_option[63] = "East Timor";
	country_option[64] = "Ecuador";
	country_option[65] = "Egypt";
	country_option[66] = "El Salvador";
	country_option[67] = "Equatorial Guinea";
	country_option[68] = "Eritrea";
	country_option[69] = "Estonia";
	country_option[70] = "Ethiopia";
	country_option[71] = "Falkland Islands (Islas Malvinas)";
	country_option[72] = "Faroe Islands";
	country_option[73] = "Fiji Islands";
	country_option[74] = "Finland";
	country_option[75] = "France";
	country_option[76] = "French Guiana";
	country_option[77] = "French Polynesia";
	country_option[78] = "French Southern and Antarctic Lands";
	country_option[79] = "Gabon";
	country_option[80] = "Gambia";
	country_option[81] = "Georgia";
	country_option[82] = "Germany";
	country_option[83] = "Ghana";
	country_option[84] = "Gibraltar";
	country_option[85] = "Greece";
	country_option[86] = "Greenland";
	country_option[87] = "Grenada";
	country_option[88] = "Guadeloupe";
	country_option[89] = "Guam";
	country_option[90] = "Guatemala";
	country_option[91] = "Guinea";
	country_option[92] = "GuineaBissau";
	country_option[93] = "Guyana";
	country_option[94] = "Haiti";
	country_option[95] = "Heard Island and McDonald Islands";
	country_option[96] = "Honduras";
	country_option[97] = "Hong Kong SAR";
	country_option[98] = "Hungary";
	country_option[99] = "Iceland";
	country_option[100] = "India";
	country_option[101] = "Indonesia";
	country_option[102] = "Iran";
	country_option[103] = "Iraq";
	country_option[104] = "Ireland";
	country_option[105] = "Israel";
	country_option[106] = "Italy";
	country_option[107] = "Jamaica";
	country_option[109] = "Japan";
	country_option[110] = "Jordan";
	country_option[111] = "Kazakhstan";
	country_option[112] = "Kenya";
	country_option[113] = "Kiribati";
	country_option[114] = "Korea";
	country_option[115] = "Kuwait";
	country_option[116] = "Kyrgyzstan";
	country_option[117] = "Laos";
	country_option[118] = "Latvia";
	country_option[119] = "Lebanon";
	country_option[120] = "Lesotho";
	country_option[121] = "Liberia";
	country_option[122] = "Libya";
	country_option[123] = "Liechtenstein";
	country_option[124] = "Lithuania";
	country_option[125] = "Luxembourg";
	country_option[126] = "Macau SAR";
	country_option[127] = "Macedonia Former Yugoslav Republic of";
	country_option[128] = "Madagascar";
	country_option[129] = "Malawi";
	country_option[130] = "Malaysia";
	country_option[131] = "Maldives";
	country_option[132] = "Mali";
	country_option[133] = "Malta";
	country_option[134] = "Marshall Islands";
	country_option[135] = "Martinique";
	country_option[136] = "Mauritania";
	country_option[137] = "Mauritius";
	country_option[138] = "Mayotte";
	country_option[139] = "Mexico";
	country_option[140] = "Micronesia";
	country_option[141] = "Moldova";
	country_option[142] = "Monaco";
	country_option[143] = "Mongolia";
	country_option[144] = "Montserrat";
	country_option[145] = "Morocco";
	country_option[146] = "Mozambique";
	country_option[147] = "Myanmar";
	country_option[148] = "Namibia";
	country_option[149] = "Nauru";
	country_option[150] = "Nepal";
	country_option[151] = "Netherlands";
	country_option[152] = "Netherlands Antilles";
	country_option[153] = "New Caledonia";
	country_option[154] = "New Zealand";
	country_option[155] = "Nicaragua";
	country_option[156] = "Niger";
	country_option[157] = "Nigeria";
	country_option[158] = "Niue";
	country_option[159] = "Norfolk Island";
	country_option[160] = "North Korea";
	country_option[161] = "Northern Mariana Islands";
	country_option[162] = "Norway";
	country_option[163] = "Oman";
	country_option[164] = "Pakistan";
	country_option[165] = "Palau";
	country_option[166] = "Panama";
	country_option[167] = "Papua New Guinea";
	country_option[168] = "Paraguay";
	country_option[169] = "Peru";
	country_option[170] = "Philippines";
	country_option[171] = "Pitcairn Islands";
	country_option[172] = "Poland";
	country_option[173] = "Portugal";
	country_option[174] = "Puerto Rico";
	country_option[175] = "Qatar";
	country_option[176] = "Reunion";
	country_option[177] = "Romania";
	country_option[178] = "Russia";
	country_option[179] = "Rwanda";
	country_option[180] = "St. Kitts and Nevis";
	country_option[181] = "St. Lucia";
	country_option[182] = "St. Vincent and the Grenadines";
	country_option[183] = "Samoa";
	country_option[184] = "San Marino";
	country_option[185] = "São Tom&eacute; and Pr&iacute;ncipe";
	country_option[186] = "Saudi Arabia";
	country_option[187] = "Senegal";
	country_option[188] = "Seychelles";
	country_option[189] = "Sierra Leone";
	country_option[190] = "Singapore";
	country_option[191] = "Slovakia";
	country_option[192] = "Slovenia";
	country_option[193] = "Solomon Islands";
	country_option[194] = "Somalia";
	country_option[195] = "South Africa";
	country_option[196] = "South Georgia";
	country_option[197] = "Spain";
	country_option[198] = "Sri Lanka";
	country_option[199] = "St. Helena";
	country_option[200] = "St. Pierre and Miquelon";
	country_option[201] = "Sudan";
	country_option[202] = "Suriname";
	country_option[203] = "Svalbard and Jan Mayen";
	country_option[204] = "Swaziland";
	country_option[205] = "Sweden";
	country_option[206] = "Switzerland";
	country_option[207] = "Syria";
	country_option[208] = "Taiwan";
	country_option[209] = "Tajikistan";
	country_option[210] = "Tanzania";
	country_option[211] = "Thailand";
	country_option[212] = "Togo";
	country_option[213] = "Tokelau";
	country_option[214] = "Tonga";
	country_option[215] = "Trinidad and Tobago";
	country_option[216] = "Tunisia";
	country_option[217] = "Turkey";
	country_option[218] = "Turkmenistan";
	country_option[219] = "Turks and Caicos Islands";
	country_option[220] = "Tuvalu";
	country_option[221] = "Uganda";
	country_option[222] = "Ukraine";
	country_option[223] = "United Arab Emirates";
	country_option[224] = "United Kingdom";
	country_option[225] = "United States Minor Outlying Islands";
	country_option[226] = "Uruguay";
	country_option[227] = "Uzbekistan";
	country_option[228] = "Vanuatu";
	country_option[229] = "Vatican City";
	country_option[230] = "Venezuela";
	country_option[231] = "Viet Nam";
	country_option[232] = "Virgin Islands (British)";
	country_option[233] = "Virgin Islands";
	country_option[234] = "Wallis and Futuna";
	country_option[235] = "Yemen";
	country_option[236] = "Yugoslavia";
	country_option[237] = "Zambia";
	country_option[238] = "Zimbabwe";

	for (var i = 0; i < country_option.length; i++) {
		var select_mark = "";
		if (country_option[i] == country) {
			select_mark = " selected";
		}
		document.write("<option value=\""+country_option[i]+ "\" "+ select_mark + ">" + country_option[i] + "\n");
	}
}

//-->
