function NewWindow(mypage, myname, w, h, scroll, status, t, m) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',status='+status+',toolbar='+t+',menubar='+m+',resizable' win = window.open(mypage, myname, winprops) } function loadFrames(p) { framecode = "Calculators" + "" + "" + ""; page = window.open("","","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=750,height=500,top=30,left=10"); page.document.open(); page.document.write(framecode); page.document.close(); } //Functions to handle search requests function openDbRelativeURL( url, target ){ //Check we have a target window; target = (target == null ) ? window : target; //Work out the path of the database; path = location.pathname.split('.nsf')[0] + '.nsf/'; target.location.href = path + url; } function doSearch ( s ) { var regExp1 = /\bfield\b/; var regExp2 = /[(,),<,>,\[,\]]/; var str = s.value; if ( str == "" ){ alert("Please be sure to enter something to search for."); s.focus(); } else { if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing if ( regExp1.test( str ) || regExp2.test( str ) ){ var alrt = "Please note that you can not include:"; alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >"; alrt += "\n\nin your search query!\n\nIf you are confident that you know"; alrt += "\nwhat you are doing, then you can\nmanually produce the URL required." s.focus(); return alert( alrt ); } this.location.href="/Mortgage/MtgAppArchive.nsf/vSiteSearch?SearchView&SearchFuzzy=True&Query=" + escape( str ) + "&start=1&count=500"; //openDbRelativeURL("/Mortgage/MtgAppArchive.nsf/vSiteSearch?SearchView&SearchFuzzy=True&Query=" + escape( str ) + "&start=1&count=500"); } } function returnFalse(s){ //guess the field if not supplied s = (s == null) ? document.forms[0].Query : s; //if you want to do the search, use this line //doSearch(s); //if you want to alert the user, use this line //alert('Please use the \'Go!!\' button to do a search'); //this line should always be here!! return false; } isMac = (navigator.appVersion.indexOf('Mac')!=-1) ? true : false; NS4 = (document.layers) ? true : false; IEmac = ((document.all)&&(isMac)) ? true : false; IE4plus = (document.all) ? true : false; IE4 = ((document.all)&&(navigator.appVersion.indexOf('MSIE 4.')!=-1)) ? true : false; IE5 = ((document.all)&&(navigator.appVersion.indexOf('MSIE 5.')!=-1)) ? true : false; IE6 = ((document.all)&&(navigator.appVersion.indexOf('MSIE 6.')!=-1)) ? true : false; ver4 = (NS4 || IE4plus) ? true : false; NS6 = (!document.layers)?true:false; IE5plus = IE5 || IE6; IEMajor = 0; if (IE4plus) { var start = navigator.appVersion.indexOf('MSIE'); var end = navigator.appVersion.indexOf('.',start); IEMajor = parseInt(navigator.appVersion.substring(start+5,end)); IE5plus = (IEMajor>=5) ? true : false; } function popUpWindow(mypage, myname, w, h, scroll, status, t) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',status='+status+',toolbar='+t+',resizable' win = window.open(mypage, myname, winprops) } var browserName=navigator.appName function errorFnc(obj){ if (browserName != 'Netscape'){ obj.style.backgroundColor='#FFDA75'; } } function formatEmail(obj){ // Note: The next expression must be all on one line... // allow no spaces, linefeeds, or carriage returns! var goodEmail = obj.value.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i); if (goodEmail){ return true; } else { obj.focus() obj.select() return false } } //} function stringFilter (input) { s = input.value; filteredValues = "()-. "; // Characters stripped out var i; var returnString = ""; for (i = 0; i < s.length; i++) { // Search through string and append to unfiltered values to returnString. var c = s.charAt(i); if (filteredValues.indexOf(c) == -1) returnString += c; } return returnString; } function formatPhone(obj){ var string = obj.value; if (string.length == 7){ if (string.search(/[0-9][0-9][0-9][0-9][0-9][0-9][0-9]/) != -1){ obj.value = string.slice(0,3) + '-' + string.slice(3,7) return true; } else return false } else if (string.length == 8){ if (string.search(/[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/) != -1) return true; else return false } else if (string.length == 10) { if (string.search(/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/) != -1) { obj.value = '('+ string.slice(0,3) + ') ' + string.slice(3,6) + '-' + string.slice(6,10) return true } else return false } else if (string.length == 14) { if (string.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 } else if (string.length == 0) return true else return false } function validateForm(){ f = document.forms[0] frmLength = f.length; anyFalse = false; var browserName=navigator.appName //Loop through all fields and check for blank values //highlights all required fields that are blank for (i=0; i -1){ if (id.indexOf("email") != -1) { type = "email"; } else if (id.indexOf("phone") != -1) { type = "phone"; } else if (id.indexOf("password")!=-1){ type="password"; } else{ type="text" } id = "RQ"; } //reset colors of fields if (browserName != 'Netscape'){ f[i].style.backgroundColor=''; } if (id == 'RQ'){ switch (f[i].type) { case "text": //text box switch (type){ case "email": if ((!formatEmail(f[i])) || f[i].value==""){ errorFnc(f[i]); anyFalse = true; }; break case "phone": //Removed Phone formatting until better formatting script is found or built //(!formatPhone(f[i])) || if (f[i].value==""){ errorFnc(f[i]); anyFalse = true; } break default: if(f[i].value==""){ errorFnc(f[i]); anyFalse = true; } break } break case "password": if(f[i].value.length < 6){ errorFnc(f[i]); anyFalse = true; } break case "textarea": //textarea if(f[i].value==""){ errorFnc(f[i]); anyFalse = true; } break case "select-one": //dropdown list if(f[i].selectedIndex == 0){ errorFnc(f[i]); anyFalse = true; } break default: break } } } //This loop will take focus to the first error field for (i=0; i -1){ if (id.indexOf("email") != -1) { type = "email"; } else if (id.indexOf("phone") != -1) { type = "phone"; } else{ type="" } id = "RQ"; } if (id == 'RQ'){ if (f[i].type == "text") { if (type=="email"){ if ( (!formatEmail(f[i])) || f[i].value==""){ f[i].focus(); break } } else if (type=="phone"){ //Removed phone formatting //!formatPhone(f[i])) || if (f[i].value==""){ f[i].focus(); break; } } else{ if ((f[i].value =="")){ f[i].focus(); break } } } else if(f[i].type == "password") { if (f[i].value.length < 6){ f[i].focus(); break; } } else if (f[i].type=="select-one"){ if (f[i].selectedIndex == 0){ f[i].focus(); break; } } } } if (anyFalse){ alert('Please provide all required information'); return false; } else return true; } function getSelectedButton(rbObj){ for (var i = 0; i < rbObj.length; i++) { if (rbObj[i].checked) { return i } } return 0 } function showHide(elementToHide, showHide){ if (showHide == "show") { document.getElementById(elementToHide).style.visibility = "visible" document.getElementById(elementToHide).style.display = "block" } else{ document.getElementById(elementToHide).style.visibility = "hidden" document.getElementById(elementToHide).style.display = "none" } }