searchDomain="http://search1.pwc.com/search/" // the Atomz search engine searchAccount="00063301-sp00000000" // production account is "00063301-sp00000000" DefaultSearchHelp="/extweb/searchresults.nsf/results/gx-searchsimplehelp-eng?opendocument" AdvancedSearchHelp="/extweb/searchresults.nsf/results/gx-searchadvancedhelp-eng?opendocument" // This function returns the sand style sheet if the ssColor is not a member of the arraySS else it returns the color. // Used to force sand in event ss parameter is invalid (not a member of arraySS). function styleSS(ssColor) { // This is the array of available stylesheets in the system. var arraySS = [['bordeaux'], ['earth'], ['ocean'], ['olive'], ['sand'], ['terracotta'], ['wheat']] var color="sand"; for (i = 0; i < arraySS.length; i++) { // check value of ss to ensure it is valid. if (ssColor == arraySS[i][0]) { color = ssColor; } } return color; } // This function submits a search based on the arguments passed in.... //There is a basic set of arguments defined in this function that are set to the default in case they are not passed in function submitSearch(args, resultsURL) { //alert("submitSearch Function"); //uncomment for debug only. //alert("resultsURL: " + resultsURL) //uncomment for debug only //alert("args: " +args) //uncomment for debug only var searchArgs = Array(); // Set the default values ... this is done in case these parameters are not passed in through the args array [value] searchArgs["sp-a"] = "sp1002182f"; searchArgs["sp-c"] = "25"; searchArgs["sp-p"]="phrase"; searchArgs["sp-w-control"]="1"; searchArgs["sp-q"]=""; searchArgs["sp-t"]="js" ; // indicate that we want the JavaScript output // loop through the args array passed in and set the arguments in the searchArgs array to the values that are set in the args array for (var i in args) { searchArgs[i] = args[i]; } // loop through the searchArgs array to generate the search url [query string] url = "" for (var i in searchArgs) { url+= i+"="+searchArgs[i]+"&"; } url = url.substring(0,(url.length-1)); // remove the last & [ampersand] location.href = resultsURL + "&searchLoc=" + searchDomain + "?" + url; } // End submitSearch(args) // This function changes one parameter's value [passed in] and searches again... // Useful for changing between showing and hiding the descriptors, changing between sort by date and sort by score, etc. function searchAgain(param,val) { //alert("searchAgain Function"); //uncomment for debug only. //alert("param: " + param) //uncomment for debug only //alert("val: " + val) //uncomment for debug only srch.searchParameters[param] = val; var tmp = location+""; // get the location //alert("location: " + location) //uncomment for debug only // use indexOf() instead of split() because of JS1 compatibility vs JS3 compatibility [necessary for many v4 browsers] var num = tmp.indexOf("&searchLoc="); if (num < 0) return ""; // if it couldn't find "&searchLoc=" in the URL then return without resubmitting the search... this means there was an error tmp = tmp.substring(0, num); // get the portion of the location before "&searchLoc=" //alert("tmp: " + tmp) //uncomment for debug only submitSearch(srch.searchParameters, tmp); } // End searchAgain(param,val) // - - - - - - - - - - - - - - - - - - - //This utility function will replace the value of the specified parameter in the full URL. function swapParameter(fullURL, param, newvalue) { //alert("swapParameter Function"); //uncomment for debug only. //alert ("Full URL: " + fullURL) //uncomment for debug only //alert("param: " + param) //uncomment for debug only //alert("newvalue: " + newvalue) //uncomment for debug only var paramStart = fullURL.indexOf('&' + param + '='); var paramEnd; var returnURL; // alert("paramStart: " + paramStart); //uncomment for debug only if (paramStart != -1) { paramEnd = fullURL.indexOf('&',paramStart+1); //alert("paramEnd: " + paramEnd); //uncomment for debug only returnURL = fullURL.substring(0,paramStart) + '&' + param + '=' + newvalue; if (paramEnd != -1) { returnURL = returnURL + fullURL.substring(paramEnd,fullURL.length); } } else { returnURL = fullURL + '&' + param + '=' + newvalue; } // alert ("Return URL: " + returnURL); //uncomment for debug only return returnURL; } // function getParam(browserLocation, SearchFor) { //alert("getParam Function Deprecated"); //uncomment for debug only. //alert("browserLocation: " + browserLocation) //uncomment for debug only //alert("SearchFor: " + SearchFor) //uncomment for debug only var begin, end; var value; var searchString='&'+SearchFor; var bl = browserLocation+""; //ensure it is a string type. begin = bl.indexOf(searchString); if (begin > 0) { end = bl.indexOf("&",begin+1); if (end == (-1)) { end = bl.length; //alert(end); } value = bl.substring((begin+searchString.length),end); } else { value = ""; } //alert("value: " + value) //uncomment for debug only return(value); } // End getParam () // function GetParam(name) { //alert("GetParam Function"); //uncomment for debug only. // alert ("Parameter Name: " + name); //uncomment for debug only var start = location.search.indexOf("?"+name+"="); // assign variable start if (start < 0) start = location.search.indexOf("&"+name+"="); // check variable if < 0 then assign using "&" if (start < 0) return ''; // Check again if still < 0 then exit start += name.length+2; var end = location.search.indexOf("&",start) - 1; if ( end < 0) end = location.search.length; var result = location.search.substring(start,end); var result=''; for(var i = start; i <= end; i++) { var c = location.search.charAt(i); result = result+(c=='+'?' ':c); } // alert ("Result: " + result); //uncomment for debug only return unescape(result); } // - - - - - - - - - - - - - - - - - - - // This function generates sandard search links below the search output - sort order and show/hide summary. // This function as a dependency on the browser's url location!!! // This function as a dependency on Atomz's results definition (from js template) function writeSearchLinks() { //alert("writeSearchLinks Function"); //uncomment for debug only. if ( !(srch.results.length > 0)) return ""; // if there aren't results return without writing the links var out="

