//Function to Set Current Page's Nav Item ON function setCurrentNav(nav1, nav2, nav3) { //alert(nav1 + " - " + nav2 + " - " + nav3); if (nav1) { if (nav1 != 'x') { document.getElementById('mainNav' + nav1).className = 'mainNavON'; } } if (nav2 != 'x') { document.getElementById(nav2 + 'LI').style.backgroundColor = '#F1F8F6'; } if (nav3 != 'x') { document.getElementById('leftNavA' + nav3).style.color = '#004B8D'; document.getElementById('leftNavLI' + nav3).style.backgroundColor = '#F1F8F6'; } } //Function to Set Current News Page's Nav Item ON function setCurrentNewsNav(news) { document.getElementById('leftNavA' + news).style.color = '#004B8D'; document.getElementById('leftNavLI' + news).style.backgroundColor = '#F1F8F6'; } //Function to Set Selected Calendar Date Item ON function setSelectedDate(dateId) { if (dateId != 'x') { if (document.getElementById('date' + dateId)) { document.getElementById('date' + dateId).style.backgroundColor = '#F1F8F6'; } } } //Build Search URL function siteSearch(searchString) { if (searchString > "" ) { searchString = searchString.replace(/[^a-zA-Z 0-9]+/g,''); window.location='/Web/ShawneeCMS.nsf/frmSearchResults?OpenForm&Query=' + searchString; } } //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 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; } //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 search(searchString) { if (searchString > "" ) { window.location='http://www.mjinsurance.com/Web/ShawneeCMS.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) { siteSearch(search); return false; } else return true; } function autoSlide(divId) { if (divId != 'x') { slide(divId); } } function slide(divId) { if(document.getElementById(divId).style.display == 'none') { document.getElementById(divId).style.display = 'inline-block' document.getElementById(divId + 'Twistie').src = '/Web/ShawneeCMS.nsf/twistieCollapse.gif'; document.getElementById(divId + 'LI').style.borderBottom = '0px solid #F7FAF9'; return false; } else { document.getElementById(divId).style.display = 'none' document.getElementById(divId + 'Twistie').src = '/Web/ShawneeCMS.nsf/twistieExpand.gif'; document.getElementById(divId + 'LI').style.borderBottom = '1px solid #F7FAF9'; return false; } } sfHover = function() { var sfEls = document.getElementById("nav").getElementsByTagName("LI"); for (var i=0; i @ , ; : \ " . [ ] */ var specialChars="\\(\\)><@,;:\\\\\\\"\\'#$%!`\\|\\.\\[\\]*/"; /* The following string represents the range of characters allowed in a username or domainname. It really states which chars aren't allowed.*/ var validChars="\[^\\s" + specialChars + "\]"; /* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are allowed and which aren't; anything goes). E.g. "jiminy cricket"@disney.com is a legal e-mail address. */ var quotedUser="(\"[^\"]*\")"; /* The following pattern applies for domains that are IP addresses, rather than symbolic names. E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */ var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; /* The following string represents an atom (basically a series of non-special characters.) */ var atom=validChars + '+'; /* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */ var word="(" + atom + "|" + quotedUser + ")"; // The following pattern describes the structure of the user var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); /* The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above. */ var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); /* Finally, let's start trying to figure out if the supplied address is valid. */ /* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */ var matchArray=emailStr.match(emailPat); if (matchArray==null) { /* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */ return false; } var user=matchArray[1]; var domain=matchArray[2]; // Start by checking that only basic ASCII characters are in the strings (0-127). for (i=0; i127) { return false; } } for (i=0; i127) { return false; } } // See if "user" is valid if (user.match(userPat)==null) { // user is not valid return false; } /* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */ var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { return false; } } f.tEmail.focus();f.tEmail.select();return true; } // Domain is symbolic name. Check if it's valid. var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i