1function trim(str){ 2 var str = str.replace(/^\s\s*/,''), 3 ws = /\s/, 4 i = str.length; 5 while (ws.test(str.charAt(--i))); 6 return str.slice(0, i + 1); 7} 8 9function showtotal(val) 10{ 11 if(val == 'T') 12 { 13 document.getElementById("stats").style.display =""; 14 document.getElementById("averages").style.display ="none"; 15 document.getElementById("totals").style.display =""; 16 } 17 else if(val == 'A') 18 { 19 document.getElementById("stats").style.display =""; 20 document.getElementById("averages").style.display =""; 21 document.getElementById("totals").style.display ="none"; 22 } 23 else if(val == 'N') 24 { 25 document.getElementById("stats").style.display ="none"; 26 document.getElementById("averages").style.display ="none"; 27 document.getElementById("totals").style.display ="none"; 28 } 29} 30function get_value( o ) { 31 if( o ) { 32 return( o.value ) ; 33 } else { 34 return '' ; 35 } 36} 37var reg = /^[0-9]+$/; 38function valid_stats() 39{ 40 var minutes=trim(get_value( document.getElementById('minutes'))); 41 var games=trim(get_value( document.getElementById('games'))); 42 return( valid_minutes( games, minutes ) ) ; 43} 44function valid_player_stat() 45{ 46 var season=get_value( document.getElementById('season')); 47 var country = get_value( document.getElementById('country')); 48 var league = get_value( document.getElementById('league')); 49 var league_other = trim(get_value( document.getElementById('league_other')) ); 50 var club_season=get_value( document.getElementById('club_season')); 51 var gc_league = document.getElementById("p_gc") ; 52 var gc_player_id=get_value( document.getElementById('gc_player_id')); 53 var club_other = trim(get_value( document.getElementById('club_other')) ); 54 var statistics=valButton(document.getElementsByName('statistics')); 55 var minutes=trim(get_value( document.getElementById('minutes'))); 56 var games=trim(get_value( document.getElementById('games'))); 57 var did_play=valButton(document.getElementsByName('did_play')); 58 var frmMonth = document.getElementById('frmMonth').value; 59 var frmYear = document.getElementById('frmYear').value; 60 61 if (season == '') 62 { 63 alert('Please select a season'); 64 document.getElementById('season').focus(); 65 return false; 66 } 67 if (did_play == 0) 68 { 69 return true ; 70 } 71 else if (country == '') 72 { 73 alert('Please select a country'); 74 document.getElementById('country').focus(); 75 return false; 76 } 77 else if ( ! ( league > 0 || ( league == -1 && ( 1 || league_other > '' ) ) ) ) 78 { 79 alert('Please select a league'); 80 document.getElementById('league').focus(); 81 return false; 82 } 83 else if ( ! ( club_season > 0 || ( ( club_season < 0 || league < 0 )&& club_other > '' ) ) ) 84 { 85 alert('Please enter the name of the club'); 86 document.getElementById('club_season').focus(); 87 return false; 88 } 89 else if ( gc_league ) { 90 if( ! gc_player_id ) 91 { 92 alert('Please select your name from the player list'); 93 document.getElementById('gc_player_id').focus(); 94 return false; 95 } 96 // else this is a valid gamecenter match 97 return true ; 98 } 99 else if (frmMonth == '') { 100 alert('Please enter the month in which you started with this club'); 101 document.getElementById('frmMonth').focus(); 102 return false; 103 } 104 else if (frmYear == '') { 105 alert('Please enter the year in which you started with this club'); 106 document.getElementById('frmYear').focus(); 107 return false; 108 } 109 else if (statistics == null) 110 { 111 alert('Please select the way in which you are going to insert the statistics'); 112 document.getElementById('statistics').focus(); 113 return false; 114 } 115 else if( statistics =='T' || statistics =='A') 116 { 117 if( ! valid_stats() ) { 118 return false ; 119 } 120 } 121 return true ; 122} 123function valid_minutes( games, minutes ) { 124 if ( games == '' ) 125 { 126 alert('Please enter the number of games'); 127 document.getElementById('games').focus(); 128 return false; 129 } 130 if( games == '0' || !reg.test(games) ) 131 { 132 alert("Games should be a positive number, do not use letters, commaas, dots etc."); 133 document.getElementById('games').focus(); 134 document.getElementById('games').value=''; 135 return false; 136 } 137 if( minutes !='' ) 138 { 139 if(!reg.test(minutes) ) 140 { 141 alert("Please enter minutes only numeric form"); 142 document.getElementById('minutes').focus(); 143 document.getElementById('minutes').value=''; 144 return false;
145 } 146 if( ( minutes / games ) > 40 ) 147 { 148 alert("Something is wrong, the total amount of minutes should not be more then 40 times the number of games."); 149 document.getElementById('games').focus(); 150 return false; 151 } 152 if ( ( minutes / games ) < 10 ) 153 { 154 if( ! confirm( "The average number of minutes per game is now less then 10. Is that correct?" ) ) { 155 document.getElementById('minutes').focus(); 156 return false; 157 } 158 } 159 } 160 return true ; 161} 162 163function valButton(btn) { 164 var cnt = -1; 165 for (var i=btn.length-1; i > -1; i--) { 166 if (btn[i].checked) {cnt = i; i = -1;} 167 } 168 if (cnt > -1) return btn[cnt].value; 169 else return null; 170} 171function isValidDate(day, month, year) { 172 /* 173 * Purpose: return true if the date is valid, false otherwise 174 * 175 * Arguments: day integer representing day of month month integer 176 * representing month of year year integer representing year 177 * 178 * Variables: dteDate - date object 179 * 180 */ 181 var dteDate; 182 183 // set up a Date object based on the day, month and year arguments 184 // javascript months start at 0 (0-11 instead of 1-12) 185 month = month -1 ; 186 dteDate = new Date(year, month , day); 187 188 /* 189 * Javascript Dates are a little too forgiving and will change the date 190 * to a reasonable guess if it's invalid. We'll use this to our 191 * advantage by creating the date object and then comparing it to the 192 * details we put it. If the Date object is different, then it must have 193 * been an invalid date to start with... 194 */ 195 196 return ((day == dteDate.getDate()) && (month == dteDate.getMonth()) && (year == dteDate 197 .getFullYear())); 198}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.