var fm; var pathname = window.location.pathname; var path = pathname.substring(0,(pathname.lastIndexOf('.nsf')+5)); var thisDoc; function SaveDoc ( ValidTab , ongle ) { //---ONGLE 3 Mandatory fields --// if ( ValidTab ==3 ) { if ( ! isValidString( thisDoc.RecY_1 , "Year of record")) return (false); if ( ! isValidString( thisDoc.RecS_1, "Championships / Series")) return(false); if ( ! isValidString( thisDoc.RecC_1, "Classification")) return(false); if ( thisDoc.Confirm.checked==false ) { alert("A confirmation of this form is required before submit."); return(false); } //document.getElementById('upload').value } //---ONGLE 2 Mandatory fields --// if ( ValidTab ==2 ) { // Category : A- Platinum, B- Gold, C- Silver, D- Bronze var message01 = 'Please specify your classification.'; var message02 = 'Please give further information.'; var message03 = 'Please fill the question '; // if ( ( thisDoc.strCategory.value =='0') || ( thisDoc.strCategory.value =='1') ) { if ( thisDoc.strCategory.value=='1') { if ( ! isRadioSelected( thisDoc.Category )) { alert( "Please select your Category." ); return(false); } // if ( thisDoc.Category[0].checked) { if ( !isRadioSelected ( thisDoc.Cat_A1) || (( thisDoc.Cat_A1[0].checked) && ( thisDoc.Cat_A1_1.value=='')) ) { alert( message03 + 'Platinum 1' ); thisDoc.Cat_A1_1.focus(); return(false); } // comment on GL 23.12.08 _ Ftrouve demande if ( !isRadioSelected ( thisDoc.Cat_A2) || (( thisDoc.Cat_A2[0].checked) && ( thisDoc.Cat_A2_1.value=='')) ) { alert( message03 + 'Platinum 2' ); thisDoc.Cat_A2_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_A3) || (( thisDoc.Cat_A3[0].checked) && ( thisDoc.Cat_A3_1.value=='')) ) { alert( message03 + 'Platinum 3' ); thisDoc.Cat_A3_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_A4) || (( thisDoc.Cat_A4[0].checked) && ( thisDoc.Cat_A4_1.value=='')) ) { alert( message03 + 'Platinum 4' ); thisDoc.Cat_A4_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_A5) || (( thisDoc.Cat_A5[0].checked) && ( thisDoc.Cat_A5_1.value=='')) ) { alert( message03 + 'Platinum 5' ); thisDoc.Cat_A5_1.focus(); return(false); } // } // if ( thisDoc.Category[1].checked) { if ( !isRadioSelected ( thisDoc.Cat_B1) || (( thisDoc.Cat_B1[0].checked) && ( thisDoc.Cat_B1_1.value=='')) ) { alert( message03 + 'Gold 1' ); thisDoc.Cat_B1_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_B2) || (( thisDoc.Cat_B2[0].checked) && ( thisDoc.Cat_B2_1.value=='')) ) { alert( message03 + 'Gold 2' ); thisDoc.Cat_B2_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_B3) || (( thisDoc.Cat_B3[0].checked) && ( thisDoc.Cat_B3_1.value=='')) ) { alert( message03 + 'Gold 3' ); thisDoc.Cat_B3_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_B4) || (( thisDoc.Cat_B4[0].checked) && ( thisDoc.Cat_B4_1.value=='')) ) { alert( message03 + 'Gold 4' ); thisDoc.Cat_B4_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_B5) || (( thisDoc.Cat_B5[0].checked) && ( thisDoc.Cat_B5_1.value=='')) ) { alert( message03 + 'Gold 5' ); thisDoc.Cat_B5_1.focus(); return(false); } if ( !isRadioSelected ( thisDoc.Cat_B6) || (( thisDoc.Cat_B6[0].checked) && ( thisDoc.Cat_B6_1.value=='')) ) { alert( message03 + 'Gold 6' ); thisDoc.Cat_B6_1.focus(); return(false); } // } // if ( thisDoc.Category[2].checked) { if ( !isRadioSelected ( thisDoc.Cat_C1) || (( thisDoc.Cat_C1[0].checked) && ( thisDoc.Cat_C1_1.value=='')) ) { alert( message03 + 'Silver 1' ); thisDoc.Cat_C1_1.focus(); return(false); } /* if ( !isRadioSelected ( thisDoc.Cat_C2) || (( thisDoc.Cat_C2[0].checked) && ( thisDoc.Cat_C2_1.value=='')) ) { alert( message03 + 'Silver 2' ); thisDoc.Cat_C2_1.focus(); return(false); } */ if ( !isRadioSelected ( thisDoc.Cat_C3) || (( thisDoc.Cat_C3[0].checked) && ( thisDoc.Cat_C3_1.value=='')) ) { alert( message03 + 'Silver 3' ); thisDoc.Cat_C3_1.focus(); return(false); } // } // if ( thisDoc.Category[3].checked) { if ( !isRadioSelected ( thisDoc.Cat_D1) || (( thisDoc.Cat_D1[0].checked) && ( thisDoc.Cat_D1_1.value=='')) ) { alert( message03 + 'Bronze 1' ); thisDoc.Cat_D1_1.focus(); return(false); } // } } //strCategory Check1 }//---ONGLE 2 Mandatory fields --// //---ONGLE 1 Mandatory fields --// if ( ValidTab ==1 ) { if ( ! isValidString( thisDoc.Surname, "Surname")) return(false) if ( ! isValidString( thisDoc.Firstname, "Firstname")) return(false) // if ( ! isValidString( thisDoc.Team, "Team")) return(false) if ( ! isValidString( thisDoc.Nationality, "Nationality")) return(false) if ( isValidDate("Date of Birth", thisDoc.DtBirth.value) != true){ thisDoc.DtBirth.focus(); return (false) } if ( isValidDate("Date of Licence", thisDoc.DtLicence.value) != true){ thisDoc.DtLicence.focus(); return (false) } if ( ! isValidString( thisDoc.LicenceGrade, "Licence Grade")) return(false) if ( ! isValidString( thisDoc.AsnName, "ASN Name")) return(false) if ( ! isValidString( thisDoc.Email, "Email") ) return(false); /* else { if ( ! isEmailValid ( thisDoc.Email ) ) alert("The field Email is required."); thisDoc.Email.focus(); return(false);} */ if ( ! isValidString( thisDoc.CoDriver1, "Co-driver 1 ")) return(false) } //---ONGLE 1 Mandatory fields---// blockdisplay( ongle ); } function OpenDoc ( url ){ window.open( url , 'doc', 'width=340,height=440,menubar=no,resizable=no,toolbar=no,status=no,scrollbars=yes,titlebar=no') } function OpenLog ( url ){ window.open( url , 'doc', 'width=210,height=210,menubar=no,resizable=no,toolbar=no,status=no,scrollbars=yes,titlebar=no') } function OpenFrame ( type ) { if ( type==1) { var url = path + 'fmGT3.10?openform'; } else if ( type==2) { var url = path + 'fmGT.10?openform'; } else if ( type==3) { var url = path + 'fmWEC.12?openform'; } document.getElementById('WelcomePage').style.visibility = 'hidden'; document.getElementById('IFContent').style.visibility = 'visible'; //alert ( url ) //-- used widoth frameset on first page window.top.frames[ 'IFContent' ].location.href= url; //-- used with frameset on first page --// top.frames[0].IFContent.location.href = url } function blockdisplay(i) { if ( i==1) { document.getElementById('tab1').style.visibility ='visible'; document.getElementById('tab2').style.visibility ='hidden'; document.getElementById('tab3').style.visibility ='hidden'; } if ( i==2) { document.getElementById('tab1').style.visibility ='hidden'; document.getElementById('tab2').style.visibility ='visible'; document.getElementById('tab3').style.visibility ='hidden'; } if ( i==3) { document.getElementById('tab1').style.visibility ='hidden'; document.getElementById('tab2').style.visibility ='hidden'; document.getElementById('tab3').style.visibility ='visible'; } } function Over_display( i,flag) { flag.style.cursor = 'hand' } function hl_over_menu( obj , color , pai , colorPai ){ document.getElementById(pai).bgColor = colorPai ; obj.bgColor = color ; obj.style.cursor = 'hand'; } function hl_out_menu( obj , color , pai , colorPai ){ document.getElementById(pai).bgColor = colorPai ; obj.bgColor = color ; obj.style.cursor = 'default'; } function hl_click_menu( obj ) { if(event.srcElement.tagName=='TD'){ obj.children.tags('A')[0].click(); } } //---- validation functions ----// function isEmailValid( strEmail ) { for ( nCont=0; nCont < strEmail.length; nCont++ ) if ( strEmail.charAt (nCont) == '@' ) return (true); return (false); } function isValidNumberValue ( objTextControl, strFieldName) { var nRet = true; var strValidNumber="1234567890"; for (nCount=0; nCount < objTextControl.length; nCount++) { strTempChar=objTextControl.substring(nCount,nCount+1); if ( strValidNumber.indexOf(strTempChar,0)==-1) { alert("The field " + strFieldName + " can contains only numbers."); return false; } } return nRet; } function isValidString ( objTextControl, strFieldName) { if ( objTextControl.value =="") { alert("The field " + strFieldName + " is required."); objTextControl.focus(); return(false); } else { return(true); } } function isValidList ( objList, strFieldName ) { nReturn = true; if( objList.options[objList.selectedIndex].text == "" || objList.options[objList.selectedIndex].text == "-") { alert("The field " + strFieldName + " is required.") objList.focus() nReturn = false } return( nReturn) } function isRadioSelectedYes( objRadio, fldString ) { var nSelected = true; if( (objRadio[0].checked) && ( fldString.value !='') ) { nSelected = false; } return nSelected } function isRadioSelected( objRadio ) { var nSelected = false; for( var nPos = 0; nPos < objRadio.length; nPos++) { if( objRadio[nPos].checked) { nSelected = true } } return nSelected } function valButton(btn) { var cnt = -1; for (var i=btn.length-1; i > -1; i--) { if (btn[i].checked) {cnt = i; i = -1;} } if (cnt > -1) return (true); //btn[cnt].value; else return (false); // else return null; } function isValidYear ( aFilName, aYear) { var validY = new String(""); validY = aYear; if( validY == "" ) { alert(aFilName + " is required."); return false; } if( validY.length != 4 ) { alert(aFilName + " - use this date format = ( YYYY )."); return false; } if ( ! isValidNumberValue ( aFilName , "Year") ) return(false) } function isValidDate( aFilName, aDate) { var monthDays = "101010110101"; var validDate = new String(""); var aDay, aMonth, aYear; var aN, aMonthFlg; validDate = aDate; if( validDate == "" ) { alert(aFilName + " is required."); return false; } if( validDate.length != 10 ) { alert(aFilName + " - use this date format = (dd/mm/yyyy)."); return false; } aDay = validDate.substring(0, 2); aMonth = validDate.substring(3, 5); aYear = validDate.substring(6, 10); if( isNaN(parseInt(aDay)) || isNaN(parseInt(aMonth)) || isNaN(parseInt(aYear)) ) { alert(aFilName + " - Day, Month and Year must be numbers."); return false; } aN = parseInt(aDay); if( (aN < 0) || (aN > 31) ) { alert(aFilName + " - Month day must be between 1 and 31."); return false; } if( (aMonth < 1) || (aMonth > 12) ) { alert(aFilName + " - Month must be between 1 and 12."); return false; } aMod = aYear % 4; if( aMod == 0 ) aLim = 29; else aLim = 28; if( (aMonth == 2) && (aDay > aLim) ) { alert(aFilName + " - February has " + aLim + " days."); return false; } aMonthFlg = parseInt(monthDays.substring(aMonth-1, aMonth)); if( (aMonthFlg == 0) && (aDay > 30) ) { alert(aFilName + " - The month has 30 days."); return false; } return true; }