// Browsercheck (needed) function cm_bwcheck() { this.ver = navigator.appVersion; this.agent = navigator.userAgent.toLowerCase(); this.dom = document.getElementById ? 1 : 0; // operating systems this.win = this.agent.indexOf( "win" ) > -1; this.mac = this.agent.indexOf( "mac" ) > -1; this.linux = this.agent.indexOf( "linux" ) > -1; this.unix = this.agent.indexOf( "unix" ) > -1; this.sun = this.agent.indexOf( "sun" ) > -1; // high level browser names this.gecko = this.agent.indexOf( "gecko" ) > -1; this.opera = this.agent.indexOf( "opera" ) > -1; this.safari = this.agent.indexOf( "safari" ) > -1; this.konqueror = this.agent.indexOf( "konqueror" ) > -1; this.netscape = this.agent.indexOf( "netscape" ) > -1; this.palm = this.agent.indexOf( "palm" ) > -1; this.phone = this.agent.indexOf( "phone" ) > -1; this.ie = ( this.agent.indexOf( "msie" ) > -1 && !this.opera && !this.palm ); // more specific browser names and versions this.ie7 = ( this.agent.indexOf( "msie 7" ) > -1 && !this.opera && !this.palm ); this.ie6 = ( this.agent.indexOf( "msie 6" ) > -1 && !this.opera && !this.palm ); this.ie5 = ( this.agent.indexOf( "msie 5.0" ) > -1 && !this.opera && !this.palm ); this.ie51 = this.agent.indexOf( "msie 5.1" ) > -1; this.ie52 = this.agent.indexOf( "msie 5.2" ) > -1; this.ie55 = ( this.agent.indexOf( "msie 5.5" ) > -1 && !this.opera && !this.palm ); var msieInd = this.agent.search(/((MSIE\s)([6-9]{1}\.|[1-9]{1}[0-9]{1}\.))/i); //find any "MSIE 6." to "MSIE 99." if (msieInd > -1) { this.ie6 = true; } this.ie4 = this.agent.indexOf( "msie 4" ) > -1; this.ie3 = this.agent.indexOf( "msie 3" ) > -1; this.ie2 = this.agent.indexOf( "msie 3" ) > -1; this.mozilla = ( this.gecko && ( this.agent.indexOf( "firefox" ) > -1 || this.agent.indexOf( "firebird" ) > -1 || this.agent.indexOf( "phoenix" ) > -1 || this.agent.indexOf( "galeon" ) > -1 || this.agent.indexOf( "k-meleon" ) > -1 ) ); this.firefox = this.agent.indexOf( "firefox" ) > -1; this.op5 = (this.agent.indexOf( "opera 5" ) > -1 || this.agent.indexOf( "opera/5" ) > -1); this.op6 = (this.agent.indexOf( "opera 6" ) > -1 || this.agent.indexOf( "opera/6" ) > -1); this.op7 = (this.agent.indexOf( "opera 7" ) > -1 || this.agent.indexOf( "opera/7" ) > -1); this.op8 = (this.agent.indexOf( "opera 8" ) > -1 || this.agent.indexOf( "opera/8" ) > -1); this.op9 = (this.agent.indexOf( "opera 9" ) > -1 || this.agent.indexOf( "opera/9" ) > -1); this.nsdom = ( this.gecko && this.netscape ); this.ns8 = ( this.agent.indexOf( "netscape/8" ) > -1 && this.netscape ); this.ns7 = ( this.agent.indexOf( "netscape/7" ) > -1 && this.netscape ); this.ns6 = ( this.agent.indexOf( "netscape6" ) > -1 && this.netscape ); this.ns47 = ( this.agent.indexOf( "mozilla/4.7" ) > -1 && this.netscape ); this.ns45 = ( this.agent.indexOf( "mozilla/4.5" ) > -1 && this.netscape ); this.ns4 = ( this.agent.indexOf( "mozilla/4.0" ) > -1 && this.netscape ); this.ns3 = ( this.agent.indexOf( "mozilla/3.0" ) > -1 && this.netscape ); this.ns2 = ( this.agent.indexOf( "mozilla/2.0" ) > -1 && this.netscape ); // un/supported browser lists //this.bw = ( this.gecko || this.safari || this.ie7 || this.ie6 || this.ie55 || this.ie5 || this.ie4 || this.ns47 || this.ns45 || this.op7 || this.op6 || this.op5 ); this.supported = ( this.safari || this.firefox || this.ie7 || this.ie6 || this.ie55 ); this.unsupported = ( this.ie51 || (this.ie52 && this.mac) || this.ie4 || this.ie3 || this.ie2 || (this.netscape && !this.ns8 ) || this.palm || this.phone || this.op6 || this.op7 || this.op8 || this.op9|| this.ie5); this.usedom= this.ns6; // Use dom creation this.reuse = this.ie || this.usedom; // Reuse layers this.px = this.dom && !this.op5 ? "px" : ""; this.img = document.images ? 1 : 0; this.fr = document.frames ? 1 : 0; this.appversion = parseFloat(navigator.appVersion.substring(0,3)); //alert(this.agent+"\n"+navigator.appVersion+"\n"+this.appversion); return this; } var bw = new cm_bwcheck(); function getCookie( name ) { var index = document.cookie.indexOf( name + "=" ); if ( index == -1 ) return null; index = document.cookie.indexOf( "=", index ) + 1; // first character var endstr = document.cookie.indexOf( ";", index ); if ( endstr == -1 ) endstr = document.cookie.length; // last character return unescape( document.cookie.substring( index, endstr ) ); } function checkBrowserCookie() { var theCookieName = getCookie( "abw" ); if ( theCookieName == "displayed" ) return true; return false; } if (!checkBrowserCookie()){ if ( window.location.hostname.indexOf( "sgio" ) > -1 ) { if ( bw.unsupported || bw.appversion <= 3 ) window.location.href = "/pub/internet/error/sgio_unsupported.shtml?url="+window.location; } else if ( window.location.hostname.indexOf( "sgic" ) > -1 ) { if ( bw.unsupported || bw.appversion <= 3 ) window.location.href = "/pub/internet/error/sgic_unsupported.shtml?url="+window.location; } else if ( window.location.hostname.indexOf( "nrmaqld" ) > -1 ) { if ( bw.unsupported || bw.appversion <= 3 ) window.location.href = "/pub/internet/error/nrma_unsupported.shtml?url="+window.location; } else if ( window.location.hostname.indexOf( "nrma" ) > -1 ) { if ( bw.unsupported || bw.appversion <= 3 ) window.location.href = "/pub/internet/error/nrma_unsupported.shtml?url="+window.location; } else if ( window.location.hostname.indexOf( "racv" ) > -1 ) { //racv_unsupported.html? } else if ( window.location.hostname.indexOf( "state." ) > -1 ) { if ( bw.unsupported || bw.appversion <= 3 ) window.location.href = "/pub/internet/error/statenz_unsupported.shtml?url="+window.location; } else { if ( bw.unsupported || navigator.appVersion <= 3 ) window.location.href = "/pub/internet/error/nrma_unsupported.shtml?url="+window.location; } } // end browser sniffing code if (window.location.href.indexOf("/pub/") >= 0 && window.location.protocol == "https:") { winPro = "http:"; winHost = window.location.hostname; winPath = window.location.pathname; window.location.href = winPro + "//" + winHost + winPath; } function showLayer(div,nest) { document.getElementById(div).style.visibility = 'visible'; } function hideLayer(div,nest) { document.getElementById(div).style.visibility = 'hidden'; } function hideAll() { hideLayer('motorO'); hideLayer('homeO'); hideLayer('healthO'); hideLayer('businessO'); hideLayer('otherO'); hideLayer('communityO'); } // Swap images that are nested in Layers function swapImage(imgName, imgSource, layerOne, layerTwo) { if (bw.img) getImgObj(imgName, layerOne, layerTwo).src = imgSource; } // Get the image object given imageid/name and the layers the image sits in - for two layers. function getImgObj(imgId, layer1, layer2) { if (bw.dom) menuImgObj = eval ("document.getElementById('" + imgId + "')"); else if ((bw.ie4) || (bw.ie5)) menuImgObj = eval ("document.all." + layer2 + ".document.images['" + imgId + "']"); else if (bw.ns4) menuImgObj = eval ("document.layers." + layer1 + ".document.layers." + layer2 + ".document.images['" + imgId + "']"); return menuImgObj; } // getHighLight gets the id element from the navbar Table, looks at URL & determines if page is a match to category. function getURL(){ elementID = ''; //dirName is the name of the main directory dirName = location.href.split('/pub/nrma/')[1].split('.')[0].split('/')[0]; //anchorName is the name of file with _ before it anchorName = location.href.split('/pub/nrma/' + dirName)[1].split('.')[0]; //while (anchorName.search('-')!=-1) //anchorName = anchorName.replace('-',''); //while (anchorName.search('_')!=-1) //anchorName = anchorName.replace('_',''); while (anchorName.search('/')!=-1) anchorName = anchorName.replace('/','_'); elementID += '_pub_nrma_'; elementID += dirName; elementID += anchorName; updateTD(elementID,dirName); if (anchorName == '_cv_lifeinsurance'){window.setTimeout('location.replace(\'http://clearview.nrma.com.au\');',1000)} } //determines which menu item is highlighted based on URL of page and menu id. function updateTD(pageName,dirName){ if (!(bw.ns4)){ var element = document.getElementById(pageName); if (!(element == null)){ switch (dirName) { case 'motor': document.getElementById(pageName).className = "mot"; break; case 'home': document.getElementById(pageName).className = "hom"; break; case 'health': document.getElementById(pageName).className = "hea"; break; case 'business': document.getElementById(pageName).className = "bus"; break; case 'other-insurance': document.getElementById(pageName).className = "oth"; break; case 'retirement': document.getElementById(pageName).className = "oth"; break; case 'public-liability': document.getElementById(pageName).className = "oth"; break; case 'community': document.getElementById(pageName).className = "com"; break; } } } } //This function determines the directory of the previous page function getPrevious(){ if (document.referrer&&document.referrer!=""){ dirName = document.referrer.split('/pub/nrma/')[1].split('.')[0].split('/')[0]; updateSelected(dirName); } } //determines directory case for previous section for claims function updateSelected(dirName){ element = ''; element += dirName; element += "Cat"; switch (dirName) { case 'motor': updateSelectedClaim(element); break; case 'home': updateSelectedClaim(element); break; case 'health': updateSelectedClaim(element); break; case 'business': updateSelectedClaim(element); break; case 'other-insurance': updateSelectedClaim(element); break; } } //updates the selected option, based on previous directory for claims. function updateSelectedClaim(x){ document.getElementById(x).selected = true; ChangeSOpt(document.getElementById(x).value); } function verifyMe() { var error; error = false; var message; message = "Please complete the following fields:" if (bw.ns4){ var form = document.layers["middle"].document.forms["formname"]; } else { var form = document.forms.formname; } var ticked; ticked = false; if (form.state.selectedIndex == 0) { error = true; message += "\n\n * State"; } if (form.claim.selectedIndex == 0) { error = true; message += "\n\n * Claim Type"; } if (error) { alert(message); } else { //State Value stateVal = form.state.options[form.state.selectedIndex].value; //claim Value = this is the url + state name to link to claimVal = form.claim.options[form.claim.selectedIndex].value; redirectPage(stateVal, claimVal); } } //Redirects, based on which claim user chooses function redirectPage(state, claim){ url=''; url+= '/pub/nrma/claims/'; url+= claim; url+= '-'; if ((state == 'act')||(state == 'nsw')){ if (!(claim == 'ctp-injury')){ state = 'act-nsw'; } } url+= state; url+= '.shtml'; window.location.href = url; } // Removes White Space. (Used by Search box) function removeWhiteSpace(field) { while('' + field.value.charAt(0) == ' ') field.value = field.value.substring(1,field.value.length); while('' + field.value.charAt(field.value.length-1) == ' ') field.value = field.value.substring(0,field.value.length-1); } function openPopUp(pageId, toolbars, width, height, tb, mb, loc, sb, rs) { if (toolbars == "s") { popArg = "toolbar=" + tb + ",menubar=" + mb + ",location=" + loc + ",scrollbars=" + sb + ",resizable=" + rs + ",width=" + width + ",height=" + height; window.open(pageId, "popUp", popArg); } else if(toolbars) { popArg = "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height; window.open(pageId, "popUp", popArg); } else { popArg = "toolbar=no,menubar=no,location=no,scrollbars=auto,resizable=no,width=" + width + ",height=" + height; window.open(pageId, "popUp", popArg); } } // function to keep backwards compatibility with old design function See(page) { OpenWin = this.open(page, "_"+"blank", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=no,width=677,height=494"); } function feedbackPopup(page) { FeedWin = this.open(page, "FeedbackWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=677,height=525"); } function startIt() { return } function new_window(page) { var win = window.open(page,"_"+"blank","toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=500,height=500"); } // opens the calculator windows function openCalc(url) { window.open( url, 'calcWin', 'toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes, width=800, height=550, top=5, left=5' ); } function trim(inputString) { // Removes leading and trailing spaces from the passed string. Also removes // consecutive spaces and replaces it with one space. If something besides // a string is passed in (null, custom object, etc.) then return the input. var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } return retValue; // Return the trimmed string back to the user } function isTabKeyEvent(evt) { evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode == 9) { return true; } return false; } function getFirstFormElement(evt) { var obj = null; if(isTabKeyEvent(evt)) { for (i = 0; i < document.forms.length; ++i) { for (j=0; j 0) { if(obj==null || document.forms[i].elements[j].tabIndex < obj.tabIndex) obj = document.forms[i].elements[j]; } } } } return obj; } function drawBorder(obj) { //04-01-2007 // this is currently used by radio buttons in NBOL car comp - owner //We might need to add some code here later to let the user know when //the object is in focus but the browser should do that by default //this code only affects ie6+ (not firefox) return; /*if(obj) { obj.style.borderStyle="dotted"; obj.style.borderWidth="1px"; obj.style.borderColor="gray"; return true; } return false; */ } function eraseBorder(obj) { if(obj) { obj.style.borderStyle=""; return true; } return false; } var first_mandatory_error = null;