	var ControlToSet;
	var theForm = document.theForm;
	var NN4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
	var NN6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	var TOP;
	var LEFT;
	var helpWindow;
	var helpText;
		
	function popUp(URL)
	{
			day = new Date();
			id = day.getTime();
			eval("page" + id + " = window.open(URL, '" + id +
			"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=230,left=300,top=200');");
	}

	function popupHelp(helpMessage)
	{
		var toolbar = 0;
		var scrollbars = 1;
		var location = 0;
		var statusbar = 0;
		var menubar = 0;
		var resizable = 1;
		var width = 400;
		var height = 200;
		var left = 0;
		var top = 0;
		var features;
		
		helpText = helpMessage;
		
		// The following features will position the window's top left corner at the cursor
		//	features = "toolbar=0,scrollbars=" + scrollbars + ",location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",left=" + LEFT + ",top=" + TOP;

		// The following features will center the window on the screen
			left = (screen.width / 2) - (width / 2);
			top = (screen.height / 2) - (height / 2);
			features = "toolbar=" + toolbar + ",scrollbars=" + scrollbars 
					 + ",location=" + location + ",statusbar=" + statusbar 
					 + ",menubar=" + menubar + ",resizable=" + resizable 
					 + ",width=" + width + ",height=" + height 
					 + ",left=" + left + ",top=" + top;

		helpWindow = window.open("tip.html", 'helpWindow1', features);
	}
	
	function callBack()
	{
		if (document.getElementById)
		{
			var theDiv = helpWindow.document.getElementById('display');
			if (typeof theDiv.innerHTML == 'string')
			{
				theDiv.innerHTML = helpText;
				helpText = "";
			}
		}
	}
	
	function changeClass(obj, className)
	{
		obj.className = className;
	}

	function redirect($location)
	{
		window.location = $location;
	}

	function toggleObject(targetID,openClass)
	{
		if (document.getElementById)
		{
			var x = document.getElementById(targetID);
			if (x.className == openClass)
			{
				x.className = "hide";
			}
			else
			{
				x.className = openClass;
			}
		}
	}

	var arrSideContent = new Array(0);
	
	function addSideContent(id,title)
	{
		var nextIndex = arrSideContent.length;
		arrSideContent.push(nextIndex);
		arrSideContent[nextIndex] = new Array(id,title);
		
		writeSideContentList();
	}
	
	function deleteSideContent(id)
	{
		if (arrSideContent.length > 0)
		{ 
			arrSideContent.splice(id,1);
		}
		writeSideContentList(); 
	}

	function moveSideContentUp(id)
	{
		tempID = arrSideContent[id][0];
		tempTitle = arrSideContent[id][1];
		
		arrSideContent.splice(id,1);
		arrSideContent.splice(id-1,0,new Array(tempID,tempTitle));
		
		writeSideContentList();
	}

	function moveSideContentDown(id)
	{
		tempID = arrSideContent[id][0];
		tempTitle = arrSideContent[id][1];
		
		arrSideContent.splice(id,1);
		arrSideContent.splice(id+1,0,new Array(tempID,tempTitle));
		
		writeSideContentList();
	}

	function launchSideContentChooser(pageID)
	{
		popUp("side_content_chooser.php?page=" + pageID);
	}

	function writeSideContentList()
	{
		var output ="";
		
		output += "<table cellspacing='0' cellpadding='0'>";
		for (i=0;i<arrSideContent.length;i++)
		{
			output += "<tr><td><input type='hidden' name='side_content_includes[]' value='" + arrSideContent[i][0] + "' />" + arrSideContent[i][1] + "</td><td class='scrollerOptions'>" + (i!=0 ? "<a href='javascript:moveSideContentUp(" + i + ")'>[^]</a> " : "") + (i!=arrSideContent.length-1 ? "<a href='javascript:moveSideContentDown(" + i + ");'>[v]</a> " : "") + "<a href='javascript:deleteSideContent(" + i + ")'>X</a></td></tr>";
		}
		output += "</table>";

		document.getElementById("sideContentScroller").innerHTML = output;
	}
	
    function setAllCheckBoxes(groupName,value)
    {
        for (var n = 0; n < document.forms[0].length; n++)
        {
            var oElement = document.forms[0].elements[n];
            if (oElement.type == 'checkbox' && (oElement.name.indexOf(groupName) >= 0) )
                oElement.checked = value;
        }
    }
