//
// Title: jaja.js
//
// This document is the copyright and property of Tim Mathias.
// It must not be copied (in whole or in part) used for manufacture or
// otherwise disclosed without prior written consent. Any copies of this
// document made by any method must also include a copy of this Legend,
// (c) Tim Mathias 2004.
//
// **************************
// *     Change History     *
// **************************
//
// Version  Author          Date      Description
// -------  --------------  --------  -----------------------------------------
//       1  Tim Mathias     23-12-04  Original.
//
// ****************************************************************************
//
// 1.0     Introduction
// --------------------
//
//   Shopping chores.
//
// 2.0     Program Listing
// -----------------------

function OpenShoppingBasket(query)
{
	var wnd_jaja_shopping_basket_options = "resizable=yes,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no";
	if (query)
	{
		query = "?" + query;
	}
	wnd_jaja_shopping_basket = window.open("shopping_basket.asp" + query, "wnd_jaja_shopping_basket", wnd_jaja_shopping_basket_options, true);
}

function OpenShopWindow(query)
{
	var wnd_jaja_shop_window_options = "resizable=yes,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no";
	wnd_jaja_shop_window = window.open("shop_window.asp?" + query, "wnd_jaja_shop_window", wnd_jaja_shop_window_options, true);
}

function OpenFlyerWindow()
{
	window.open("flyer.htm", "wnd_jaja_flyer");
}

// Create a cookie with the specified name and value.
function SetCookie(s_name, s_value)
{
	if (navigator.cookieEnabled)
	{
		// The cookie expires when browser is closed
		document.cookie = s_name + "=" + escape(s_value);
		/**
		// The cookie expires at the end of today
		date = new Date();
		document.cookie = s_name + "=" + escape (s_value) + "; expires=" + date.toGMTString ();
		/**/
	}
}

// Retrieve the value of the cookie with the specified name.
function GetCookie(s_name)
{
	if (navigator.cookieEnabled)
	{
		// Cookies are separated by semicolons
		var a_cookie = document.cookie.split("; ");
		for (var i = 0; i < a_cookie.length; i++)
		{
			// A name/value pair (a crumb) is separated by an equal sign
			var a_crumb = a_cookie[i].split("=");
			if (s_name == a_crumb[0])
			{
				return unescape(a_crumb[1]);
			}
		}
	}

	// A cookie with the requested name does not exist
	return null;
}

// Delete the cookie with the specified name.
function DelCookie(s_name)
{
	if (navigator.cookieEnabled)
	{
		document.cookie = s_name + "=0; expires=Thu, 1 Jan 1970 00:00:01 GMT;";
	}
}