"; if (srch.searchParameters["sp-s"] == 0) { out += 'Sort By Date'; out += ' '; out += ''; out += ''; } else { out += 'Sort By Score'; out+=' ' out+=''; out+=''; } out += '     '; if (srch.searchParameters["sp-m"] == 0) { out += 'Show Summaries'; out += ' '; out += ''; out += '
'; } else { out += 'Hide Summaries'; out += ' '; out += ''; out += '
'; } document.write(out); } // End writeSearchLinks() // - - - - - - - - - - - - - - - - - - - // This function generates search links that will allow to quickly rerun the same search with only one parameter changed.. // Eg. All territories or All languageshe search output - sort order and show/hide summary. // This function as a dependency on the browser's url location!!! // This function as a dependency on Atomz's results definition (from js template) function writeSearchAgainLinks() { //alert("writeSearchAgainLinks Function"); //uncomment for debug only. var out = ''; var param = getParam(location,"sp-q-3="); var dblist = ""; var newurl = location + ""; //alert("param: " + param); //uncomment for debug only. //alert("newurl: " + newurl); //uncomment for debug only. out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ' '; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += '
'; out += ''; out +=''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += '
Connected Thinking
'; out += '
'; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += ''; out += '
'; if (param.indexOf("insights") >= 0) { newurl=swapParameter(newurl, "sp-x-3","pwcDB") dblist= escape("services aboutus"); out += "Search related Services content for " + srch.query + "
"; } else { newurl=swapParameter(newurl, "sp-x-3","pwcDB") dblist = escape("newcolth frmclp11 newcoweb pwcpublications indissue manissue ncsurvres insights newcoatwork"); out += "Search related Business Topics content for " + srch.query + "
"; } if (GetParam("sp-q-1") != "") { //when searching again for all territories, remove ln and rn customization params from url , since we'll want to show the dft global results page. newurl = swapParameter(newurl, "ln", ""); newurl = swapParameter(newurl, "rn", ""); newurl = swapParameter(newurl, "sp-q-1", "") ; out += '
Search ALL Territories for ' + srch.query + '
'; } if (srch.searchParameters["sp-q-1"] != "gx") { //when searching again for global, remove ln and rn customization params from url , since we'll want to show the dft global results page. newurl = swapParameter(newurl, "ln", ""); newurl = swapParameter(newurl, "rn", ""); newurl = swapParameter(newurl, "sp-x-1", "pwcGeo") ; newurl = swapParameter(newurl, "sp-q-1", "gx") ; newurl = swapParameter(newurl, "sp-x-2", "pwcLang") ; newurl = swapParameter(newurl, "sp-q-2", "eng") ; newurl = swapParameter(newurl, "sp-x-3", "pwcDB") ; newurl = swapParameter(newurl, "sp-q-3", "") ; out += '
Show Global Results for ' + srch.query + ''; } out += '
'; document.write(out); //END // Uncomment the lines below if similar toggle is needed for languages... //out+="
"; //if(srch.searchParameters["sp-q-2"]!="") { //out+='Search ALL Languages for ' +srch.query+'
'; //} } // End writeSearchAgainLinks() // - - - - - - - - - - - - - - - - - - - // This function generates search links that will allow user to quickly rerun the same search // with the following changes: pwcGeo = gx, pwcLang = ENG and pwcDB = industry // This function as a dependency on the browser's url location!!! // This function as a dependency on Atomz's results definition (from js template) function writeSearchGlobalLinks() { //alert("writeSearchGlobalLinks Function"); //uncomment for debug only. if (srch.searchParameters["sp-q"] != "") { // Don't write link if sp-q is empty var out = ''; var dblist = ""; var newurl = location + ""; dblist = escape("industry"); newurl = swapParameter(newurl, "ln", "") ; newurl = swapParameter(newurl, "rn", "") ; newurl = swapParameter(newurl, "sp-x-1", "pwcGeo") ; newurl = swapParameter(newurl, "sp-q-1", "gx") ; newurl = swapParameter(newurl, "sp-x-2", "pwcLang") ; newurl = swapParameter(newurl, "sp-q-2", "ENG") ; newurl = swapParameter(newurl, "sp-x-3", "pwcDB"); newurl = swapParameter(newurl, "sp-q-3", dblist); out = ''; out += ''; out += ''; out += ''; out += '  Search Global Industries
  for '; out += "" + srch.query + " "; out += ''; out += ''; document.write(out); } } // End writeSearchGlobalLinks() function submitQuickSearch(htmlformname) { var currform = window.document.forms[htmlformname]; var resultForm = "/extweb/searchresults.nsf/Results/Simple?OpenDocument"; var action = resultForm; if (currform.ss.value != "") action += "&ss=" +styleSS(currform.ss.value); if (currform.ln.value != "") action +="&ln=" + currform.ln.value; if (currform.rn.value != "") action +="&rn=" + currform.rn.value; // if they were specified, add stylesheet and nav's action += "&searchLoc="+searchDomain; action +="?sp-a="+searchAccount; if (searchAccount != "sp1002182f") action +="&sp-t=js" action += "&sp-x-1=pwcGeo"; action += "&sp-q-1="+ currform.sp_q_1.value; action += "&sp-x-2=pwcLang"; action += "&sp-q-2=" + currform.sp_q_2.value; if (currform.sp_c.value !="") action += "&sp-c=" + currform.sp_c.value; if (currform.sp_p.value !="") action += "&sp-p=" + currform.sp_p.value; // This should be added to every search: "&sp-x-9=pwcHideLevel" and "&sp-q-9=0" to ensure that docs marked hide do not show. action += "&sp-x-9=pwcHideLevel"; action += "&sp-q-9=0"; // action += "&sp-f=ISO-8859-1"; action += "&sp-q="+ escape(currform.sp_q.value.replace("&"," ")); // alert (action); window.location.href=action; } // - - - - - - - - - - - - - - - // This function is used to submit a simpleSearch html form to Atomz and forward to the simple results page. // It has a dependency on the search.js inclusion (needs the searchDomain & searchAccount defined in this file) // It will display the results on the default result form (Simple results) // Param 1: The html form name (string) // Note that the html form must define the following fields: // sp_q : free text query string // sp_q_1: country code to search, blank means All // sp_q_2: language code to search, blank means All // function submitSimpleSearchURL(htmlformname) { //alert("submitSimpleSearchURL Function"); //uncomment for debug only. //alert("htmlformname: " + htmlformname); //uncomment for debug only. var currform = window.document.forms[htmlformname]; var resultForm = "/extweb/searchresults.nsf/Results/Simple?OpenDocument"; //alert ("resultform: " + resultForm); //uncomment for debug only. var action = resultForm; //if they were specified, add stylesheet and nav's if (ss != "") action += "&ss=" + styleSS(ss); if (lnavname != "") action += "&ln=" + lnavname; if (rnavname != "") action += "&rn=" + rnavname; action += "&searchLoc=" + searchDomain; action += "?sp-a=" + searchAccount; if (searchAccount != "sp1002182f") action +="&sp-t=js" // alert ("action(leftpart)=" + action); // action += "&sp-f=ISO-8859-1"; // action += "&sp-s=pwcMasterRank"; // This will override the default 'score' ranking and force "hot topics" first. action += "&sp-x-1=pwcGeo"; action += "&sp-q-1="+ currform.sp_q_1.value; action += "&sp-x-2=pwcLang"; action += "&sp-q-2=" + currform.sp_q_2.value; action += "&sp-q="+ escape(currform.sp_q.value.replace("&"," ")); action +="&sp-p="+getSelectedRadioValue(currform.sp_p); // This should be added to every search: "&sp-x-9=pwcHideLevel" and "&sp-q-9=0" to ensure that docs marked hide do not show. action += "&sp-x-9=pwcHideLevel"; action += "&sp-q-9=0"; window.location.href = action; } // End submitSimpleSearchURL() function submitSimple_OldSearchURL(htmlformname) { //alert("submitSimpleSearchURL Function"); //uncomment for debug only. //alert("htmlformname: " + htmlformname); //uncomment for debug only. var currform = window.document.forms[htmlformname]; var resultForm = "/extweb/searchresults.nsf/Results/Simple_Old?OpenDocument"; //alert ("resultform: " + resultForm); //uncomment for debug only. var action = resultForm; //if they were specified, add stylesheet and nav's if (ss != "") action += "&ss=" + styleSS(ss); if (lnavname != "") action += "&ln=" + lnavname; if (rnavname != "") action += "&rn=" + rnavname; action += "&searchLoc=" + searchDomain; action += "?sp-a=" + searchAccount; if (searchAccount != "sp1002182f") action +="&sp-t=js" // alert ("action(leftpart)=" + action); // action += "&sp-f=ISO-8859-1"; // action += "&sp-s=pwcMasterRank"; // This will override the default 'score' ranking and force "hot topics" first. action += "&sp-x-1=pwcGeo"; action += "&sp-q-1="+ currform.sp_q_1.value; action += "&sp-x-2=pwcLang"; action += "&sp-q-2=" + currform.sp_q_2.value; action += "&sp-q="+ escape(currform.sp_q.value.replace("&"," ")); action +="&sp-p="+getSelectedRadioValue(currform.sp_p); // This should be added to every search: "&sp-x-9=pwcHideLevel" and "&sp-q-9=0" to ensure that docs marked hide do not show. action += "&sp-x-9=pwcHideLevel"; action += "&sp-q-9=0"; window.location.href = action; } // End submitSimple_OldSearchURL() // - - - - - - - - - - - - - - - // This function is used to submit a simpleSearch html form to Atomz and forward to the simple results page. // It has a dependency on the search.js inclusion (needs the searchDomain & searchAccount defined in this file) // It will display the results on the default result form (Simple results) // Param 1: The html form name (string) // Note that the html form must define the following fields: // sp_q : free text query string // sp_q_1: country code to search, blank means All // sp_q_2: language code to search, blank means All // function submitSimpleSearchURL(htmlformname) { //alert("submitSimpleSearchURL Function"); //uncomment for debug only. //alert("htmlformname: " + htmlformname); //uncomment for debug only. var currform = window.document.forms[htmlformname]; var resultForm = "/extweb/searchresults.nsf/Results/Simple?OpenDocument"; //alert ("resultform: " + resultForm); //uncomment for debug only. var action = resultForm; //if they were specified, add stylesheet and nav's if (ss != "") action += "&ss=" + ss; if (lnavname != "") action += "&ln=" + lnavname; if (rnavname != "") action += "&rn=" + rnavname; action += "&searchLoc=" + searchDomain; action += "?sp-a=" + searchAccount; if (searchAccount != "sp1002182f") action +="&sp-t=js" // alert ("action(leftpart)=" + action); // action += "&sp-f=ISO-8859-1"; // action += "&sp-s=pwcMasterRank"; // This will override the default 'score' ranking and force "hot topics" first. action += "&sp-x-1=pwcGeo"; action += "&sp-q-1="+ currform.sp_q_1.value; action += "&sp-x-2=pwcLang"; action += "&sp-q-2=" + currform.sp_q_2.value; action += "&sp-q="+ escape(currform.sp_q.value); action +="&sp-p="+getSelectedRadioValue(currform.sp_p); // This should be added to every search: "&sp-x-9=pwcHideLevel" and "&sp-q-9=0" to ensure that docs marked hide do not show. action += "&sp-x-9=pwcHideLevel"; action += "&sp-q-9=0"; window.location.href = action; } // End submitSimpleSearchURL() // - - - - - - - - - - - - - - - - - - - // This function is used to popup a Search Help Page. // parameter 1 is the url of the page to open, if "" or "simple" is passed, the DefaultSearchHelp url is opened. // if "advanced" is passed, the AdvancedSearchHelp url is opened // function openSearchHelp(searchpage) { //alert("openSearchHelp Function"); //uncomment for debug only. //alert("searchpage: " + searchpage); //uncomment for debug only. if (searchpage == "" | searchpage == "simple") { searchpage = DefaultSearchHelp; } if (searchpage == "advanced") { searchpage = AdvancedSearchHelp; } window.open(searchpage,"helppopup", "top=100,left=100,width=600,height=400,toobar=no, location=no, status=no, scrollbars=yes, resizable=yes"); } // End openSearchHelp(searchpage) // - - - - - - - - - - - - - - - - - - - // This function generates the default next/prev links (usually used below the search output) // This function as a dependency on the browser's url location!!! // This function as a dependency on Atomz's results definition (from js template) function writeNextPrevLinks() { //alert("writeNextPrevLinks Function"); //uncomment for debug only. var out = ""; if (srch.prevCount > 0) { var num = srch.lower - srch.prevCount; out += 'Prev ' + srch.prevCount + ''; // out+="Prev "+srch.prevCount+""; } if (srch.prevCount > 0 && srch.nextCount > 0) out += " | "; if (srch.nextCount > 0) { var num=srch.lower+srch.count; // alert(num); // uncomment for debug only out += 'Next ' + srch.nextCount + ''; // out += "Next "+srch.nextCount+""; } document.write(out); } // End writeNextPrevLinks()