// Flash ActionScript functions
function thisMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function addbasket(a,b) {
	// javascript substitutes 'null' for null a or b
	if (!a) a="";
	if (!b) b="";
	// set cookie
	var date = new Date();
	date.setTime(date.getTime()+(1*24*60*60*1000));
	var expires = "expires="+date.toGMTString();
	document.cookie = "makeBasket="+a+"; "+expires+"; path=/";
	document.cookie = "basketQty="+b+"; "+expires+"; path=/";
}
function setcookie(name, val) {
	// set cookie
	var date = new Date();
	if (val!=""){
		date.setTime(date.getTime()+(1*24*60*60*1000));
	} else {
		date.setTime(date.getTime()-9000);
		val = "0";
	}
	var expires = "expires="+date.toGMTString();
	document.cookie = name+"="+val+"; "+expires+"; path=/";
}
function getcookie(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);
	}
	return '';
}
function warning(m,u) {
	alert(m);
	if (u) top.location.href = u;
}
function newWin(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function confirmIt(m){
	return(confirm(m));
}

var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;

function InitializeTimer() {
    // Set the length of the timer, in seconds
    secs = 6;
    StopTheClock();
    StartTheTimer();
}

function StopTheClock() {
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheTimer() {
    if (secs==0) {
        StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        document.getElementById("flashcontent").className = "vis";
        // TURN VIS OF PRODUCTS TABLE ON
        if (document.getElementById) {
			// this is the way the standards work
			var style2 = document.getElementById('htmlcontent').style;
			style2.display = "";
		} else if (document.all) {
			// this is the way old msie versions work
			var style2 = document.all['htmlcontent'].style;
			style2.display = "";
		} else if (document.layers) {
			// this is the way nn4 works
			var style2 = document.layers['htmlcontent'].style;
			style2.display = "";
		}
    } else {
        //self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}