//The code in this file is copyright © Creative Technology 2000.  All rights are reserved.
//The ordering system uses the hard-coded cookie called ct_basket, which has the format
// number_of_items | item_ordercode ^ quantity | item_ordercode ^ quantity (etc)
//JS Common file - graphic routines common to all pages, and browser detection
//

//------THESE ROUTINES DEAL WITH DESIGN FEATURES 
//-------SUCH AS HEADER-WRITERS ETC

//----------This section is purely UI Design & visual - no shopping cart stuff
function show_header(headertext) {
//Faded white heading background
	if (ct_checkout)
	{document.write('<table width="386" border="0" cellspacing="0" cellpadding="0" background="common/heading_bg.gif">');
  	document.write('<tr valign="middle"><td width="8"> <img src="common/heading_edge.gif" width="8" height="20" align="absmiddle"></td>');
  	document.write('<td width="388" class="subheading">' + headertext + '</td></tr></table>');

	}
	else {
	document.write('<table width="386" border="0" cellspacing="0" cellpadding="0" background="/images/common/heading_bg.gif">');
  	document.write('<tr valign="middle"><td width="8"><img src="/images/common/heading_edge.gif" width="8" height="20" align="absmiddle"></td>');
  	document.write('<td width="388" class="subheading">' + headertext + '</td></tr></table>');
	}
}

function ExistCookie(name) {
//Used by browser check below
	var nameEQ = name + "="
	var ca = document.cookie.split(";")
	if (document.cookie != "") {
		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 true}
		}
     return false}
}


//Stuff which executes on every page
browser_v = parseInt(navigator.appVersion);
if (browser_v <=3 && !ExistCookie('ct_browser')){
	document.cookie = "ct_browser=v3;path=/"
	location = 'warning.htm';
}

var ct_checkout = false; // flag to indicate whether we're at the secure server - set to true in secure pages
