// VaFWIS_common.asp ASP JavaScript altered by IIS Session March 7, 2017 abj3 //include only that which can be duplicated in VaFWIS_report_search.asp //---JavaScript does not re-define a previously defined variable so it is safe to declare these OpenWindowVar var helpOpenWindowVar; var mapOpenWindowVar; var bovaOpenWindowVar; var docHref; if( typeof docHref == 'undefined' ) { docHref = ""; } var softwareVersion = '20130625'; var remote_addr = '54.81.150.27'; var ampersand = String.fromCharCode(38); var computerName = ''; if( computerName.indexOf('%')==1 ) { computerName = ''; } var loginName = ''; if( loginName.indexOf('%')==1 ) { loginName = 'Visitor'; } var loginType = ''; if( loginType.indexOf('%')==1 ) { loginType = 'V'; } var loginTracking = ''; if( loginTracking.indexOf('%')==1 ) { loginTracking = '0'; } var loginCTS = ''; if( loginCTS.indexOf('%')==1 ) { loginCTS = '0'; } if(0) { alert('VaFWIS_common.asp\n' + '\nloginName="' + loginName + '"' + '\nloginType="' + loginType + '"' + '\nloginTracking="' + loginTracking + '"' ); } var ss = new SearchString(); if( loginName == "" ) { loginName = "Visitor"; } if( loginType == "" ) { loginType = "V"; } if( loginTracking == "" ) { loginTracking = 0; } if( loginCTS == "" ) { loginCTS = 0; } //alert('VaFWIS_common.asp:\n' // + 'user_name=""\n' // + 'user_type=""\n' // + 'user_id=""\n' // + 'loginCTS="'+ loginCTS + '"\n' //); var trackingComment = ''; if( false || ("A").indexOf(loginType) > -1 ) { trackingComment = computerName + ' ' + loginName + ' ' + loginType + ' ' + loginTracking + '   W3C HTML ' + 'validation'; if(typeof baseHref!='undefined' && baseHref!='') { trackingComment += '<BASE href="' + baseHref + '">'}; trackingComment += '' + docHref + '<' + '/a>'; } else { trackingComment = loginType + ' ' + loginTracking; } function openHelpWindow(url,windowName,helpWidth,helpHeight){ if( typeof helpOpenWindowVar != 'undefined' && !helpOpenWindowVar.closed ) { helpOpenWindowVar.close(); } if( ! helpWidth ) { helpWidth = 920; } if( ! helpHeight ) { helpHeight = 700; } if( ! windowName ) { windowName = "help"; } if(typeof baseHref == 'undefined') { baseHref = ''; } if( url.substr(0,6) == 'Title=' || url.substr(0,12)=='Content_URL=' ) { url = baseHref + '../?' + url + '&pf=2'; url += '&target='+windowName; } else if( url.substr(0,5) != 'http:' ) { url = url.replace('?','&'); //--- Microsoft IE6 does not acknowledge BASE html tag when redirecting within JavaScript so baseHref is needed. if( url.substr(0,3)=='../' ) { url = baseHref + '../?Content_URL='+url.substr(3,url.length-3) + '&pf=2'; } else { if(typeof NewPages == 'undefined') { NewPages = 'NewPages'; } url = baseHref + '../?Content_URL=' + NewPages + '/'+url + '&pf=2'; } url += '&target='+windowName; } else { if( url.indexOf('?')<0 ) { url += '?pf=2'; } else { url += '&pf=2'; } url += '&target='+windowName; } //alert('openHelpWindow "' + unescape(unescape(url)) + '"'); url += '&version=' + parseInt((( new Date()).getTime())/1000/60/60/24,10); if( typeof helpOpenWindowVar != 'undefined' && !helpOpenWindowVar.closed ) { helpOpenWindowVar.close(); } helpOpenWindowVar = window.open( unescape(unescape(url)),windowName, 'top=0,left=200,width=' + helpWidth + ',height=' + helpHeight + ',resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes'); helpOpenWindowVar.focus(); return( false ); } function openMapWindow(url,windowName){ if( typeof mapOpenWindowVar != 'undefined' && !mapOpenWindowVar.closed ) { mapOpenWindowVar.close(); } if( ! windowName ) { windowName = "map"; } //--- Microsoft IE6 does not acknowledge BASE html tag when redirecting within JavaScript so baseHref is needed. //------ if(typeof baseHref == 'undefined') { baseHref = ''; } if( typeof searchType != 'undefined' ) { url += '&searchType='+searchType; } url += '&target='+windowName; url = unescape(url); url = url.replace('#','%23'); //------ url = baseHref + unescape(url); url += '&version=' + parseInt((( new Date()).getTime())/1000/60/60/24,10); if( typeof mapOpenWindowVar != 'undefined' && !mapOpenWindowVar.closed ) { mapOpenWindowVar.close(); } mapOpenWindowVar = window.open( url,windowName, 'top=0,left=200,width=920,height=700,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes'); mapOpenWindowVar.focus(); return( false ); } function openBOVAWin(bovaCode){ if( typeof bovaOpenWindowVar != 'undefined' && typeof helpOpenWindowVar != 'undefined' && !helpOpenWindowVar.closed ) { helpOpenWindowVar.close(); } var windowName = 'booklet_window'; //--- Microsoft IE6 does not acknowledge BASE html tag when redirecting within JavaScript so baseHref is needed. // if(typeof baseHref == 'undefined') { baseHref = ''; } // var url = baseHref; //--- --- --- url += 'VaFWIS_booklet.html?'; url = ( ss && ss.get && ss.get("BOVALite","")!="" ) ? "/fwis/BOVALite.html?" : "/fwis/booklet.html?"; url += '&bova=' + bovaCode; url += '&Menu=_.Taxonomy'; url += '&version=' + parseInt((( new Date()).getTime())/1000/60/60/24,10); bovaOpenWindowVar = window.open(url,windowName, 'top=0,left=200,width=920,height=700,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes'); bovaOpenWindowVar.focus(); return( false ); } function closeWindows(){ if( typeof helpOpenWindowVar != 'undefined' && helpOpenWindowVar && typeof helpOpenWindowVar.closed != 'undefined' && helpOpenWindowVar.closed == false ) { helpOpenWindowVar.close(); helpOpenWindowVar = undefined; } if( typeof mapOpenWindowVar != 'undefined' && mapOpenWindowVar && typeof mapOpenWindowVar.closed != 'undefined' && mapOpenWindowVar.closed == false ) { mapOpenWindowVar.close(); mapOpenWindowVar = undefined; } if( typeof bovaOpenWindowVar != 'undefined' && bovaOpenWindowVar && typeof bovaOpenWindowVar.closed != 'undefined' && bovaOpenWindowVar.closed == false ) { bovaOpenWindowVar.close(); mapOpenWindowVar = undefined; } return( true ); } function styleObject(object) { if (document.getElementById && document.getElementById(object) != null) { return document.getElementById(object).style; } else if (document.layers && document.layers[object] != null) { return document.layers[object].style; } else if (document.all) { return( document.all[object]); } else { return( new Object()); } } function elementObject(object) { if (document.getElementById && document.getElementById(object) != null) { return document.getElementById(object); } else if (document.layers && document.layers[object] != null) { return document.layers[object]; } else if (document.all) { return( document.all[object] ); } else { return( new Object()); } } function SearchString(sString,delimiter) { //--- return an object of value[name] from the browser search string //--- with method ".get(name)" to return associated value; this.params = new Object(); this.get = function(name, defaultValue) { //--- return value from this object if( typeof defaultValue == 'undefined' ) { defaultValue = null; } var value=this.params[name]; if( typeof value == 'undefined' || value==null) { value=defaultValue; } return( value ); } this.set = function(name,value,defaultValue) { //--- place value into this object if( typeof defaultValue == 'undefined' ) { defaultValue = null; } if( typeof value == 'undefined' || value==null) { value=defaultValue; } if( typeof name != 'undefined' ) { this.params[name] = value; } return( value ); } this.remove = function(name) { //--- delete "name" elemengt delete this.params[name]; return; } this.string = function(name,delimiter) { //--- return all name,value pairs asString if( !delimiter ) { delimiter = "&"; } var listString = ""; if( !name ) { for( var item in this.params ) { listString += delimiter+item + "=" + this.params[item]; } if( listString != "" ) { listString = listString.substr(1); } } else { listString = name + "=" + this.params[name]; } return( listString ); } //--- may pass a string to parse if (!sString) { sString=location.search.substring(1,location.search.length); if( typeof content_url_addon != 'undefined' ) { sString += content_url_addon; } } if( !delimiter ) { delimiter = '&'; } if (sString.length > 0) { //--- replace pluss with space sString = sString.replace(/\+/g, ' '); //--- name/value pairs separated by & var argsArray = sString.split(delimiter); //--- assign each params as name=value for (var i in argsArray) { var nameArray = argsArray[i].split('='); if (nameArray[1]) { var name = unescape(nameArray.shift()); var value = ''; while( nameArray.length>0 ) { value += unescape(nameArray.shift()); if( nameArray.length > 0 ) { value += '='; } } this.params[name] = value; } } } } function decode( comments ) { if( !comments ) { comments = ""; } var result = Replace(comments,"%25","%"); result = Replace(result,"%26","&"); result = Replace(result,"%3C","<"); result = Replace(result,"%5C%27","'"); result = Replace(result,"%5C%5C","\\"); result = Replace(result,"%27","'"); result = Replace(result,"%5C","\\"); result = Replace(result,"%23","#"); result = Replace(result,"%20"," "); return( result ); } function safeComment(stringValue,maxLen) { if( !maxLen ) { maxLen = 32; } if( stringValue.length < maxLen ) { maxLen = stringValue.length; } var safeComment = stringValue.substr(0,maxLen); safeComment = safeComment.replace(/[^A-Za-z0-9\@\$\.\,\+\-\_\/\[\]]\~\!/g, " "); safeComment = safeComment.replace(/\s\s/g, " "); return( safeComment.trim() ); }