function nav ( navpage, selectedform ) { myformname = document.getElementById(selectedform); myformname.page.value = navpage; myformname.submit(); } function populateoptdays() { var programid = document.progreg.program_id; // Clear out the list of member_reg_type ClearOptions(document.progreg.prog_opt_days); if (programid[programid.selectedIndex].value == 1) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 1) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 1) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } if (programid[programid.selectedIndex].value == 2) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 2) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 3) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 3) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 4) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 4) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 5) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 5) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 6) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 6) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 8) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 8) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 15) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 15) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 15) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } if (programid[programid.selectedIndex].value == 16) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 16) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 18) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 18) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 23) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 23) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 23) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } if (programid[programid.selectedIndex].value == 24) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 24) { AddToOptionList(document.progreg.prog_opt_days, "0", "No Elective Days"); } if (programid[programid.selectedIndex].value == 25) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 25) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 25) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } if (programid[programid.selectedIndex].value == 26) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 26) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 26) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } if (programid[programid.selectedIndex].value == 27) { AddToOptionList(document.progreg.prog_opt_days, "", "Select Elective Day"); } if (programid[programid.selectedIndex].value == 27) { AddToOptionList(document.progreg.prog_opt_days, "3", "Tuesday"); } if (programid[programid.selectedIndex].value == 27) { AddToOptionList(document.progreg.prog_opt_days, "5", "Thursday"); } } function populatememtypes() { var memtypes1 = document.display.display1; // Clear out the list of member_reg_type ClearOptions(document.display.display2); if (memtypes1[memtypes1.selectedIndex].value == 2) { AddToOptionList(document.display.display2, "", "All"); AddToOptionList(document.display.display2, "FIS-A", "FIS-Alpine"); AddToOptionList(document.display.display2, "E", "E-NGSL"); AddToOptionList(document.display.display2, "K1", "K1"); AddToOptionList(document.display.display2, "K2", "K2"); AddToOptionList(document.display.display2, "GM", "General Member"); AddToOptionList(document.display.display2, "CO", "Coach"); } if (memtypes1[memtypes1.selectedIndex].value == 3) { AddToOptionList(document.display.display2, "", "All"); AddToOptionList(document.display.display2, "NGSL Sun", "NGSL Sunday"); AddToOptionList(document.display.display2, "KSTAR Sun", "KStar Sunday"); AddToOptionList(document.display.display2, "K1", "Kinder - 1"); AddToOptionList(document.display.display2, "K2", "Kinder - 2"); AddToOptionList(document.display.display2, "VST", "Vancouver Ski Team"); AddToOptionList(document.display.display2, "TNT", "Tuesday Night Adult Training"); AddToOptionList(document.display.display2, "CD", "Coaching Development"); AddToOptionList(document.display.display2, "NGSL+", "NGSL Plus"); AddToOptionList(document.display.display2, "KSTAR+", "KStar Plus"); AddToOptionList(document.display.display2, "TNT+", "Thursday Night Adult Training"); AddToOptionList(document.display.display2, "NGSL Sat", "NGSL Saturday"); AddToOptionList(document.display.display2, "KSTAR Sat", "KStar Saturday"); AddToOptionList(document.display.display2, "MTNSTAR Sat", "MountainStar Saturday"); AddToOptionList(document.display.display2, "MTNSTAR+", "MountainStar Plus"); AddToOptionList(document.display.display2, "MTNSTAR Sun", "MountainStar Sunday"); } if (memtypes1[memtypes1.selectedIndex].value == 4) { AddToOptionList(document.display.display2, "", "All"); AddToOptionList(document.display.display2, "1", "Communications"); AddToOptionList(document.display.display2, "2", "Social Events"); AddToOptionList(document.display.display2, "3", "Finance/Marketing"); AddToOptionList(document.display.display2, "4", "Membership"); AddToOptionList(document.display.display2, "5", "Parent Coordinators"); AddToOptionList(document.display.display2, "13", "N/A (Racers Only)"); AddToOptionList(document.display.display2, "14", "Fundraising"); AddToOptionList(document.display.display2, "15", "Race Organization"); AddToOptionList(document.display.display2, "16", "Sponsorship"); AddToOptionList(document.display.display2, "17", "Accounting"); AddToOptionList(document.display.display2, "18", "Technical Support (IT)"); AddToOptionList(document.display.display2, "19", "Media / PR"); AddToOptionList(document.display.display2, "20", "Legal"); AddToOptionList(document.display.display2, "21", "Photography"); AddToOptionList(document.display.display2, "22", "Travel Arrangements"); AddToOptionList(document.display.display2, "23", "Uniforms"); AddToOptionList(document.display.display2, "24", "Race Equipment"); AddToOptionList(document.display.display2, "25", "On-snow Saftey"); } } function populateregtypes() { var regtypes = document.newmember.year; // Clear out the list of member_reg_type ClearOptions(document.newmember.member_reg_type); if ((regtypes[regtypes.selectedIndex].value >= 15) && (regtypes[regtypes.selectedIndex].value <= 99)) { AddToOptionList(document.newmember.member_reg_type, "FIS-A", "FIS-Alpine "); } if ((regtypes[regtypes.selectedIndex].value >= 5) && (regtypes[regtypes.selectedIndex].value <= 12)) { AddToOptionList(document.newmember.member_reg_type, "E", "E-NGSL ($58.00)"); } if ((regtypes[regtypes.selectedIndex].value >= 11) && (regtypes[regtypes.selectedIndex].value <= 12)) { AddToOptionList(document.newmember.member_reg_type, "K1", "K1 ($98.00)"); } if ((regtypes[regtypes.selectedIndex].value >= 13) && (regtypes[regtypes.selectedIndex].value <= 14)) { AddToOptionList(document.newmember.member_reg_type, "K2", "K2 ($98.00)"); } if ((regtypes[regtypes.selectedIndex].value >= 5) && (regtypes[regtypes.selectedIndex].value <= 99)) { AddToOptionList(document.newmember.member_reg_type, "GM", "General Member ($28.00)"); } if ((regtypes[regtypes.selectedIndex].value >= 15) && (regtypes[regtypes.selectedIndex].value <= 99)) { AddToOptionList(document.newmember.member_reg_type, "CO", "Coach "); } } function ClearOptions(OptionList) { // Always clear an option list from the last entry to the first for (x = OptionList.length; x >= 0; x = x - 1) { OptionList[x] = null; } } function AddToOptionList(OptionList, OptionValue, OptionText) { // Add option to the bottom of the list OptionList[OptionList.length] = new Option(OptionText, OptionValue); } function validprogram( selectedform ) { myformname = document.getElementById(selectedform); valid = true; if (myformname.program_id.selectedIndex == 0) { alert ( "You must select a program." ); valid = false; } if (myformname.prog_opt_days.selectedIndex == 0 && valid == true) { alert ( "You must select your elective day." ); valid = false; } return valid; } function validatephoto( selectedform ) { myformname = document.getElementById(selectedform); valid = true; if (myformname.photo_category.selectedIndex == 0) { alert ( "You must select an album." ); valid = false; } return valid; } function validatemember( selectedform ) { myformname = document.getElementById(selectedform); valid = true; if ( myformname.family_email.value === "" ) { alert ( "You must enter an email address." ); valid = false; } if ( (myformname.family_pass1.value === "" || myformname.family_pass2.value === "") && valid == true ) { alert ( "You must enter a password in both password fields." ); valid = false; } if ( (myformname.family_pass1.value !== myformname.family_pass2.value) && valid == true ) { alert ( "Both password fields must match." ); valid = false; } if ( myformname.family_firstname.value === "" && valid == true ) { alert ( "You must enter your first name." ); valid = false; } if ( myformname.family_name.value === "" && valid == true ) { alert ( "You must enter your last name / family name." ); valid = false; } if ( myformname.family_address1.value === "" && valid == true ) { alert ( "You must enter your address." ); valid = false; } if ( myformname.family_city.value === "" && valid == true ) { alert ( "You must enter your city." ); valid = false; } if ( myformname.family_province.value === "" && valid == true ) { alert ( "You must enter your province." ); valid = false; } if ( myformname.family_postal.value === "" && valid == true ) { alert ( "You must enter your postal code." ); valid = false; } if ( myformname.family_country.value === "" && valid == true ) { alert ( "You must enter your country." ); valid = false; } if ( myformname.family_phone1.value === "" && valid == true ) { alert ( "You must enter your phone number." ); valid = false; } return valid; } function validateoldmember( selectedform ) { myformname = document.getElementById(selectedform); valid = true; if ( myformname.family_email.value === "" ) { alert ( "You must enter an email address." ); valid = false; } if ( myformname.family_pass1.value !== "" && (myformname.family_pass1.value !== myformname.family_pass2.value) && valid == true ) { alert ( "Both password fields must match." ); valid = false; } if ( myformname.family_firstname.value === "" && valid == true ) { alert ( "You must enter your first name." ); valid = false; } if ( myformname.family_name.value === "" && valid == true ) { alert ( "You must enter your last name / family name." ); valid = false; } if ( myformname.family_address1.value === "" && valid == true ) { alert ( "You must enter your address." ); valid = false; } if ( myformname.family_city.value === "" && valid == true ) { alert ( "You must enter your city." ); valid = false; } if ( myformname.family_province.value === "" && valid == true ) { alert ( "You must enter your province." ); valid = false; } if ( myformname.family_postal.value === "" && valid == true ) { alert ( "You must enter your postal code." ); valid = false; } if ( myformname.family_country.value === "" && valid == true ) { alert ( "You must enter your country." ); valid = false; } if ( myformname.family_phone1.value === "" && valid == true ) { alert ( "You must enter your phone number." ); valid = false; } return valid; } function validateindiv( selectedform ) { myformname = document.getElementById(selectedform); regtype = myformname.member_reg_type; voltype = myformname.volunteer; valid = true; if ( (myformname.member_gender[0].checked == false) && (myformname.member_gender[1].checked == false) ) { alert ( "You must select a gender." ); valid = false; } if ( myformname.member_firstname.value === "" && valid == true ) { alert ( "You must enter a first name." ); valid = false; } if ( myformname.member_lastname.value === "" && valid == true ) { alert ( "You must enter a last name." ); valid = false; } if ( (myformname.year.selectedIndex == 0 || myformname.month.selectedIndex == 0 || myformname.day.selectedIndex == 0) && valid == true ) { alert ( "You must select valid date of birth." ); valid = false; } //if ( myformname.member_volunteer.selectedIndex == 0 && valid == true ) { // alert ( "You must select a volunteer category or select N/A if you are exempt (Racers Only)." ); // valid = false; //} if ( myformname.member_emergency_name.value === "" && valid == true ) { alert ( "You must enter an emergency contact name." ); valid = false; } if ( myformname.member_emergency_phone.value === "" && valid == true ) { alert ( "You must enter an emergency contact phone number." ); valid = false; } if ( myformname.member_healthcard.value === "" && valid == true ) { alert ( "You must enter your provincial health card number." ); valid = false; } //if ( myformname.member_reg_type.selectedIndex == -1 && valid == true ) { // alert ( "You must select at least one membership category."); // valid = false; //} if (valid == true) { valid = validateRenewCategories(); } return valid; } function validateCandidateSubmission(candidateForm) { var myform = document.getElementById(candidateForm); var valid = true; var candidate_year = myform.candidate_year.value; var year_test = /(\d{4})/ ; if (!(year_test.test(candidate_year)) || !(candidate_year.substr(0,2) == '20')) { alert("Registration year must be a valid year"); valid = false; } return valid; } function validateRenewCategories() { var valid = true; if ($('#main_insurance_question').length) { if (!$("input[name='personWillEnroll']:checked").val()) { alert("enrollment question must be answered"); valid = false; } else { answer1 = $("input[name='personWillEnroll']:checked").val(); } if (valid) { if ($('#enrollment_question').length && $('#enrollment_question').is(":visible") && answer1 == "yes") { if (!$("input[name='racingAndSkills']:checked").val()) { alert ("second enrollment question must be answered"); valid = false; } } } if (valid) { if ($('#enrollment_question2').length && $('#enrollment_question2').is(":visible") && answer1 == "no") { if (!$("input[name='coachQuestion']:checked").val()) { alert ("coaching question must be answered"); valid = false; } } } } if (valid) { if ($('.vol_cat').length && $('.vol_cat').is(":visible")) { if (!$("input[name='vol_cat']:checked").val()) { alert('You must choose a volunteer category!'); valid = false; } } } return valid; } function validateFamilyRenewal(renew_fam_form) { var valid = true; var answer = $("input[name='membership_directory']:checked").val(); if (undefined == answer) { alert("membership directory question must be answered!"); valid = false; } return valid; } function validateCCPay() { var valid = true; if(!($("#understand_and_agree").attr("checked"))) { alert("you must check the box to indicate that you agree to the conditions"); valid = false; } return valid; } function validateMembershipTypes() { var valid = true; $("#save_changes input").each(function() { var name = $(this).attr('name'); if((name.indexOf('allow_racers') > 0) && (name.indexOf('new_') != 0)){ var value = $(this).val(); value = value.toUpperCase(); $(this).val(value); if (value != 'Y' && value != 'N') { alert("'Allow Racers' must be Y or N"); valid=false; return false; } } if((name.indexOf('accounting_code') > 0) && (name.indexOf('new_') != 0)){ var value = $(this).val(); if (value != parseInt(value)) { alert("Accounting Code must be numeric"); valid=false; return false; } } }); return valid; } function event_category_change() { // alert ('we are here'); var input_code = $('#event_category_select').val(); var accounting_codes = new Object(); accounting_codes['General'] = 'General'; accounting_codes['General'] = {}; accounting_codes['General'].code = '4000'; accounting_codes['General'].id = '1'; accounting_codes['Racing'] = 'Racing'; accounting_codes['Racing'] = {}; accounting_codes['Racing'].code = '1605'; accounting_codes['Racing'].id = '2'; accounting_codes['Training'] = 'Training'; accounting_codes['Training'] = {}; accounting_codes['Training'].code = '4305'; accounting_codes['Training'].id = '3'; accounting_codes['Social'] = 'Social'; accounting_codes['Social'] = {}; accounting_codes['Social'].code = '4700'; accounting_codes['Social'].id = '5'; accounting_codes['Fundraising'] = 'Fundraising'; accounting_codes['Fundraising'] = {}; accounting_codes['Fundraising'].code = '4461'; accounting_codes['Fundraising'].id = '6'; accounting_codes['Volunteer'] = 'Volunteer'; accounting_codes['Volunteer'] = {}; accounting_codes['Volunteer'].code = '4300'; accounting_codes['Volunteer'].id = '7'; accounting_codes['Apparel'] = 'Apparel'; accounting_codes['Apparel'] = {}; accounting_codes['Apparel'].code = '4300'; accounting_codes['Apparel'].id = '8'; accounting_codes['Summer Field Dryland'] = 'Summer Field Dryland'; accounting_codes['Summer Field Dryland'] = {}; accounting_codes['Summer Field Dryland'].code = '4284'; accounting_codes['Summer Field Dryland'].id = '9'; accounting_codes['Summer Strength training'] = 'Summer Strength training'; accounting_codes['Summer Strength training'] = {}; accounting_codes['Summer Strength training'].code = '4286'; accounting_codes['Summer Strength training'].id = '10'; accounting_codes['Fall Strength training'] = 'Fall Strength training'; accounting_codes['Fall Strength training'] = {}; accounting_codes['Fall Strength training'].code = '4288'; accounting_codes['Fall Strength training'].id = '11'; accounting_codes['Mountain Bike'] = 'Mountain Bike'; accounting_codes['Mountain Bike'] = {}; accounting_codes['Mountain Bike'].code = '4290'; accounting_codes['Mountain Bike'].id = '12'; accounting_codes['VST Dryland'] = 'VST Dryland'; accounting_codes['VST Dryland'] = {}; accounting_codes['VST Dryland'].code = '4294'; accounting_codes['VST Dryland'].id = '13'; accounting_codes['Gymnastics'] = 'Gymnastics'; accounting_codes['Gymnastics'] = {}; accounting_codes['Gymnastics'].code = '4292'; accounting_codes['Gymnastics'].id = '14'; accounting_codes['Fitness'] = 'Fitness'; accounting_codes['Fitness'] = {}; accounting_codes['Fitness'].code = '4200'; accounting_codes['Fitness'].id = '4'; accounting_codes['Silent Auction'] = 'Silent Auction'; accounting_codes['Silent Auction'] = {}; accounting_codes['Silent Auction'].code = '4461'; accounting_codes['Silent Auction'].id = '15'; accounting_codes['Unknown'] = 'Unknown'; accounting_codes['Unknown'] = {}; accounting_codes['Unknown'].code = '0000'; accounting_codes['Unknown'].id = '16'; for(var prop in accounting_codes) { if(accounting_codes.hasOwnProperty(prop)) { if (accounting_codes[prop]['id'] == input_code) { $('#event_accounting_code').val(accounting_codes[prop]['code']); } } } } function HideContent(d) { document.getElementById(d).style.display = "none"; } function ShowContent(d) { document.getElementById(d).style.display = "block"; } function ReverseDisplay(d) { if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } } /* Calendar Functions */ var enableCache = false; var jsCache = new Array(); var AjaxObjects = new Array(); function ShowContent_UpdateMiniCal2(divId,ajaxIndex,url) { document.getElementById(divId).innerHTML = AjaxObjects[ajaxIndex].response; if(enableCache){ jsCache[url] = AjaxObjects[ajaxIndex].response; } AjaxObjects[ajaxIndex] = false; } function Ajax_UpdateMiniCal(divId,url) { if(enableCache && jsCache[url]){ document.getElementById(divId).innerHTML = jsCache[url]; return; } var ajaxIndex = AjaxObjects.length; document.getElementById(divId).innerHTML = ''; AjaxObjects[ajaxIndex] = new sack(); AjaxObjects[ajaxIndex].requestFile = url; AjaxObjects[ajaxIndex].onCompletion = function(){ ShowContent_UpdateMiniCal2(divId,ajaxIndex,url); }; AjaxObjects[ajaxIndex].runAJAX(); } function HL_On(id, upto) { var i=0 for (i=0;i<=upto;i++) { var x = id + '_' + i css_color_change(x,'FFFF99'); } } function HL_Off(id, upto) { var i=0 for (i=0;i<=upto;i++) { var x = id + '_' + i css_color_change(x,'ffffff'); } } function css_color_change(id, val) { var e = document.getElementById(id); if(!(e)) { // alert("This change is not possible! [" + id + "]"); return(false); } e.style.backgroundColor = "#"+val; return(true); } /* */