/*

var products = new Array(
new Array("200","Diploma in Life Coaching &#163;655 / &#36;1360 plus postage", "","655.00"),
new Array("201","Diploma in Life Coaching - Life Coaching Studio", "","655.00"),
new Array("202","Diploma in Life Coaching - Special Businessballs price &#36;1224 / &#163;589 plus postage", "","589.00"),
new Array("500","Diploma in Catering &#163;395 / &#36;765 plus postage","","395.00"),
new Array("2","Diploma in Cartooning &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("3","Diploma in Copywriting &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("36","Copywriting Advertisment", "","100.00"),
new Array("38","Diploma in Creative Writing &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("39","Diploma in Creative Writing &#36;465 / &#163;259 plus postage", "","259.00"),
new Array("4","Test", "","1.50"),
new Array("5","Diploma in Event Planning &#163;438 / &#36;835 plus postage", "","438.00"),
new Array("6","Diploma in Horticulture (RHS General) &#163;449 / &#36;856 /  plus postage", "","449.00"),
new Array("7","Diploma in Private Investigation &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("8","Diploma in Garden Design &#163;495 / &#36;938 plus postage", "","495.00"),
new Array("9","Diploma in Counselling &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("91","Diploma in Herbal Medicine &#36;790 / &#163;395 plus postage", "","395.00"),
new Array("92","Diploma in Homeopathy &#36;620 / &#163;345 plus postage", "","345.00"),
new Array("123","Diploma in Interior Design &#163;595 / &#36;1,117 /  plus postage", "","595.00"),
new Array("14","Diploma in Freelance Photography &#36;722 / &#163;440 plus postage", "","440.00"),
new Array("40","Restaurant Entrepreneur Diploma &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("41","Virtual Assistant Diploma &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("15","Diploma in Technical Writing &#163;395 / &#36;765 plus postage", "","395.00"),
new Array("155","Diploma in Technical Writing &#163;280", "","280.00"),
new Array("16","Diploma in Visual Basic &#36;760 / &#163;431 plus postage", "","431.00"),
new Array("17","Webstart course &#163;250", "","250.00"),
new Array("18","Personal Trainer Diploma  &#163;395 / &#36;765 plus postage", "","395.00")
);
*/
var products = new Array(
new Array("123","Diploma in Interior Design", "GBP","595.00"),
new Array("14","Diploma in Freelance Photography", "GBP","440.00"),
new Array("155","Diploma in Technical Writing", "GBP","280.00"),
new Array("15","Diploma in Technical Writing", "GBP","395.00"),
new Array("16","Diploma in Visual Basic", "GBP","431.00"),
new Array("17","Webstart course", "GBP","250.00"),
new Array("18","Personal Trainer Diplom", "GBP","395.00"),
new Array("200","Diploma in Life Coaching", "GBP","655.00"),
new Array("201","Diploma in Life Coaching - Life Coaching Studio", "GBP","655.00"),
new Array("202","Diploma in Life Coaching - Special Businessballs price", "GBP","589.00"),
new Array("2","Diploma in Cartooning", "GBP","395.00"),
new Array("36","Copywriting Advertisment", "GBP","100.00"),
new Array("38","Diploma in Creative Writine", "GBP","395.00"),
new Array("39","Diploma in Creative Writing", "GBP","259.00"),
new Array("3","Diploma in Copywriting", "GBP","395.00"),
new Array("40","Restaurant Entrepreneur Diploma", "GBP","395.00"),
new Array("41","Virtual Assistant Diploma", "GBP","395.00"),
new Array("4","Test", "GBP","1.50"),
new Array("500","Diploma in Catering","GBP","395.00"),
new Array("5","Diploma in Event Planning", "GBP","438.00"),
new Array("6","Diploma in Horticulture (RHS General)", "GBP","449.00"),
new Array("7","Diploma in Private Investigation", "GBP","395.00"),
new Array("8","Diploma in Garden Design", "GBP","495.00"),
new Array("91","Diploma in Herbal Medicine", "GBP","395.00"),
new Array("92","Diploma in Homeopathy", "GBP","345.00"),
new Array("9","Diploma in Counselling", "GBP","395.00"),


new Array("123","Diploma in Interior Design", "USD","1057.00"),
new Array("14","Diploma in Freelance Photography", "USD","7822.00"),
new Array("155","Diploma in Technical Writing", "USD","280.00"),
new Array("15","Diploma in Technical Writing", "USD","699.00"),
new Array("16","Diploma in Visual Basic", "USD","760.00"),
new Array("17","Webstart course", "USD","250.00"),
new Array("18","Personal Trainer Diploma", "USD","699.00"),
new Array("200","Diploma in Life Coaching", "USD","1164.00"),
new Array("201","Diploma in Life Coaching - Life Coaching Studio", "USD","655.00"),
new Array("202","Diploma in Life Coaching - Special Businessballs price", "USD","1224.00"),
new Array("2","Diploma in Cartooning", "USD","699.00"),
new Array("36","Copywriting Advertisment", "USD","100.00"),
new Array("38","Diploma in Creative Writing", "USD","699.00"),
new Array("39","Diploma in Creative Writing", "USD","465.00"),
new Array("3","Diploma in Copywriting", "USD","699.00"),
new Array("40","Restaurant Entrepreneur Diploma", "USD","699.00"),
new Array("41","Virtual Assistant Diploma", "USD","699.00"),
new Array("4","Test", "USD","1.50"),
new Array("500","Diploma in Catering","USD","699.00"),
new Array("5","Diploma in Event Planning", "USD","778.00"),
new Array("6","Diploma in Horticulture (RHS General)", "USD","798.00"),
new Array("7","Diploma in Private Investigation", "USD","699.00"),
new Array("8","Diploma in Garden Design", "USD","879.00"),
new Array("91","Diploma in Herbal Medicine", "USD","699.00"),
new Array("92","Diploma in Homeopathy", "USD","620.00"),
new Array("9","Diploma in Counselling", "USD","699.00")

);

