var RedirectToHrefEnabled = false;

function RedirectToHref(Id) {
	if (RedirectToHrefEnabled)
	{
		if (Id != "") {
			for(var i = 0;i < document.all.length;i++)
				if (document.all.item(i).id == Id) {
					document.location.href = document.all.item(i).href;							
					break;
				}
		}
	}
}

function Href_OnClick(ctrl) {
	if (window.clientInformation.cookieEnabled)	{
		var Time = new Date();
		Time = new Date(Time.valueOf() + 86400000 * 365); // 1 Year
		document.cookie = "ID=" + escape(ctrl.id) + "; expires=" + Time.toGMTString();
	}
}

function OnLoad() {
	if (document.location.href.indexOf("ID=") > -1) {
		var Id = document.location.href.substr(document.location.href.indexOf("ID=") + 3);
		
		if (Id.indexOf("&") > -1)
			Id = Id.substr(0,Id.indexOf("&"));
		RedirectToHref(Id);
	}
	else
		if (window.clientInformation.cookieEnabled) {
			if (document.location.href.indexOf("IGNORE=") > -1)
				document.cookie = "ID=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
			else {
				var Cookie = document.cookie.split("; ");
				
				for(var i = 0;i < Cookie.length;i++)
				{
					var Crumb = Cookie[i].split("=");
					
					if (Crumb[0] == "ID") {
						RedirectToHref(unescape(Crumb[1]));
						break;
					}
				}
			}
		}			
}

