String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } Array.prototype.in_array = function(p_val) { for(var i = 0; i < this.length; i++) if(this[i] == p_val) return true; return false; } var guntypes = new Array('h','s','r','m'); var divisions = new Array(); divisions[0] = new Array('--All--', 'OPEN','STANDARD','MODIFIED','PRODUCTION','REVOLVER (STANDARD)'); divisions[1] = new Array('--All--', 'OPEN','MODIFIED','STANDARD','STANDARD MANUAL'); divisions[2] = new Array('--All--', 'OPEN SEMI-AUTO','STANDARD SEMI-AUTO','OPEN MANUAL ACTION','STANDARD MANUAL ACTION'); divisions[3] = new Array('--All--'); function fixDiv() { var div = document.getElementById('div'); var guntype = document.getElementById('guntype'); var gtype = guntype.options[guntype.selectedIndex].value; var index = -1; var value = ''; for(var i=0; i -1) { div.options.length = 0; for (divindex in divisions[index]) { value = divisions[index][divindex] == '--All--' ? '' : divisions[index][divindex]; div.options[divindex]=new Option(divisions[index][divindex],value); } } } function FixGuntype() { var tid = document.forms[0].tid.options[document.forms[0].tid.selectedIndex].value; var guntype = document.forms[0].guntype; guntype.options.length = 0; if (tid == '0') { guntype.options[0]=new Option('Handgun', 'h'); guntype.options[1]=new Option('Shotgun', 's'); guntype.options[2]=new Option('Rifle', 'r'); guntype.options[3]=new Option('Multigun', 'm'); } else { var index = 0; eval('var guntypelist = typeof(tid'+tid+') != \'undefined\' ? tid'+tid+' : \'____\';'); if (guntypelist.charAt(0) == 'h') { guntype.options[index]=new Option('Handgun', 'h');; index = index + 1; } if (guntypelist.charAt(1) == 's') { guntype.options[index]=new Option('Shotgun', 's'); index = index + 1; } if (guntypelist.charAt(2) == 'r') { guntype.options[index]=new Option('Rifle', 'r'); index = index + 1; } if (guntypelist.charAt(3) == 'm') { guntype.options[index]=new Option('Multigun', 'm'); index = index + 1; } } fixDiv(); return true; } function Validate() { if (document.forms[0].action.value == 'yearchange') return true; if (document.forms[0].tid.selectedIndex == 0) { alert('Please select a competition.'); document.forms[0].tid.focus(); return false; } return true; } function changeY() { document.forms[0].action.value = 'yearchange'; document.forms[0].submit(); } function ValidatePl() { if (document.forms[0].action.value == 'skip') return true; var players = new Array(); var length = 0; for(i = 1; i < 6; i++) { eval('pli = document.forms[0].plr'+i+';'); if (pli.selectedIndex == 0) continue; if (players.in_array(pli.selectedIndex)) pli.selectedIndex = 0; else length = players.push(pli.selectedIndex); } if (length < 2) { alert('Please select at least two competitors.'); return false; } return true; } function Skip() { document.forms[0].action.value = 'skip'; var pli; for(i = 1; i < 6; i++) { eval('pli = document.forms[0].plr'+i+';'); pli.selectedIndex = 0; } document.forms[0].submit(); }