
function Global() {}

Global.AppPath;

Global.Link_Click = function(hRef, target)
{
	var decodedHRef = Global.DecodeUrl(hRef);
	var decodedTarget = Global.DecodeTarget(target, decodedHRef);
	window.open(decodedHRef, decodedTarget);
}

Global.DecodeUrl = function(url)
{
	if(url == null || url.length == 0)
		return "#";

	if(url.indexOf("/") == 0)
		return Global.AppPath + url;

	return url;
}

Global.EncodeUrl = function(url)
{
	if(url == null || url.length == 0 || url == "#")
		return "";

	if(url.indexOf(Global.AppPath) == 0)
		return url.substr(Global.AppPath.length);

	return url;
}

Global.DecodeTarget = function(target, hRef)
{
	if(hRef == "#")
		return "_self";
	
	if(target == null || target.length == 0)
		return "_top";
		
	return target;
}

Global.EncodeTarget = function(target)
{
	if(target == null || target.length == 0 || target.toLowerCase() == "_self" || target.toLowerCase() == "_top")
		return "";

	return target;
}





