//Function to Set Current Page's Nav Item ON function setCurrentNav(nav1, nav2, nav3) { //alert(nav1 + " - " + nav2 + " - " + nav3); if (nav1) { document.getElementById('link' + nav1).className = 'mainNavON'; document.getElementById('td' + nav1).className = 'mainNavTDON'; } if (nav2 != 'x') { document.getElementById('linkSub' + nav2).className = 'leftNav1ON'; } if (nav3 != 'x') { document.getElementById('linkSub' + nav3).className = 'leftNav2ON'; } } //Function to remove leading and trailing spaces from fields function trim(tmpString){ //Replaces leading spaces while(tmpString.charAt(0) == " "){ tmpString = tmpString.substring(1, tmpString.length); } //Removes trailing spaces while(tmpString.charAt(tmpString.length - 1) == " "){ tmpString = tmpString.substring(0, tmpString.length - 1); } //Returns string return tmpString; } //Function to validate dates function dateChecker(date) { var year; var month; var day; var validDate; validDate = true; //Tests to make sure the string is exactly 10 characters long if (date.length != 10) {validDate = false; return validDate} //Extracts month, day, year, and slashes from string sep = "/" month = date.substring(0, 2); firstSlash = date.substring(2, 3); day = date.substring(3, 5); secondSlash = date.substring(5, 6); year = date.substring(6, 10); //Test to ensure numeric values if (isNaN(month)) validDate = false; if (isNaN(day)) validDate = false; if (isNaN(year)) validDate = false; //Tests month, day, year, and slashes if (month < 1 | month > 12) validDate = false; if (firstSlash != sep) validDate = false; if (day < 1 | day > 31) validDate = false; if (secondSlash != sep) validDate = false; if (year < 0 | year > 2999) validDate = false; //Checks to make sure that April, June, Sept, or November 31st isn't entered if ((month == 4 | month == 6 | month == 9 | month == 11) & (day == 31)) validDate = false; //Tests February if (month == 2) { var g = parseInt(year/4) if (isNaN(g)) validDate = false; if (day > 29) validDate = false; if (day == 29 & ((year/4) != g)) validDate = false; } //Returns true or false return validDate; } //Function to validate Claim Date (must be less than today) function claimDateChecker(month,day,year) { var now = new Date(); var nowYear = now.getFullYear(); var nowMonth = now.getMonth(); var nowDay = now.getDate(); if (nowMonth < 10){ nowMonth = '0' + nowMonth; } if (nowDay < 10){ nowDay = '0' + nowDay; } if (year < nowYear){return true} if (year > nowYear){return false} if (month > (parseInt(nowMonth) + 1)){return false} if (day > nowDay){return false} return true } //Function to remove Twistie image alt values function changeTwistieAlts() { var images = document.images; var imgSource; for (i=0;i-1)||(imgSource.indexOf('collapse.gif'))>-1) { images[i].alt = ''; } } } //The following function are for Phone Number validation function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripChars(s, delimiters){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in delimiters, append to returnString. for (i = 0; i < s.length; i++){ // Check that current character isn't whitespace. var c = s.charAt(i); if (delimiters.indexOf(c) == -1) returnString += c; } return returnString; } function checkPhone(strPhone, international){ var digits = "0123456789"; var phoneNumberDelimiters = "()-. "; var minDigitsInIPhoneNumber = 10; if(international) phoneNumberDelimiters += "+"; s=stripChars(strPhone,phoneNumberDelimiters); return (isInteger(s) && s.length >= minDigitsInIPhoneNumber); } function newPhoneCheck(strPhone) { if(strPhone.search(/^[0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$/) != -1) return true; else return false; } //force all attachments to new windows function setAttachmentsNewWindow() { for (var i = 0; i < document.links.length; i++) { //Use the target property of the link object to append the target window to open the attachments if ( ( "" + document.links[i] ).indexOf( "$FILE" ) != -1 ) { document.links[i].target = "_resource_win" ; } } } //Function to Hide/Show Product Attributes function hideShow(hidethis) { if( document.getElementById(hidethis).style.display=='none' ){ document.getElementById(hidethis + 'Img').src = 'twistieOn.gif'; document.getElementById(hidethis).style.display = ''; } else{ document.getElementById(hidethis + 'Img').src = 'twistie.gif'; document.getElementById(hidethis).style.display = 'none'; } } function expandCollapse(ec,count,img) { var i=0 for (i=1;i<=count;i++) { if (document.getElementById('row' + i)) { document.getElementById('row' + i + 'Img').src = 'twistie' + img + '.gif'; document.getElementById('row' + i).style.display = ec } else { break } } } function librarySearch(searchString) { if (searchString > "" ) { window.location='http://www.mjinsurance.com/dupre.nsf/vwLibrary?SearchView&Query=' + searchString + '&SearchOrder=4&Count=999'; } else { alert('Please enter a search keyword.'); } } function submitEnter(myfield,e,search){ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { librarySearch(search); return false; } else return true; } //Swap Submit Header Login Image function swapSubmit(flag) { if (flag == 'ON') { document.getElementById('eServicesSubmit').src = '/dupre.nsf/eServicesSubmitON.gif'; } else { document.getElementById('eServicesSubmit').src = '/dupre.nsf/eServicesSubmit.gif'; } } function submitEnter(myfield,e,search){ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { validateLogin(); return false; } else return true; } //***** Validate Login begin function validateLogin() { var f; f = document.forms['frmLoginManual']; if (f.Username.value=="") { alert("Please enter your user name"); f.Username.focus(); return; } if (f.Password.value=="") { alert("Please enter your password"); f.Password.focus(); return; } f.submit(); } //***** Validate Login end