
var jsReady = false;
var swfReady = false;
var recheckInterval = 0;

function setJSReady() {
	//called by body onload event to indicate JS is running
    jsReady = true;
}

function getJSReady() {
	//called by flash to check if JS is running
	return jsReady;
}

function setSWFReady() {
	//called by flash to indicate AS is running
	swfReady = true;
}

function setIntroPlayed() {
	//called by flash when intro has played through
	document.cookie = "intro=1";
}

function getIntroPlayed() {
	//test if intro has played through
	if (document.cookie.indexOf("intro=1") != -1) {
		return true;
	} else {
		return false;
	}
}

function getSWF() {
	//get a browser appropriate reference to flash object
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window['flash'];
	} else {
		return document['flash'];
	}
}

function skipIntro() {
	//calls AS method to skip intro
	getSWF().skipIntro();
}

function playIntro() {
	//calls AS method to play intro
	getSWF().playIntro();
}

function checkIntro() {
	if (getIntroPlayed()) {
		skipIntro();
	} else {
		playIntro();
	}
}

function recheckSWFReady() {
	if (swfReady) {
		window.clearInterval(recheckInterval);
		checkIntro();
	}
}

recheckInterval = window.setInterval(recheckSWFReady, 10);

//write the flash object
document.writeln('<object name="flash" id="flash" width="679" height="362" data="/images/spring2012.swf" standby="Loading&hellip;" type="application/x-shockwave-flash" archive="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0 //www.macromedia.com/go/getflashplayer">');
document.writeln('<param name="swliveconnect" value="true" />');
document.writeln('<param name="allowScriptAccess" value="" />');
document.writeln('<param name="allowFullScreen" value="false" />');
document.writeln('<param name="play" value="true" />');
document.writeln('<param name="loop" value="false" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="scale" value="showAll" />');
document.writeln('<param name="wmode" value="opaque" />');
document.writeln('<param name="bgcolor" value="#ffffff" />');
document.writeln('<param name="movie" value="/images/spring2012.swf" />');
document.writeln('<param name="menu" value="true" />');
document.writeln('<param name="salign" value="tl" />');
document.writeln('<param name="flashvars" value="" />');
document.writeln ('<a title="Shop butterLONDON" href="/Great-Gift-Ideas/?a=29&manufacturer=BUTTR"><img src="/images/spring2012.jpg" alt="Make All the Easter Eggs Jealous" /></a>');
document.write('</object>');

