// warns swimmers about inactivity clock. var vieth_date1 = new Date(); var vieth_minutes = 1000 * 60; var vieth_hours = vieth_minutes * 60; var vieth_days = vieth_hours * 24; var vieth_years = vieth_days * 365; var vieth_start_time = vieth_date1.getTime(); var log_out_time = 'yes'; //alert ( 'this is start time' + vieth_start_time ); function timeRequestObject() { var tmpXmlHttpObject; if (window.XMLHttpRequest) { tmpXmlHttpObject = new XMLHttpRequest(); //alert ( 'first was called.' ); } else if (window.ActiveXObject) { // IE would use this method ... tmpXmlHttpObject = new ActiveXObject('Microsoft.XMLHTTP'); //alert ( 'second was called.' ); } return tmpXmlHttpObject; } function get_time_from_server(){ time_out.open('get', 'http://www.swimmershowcase.com/actions.php?set=time_return' ); time_out.onreadystatechange = process_time_Response; time_out.send(null); } function process_time_Response() { if(time_out.readyState == 4){ var response = time_out.responseText; if ( log_out_time == 'yes' ){ window.location = "http://www.swimmershowcase.com/?log=time"; } else{ } //alert ( response ); } } var time_out = new timeRequestObject(); function get_inactive_time(){ var vieth_date2 = new Date(); var vieth_current_time = vieth_date2.getTime(); //alert ( 'inactive time called'+vieth_current_time+' '+vieth_start_time ); if ( (vieth_current_time - vieth_start_time) > 1800000 ){ var time_out = timeRequestObject(); get_time_from_server(); log_out_time = 'yes'; var user_confirm = confirm ( "You will be automatically logged out in 20 seconds, Click cancel to stop." ); if ( user_confirm == true ){ window.location = "http://www.swimmershowcase.com/?log=time"; } else { log_out_time = 'no'; var vieth_date1 = new Date(); vieth_start_time = vieth_date1.getTime(); } } setTimeout( "get_inactive_time()", 10000 ); } function inactivity (){ //alert ( 'inactivity called' ); setTimeout( "get_inactive_time()", 10000 ); } inactivity ( ); function check_phone (){ //alert ( 'function called' ); var phone = document.getElementById( 'phone' ).value; var num = phone.length; var p_phone = ''; var f_phone = new Array(); var j = 0; for ( z = 0; z < num; z++ ){ if ( phone.charAt( z ) == '0' || phone.charAt( z ) == '1' || phone.charAt( z ) == '2' || phone.charAt( z ) == '3' || phone.charAt( z ) == '4' || phone.charAt( z ) == '5' || phone.charAt( z ) == '6' || phone.charAt( z ) == '7' || phone.charAt( z ) == '8' || phone.charAt( z ) == '9' ){ f_phone[j] = phone.charAt( z ); j++; } } //alert ( f_phone.length ); if ( f_phone.length != 10 ){ alert ( "The phone number should contain 10 digits." ); } var s = 0; var p_phone = ''; for ( value in f_phone ){ if ( s == 0 ){ p_phone += '('; } if ( s == 3 ){ p_phone += ') '; } if ( s == 6 ){ p_phone += '-'; } p_phone += f_phone[value]; //alert ( p_phone ); s++; } document.getElementById( 'phone' ).value = p_phone; } function check_phone_2 (){ //alert ( 'function called' ); var phone = document.getElementById( 'phone_2' ).value; var num = phone.length; var p_phone = ''; var f_phone = new Array(); var j = 0; for ( z = 0; z < num; z++ ){ if ( phone.charAt( z ) == '0' || phone.charAt( z ) == '1' || phone.charAt( z ) == '2' || phone.charAt( z ) == '3' || phone.charAt( z ) == '4' || phone.charAt( z ) == '5' || phone.charAt( z ) == '6' || phone.charAt( z ) == '7' || phone.charAt( z ) == '8' || phone.charAt( z ) == '9' ){ f_phone[j] = phone.charAt( z ); j++; } } //alert ( f_phone.length ); if ( f_phone.length != 10 ){ alert ( "The phone number should contain 10 digits." ); } var s = 0; var p_phone = ''; for ( value in f_phone ){ if ( s == 0 ){ p_phone += '('; } if ( s == 3 ){ p_phone += ') '; } if ( s == 6 ){ p_phone += '-'; } p_phone += f_phone[value]; //alert ( p_phone ); s++; } document.getElementById( 'phone_2' ).value = p_phone; } function check_phone_3 (){ //alert ( 'function called' ); var phone = document.getElementById( 'phone_3' ).value; var num = phone.length; var p_phone = ''; var f_phone = new Array(); var j = 0; for ( z = 0; z < num; z++ ){ if ( phone.charAt( z ) == '0' || phone.charAt( z ) == '1' || phone.charAt( z ) == '2' || phone.charAt( z ) == '3' || phone.charAt( z ) == '4' || phone.charAt( z ) == '5' || phone.charAt( z ) == '6' || phone.charAt( z ) == '7' || phone.charAt( z ) == '8' || phone.charAt( z ) == '9' ){ f_phone[j] = phone.charAt( z ); j++; } } //alert ( f_phone.length ); if ( f_phone.length != 10 ){ alert ( "The phone number should contain 10 digits." ); } var s = 0; var p_phone = ''; for ( value in f_phone ){ if ( s == 0 ){ p_phone += '('; } if ( s == 3 ){ p_phone += ') '; } if ( s == 6 ){ p_phone += '-'; } p_phone += f_phone[value]; //alert ( p_phone ); s++; } document.getElementById( 'phone_3' ).value = p_phone; } // alert for the club admins sign up. function check_responses (obj){ var go = true; var first_name = obj.first_name.value; if ( first_name.length < 2 ){ alert ( "You must enter your first name.(At least two letters)" ); return false; } var last_name = obj.last_name.value; if ( last_name.length < 2 ){ alert ( "You must enter your last name.(At least two letters)" ); return false; } var address = obj.address_1.value; if ( address.length < 2 ){ alert ( "You must enter your address.(At least two letters)" ); return false; } var city = obj.city.value; if ( city.length < 2 ){ alert ( "You must enter your city.(At least two letters)" ); return false; } var state = obj.state.value; if ( state.length < 2 ){ alert ( "You must enter your state." ); return false; } var zip = obj.zip.value; if ( zip.length < 2 ){ alert ( "You must enter your zip code." ); return false; } var country = obj.country.value; if ( country.length < 2 ){ alert ( "You must enter your country." ); return false; } var phone = obj.phone.value; if ( phone.length < 2 ){ alert ( "You must enter your phone number." ); return false; } var email = obj.email.value; if ( email.length < 2 ){ alert ( "You must enter your email address." ); return false; } var url = obj.club_id.value; if ( url.length < 2 ){ alert ( "You must select your Club." ); return false; } if ( obj.terms_check_box.checked == false ){ alert ( 'You must agree to the terms of service before you can proceed.' ); return false; } return go; } // alert for the coaches sign up. function check_responses_2 (obj){ var go = true; var email = obj.email.value; if ( email.length < 2 ){ alert ( "You must enter your email address, or that email address is already taken." ); return false; } if ( !email_go ){ alert ( "You have to choose another email address, because that email address is already taken." ); return false; } var first_name = obj.first_name.value; if ( first_name.length < 2 ){ alert ( "You must enter your first name.(At least two letters)" ); return false; } var last_name = obj.last_name.value; if ( last_name.length < 2 ){ alert ( "You must enter your last name.(At least two letters)" ); return false; } /*var address = obj.address_1.value; if ( address.length < 2 ){ alert ( "You must enter your address.(At least two letters)" ); return false; } var city = obj.city.value; if ( city.length < 2 ){ alert ( "You must enter your city.(At least two letters)" ); return false; } var state = obj.state.value; if ( state.length < 2 ){ alert ( "You must enter your state." ); return false; } var zip = obj.zip.value; if ( zip.length < 2 ){ alert ( "You must enter your zip code." ); return false; }*/ var phone = obj.phone.value; if ( phone.length < 2 ){ alert ( "You must enter your phone number." ); return false; } var url = obj.team.value; if ( url.length < 2 ){ alert ( "You must select your Team." ); return false; } if ( obj.terms_check_box.checked == false ){ alert ( 'You must agree to the terms of service before you can proceed.' ); return false; } return go; } // alert for the athletes sign up function check_responses_3 (obj){ var go = true; var first_name = obj.first_name.value; if ( first_name.length < 2 ){ alert ( "You must enter your first name.(At least two letters)" ); return false; } var class = obj.class.value; if ( class.length < 2 ){ alert( "You must enter your class in which you are graduating." ); return false; } var last_name = obj.last_name.value; if ( last_name.length < 2 ){ alert ( "You must enter your last name.(At least two letters)" ); return false; } var address = obj.address_1.value; if ( address.length < 2 ){ alert ( "You must enter your address.(At least two letters)" ); return false; } var city = obj.city.value; if ( city.length < 2 ){ alert ( "You must enter your city.(At least two letters)" ); return false; } var state = obj.state.value; if ( state.length < 2 ){ alert ( "You must enter your state." ); return false; } var zip = obj.zip.value; if ( zip.length < 2 ){ alert ( "You must enter your zip code." ); return false; } var country = obj.country.value; if ( country.length < 2 ){ alert ( "You must enter your country." ); return false; } var phone = obj.phone.value; if ( phone.length < 2 ){ alert ( "You must enter your phone number." ); return false; } var email = obj.email.value; if ( email.length < 2 ){ alert ( "You must enter your email address." ); return false; } var club_id = obj.club_id.value; if ( club_id.length < 2 ){ alert ( "You must select your swim club." ); return false; } if ( obj.terms_check_box.checked == false ){ alert ( 'You must agree to the terms of service before you can proceed.' ); return false; } return go; } function check_password_match ( obj ){ var password = obj.password.value; var conf_password = obj.conf_password.value; if ( password == conf_password ) { return true; } else{ alert ( "Your passwords do not match! Your passwords must match before you can proceed." ); return false; } } function check_passwords ( obj ){ var new_password = obj.new_password.value; var password_conf = obj.password_conf.value; if ( new_password == password_conf ){ return true; } else{ alert ( "Your passwords do not match! Your passwords must match before you can proceed." ); return false; } }