

function VF_add_operator(){ //v2.0
	var theForm = document.forms['add_operator'];
	var sFlg_f_region_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s1=0;s1<theForm['f_region_id'].length;s1++){if(theForm['f_region_id'].options[s1].selected){if(theForm['f_region_id'].options[s1].text==theForm['f_region_id'].options[0].text)sFlg_f_region_id=true;}}

	if (theForm['f_description'].value == ""){
		errMsg = "Please enter a description of your operation";
		setfocus = "['f_description']";
	}
	if (theForm['f_email'].value == ""){
		errMsg = "Please enter your email address";
		setfocus = "['f_email']";
	}
	if (theForm['f_phone'].value == ""){
		errMsg = "Please enter a phone number";
		setfocus = "['f_phone']";
	}
	if (theForm['f_address_1'].value == ""){
		errMsg = "Please enter your address";
		setfocus = "['f_address_1']";
	}
	if (theForm['f_last_name'].value == ""){
		errMsg = "Please enter the last name of the contact person";
		setfocus = "['f_last_name']";
	}
	if (theForm['f_first_name'].value == ""){
		errMsg = "Please enter the first name of the contact person";
		setfocus = "['f_first_name']";
	}
	if (theForm['f_organisation'].value == ""){
		errMsg = "Please enter the name of your organisation";
		setfocus = "['f_organisation']";
	}
	if (sFlg_f_region_id){
		errMsg = "Please select a region";
		setfocus = "['f_region_id']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_tell_friend(){ 
	var theForm = document.forms['tell_friend'];
	var emailRE = /(@\w[-._\w]*\w\.\w+)$/;
	var errMsg = "";
	var setfocus = "";

	if (!emailRE.test(theForm['tomail'].value)){
		errMsg = "Please enter your friend\'s email address";
		setfocus = "['tomail']";
	}
	if (!emailRE.test(theForm['frommail'].value)){
		errMsg = "Please enter your email address";
		setfocus = "['frommail']";
	}
	if (theForm['fromname'].value == ""){
		errMsg = "Please enter your name";
		setfocus = "['fromname']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_Feedback(){ 

	var theForm = document.forms['Feedback'];
	var emailRE = /(@\w[-._\w]*\w\.\w+)$/;
	var errMsg = "";
	var setfocus = "";

	if (theForm['f_query'].value == ""){
		errMsg = "Please enter your query";
		setfocus = "['f_query']";
	}
	if (!emailRE.test(theForm['f_email'].value)){
		errMsg = "Please enter a valid email address";
		setfocus = "['f_email']";
	}
	if (theForm['f_name'].value == ""){
		errMsg = "Please enter your name";
		setfocus = "['f_name']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_add_feature(){ 

	var theForm = document.forms['add_feature'];
	var errMsg = "";
	var setfocus = "";

	if (theForm['f_feature'].value == ""){
		errMsg = "Please enter a feature";
		setfocus = "['f_feature']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function formtool_count_chars(textField, countField, maxlen,show_alert) {
    if(textField != null && textField.value != null) {
	    if (textField.value.length > maxlen){
            if(show_alert)
               alert('This field cannot exceed ' +  maxlen + ' characters.');
            textField.value = textField.value.substring(0, maxlen);
	    } else {
            countField.value = maxlen - textField.value.length;
	    }
    }
}

function VF_admin_operator(){ //v2.0

	var theForm = document.forms['admin_operator'];
	var sFlg_f_region_id = false;
	var sFlg_f_cat_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s1=0;s1<theForm['f_region_id'].length;s1++){if(theForm['f_region_id'].options[s1].selected){if(theForm['f_region_id'].options[s1].text==theForm['f_region_id'].options[0].text)sFlg_f_region_id=true;}}
	for(var s0=0;s0<theForm['f_cat_id'].length;s0++){if(theForm['f_cat_id'].options[s0].selected){if(theForm['f_cat_id'].options[s0].text==theForm['f_cat_id'].options[0].text)sFlg_f_cat_id=true;}}

	if (theForm['f_description'].value == ""){
		errMsg = "Please enter a description of your organisation";
		setfocus = "['f_description']";
	}
	if (theForm['f_phone'].value == ""){
		errMsg = "Please enter the phone number";
		setfocus = "['f_phone']";
	}
	if (theForm['f_address_1'].value == ""){
		errMsg = "Please enter an Address";
		setfocus = "['f_address_1']";
	}
	if (theForm['f_contact'].value == ""){
		errMsg = "Please enter a Contact Name";
		setfocus = "['f_contact']";
	}
	if (theForm['f_organisation'].value == ""){
		errMsg = "Please enter the name of your Organisation";
		setfocus = "['f_organisation']";
	}
	if (sFlg_f_region_id){
		errMsg = "Please select a Region";
		setfocus = "['f_region_id']";
	}
	if (sFlg_f_cat_id){
		errMsg = "Please select a Category";
		setfocus = "['f_cat_id']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function currency() 
{popup = window.open("http://www.actionweb.co.nz/currency.htm","POPUP", "status=no,toolbar=no,location=no,scrollbars=yes,width=600,height=400");
}	

function VF_sel_times(){ //v2.0

	var theForm = document.forms['sel_times'];
	var sFlg_f_start_year = false;
	var sFlg_f_start_month = false;
	var sFlg_f_start_day = false;
	var errMsg = "";
	var setfocus = "";

	for(var s2=0;s2<theForm['f_start_year'].length;s2++){if(theForm['f_start_year'].options[s2].selected){if(theForm['f_start_year'].options[s2].text==theForm['f_start_year'].options[0].text)sFlg_f_start_year=true;}}
	for(var s1=0;s1<theForm['f_start_month'].length;s1++){if(theForm['f_start_month'].options[s1].selected){if(theForm['f_start_month'].options[s1].text==theForm['f_start_month'].options[0].text)sFlg_f_start_month=true;}}
	for(var s0=0;s0<theForm['f_start_day'].length;s0++){if(theForm['f_start_day'].options[s0].selected){if(theForm['f_start_day'].options[s0].text==theForm['f_start_day'].options[0].text)sFlg_f_start_day=true;}}

	if (sFlg_f_start_year){
		errMsg = "Please enter a start year";
		setfocus = "['f_start_year']";
	}
	if (sFlg_f_start_month){
		errMsg = "Pldease enter a start month";
		setfocus = "['f_start_month']";
	}
	if (sFlg_f_start_day){
		errMsg = "Please enter a start day";
		setfocus = "['f_start_day']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}


function VF_editsession(){ //v2.0

	var theForm = document.forms['editsession'];
	var sFlg_f_start_year = false;
	var sFlg_f_start_month = false;
	var sFlg_f_start_day = false;
	var errMsg = "";
	var setfocus = "";

	for(var s11=0;s11<theForm['f_start_year'].length;s11++){if(theForm['f_start_year'].options[s11].selected){if(theForm['f_start_year'].options[s11].text==theForm['f_start_year'].options[0].text)sFlg_f_start_year=true;}}
	for(var s10=0;s10<theForm['f_start_month'].length;s10++){if(theForm['f_start_month'].options[s10].selected){if(theForm['f_start_month'].options[s10].text==theForm['f_start_month'].options[0].text)sFlg_f_start_month=true;}}
	for(var s9=0;s9<theForm['f_start_day'].length;s9++){if(theForm['f_start_day'].options[s9].selected){if(theForm['f_start_day'].options[s9].text==theForm['f_start_day'].options[0].text)sFlg_f_start_day=true;}}

	if (sFlg_f_start_year){
		errMsg = "Please enter a start year";
		setfocus = "['f_start_year']";
	}
	if (sFlg_f_start_month){
		errMsg = "Please enter a start month";
		setfocus = "['f_start_month']";
	}
	if (sFlg_f_start_day){
		errMsg = "Plese enter a start day";
		setfocus = "['f_start_day']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}



function VF_submitFeed(){ //v2.0

	var theForm = document.forms['submitFeed'];
	var rFlg_an3 = false;
	var rFlg_an2 = false;
	var rFlg_an1 = false;
	var errMsg = "";
	var setfocus = "";

	for(var r2=0;r2<theForm['an3'].length;r2++){if(theForm['an3'][r2].checked)rFlg_an3=true;}
	for(var r1=0;r1<theForm['an2'].length;r1++){if(theForm['an2'][r1].checked)rFlg_an2=true;}
	for(var r0=0;r0<theForm['an1'].length;r0++){if(theForm['an1'][r0].checked)rFlg_an1=true;}

	if (!rFlg_an3){
		errMsg = "Please select an answer for question 3";
		setfocus = "['an3'][0]";
	}
	if (!rFlg_an2){
		errMsg = "Please select an answer for question 2";
		setfocus = "['an2'][0]";
	}
	if (!rFlg_an1){
		errMsg = "Please select an answer for question 1";
		setfocus = "['an1'][0]";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}
function VF_add_comp(){ //v2.0
	var theForm = document.forms['add_comp'];
	var sFlg_f_comp_area_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s0=0;s0<theForm['f_comp_area_id'].length;s0++){if(theForm['f_comp_area_id'].options[s0].selected){if(theForm['f_comp_area_id'].options[s0].text==theForm['f_comp_area_id'].options[0].text)sFlg_f_comp_area_id=true;}}

	if (theForm['f_competency'].value == ""){
		errMsg = "Please enter the description of the Context";
		setfocus = "['f_competency']";
	}
	if (theForm['f_comp_seq'].value == ""){
		errMsg = "Please enter the Context Number";
		setfocus = "['f_comp_seq']";
	}
	if (sFlg_f_comp_area_id){
		errMsg = "Please select a Unit";
		setfocus = "['f_comp_area_id']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_add_venue(){ //v2.0
	var theForm = document.forms['add_venue'];
	var sFlg_f_v_city_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s4=0;s4<theForm['f_v_city_id'].length;s4++){if(theForm['f_v_city_id'].options[s4].selected){if(theForm['f_v_city_id'].options[s4].text==theForm['f_v_city_id'].options[0].text)sFlg_f_v_city_id=true;}}

	if (sFlg_f_v_city_id){
		errMsg = "Please select a city";
		setfocus = "['f_v_city_id']";
	}
	if (theForm['f_venue'].value == ""){
		errMsg = "Please add a venue";
		setfocus = "['f_venue']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_edit_venue(){ //v2.0
	var theForm = document.forms['edit_venue'];
	var sFlg_f_v_city_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s4=0;s4<theForm['f_v_city_id'].length;s4++){if(theForm['f_v_city_id'].options[s4].selected){if(theForm['f_v_city_id'].options[s4].text==theForm['f_v_city_id'].options[0].text)sFlg_f_v_city_id=true;}}

	if (sFlg_f_v_city_id){
		errMsg = "Please select a City";
		setfocus = "['f_v_city_id']";
	}
	if (theForm['f_venue'].value == ""){
		errMsg = "Please enter a Venue";
		setfocus = "['f_venue']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}



function VF_add_prov(){ //v2.0

	var theForm = document.forms['add_prov'];
	var emailRE = /(@\w[-._\w]*\w\.\w+)$/;
	var errMsg = "";
	var setfocus = "";

	if (!emailRE.test(theForm['f_email'].value)){
		errMsg = "Please enter a valid email address";
		setfocus = "['f_email']";
	}
	if (theForm['f_phone'].value == ""){
		errMsg = "Please enter the Provider\'s phone number";
		setfocus = "['f_phone']";
	}
	if (theForm['f_provider'].value == ""){
		errMsg = "Please enter the name of the Provider";
		setfocus = "['f_provider']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_edit_custom(){ //v2.0
<!--start_of_saved_settings-->
<!--type,text,name,f&under;presname,required,true,errMsg,Please&space;provide&space;the&space;Presenter&sright;s&space;Name-->
<!--type,textarea,name,f&under;event&under;name,required,true,errMsg,Please&space;provide&space;a&space;name&space;for&space;the&space;Event-->
<!--type,select,name,f&under;event&under;type,isDefault,errMsg,Please&space;select&space;the&space;Event&space;Type-->
<!--type,radio-g,name,f&under;event&under;action,isChecked,errMsg,Please&space;Approve&space;or&space;Reject&space;this&space;Custom&space;Event-->
<!--end_of_saved_settings-->
	var theForm = document.forms['edit_custom'];
	var sFlg_f_event_type = false;
	var rFlg_f_event_action = false;
	var errMsg = "";
	var setfocus = "";

	for(var s2=0;s2<theForm['f_event_type'].length;s2++){if(theForm['f_event_type'].options[s2].selected){if(theForm['f_event_type'].options[s2].text==theForm['f_event_type'].options[0].text)sFlg_f_event_type=true;}}
	for(var r1=0;r1<theForm['f_event_action'].length;r1++){if(theForm['f_event_action'][r1].checked)rFlg_f_event_action=true;}

	if (theForm['f_presname'].value == ""){
		errMsg = "Please provide the Presenter\'s Name";
		setfocus = "['f_presname']";
	}
	if (theForm['f_event_name'].value == ""){
		errMsg = "Please provide a name for the Event";
		setfocus = "['f_event_name']";
	}
	if (sFlg_f_event_type){
		errMsg = "Please select the Event Type";
		setfocus = "['f_event_type']";
	}
	if (!rFlg_f_event_action){
		errMsg = "Please Approve or Reject this Custom Event";
		setfocus = "['f_event_action'][0]";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_admineditevent(){ //v2.0
<!--start_of_saved_settings-->
<!--type,text,name,f&under;reg&under;phone,required,true,errMsg,Please&space;enter&space;a&space;phone&space;number&space;for&space;the&space;Registration&space;Contact-->
<!--type,text,name,f&under;reg&under;contact,required,true,errMsg,Please&space;enter&space;a&space;contact&space;for&space;the&space;Event-->
<!--type,textarea,name,f&under;event&under;description,required,true,errMsg,Please&space;enter&space;a&space;description&space;for&space;the&space;Event-->
<!--type,radio-g,name,f&under;event&under;action,isChecked,errMsg,Please&space;select&space;an&space;Action&space;for&space;the&space;Event-->
<!--type,text,name,f&under;points,required,true,errMsg,Please&space;enter&space;points&space;for&space;the&space;Event-->
<!--type,text,name,f&under;title,required,true,errMsg,Please&space;enter&space;a&space;name&space;for&space;the&space;Event-->
<!--end_of_saved_settings-->
	var theForm = document.forms['admineditevent'];
	var rFlg_f_event_action = false;
	var errMsg = "";
	var setfocus = "";

	for(var r2=0;r2<theForm['f_event_action'].length;r2++){if(theForm['f_event_action'][r2].checked)rFlg_f_event_action=true;}

	if (theForm['f_reg_phone'].value == ""){
		errMsg = "Please enter a phone number for the Registration Contact";
		setfocus = "['f_reg_phone']";
	}
	if (theForm['f_reg_contact'].value == ""){
		errMsg = "Please enter a contact for the Event";
		setfocus = "['f_reg_contact']";
	}
	if (theForm['f_event_description'].value == ""){
		errMsg = "Please enter a description for the Event";
		setfocus = "['f_event_description']";
	}
	if (!rFlg_f_event_action){
		errMsg = "Please select an Action for the Event";
		setfocus = "['f_event_action'][0]";
	}
	if (theForm['f_points'].value == ""){
		errMsg = "Please enter points for the Event";
		setfocus = "['f_points']";
	}
	if (theForm['f_title'].value == ""){
		errMsg = "Please enter a name for the Event";
		setfocus = "['f_title']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_non_event(){ //v2.0
<!--start_of_saved_settings-->
<!--type,radio-g,name,f&under;event&under;action,isChecked,errMsg,Please&space;select&space;an&space;action-->
<!--end_of_saved_settings-->
	var theForm = document.forms['non_event'];
	var rFlg_f_event_action = false;
	var errMsg = "";
	var setfocus = "";

	for(var r0=0;r0<theForm['f_event_action'].length;r0++){if(theForm['f_event_action'][r0].checked)rFlg_f_event_action=true;}

	if (!rFlg_f_event_action){
		errMsg = "Please select an action";
		setfocus = "['f_event_action'][0]";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}




function jumper(selectList) {
	urlAppend = selectList.options[selectList.selectedIndex].value;
	selectList.form.reset();
	document.location = urlAppend;
}
function VF_edit_profile(){ //v2.0

	var theForm = document.forms['edit_profile'];
	var emailRE = /(@\w[-._\w]*\w\.\w+)$/;
	var sFlg_f_city_id = false;
	var errMsg = "";
	var setfocus = "";

	for(var s10=0;s10<theForm['f_city_id'].length;s10++){if(theForm['f_city_id'].options[s10].selected){if(theForm['f_city_id'].options[s10].text==theForm['f_city_id'].options[0].text)sFlg_f_city_id=true;}}

	if (sFlg_f_city_id){
		errMsg = "Please select a city for your Street Address";
		setfocus = "['f_city_id']";
	}
	if (!emailRE.test(theForm['f_email'].value)){
		errMsg = "Please enter a valid email address";
		setfocus = "['f_email']";
	}
	if (theForm['f_phone'].value == ""){
		errMsg = "Please enter your phone number";
		setfocus = "['f_phone']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function VF_add_non_event(){ //v2.0

	var theForm = document.forms['add_non_event'];
	var sFlg_f_event_type = false;
	var errMsg = "";
	var setfocus = "";

	for(var s0=0;s0<theForm['f_event_type'].length;s0++){if(theForm['f_event_type'].options[s0].selected){if(theForm['f_event_type'].options[s0].text==theForm['f_event_type'].options[0].text)sFlg_f_event_type=true;}}

	if (theForm['f_outline'].value == ""){
		errMsg = "Please enter a description of the Event";
		setfocus = "['f_outline']";
	}
	if (theForm['f_presname'].value == ""){
		errMsg = "Please enter the name of the Presenter\(s\)";
		setfocus = "['f_presname']";
	}
	if (theForm['f_event_name'].value == ""){
		errMsg = "Please enter the Name of the Event";
		setfocus = "['f_event_name']";
	}
	if (sFlg_f_event_type){
		errMsg = "Please select an Event Type";
		setfocus = "['f_event_type']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}



function VF_prov_feedback(){ //v2.0
	var theForm = document.forms['prov_feedback'];
	var rFlg_an3 = false;
	var rFlg_an2 = false;
	var rFlg_an1 = false;
	var errMsg = "";
	var setfocus = "";

	for(var r2=0;r2<theForm['an3'].length;r2++){if(theForm['an3'][r2].checked)rFlg_an3=true;}
	for(var r1=0;r1<theForm['an2'].length;r1++){if(theForm['an2'][r1].checked)rFlg_an2=true;}
	for(var r0=0;r0<theForm['an1'].length;r0++){if(theForm['an1'][r0].checked)rFlg_an1=true;}

	if (!rFlg_an3){
		errMsg = "Please select an answer for Q3";
		setfocus = "['an3'][0]";
	}
	if (!rFlg_an2){
		errMsg = "Please select an answer for Q2";
		setfocus = "['an2'][0]";
	}
	if (!rFlg_an1){
		errMsg = "Please select an answer for Q1";
		setfocus = "['an1'][0]";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}
function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}
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 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_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_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 winOpen(url) {
window.open(
	url,
	'popup',
	'width=500,height=500,scrollbars=1,'
);
}


function VF_edit_user(){ //v2.0
	var theForm = document.forms['edit_user'];
	var errMsg = "";
	var setfocus = "";

	if (theForm['f_password2'].value == "" || (theForm['f_password2'].value != theForm['f_password'].value)){
		errMsg = "The second password differs from the first\. Please re\-enter";
		setfocus = "['f_password2']";
	}
	if (theForm['f_password'].value.length < 6 || theForm['f_password'].value.length > 100){
		errMsg = "Please enter a password of at least 6 characters or numbers";
		setfocus = "['f_password']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

