if(window["gHelper_Loaded"] != true)
{
	window["gHelper_Loaded"] = true;

	function getQueryVariable(variable) 
	{
		var query = window.location.search.substring(1);
		var vars = query.split("&");
	
		for (var i=0;i<vars.length;i++) 
		{
			var pair = vars[i].split("=");
		
			if (pair[0] == variable) 
			{
				return pair[1];
			}
		}
		//alert('Query Variable ' + variable + ' not found');
	} 

	function downloadAsset(assetid)
	{
		document.location ="../../v3/asset_manager/download_quick.cfm?assetid=" + assetid;
	}
	function downloadNode(nodeid)
	{
		document.location ="../../v3/BrandToolBox/downloadnode.cfm?nodeid=" + nodeid;
	}
	function gotoPage(pageid)
	{
		document.location =window['prefix']+"v3/generic/redirect_node.cfm?nodeid="+pageid;
	}
	
	function openImageCropper(obj, funcname, funcvar)
	{
		var centerX = screen.width - 300;
		var centerY = screen.height /8 - 100;
		
		var mainTD = document.getElementById(obj.getAttribute('mainTD'));
		
		var win = window.open(syspath+"/_system/popup_crop.cfm?width="+parseFloat(mainTD.style.width) + '&height='+parseFloat(mainTD.style.height)+'&assetid='+forms_GetComponentAttribute(obj,'assetid')+'&formid='+obj.getAttribute('id')+'&x1='+forms_GetComponentAttribute(obj,'x1')+'&y1='+forms_GetComponentAttribute(obj,'y1')+'&x2='+forms_GetComponentAttribute(obj,'x2')+'&y2='+forms_GetComponentAttribute(obj,'y2')+(funcname==null?(''):('&funcname='+funcname))+(funcvar==null?(''):('&funcvar='+funcvar)), "ShowEditForm", "left=" + centerX + ", top=" + centerY + ", width=640, height=480, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, titlebar=no, toolbar=no");
		win.focus();
	}
	function openContentEditor(obj, funcname, funcvar)
	{
		var centerX = screen.width - 300;
		var centerY = screen.height /8 - 100;
		
		var mainTD = document.getElementById(obj.getAttribute('mainTD'));
		
		var win = window.open(syspath+"/_system/contenteditor.cfm?formid="+obj.getAttribute('id')+(funcname==null?(''):('&funcname='+funcname))+(funcvar==null?(''):('&funcvar='+funcvar)), "ShowContentEditor", "left=" + centerX + ", top=" + centerY + ", width=640, height=480, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, titlebar=no, toolbar=no");
		win.focus();
	}
	
	function clearElementEventFunctions(obj)
	{
		obj.setAttribute('onmousedown',null);
		obj.setAttribute('onclick',null);
		obj.setAttribute('onmouseup',null);
		obj.setAttribute('ondblclick',null);
		obj.setAttribute('oncontextmenu',null);
		obj.setAttribute('ondragover',null);
		obj.setAttribute('ondrop',null);

		for(var i = 0; i < obj.childNodes.length; i++)
			if(typeof(obj.childNodes[i].setAttribute) == "function")
				clearElementEventFunctions(obj.childNodes[i]);

	}
	
}