var url = top.location.href;

var restrictedRedirectURL = new Array();
restrictedRedirectURL.push("cns_sign_in.jsp")
restrictedRedirectURL.push("cns_registration.jsp")
restrictedRedirectURL.push("cns_registration_thankyou.jsp")
restrictedRedirectURL.push("cns_my_info.jsp")
restrictedRedirectURL.push("cns_update_my_info_thankyou.jsp");

function search(tmpObject)
{
	isFound = false;
	if (typeof(tmpObject) == "string")
	{
		for(i=0;i<this.length;i++)
		{
			if (this[i] == tmpObject)
			{
				isFound = true;
				break;
			}
		}
	}
	return isFound;
}
Array.prototype.contains=search;


url = ( url.lastIndexOf("/") != -1	) ? url.substring(url.lastIndexOf("/")+1) : url ;
url = ( url.indexOf(".") != -1		) ? url.substring(0,url.indexOf(".")+4)	  : url ;

if ( ! restrictedRedirectURL.contains(url) )
{
	document.cookie = "RedirectURL" + "=" + escape(top.location.href + "~~" + document.title) + "; path=/";

}

//function to get the parameter for URL
function getParam(paramName,url)
{
	exp = new Array("zQz","zAz", "zEz", "zPz", "zCz", "zSz", "zTz", "zUz");
	val = new Array( "?"  ,"&"  , "="  , "."  , ":"  , "/"  , "+"  , "%");
	for (i =0 ; i < exp.length; url=url.replace(new RegExp(exp[i],"g"),val[i]), i++);

	startPos = url.indexOf(paramName+"=");
	return (startPos == -1) ? null : url.substring( (startPos + paramName.length + 1) , ( url.indexOf("&",startPos) == -1 ) ? url.length : url.indexOf("&",startPos) );
}

//redirect to healthtools if the url contains the parameter.
url			= top.location.href;
targetTool	= getParam("targetTool",url);
vendor		= getParam("vendor",url);
desc		= getParam("desc",url);

if ( !(targetTool == null || vendor == null || desc == null) )
{
	// this method is from popup.js
	popUpRestricted(targetTool,vendor,desc,"listUnRestricted");
}