/*** Graceful degrade for non-javascript users & some event capture for livesearch ***/ window.onload = addscript; // Graceful degrade stuff for non-javascript users document.onclick = hidelivesearch; // Onclick capturing for closing live search box function addscript() { // check to see that the browser supports the getElementById method if (!document.getElementById) { return false; } else { // document.getElementById('countriesanchor').href = "#"; // Replace conventional url in countries footer link // document.getElementById('searchfield').value= " Search"; // document.getElementById('popupclose').innerHTML = "close //window close window"; //Add //close window link for popup template } } function openpopup() { //window.open(linkURL,'popup','width=' + w +',height=' + h); window.open('popup.html','popup','width=500,height=500'); } /*** START Primary nav hover function for IE ***/ sfHover = function() { var sfEls = document.getElementById("nav").getElementsByTagName("LI"); for (var i=0; i minchars) { // Loop through all link elements for (i=0;i" + xtitles[0].firstChild.nodeValue + "
"; } else { searchoutput = searchoutput + ""; } } catch (er) { searchoutput = searchoutput + ""; } } } } if (searchoutput=="") { // Collapse the suggestions box when no matches & halt the ajax loading gif document.getElementById("livesearch").style.visibility="hidden"; document.getElementById("livesearchbutton").src="http://www.pwc.com/gx/en/webadmin/assets/image/ajaxclose.gif"; // Show the close button, replacing the ajax gif document.getElementById("livesearchbutton").className="livesearchclose"; } else { // Return the response, only when xml http call is done. Show the close button, replacing the ajax gif if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") { document.getElementById("livesearch").style.visibility="visible"; document.getElementById("livesearch").innerHTML=searchoutputheader + searchoutput + searchoutputfooter; document.getElementById("livesearchbutton").src="http://www.pwc.com/gx/en/webadmin/assets/image/ajaxclose.gif"; document.getElementById("livesearchbutton").className="livesearchclose"; } } } function clearsearch() { //Clear from initial focus document.getElementById("searchfield").value=""; } function clearlivesearch() { // Clear from the button & also hide the button document.getElementById("searchfield").value=""; document.getElementById("livesearch").innerHTML=""; document.getElementById("livesearch").style.visibility="hidden"; document.getElementById("livesearchbutton").src="http://www.pwc.com/gx/en/webadmin/assets/image/tran.gif"; document.getElementById("livesearchbutton").className=""; } // Hide the livesearch box on a click outside its div function hidelivesearch(evt) { evt = evt || window.event; var targ = evt.target || evt.srcElement; // If the livesearch box is open, clear it if (targ.id=="livesearch" || targ.id=="livesearchheader" || targ.id=="livesearchfooter" || targ.id=="searchsubmit") { return; } else { //if (document.getElementById("livesearch").style.visibility=="visible") { // clearlivesearch(); //} } } /*** START Lightweight browser detection ***/ //alert(BrowserDetect.browser + ' ' + BrowserDetect.version + ' on ' + BrowserDetect.OS); var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i": output = output + ">"; break; case '"': output = output + """; break; case "'": output = output + "'"; break; case ")": output = output + ")"; break; case "(": output = output + "("; break; case "+": output = output + "+"; break; case "&": output = output + "&"; break; case ";": output = output + ";"; break; default: output = output + input.charAt(count); break; } } return output; } // End removeSpecialChars(input) var aRVP = new Array(); var sRVPBoxTitle = 'Recently Visited Pages'; var sRVPCookieText = '
Please enable cookies on your browser to activate this functionality.
'; var cookieDomain = ""; if( window.location.host.indexOf(".pwc.com") == -1 ){ cookieDomain = ""; } else { cookieDomain = "; domain=pwc.com"; } document.cookie = "PwC=PwC; path=/" + cookieDomain; var cookieenabled = (document.cookie.indexOf("PwC=") != -1) ? true : false //checks if current page needs to be recorded in the cookie function processRVP() { var pos; // checks if cookies are enabled if (!(cookieenabled)) {return;} //read cookie and load global array readRVPCookie(); //check for the indicator to record this url // 0 = not to record; any value = record if (readMetaTag("RVPFlag") == "0") return; // check for # sign followed by any var tUrl = document.location.href; if (tUrl.indexOf('#') != -1) {tUrl = tUrl.substring(0,tUrl.indexOf('#')); } if (!(recentRVP(tUrl))) { // get link description var sRVPTitle = readMetaTag("RVPTitle"); if (sRVPTitle == "") { //get title from tag sRVPTitle = document.title; if (typeof sRVPTitle != "undefined") { // searches for something like "..& PricewaterhouseCoopers:!## Test " var mt = new RegExp(/^([^a-zA-Z0-9]*)PricewaterhouseCoopers([^a-zA-Z0-9]*)\s/i); sRVPTitle = sRVPTitle.replace(mt,""); } else {sRVPTitle = "";} } //record values in the cookie if ((sRVPTitle != "") && (typeof sRVPTitle != "undefined") && (sRVPTitle != "undefined")) { var pageInfo = escape(tUrl) + "~~" + escape(sRVPTitle) + "~~_self~~0~~~" ; recordRVP(pageInfo); //repoopulate global array readRVPCookie(); } } } // record in the cookie as requested function processbyreqRVP(title,url,target) { // checks if cookies are enabled if (!(cookieenabled)) {return;} // checks if title and url are provided if ((title == "") || (url == "")) {return;} // check for # sign followed by any var tUrl = url; if (tUrl.indexOf('#') != -1) {tUrl = tUrl.substring(0,tUrl.indexOf('#')); } if (!(recentRVP(tUrl))) { //record values in the cookie if ( (!(target)) || (target == '')) var pageInfo = escape(tUrl) + "~~" + escape(title) + "~~_blank~~1~~~" ; else var pageInfo = escape(tUrl) + "~~" + escape(title) + "~~" + target + "~~1~~~" ; recordRVP(pageInfo); //repoopulate global array readRVPCookie(); } } // record URL as most RVP in the cookie function recordRVP(pageInfo) { // checks if cookies are enabled if (!(cookieenabled)) {return;} var cookieSTR = "RVPLinks=" + pageInfo; for (var i=0; i < aRVP.length; i++) { if ((aRVP[i]) && (aRVP[i] != "")) cookieSTR = cookieSTR + aRVP[i] + "~~~"; if (i >= 4) break; } document.cookie = cookieSTR + ";path=/" + cookieDomain; } // checks if URL is recorded as the most recent RVP function recentRVP(url) { if ( (!(aRVP[0])) || (aRVP[0] == "") ) {return false;} //checks first entry var tRVP = aRVP[0].split("~~"); if (tRVP[0] == escape(url)) {return true;} return false; } // populate links for RVP box using cookie function displayRVP() { // checks if cookies are enabled and display appropriate message if cookies are disabled if (!(cookieenabled)) { document.write(sRVPCookieText); return; } //display links var parmArray = new Array(); var hdr = 0; var j = 0; var urlStr; var tUrl; //display cookie contents if ((aRVP[0]) && (aRVP[0] != "") ) { for (var i=0; i < aRVP.length; i++) { if (aRVP[i]) { parmArray = aRVP[i].split("~~"); if (i == 0) { // check for # sign followed by any tUrl = document.location.href; if (tUrl.indexOf('#') != -1) {tUrl = tUrl.substring(0,tUrl.indexOf('#')); } } if ( (parmArray[1]) && (parmArray[0]) && ( (i > 0) || ( (i == 0) && (!recentRVP(tUrl))) )) { // write header if (hdr == 0) {hdr = 1; document.write('<ul>');} // urlStr = '<li><a href="' + unescape(parmArray[0]) + '"'; urlStr = '<li><a href="' + removeSpecialChars(unescape(parmArray[0])) + '"'; // window target if ((parmArray[2]) && (parmArray[2] != 0)) {urlStr = urlStr + ' target="' + parmArray[2] + '"';} //check to see if this needs to be tagged to record in RVP if ((parmArray[3]) && (parmArray[3] == 1)) {urlStr = urlStr + ' onClick="processbyreqRVP(\'' + unescape(parmArray[1]) + '\',\'' + unescape(parmArray[0]) + '\',\'' + parmArray[2] + '\');"';} tUrl = unescape(parmArray[1]).replace("<","<"); tUrl = tUrl.replace(">",">"); urlStr = urlStr + ' title="' + unescape(parmArray[1]) + '">' + tUrl + '</a></li>'; document.write(urlStr); j = j + 1; } if (j >= 5) break; } } // end of for loop if (hdr == 1) {document.write('</ul>');} } } // read cookie contents function readRVPCookie() { var lnkStr = document.cookie; var pos = lnkStr.indexOf("RVPLinks="); if (pos == -1) return; // eliminate the text "PwC=PwC;RVPLinks=" from the string lnkStr = lnkStr.substring(pos+9); if (lnkStr.indexOf(";") > -1) {lnkStr = lnkStr.substring(0,lnkStr.indexOf(";"));} //load links in global array aRVP = lnkStr.split("~~~"); } // read meta tag for value function readMetaTag(tagName) { var content = ""; // check for various browsers and versions if (document.getElementById) { if (document.getElementById(tagName)) content = document.getElementById(tagName).content; } else if (document.all) { if (document.all[tagName]) content = document.all[tagName].content; } else if (document.layers) { if (document.layers[tagName]) content = document.layers[tagName].content; } return content; } processRVP(); // END RVP JS