function getUrl() 
{
	/* ***************************************Do not modify these!***************************************** */
	var sOriginalUrl= document.URL;
	sOriginalUrl= sOriginalUrl.replace(/%3A/g,":");
	sOriginalUrl= sOriginalUrl.replace(/%2F/g,"/");
	sOriginalUrl= sOriginalUrl.replace(/%3F/g,"?");
	sOriginalUrl= sOriginalUrl.replace(/%3D/g,"=");
	sOriginalUrl= sOriginalUrl.replace(/%26/g,"&");
	var aArgs= sOriginalUrl.substring(document.URL.indexOf("?")+1).split("&");
	var validURLs = ["http://careers.peopleclick.com/careerscp", "https://careers.peopleclick.com/careerscp", "http://careerscvv.peopleclick.com/careerscp", "https://careerscvv.peopleclick.com/careerscp", "http://careersimp.corp.peopleclick.com/careerscp", "https://careersimp.corp.peopleclick.com/careerscp", "http://careersqai.corp.peopleclick.com/careerscp", "https://careersqai.corp.peopleclick.com/careerscp"];
	var finalParameters= "";
	var finalURL= null;
	/* ***************************************Do not modify these!*****************************************	*/

	/* Please set this to the production external site.  All you should need to change for this is the 
	   client_clientname, and possibly the site name (external)						*/

	var fallbackURL = "http://careers.peopleclick.com/careerscp/client_philips/external/search.do";


	/* Task #1:	Loop through the querystring parameters.  If the parameter matches the base URL parameter, 
	            we place that in its own string variable as it has to go in front.  The rest we simply
		        rewrite into a separate string which will be tacked on to the base URL (if found).	*/

	for ( x=0; x<aArgs.length; x++ )
	{
		var argName = aArgs[x].substring(0, aArgs[x].indexOf("="));
        	var argValue = aArgs[x].substring(aArgs[x].indexOf("=")+1);

	        if ( argName.toUpperCase()=="CPURL" ) 
		{

	/* Here we are going to check to make sure that the passed URL matches one of our matched ones, to
	   prevent phishing with the frames page								*/

			for( y=0; y < validURLs.length; y++ )
			{
				if(argValue.toUpperCase().indexOf(validURLs[y].toUpperCase()) == 0)
				{
					finalURL = argValue;
				}
			}
		}
		else 
		{ 
			finalParameters = finalParameters + "&" + argName + "=" + argValue; 
		}
	}


	/* Task #2:	See if we found the proper base URL in the query string.  If not, then someone has hit
	   this page manually and we should then go to the base search page			                */
    
	if ( finalURL != null ) 
	{
		finalURL += finalParameters
    	} 
	else 
	{
    	 	finalURL = fallbackURL;
    	}

	return finalURL;
}