var postPack = 30; // Amount in £ to add for postage & packing
// Just examine the order form (checkout.htm) and use 
// the value from the drop-down box to add a country for postage free
// Always leave the last row without a comma after the last speech mark
//var countries = new Array(
//"GB",
//"IE"
//);
var countries = new Array(
"GB"
);

function setprodID(n) {
productID = parseFloat(productID);
SetCookie('productID',n, 1800000, '/', '');
SetCookie('productIdent',n, 1800000, '/', '');
//setTimeout (10000);

var prodOptions = "", selectWrite = "", productString = "", total = 0, productID =""; // Setting the variables
if (GetCookie('productID') != null) {
var productID = GetCookie('productID');
	for (var i=0; i < products.length; i++) {
	// Extracting the product based on the ID, passed in
	// the cookie, from the .js file product array
	// and writing the product to a table
	product = products[i];
		if (product[0] == productID) {
		var productID = product[0];
		var description = product[1];
		var price = product[3];
		var selectWrite = "<table cellpadding='2' cellspacing='2' class='12verdblack' width='100%'>";
		selectWrite += "<tr bgcolor='#DDDDDD' align='center'><td><font face='Arial'>Description</font></td>\n";
			if (product[2]) {
			selectWrite += "<td><font face='Arial'>Options</font></td>";
			}
		selectWrite += "<td><font face='Arial'>Price</font></td>\n";
		selectWrite += "<td><font face='Arial'>Quantity</font></td></tr>\n";	
		selectWrite += "<tr bgcolor='#EEEEEE' align='center'><td><font face='Arial'>" + product[1] + "</font></td>\n";
			if (product[2]) {
			var optionsArray = product[2].split(':');
			selectWrite += "<td><select name='prodOptions'>\n";
				for (var j = 0; j < optionsArray.length; j++) {
				selectWrite += "<option>" + optionsArray[j] + "\n";
				}
			selectWrite += "</select></td>\n";	
			}
			selectWrite += "<td><font face='Arial'>£" + product[3] + "</td>\n";
			selectWrite += "<td><input type='text' size='2' name='qty' value='1'></td></tr></table>\n";
		}
	}
}

DeleteCookie('productID')
// Calculates the total based on the Quantity tag and
// writes it to a single delimited cookie
//function calculateBask() {
//frm = document.prodTotal;
//frm.qty.value = 1;
//	if (frm.qty) {
//	total = price * frm.qty.value;	
	total = price;// * 1.00;	
//	prodOptions = (frm.prodOptions ? frm.prodOptions.options[frm.prodOptions.selectedIndex].text : "&nbsp;");
	prodOptions = ("&nbsp;");
	productString += 'prodID' + '::' + productID + '-->';
	productString += 'prodDescrip' + '::' + description + '-->';
	productString += 'prodOptions' + '::' + prodOptions + '-->';
	productString += 'prodPrice' + '::' + price + '-->';
	productString += 'prodCost' + '::' + total + '-->';
	productString += 'prodQuant' + '::1';
//	productString += 'prodQuant' + '::' + frm.qty.value;
	productString += '+++';
//		if (frm.qty.value != 0 && frm.qty.value != null) {

		SetCookie('productDetails',productString, 1800000, '/', '');

//		}

	if (GetCookie('productIdent') ==3) {
		// the onlu one we've done yet
	window.location = "/checkout/index.php";
	} else	{
	window.location.href = '/checkout.htm';
	}
//	} else {
//	alert ("You have either not chosen a course or you\n" +
//	"do not have cookies enabled. Please choose a\n" +
//	"course or configure your browser to accept cookies");
//	}
//}
// As the document loads, the cookie is read to
// be added onto the beginning of the new product 

var productString = GetCookie('productDetails');

SetCookie('pageLocation',location.pathname, 1800000, '/', '');

//setTimeout("window.location.href = 'http://www.inst.org/basket.htm'", 1000);

setTimeout("window.location.href = '/checkout.htm'", 1000);

//setTimeout("window.location.href = 'http://www.inst.org/order.htm'", 1000);
}

function orderPage() {

SetCookie('pageLocation',location.pathname, 1800000, '/', '')

setTimeout("window.location.href = 'http://www.inst.org/order.htm'", 1000);	

}
// Copy the top line commencing "new Array" to a space below the bottom line.
// Make sure the previous line now ends in a comma.
// The first listing gives the product ID, the second listing describes the course, the third,
// optional listing gives product options, the fourth the price.
// For the options listing list options like this - Windows 98:Windows 95:Windows NT etc.
// Example: new Array("13","Microsoft Certified Professional", "Windows 98:Windows 95:Windows NT",385.00),
// Please do not put aphostrophes ' in your description
// Always leave the last row without a comma after the last bracket
// After you have added a product you need to add a link to your new product page as below:
// <a href="javascript: setprodID(17)">Buy Whatever Course</a>
// In the code above you have set a link for product id 17. The "Buy Whatever Course" will
// be the text that will display on your page. You can use your editor to bolden it etc.
// Finally you need to add the code shown beneath directly below this line at the top
// of your page. The line below which the code must be added is:
// <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or
// <title>Untitled Document</title>
// The code is:
//      <script language="JavaScript" src="cookies.js"></script>
//      <script language="JavaScript" src="database/data.js"></script>
// That's it! Ian
