// -------------------------------------------------------------------------
// JavaScript 1.1: Online Ordering System Part I
// Author: All rights reserved, Copyright 2004, Chris Colefax <ccolefax@yahoo.com>
// This script, or any part thereof, may not be modified or used without
// express permission from the author
// -------------------------------------------------------------------------
// Requires common script


var CurItem = -1;


function WriteBuyThisButton(itmCode, itmDescription, itmPrice, itmColours, itmSmallest, itmLargest, itmWeight, itmPagefile, ShowCurrency) {
	if (useShop) {
	var i = Items.length;
	Items[i] = new Item(itmCode, itmDescription, itmPrice, itmColours, itmSmallest, itmLargest, itmWeight, itmPagefile);

	document.open();
	if (ShowCurrency) {
		document.write(' = ' + Currencies[CurCurrency].prefix);
		document.write(FormatNumber(Items[i].price * Currencies[CurCurrency].rate, Currencies[CurCurrency].decimals));
		document.write(Currencies[CurCurrency].suffix + '');
		document.write('&nbsp; &nbsp; <small>[<a href="currencies.html" target="SandraVidenCurrency" onclick="window.open(\'\', \'SandraVidenCurrency\', \'width=300,height=340,menubar=0,resizable=1\');">Change Currency</a>]</small>');
		document.write('<br />');
		}
	document.write('<a href=\'javascript: ShowThisItem(' + i + ');\' onmouseover=\'self.status="Click to add this item to your order..."; return true;\' onmouseout=\'self.status=self.defaultStatus; return false;\'><img src="images/buy.png" alt="BUY" width="110" height="18" /></a>');
	document.close();
	}}


function TestCookies() {
	document.cookie = 'TEST=abcdefg;PATH=/';
	if (document.cookie.indexOf('abcdefg') < 0) {
		alert ('To use our online shopping system you must enable per-session cookies in your browser preferences.  Records of the cookies we send will only be saved on your computer, and all our cookies will be deleted when you finish your order or end your browser session.  You can enable cookies through the Advanced section of the Preferences/Options menu.  Alternatively, you can send your order to us by email, fax, or post using the contact information on our home page.');
		return false;
	} else {
		DeleteCookie('TEST');
		return true;
		}
	}


function ShowThisItem(i) {
	if (TestCookies()) { 
		CurItem = i;
		var SandraVidenBuy = window.open('buyitem.html', 'SandraVidenBuyItem', 'dependent=1,menubar=0,resizable=1,scrollbars=0,width=500,height=320');
		SandraVidenBuy.focus();
		}
	}
