/*** AJAX & JS Configuration parameters for territories ***/

/* Live search */
	
	var livesearchon = "true"; //Enable or disable live search. "true" for on. blank or any other value for off.
	var minchars = 2; //Min number of characters input before suggestions are triggered

	// Change to location of custom live search xml file
	var suggestionsfile = "/webmedia/633837132962720528_livesearch.xml";

/* Send & share links */

	// NB! This is required for all cc-ll.js files regardless
	var arr_ss = new Array();


/*** Graceful degrade for non-javascript users & some event capture for livesearch ***/
/* Value list for the page footer */ 
	var FooterURLs=['<li><a href="/home/eng/rss.html">RSS</a></li>', 
					'<li><a href="/home/eng/aboutusindex.html">About us</a></li>',
					'<li><a href="/home/eng/pressrmindex.html">Press room</a></li>',
					'<li><a href="/home/eng/eventsindex.html">Events</a></li>',
					'<li><a href="/home/eng/contactus.html">Office locations</a></li>',
					'<li><a href="/home/eng/contactwebmaster.html">Contact us</a></li>']

	var FooterCRLnks = ['<li><a accesskey="6" href="/home/eng/privacy.html">Privacy</a></li>',
						'<li><a href="/home/eng/legaldisclaimer.html">Legal</a></li>',
						'<li><a href="/home/eng/siteprovider.html">Site provider</a></li>',
						'<li><a href="/home/eng/sitemap.html">Site map</a></li>']

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 {
		if (document.getElementById('countriesanchor'))
		{
			document.getElementById('countriesanchor').href = "#";  // Replace conventional url in countries footer link
			document.getElementById('searchfield').value= " Search";
			document.getElementById('popupclose').innerHTML = "<a href='#' target='_self' onclick='window.close();'>close window <img src='/home/images/ui/ajaxclose.gif' border='0' alt='close window' /></a>"; //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() {
	if (document.getElementById("nav"))
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*** START Countries selector ***/

// Preload the AJAX loading gif
ajaxgif=new Image();
ajaxgif.src="/home/images/ui/ajaxload.gif";

function countriesreveal() { // Show, hide or add to territory selector box
	document.getElementById('countriesbox').style.visibility = 'visible';
	
  // Set the static lists (no longer ajax)
	document.getElementById('countriesboxhead').innerHTML = "";
	var countriesheader="<div id='countriestitle'>Commonly visited PwC sites</div><br clear='all' />";

	document.getElementById('countriescontents').innerHTML = "";
	var countriesoutput="<table id='countriestable' border='0' width='100%'><tbody><tr>";
	countriesoutput += "<td width='125px'><ul class='countrylist'><li><a href='http://www.pwc.com' target='_blank'>Global</a></li>";
	countriesoutput += "<li><a href='http://www.pwcias.com' target='_blank'>Asia Int'l Assignments</a></li>";
	countriesoutput += "<li><a href='http://www.pwccustoms.com' target='_blank'>Asia Pacific Customs</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/au' target='_blank'>Australia</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/br' target='_blank'>Brazil</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/ca' target='_blank'>Canada</a></li>";
	countriesoutput += "<li><a href='http://www.pwccn.com' target='_blank'>China</a>&nbsp;/&nbsp;<a href='http://www.pwchk.com' target='_blank'>Hong Kong</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.fr' target='_blank'>France</a></li></ul></td>";
	countriesoutput += "<td><ul class='countrylist'><li><a href='http://www.pwc.de' target='_blank'>Germany</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/in' target='_blank'>India</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/it' target='_blank'>Italy</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/jp' target='_blank'>Japan</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/mx' target='_blank'>Mexico</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/me' target='_blank'>Middle East</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/nl' target='_blank'>Netherlands</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/ru' target='_blank'>Russia</a></li></ul></td>";
	countriesoutput += "<td valign='top'><ul class='countrylist'><li><a href='http://www.pwc.com/sg' target='_blank'>Singapore</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/za' target='_blank'>South Africa</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/kr' target='_blank'>South Korea</a></li>";
    countriesoutput += "<li><a href='http://www.pwc.com/es' target='_blank'>Spain</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/se' target='_blank'>Sweden</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.ch' target='_blank'>Switzerland</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.co.uk' target='_blank'>United Kingdom</a></li>";
	countriesoutput += "<li><a href='http://www.pwc.com/us' target='_blank'>United States</a></li></ul></td></tr></tbody></table><br clear='all'>";
	countriesoutput += "<p style='text-align: right; font-weight: bold;'><a href='http://www.pwc.com/gx/en/site-index.jhtml' target='_blank'>Complete list of PwC territory sites</a></p><br clear='all' />";

	// Finally write the output; close button, header & contents.
	document.getElementById('countriesboxclose').innerHTML = "<a href='#' onClick='countrieshide(); return false;'><img src='/home/images/ui/ajaxclose.gif' alt='Close' border='0' id='countriesclosebutton' /></a>"
	document.getElementById('countriesboxhead').innerHTML = countriesheader;
	document.getElementById('countriescontents').innerHTML = countriesoutput;
}


function countrieshide() { 	// Clear the contents of the box and hide the div
	document.getElementById('countriescontents').innerHTML = "";  
	document.getElementById('countriesbox').style.visibility = 'hidden';  
}

/*** START Live search ***/

var xmlHttp
	
function showResult(str) {
	// Clear the suggestions box when no chars
	if (str.length<=minchars) {
		document.getElementById("livesearch").innerHTML="";
		document.getElementById("livesearch").style.visibility="hidden";
		return
	}
	if (livesearchon!="true") {
		return
	}
	
	// Place the AJAX loading gif. Replaced with the clear icon after the request is complete (below)
	document.getElementById("livesearchbutton").src="/home/images/ui/ajaxload.gif";
	document.getElementById("livesearchbutton").className="";
	
	xmlhttp=null;
	url = suggestionsfile; // Suggestions xml file taken from local.js

	if (window.XMLHttpRequest) {// code for IE7, Firefox, Mozilla, etc.
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {// code for IE5, IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp!=null) {
		xmlhttp.onreadystatechange=processsearch;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	else {
		//alert("Your browser does not support XMLHTTP.");
		clearlivesearch();
		return;
	}
}

function processsearch() { // Check if file is valid & if so do something with its contents

	// Take the current search string
	var str = document.getElementById("searchtext").value.toLowerCase();

	// Break the loop when http call is complete or there's an error
	if(xmlhttp.readyState!=4) return;
	if(xmlhttp.status!=200) {
		//alert("Problem retrieving XML data");
		clearlivesearch();
		return;
	}

	// Locate the link element to traverse
	x=xmlhttp.responseXML.documentElement.getElementsByTagName("link");
	var searchoutput = "";
	var searchoutputheader = "<div id='livesearchheader'>Recommended results</div>";
	var searchoutputfooter = "<div id='livesearchfooter'><a href='#'>View all results >></a></div>"; 
	if (str.length > minchars) {

		// Loop through all link elements
		for (i=0;i<x.length;i++) {

			xtitles=x[i].getElementsByTagName("title");
			xurls=x[i].getElementsByTagName("url"); {
			try {
				// The magic of string matching (must be lowercare)
				var testquery = xtitles[0].firstChild.nodeValue.toLowerCase();
				if (testquery.indexOf(str) !=-1) {
					searchoutput = searchoutput + "<a href='" + xurls[0].firstChild.nodeValue + "'>" + xtitles[0].firstChild.nodeValue + "</a><br />";
				} 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="/home/images/ui/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="/home/images/ui/ajaxclose.gif";
			document.getElementById("livesearchbutton").className="livesearchclose";
		} 
	}

}

function clearsearch() { //Clear from initial focus
	document.getElementById("searchtext").value="";
}

function clearlivesearch() { // Clear from the button & also hide the button
	document.getElementById("searchtext").value=" Search";
	document.getElementById("livesearch").innerHTML="";
	document.getElementById("livesearch").style.visibility="hidden";
	document.getElementById("livesearchbutton").src="/home/images/ui/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")) && (document.getElementById("livesearch").style.visibility=="visible")) {
			clearlivesearch();
		}
	}

}

/*** START JS Send & Share icons & links ***/

function writesharelink() {
	document.write("<li><a href='#' target='_self' class='shareicon' onclick='shareboxreveal(); return false;'><img src='/home/images/ui/share.gif' alt='' border='0'>Share</a></li>");
}

function writesharebox() {

	var arr_ss = new Array();

	var sendshare = "<link rel='image_src' href='/webmedia/973820186826_tran.gif'/><div id='sharebox'><div id='shareboxhead'><div id='shareboxtriangle'>&nbsp;</div></div><ul id='shareicons'><div id='shareboxclose'><a href='#' onClick='shareboxhide(); return false;'><img src='/home/images/ui/ajaxclose.gif' alt='Close' border='0' /></a></div>";

	// Territory, Icon, Pre-URL, Post-URL, Description & alt tag

	// Linkedin
	arr_ss [0] = new Array()
	arr_ss [0][0] = "gx";
	arr_ss [0][1] = "/home/images/ui/share_linked.gif";
	arr_ss [0][2] = "http://www.linkedin.com/shareArticle?mini=true&url=" + escape(window.location);
	arr_ss [0][3] = "&title=" + escape(document.title);	
	arr_ss [0][4] = "Linkedin";	

	// Facebook
	arr_ss [1] = new Array()
	arr_ss [1][0] = "gx";
	arr_ss [1][1] = "/home/images/ui/share_facebook.gif";
	arr_ss [1][2] = "http://www.facebook.com/share.php?u=" + escape(window.location);
	arr_ss [1][3] = "&title=Page title here";
	arr_ss [1][4] = "Facebook";

	// Mixx
	arr_ss [2] = new Array()
	arr_ss [2][0] = "gx";
	arr_ss [2][1] = "/home/images/ui/share_mixx.gif";
	arr_ss [2][2] = "http://www.mixx.com/submit?page_url=" + escape(window.location);
	arr_ss [2][3] = "";
	arr_ss [2][4] = "Mixx";


	// Digg
	arr_ss [3] = new Array()
	arr_ss [3][0] = "gx";
	arr_ss [3][1] = "/home/images/ui/share_digg.gif";
	arr_ss [3][2] = "http://digg.com/submit?phase=2&url=" + escape(window.location);
	arr_ss [3][3] = "&title=" + escape(document.title);
	arr_ss [3][4] = "Digg";


	// Yahoo! Buzz
	arr_ss [4] = new Array()
	arr_ss [4][0] = "gx";
	arr_ss [4][1] = "/home/images/ui/share_yahoobuzz.gif";
	arr_ss [4][2] = "http://buzz.yahoo.com/buzz?targetUrl=" + escape(window.location);
	arr_ss [4][3] = "&title=Page title here";
	arr_ss [4][4] = "Yahoo! Buzz";	

	for (i=0;i<arr_ss.length; i++) {
		sendshare = sendshare + "<li><a href='" + arr_ss[i][2] + arr_ss[i][3] + "' target='_blank' class='shareicon'><img src='" + arr_ss[i][1] + "' border='0' alt='" + arr_ss[i][4] + "' />&nbsp;" + arr_ss[i][4] + "</a></li>"	
	}

	sendshare = sendshare + "</ul></div>";
	document.write(sendshare);
}

function shareboxreveal() { // Show, hide or add to territory selector box
	document.getElementById('sharebox').style.display = 'block';
}

function shareboxhide() { 	// Clear the contents of the box and hide the div
	document.getElementById('sharebox').style.display = 'none';  
}


/*** 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<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


// ############### START EMAIL A COLLEAGE FUNCTIONS #######################
// Name -- emailpage
//Author: Roger Darus/E Solutions
//Additional Editors: Roger Darus/E Solutions
//Additional Editors: Sirnjeet Kalwan
// Description of code -- Form input validation and window opener
function inputValidation(form){
	var errorText;
	// Valid friends email
	errorText = form.ValidationField1.value;
	 if ( !validEmailMulti( form.friendsEmail.value ) ){
		alert(errorText);
		form.friendsEmail.focus();
		return;
	}
	//Validate name
	errorText = form.ValidationField2.value;
	if (form.name.value == ""){
		alert(errorText);
		form.name.focus();
		return;
	}
	//Validate users email address
	errorText = form.ValidationField3.value;
	 if ( !validEmail( form.yourEmail.value ) ){
		alert(errorText);
		form.yourEmail.focus();
		return;
	}
	form.submit();
}
function validEmail( email ){
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/; // valid
	return ( !reg1.test( email )  && reg2.test( email ));
}
function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}
function validEmailMulti( email ){
	email = removeSpaces(email);
	var final = 0;
	while (final == 0) {
		comma = email.indexOf(",");
		if (comma == -1) {
			final = 1;
			currentemail = email
		} else {
			currentemail = email.substring(0, comma);
			email = email.substring(comma + 1, email.length);
		}
		returncode = validEmail( currentemail );
		if (!returncode) {
			return false;
		}
		if (final == 1) {
			return true;
		}
	}
}
// ############### END EMAIL A COLLEAGE FUNCTIONS #######################

// START RVP JS

// This function replaces characters to be displayed back to the browser with xss safe characters
function removeSpecialChars(input) {
var output = "";
var char="";
for (count = 0 ; count < input.length ; count ++) {
	switch (input.charAt(count)) {
		case "<":
			output = output + "&#60";
			break;
		case ">":
			output = output + "&#62";
			break;
		case '"':
			output = output + "&#34";
			break;
		case "'":
			output = output + "&#39";
			break;
		case ")":
			output = output + "&#41";
			break;
		case "(":
			output = output + "&#40";
			break;
		case "+":
			output = output + "&#43";
			break;
		case "&":
			output = output + "&#38";
			break;
		case ";":
			output = output + "&#59";
			break;
		default:
			output = output + input.charAt(count);
			break;
	}
}
return output;
} // End removeSpecialChars(input)
var aRVP  = new Array();
var sRVPBoxTitle =  '<span class="RVPTitle">Recently Visited Pages</span>';
var sRVPCookieText = '<div class="RVPOffMessage">Please enable cookies on your browser to activate this functionality.</div><ul><li><a href="/gx/en/main/privacy/index.html" target="_self" title="Privacy">Privacy</a></li></ul>';
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 <title> 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("<","&lt;"); 
                      tUrl = tUrl.replace(">","&gt;");
		        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


