	// Default browsercheck, added to all scripts!
	function checkBrowser()
	{
		this.ver=navigator.appVersion
		this.dom=document.getElementById?1:0
		this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
		this.ie4=(document.all && !this.dom)?1:0;
		this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
		this.ns4=(document.layers && !this.dom)?1:0;
		this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
		return this;
	}

	bw = new checkBrowser();

	function getElmById(aID)
	{
		var rv = null;

		if (bw.dom)
		{
			rv = document.getElementById(aID);
		}
		else if (bw.ns4)
		{
			rv = document.layers[aID];
		}
		else if (bw.ie4)
		{
			rv = document.all[aID];
		}

		return rv;
	}

	function SetViewed(acquired, viewed)
	{
		// Find the viewed button
		obj = getElmById(viewed);

		// If the show hasn not been acquired, it cannot be seen, doh
		if (acquired.checked == false)
		{
			obj.checked = false;
		}
	}

	function SetAcquired(viewed, acquired)
	{
		// Find the acquired button
		obj = getElmById(acquired);

		// If the show has been viewed, its acquired
		if (viewed.checked == true)
		{
			obj.checked = true;
		}
	}

	function ToggleView(obj)
	{
		if (obj.style.display != 'none')
		{
			obj.style.display = 'none';
		}
		else
		{
			obj.style.display = '';	
		}
	}

	function ChangeDisplay(img, div_id)
	{				
		// Get the image
		var arrImage = img.src.split("/");

		// Replace the image
		if (arrImage[arrImage.length - 1] == 'icon_plus.gif')
		{
			arrImage[arrImage.length - 1] = 'icon_minus.gif';
		}
		else
		{
			arrImage[arrImage.length - 1] = 'icon_plus.gif';
		}

		// Change the src
		img.src = arrImage.join("/");

		ToggleView(getElmById(div_id));
	}

	function choseMode(objForm, Prefix, ID, Value)
	{
		if ((Prefix == 'A') && (Value == false))
		{
			setCheckBoxes(objForm, 'V', ID, Value);
			updateMarkAllCheckbox(objForm, 'V', ID);
		}
		else if ((Prefix == 'V') && (Value == true))
		{
			setCheckBoxes(objForm, 'A', ID, Value);
			updateMarkAllCheckbox(objForm, 'A', ID);
		}
		setCheckBoxes(objForm, Prefix, ID, Value);
	}


	function setCheckBoxes(objForm, Prefix, ID, Value)
	{
		for (var i = 0; i < objForm.elements.length; i++)
		{
			var e = objForm.elements[i];
			if ((e.type == 'checkbox') && (e.name.indexOf(Prefix+ID) == 0))
			{
				e.checked = Value;
			}
		}
	}


	function updateMarkAllCheckbox(objForm, Prefix, ID)
	{
		var TotalBoxesCnt = objForm.elements['epscnt'+ID].value;
		var BoxesChecked = 0;
		for (var h = 0; h < objForm.elements.length; h++)
		{
			var e = objForm.elements[h];
			if ((e.type == 'checkbox') && (e.name.indexOf(Prefix+ID) == 0) && (e.checked))
			{
				BoxesChecked++;
			}
		}
		objForm.elements['markall-' + Prefix + ID].checked = (TotalBoxesCnt == BoxesChecked) ? true : false;
	}


	function MarkViewed(objCheckbox, objForm, ID)
	{
		// Find the matching Acquired box.
		objAcquired = objForm.elements['A'+objCheckbox.name.substring(1)];

		// If the show has been viewed, its acquired
		if (objCheckbox.checked == true)
		{
			objAcquired.checked = true;

			// Update the MarkAll box state for the Acquired boxes
			updateMarkAllCheckbox(objForm, 'A', ID);
		}

		// Update the MarkAll box state for the Viewed boxes
		updateMarkAllCheckbox(objForm, 'V', ID);
	}


	function MarkAcquired(objCheckbox, objForm, ID)
	{
		// Find the matching Viewed box.
		objViewed = objForm.elements['V'+objCheckbox.name.substring(1)];

		// If the show has been viewed, its acquired
		if (objCheckbox.checked == false)
		{
			objViewed.checked = false;

			// Update the MarkAll box state for the Acquired boxes
			updateMarkAllCheckbox(objForm, 'V', ID);
		}

		// Update the MarkAll box state for the Viewed boxes
		updateMarkAllCheckbox(objForm, 'A', ID);		
	}


	function GotoConfirm(Item,Url) 
	{
		if (confirm(Item)) 
		{
			window.location = Url;
		}
	}
	
	function Goto(Url) 
	{
		window.location = Url;
	}

	function setSelectOptions(element, do_check)
	{
		var selectObject = getElmById(element);
		var selectCount  = selectObject.length;
		for (var i = 0; i < selectCount; i++) {
			selectObject.options[i].selected = do_check;
		}
		return true;
	}