	function MM_openBrWindow(theURL,winName,features) {
		window.open(theURL,winName,features);
	}

	function Validate()
	{
		if (document.email.sendto.value == "")
		{
			alert ("You must select the person or area you wish to send this email.");
			return false;
		}

		// Check for Empty fields
		if (document.email.name.value == ""
			|| document.email.email.value == ""
				|| document.email.subject.value == ""
					|| document.email.message.value == "")
		{
			alert ("You must complete all of the fields in the form.");
			return false;
		}


	}

	function Validate_checkout()
	{
		if (document.checkout.user_title.value == "0")
		{
			alert ("You must select a title.");
			return false;
		}

		if (document.checkout.card_type.value == "0")
		{
			alert ("You must select a credit card type.");
			return false;
		}

		// Check for Empty fields
		if (document.checkout.firstname.value == ""
			|| document.checkout.lastname.value == ""
				|| document.checkout.tel_number.value == ""
					|| document.checkout.baddress.value == ""
						|| document.checkout.daddress.value == ""
							|| document.checkout.cc_uname.value == ""
								|| document.checkout.ccnumber.value == ""
										|| document.checkout.email_address.value == "")
		{
			alert ("You must complete all of the fields in the form.");
			return false;
		}


	}

	function del_item(pid, userid, options, page_addr)
	{
		var ans;
		ans=window.confirm('Are you sure you wish to delete this item from your cart?');

		if (ans==false) {
			alert ("No action has been taken");
		} else {
			window.location = "processor.php?page_id=delitem&user_id=" + userid + "&pro_id=" + pid + "&pro_options=" + options + "&page_addr=" + page_addr;
		}
	}

	function del_all($page){
		var ans;
		ans=window.confirm('Are you sure you wish to empty your cart?');

		if (ans==false) {
			alert ("No action has been taken");
		} else {
			window.location = "processor.php?" + $page;
		}
	}

	function update_cart(pid, options, userid, page_addr)
	{
		ans = prompt("Please enter the amount you wish to buy of this item"
			+ "\n - Leave blank to cancel this action."
				+ "\n - Enter a minus number to decrease the amount of this item."
					+	"\n - Enter a positive number to add to the current amount.", "")

		if (ans)
		{
			window.location = "processor.php?page_id=editcart&user_id=" + userid + "&pid=" + pid + "&options=" + options + "&newamount=" + ans + "&page_addr=" + page_addr;
		}
		else
		{
			alert("This item has not been updated");
		}
	}

	//*****************
	//Menu System
	//*****************

	if (readCookie('xpresspanel') == null)
	{
		createCookie('xpresspanel','0','1000')
	}

	function menucheck()
	{
		xpresspanel = readCookie('xpresspanel');
		arrayOfStrings = xpresspanel.split(' ')

		for (var i=0; i < arrayOfStrings.length; i++)
		{
			exp_coll(arrayOfStrings[i],1) //expands the menus from cookie
		}
	}

	function menu_add(ind)
	{
		xpresspanelval = readCookie('xpresspanel');
		eraseCookie('xpresspanel')
		createCookie('xpresspanel',xpresspanelval + ' ' + ind,'1000')
	}

	function menu_del(ind)
	{
		xpresspanel = readCookie('xpresspanel');
		eraseCookie('xpresspanel')
		arrayOfStrings = xpresspanel.split(' ')

		for (var i=0; i < arrayOfStrings.length; i++)
		{
			if(arrayOfStrings[i] == ind)
			{
				arrayOfStrings[i] = "";
			}
		}

		for (var i=0; i < arrayOfStrings.length; i++)
		{
			if (arrayOfStrings[i])
			{
				if (i == 0)
				{
					saveString = arrayOfStrings[i];
				}
				else
				{
					saveString = saveString + " " + arrayOfStrings[i];
				}
			}
		}

		createCookie('xpresspanel',saveString,'1000')
	}

	function exp_coll(ind,value)
	{
		s = document.getElementById("sp_" + ind);
		i = document.getElementById("im_" + ind);
		if (s)
		{
			if (s.style.display == 'none')
			{
				s.style.display = 'block';
				if (i)
				{
					i.src = "images/skins/1/minus.gif";
				}
				if ((ind == 0) || (ind == 1001))
				{
					//Do Nothing!
				}
				else
				{
					if (value != 1) //checks if page loading page or user click
					{
						menu_add(ind);
					}
				}

			}
			else if (s.style.display == 'block')
			{
				s.style.display = 'none';
				if (i)
				{
					i.src = "images/skins/1/plus.gif";
				}
				if ((ind == 0) || (ind == 1001))
				{
					//Do Nothing!
				}
				else
				{
					if (value != 1) //checks if page loading page or user click
					{
						menu_del(ind);
					}
				}
			}
		}
	}

	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
	}

	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}