
<!--

var newWindow = null;

function closeWin(){
    if (newWindow != null){
        if(!newWindow.closed)
            newWindow.close();
    }
}

function popUpWin(url, type, strWidth, strHeight){
   
    // closeWin();
   
    if (type == "fullScreen"){
        strWidth = screen.availWidth - 10;
        strHeight = screen.availHeight - 160;
    }
   
    var tools="";
    if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
    if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
    newWindow = window.open(url, 'newWin', tools);
    newWindow.focus();
}

function showDescription(id) {
	if(ns4){
		document.layers[id].visibility = "show";
		document.layers[id].zindex = 99;
	}
	else if(ie4){
		document.all[id].style.visibility = "visible";
		document.all[id].style.zindex = 99;
	}
	else{
		document.getElementById(id).style.visibility = "visible";
		document.getElementById(id).style.zindex = 99;
	}
}

function hideDescription(id) {
	if(ns4){
		document.layers[id].style.visibility = "hidden";
	}
	else if(ie4){
		document.all[id].style.visibility = "hidden";
	}
	else{
		document.getElementById(id).style.visibility = "hidden";
	}
}

function check_volunteer_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("first_name", "last_name", "email", "postalcode1", "postalcode2", "skills", "new_skills", "gain", "interests");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "E-Mail", "Postal Code Part 1", "Postal Code Part 2", "Skills you have", "Skills to develop", "What you hope to gain", "Interests");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	

	// Phone number validation
	var fieldPhone = Array("phone_h","phone_w","phone_c");
	var fieldPhoneDescription = Array("Phone","Work Phone","Cell Phone");
	var alertMsgPhone1 = "Please supply at least one phone number : ";
	var alertMsgPhone = '';
	var l_MsgPhone = alertMsgPhone.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	// Validate phone numbers
	var phone_found = 0;
	for (var i = 0; i < fieldPhone.length; i++){
		var obj = formobj.elements[fieldPhone[i]];
		if (obj.value != '') {
			phone_found = 1;
		}		
	}
	if (phone_found == 0) {
		alertMsgPhone = alertMsgPhone1;
	}

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		if (alertMsgPhone.length != l_MsgPhone){
			alert(alertMsgPhone);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


function check_linkrequest_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("link_url", "link_info", "first_name", "last_name", "email", "phone_w");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("URL", "Type of Information", "First Name", "Last Name", "E-Mail", "Telephone Number");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function check_media_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("first_name", "last_name", "publication", "email", "phone_w");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "Publication/Station", "E-Mail", "Telephone Number");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


function check_contact_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("first_name", "last_name", "email", "a1", "city", "province", "postalcode1", "postalcode2");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "E-Mail", "Address 1", "City", "Province", "Postal Code Part 1", "Postal Code Part 2");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	

	// Phone number validation
	var fieldPhone = Array("phone_h","phone_w","phone_c");
	var fieldPhoneDescription = Array("Phone","Work Phone","Cell Phone");
	var alertMsgPhone1 = "Please supply at least one phone number : ";
	var alertMsgPhone = '';
	var l_MsgPhone = alertMsgPhone.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	// Validate email addresses
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	// Validate phone numbers
	var phone_found = 0;
	for (var i = 0; i < fieldPhone.length; i++){
		var obj = formobj.elements[fieldPhone[i]];
		if (obj.value != '') {
			phone_found = 1;
		}		
	}
	if (phone_found == 0) {
		alertMsgPhone = alertMsgPhone1;
	}

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		if (alertMsgPhone.length != l_MsgPhone){
			alert(alertMsgPhone);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function check_submit_listing_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("event_listing", "event_description", "first_name", "last_name", "email", "phone_w");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Event Listing", "Event Description", "First Name", "Last Name", "E-Mail", "Phone Number" );
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

function check_copyright_form(formobj){
	//1) Enter name of manditory fields.
	var fieldRequired = Array("first_name", "last_name", "email", "a1", "city", "province", "postalcode1", "postalcode2", "copyright_what", "copyright_how", "copyright_how_many", "copyright_when", "copyright_to_whom");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "E-Mail", "Address 1", "City", "Province", "Postal Code Part 1", "Postal Code Part 2", "What do you wish to copy?", "How do you wish to use this material?", "How many copies will you distribute?", "Over what period of time will this material be distributed?", "To whom will you distribute the material?");
	//3) Enter dialog message
	var alertMsg = "Please complete the following field(s):\n";
	var l_Msg = alertMsg.length;
		
	// Email address validation
	var fieldEmail = Array("email");
	var fieldEmailDescription = Array("E-Mail");
	var alertMsgEmail1 = "Invalid E-Mail Address : ";
	var alertMsgEmail2 = "Please complete the following field(s):\n";
	var alertMsgEmail = '';
	var l_MsgEmail = alertMsgEmail.length;	
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
					
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				// Radio and Checkboxes
				rc = false;
				for (var j = 0; j < obj.length; j++) {
					if (obj[j].checked) {
						rc = true;
						break;
					}
				}
				if (!rc) {
					alertMsg += " - " + fieldDescription[i] + "\n";				
				}			

			}
		}
	}
	
	for (var i = 0; i < fieldEmail.length; i++){
		var obj = formobj.elements[fieldEmail[i]];
		alertMsgEmail += validate_email(obj.value);		
	}	

	if (alertMsg.length == l_Msg){
		if (alertMsgEmail.length != l_MsgEmail){
			alert(alertMsgEmail);
			return false;		
		}
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


function validate_email(_email_) {

var _msg = '';
var alertMsgEmail1 = "Invalid E-Mail Address : ";

	// Must contain a '@'
	 if( _email_.indexOf("@") == -1 ){
		_msg = alertMsgEmail1 + _email_ + "\n";
	// The @ symbol can not be the first character of an e-mail address.
	} else if( _email_.indexOf("@") == 0 ){
		_msg = alertMsgEmail1 + _email_ + "\n";
	// An e-mail address must contain at least one period after the @ symbol.
	} else if( _email_.substring(_email_.indexOf("@")+2).indexOf(".") == -1 ){
		_msg = alertMsgEmail1 + _email_ + "\n";
	// The @ symbol can not be the last character of an e-mail address.
	} else if( _email_.lastIndexOf("@") == _email_.length-1 ){
		_msg = alertMsgEmail1 + _email_ + "\n";
	// A period can not be the last character of an e-mail address.
	} else if( _email_.lastIndexOf(".") == _email_.length-1 ){
		_msg = alertMsgEmail1 + _email_ + "\n";
	}
	
	return _msg;
}

function check_vpc(formobj)
{

	pcode1 = formobj.elements['pcode1'];
	pcode2 = formobj.elements['pcode2'];


	if ((pcode1.value != "" && pcode1.value != null) || (pcode2.value != "" && pcode2.value != null)){

		//alert(pcode1);
		//alert(pcode1.value);
		rc1 = pcode1.value.search(/^[a-z][0-9][a-z]$/i);
		rc2 = pcode2.value.search(/^[0-9][a-z][0-9]$/i);
		if (rc1 == -1 || rc2 == -1) {
			alert("Please ensure your postal is in a valid format: A1B 2C3.");
			return false;
		} else {
			return true;
		}
	}
}


isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;

if (isIE||isNN){
document.oncontextmenu=checkV;
}else{
document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=checkV;}

function checkV(e){
if (isN4){
if (e.which==2||e.which==3){
//dPUW=window.open(PopUpURL,'nrc',popO);
return false;
}}else{
//dPUW=window.open(PopUpURL,'nrc',popO);
return false;}}

-->