
function playMovie(file) {
	var so = new SWFObject('shared/flvplayer/flvplayer.swf','player','318','218','7');
	var fullPath = "http://itv-ht.rd.llnw.net/tycoon/flv/Tycoon/" + file;
	so.addParam("allowfullscreen","true");
	so.addVariable("file", fullPath);
	so.addVariable("displayheight","300");
	so.write('player');
}

function createPlayer(theFile, theImg, start, icons) {
	var s1 = new SWFObject("shared/flvplayer/flvplayer.swf","player","320","258","7");
	var fullPath = "http://itv-ht.rd.llnw.net/tycoon/flv/Tycoon/" + theFile;
	s1.addParam("allowfullscreen", "true");
	s1.addParam("overstretch", "false");
	s1.addVariable("file", fullPath);
	s1.addVariable("width", "320");
	s1.addVariable("height", "258");
	s1.addVariable("displaywidth", "320");
	s1.addVariable("displayheight", "240");
	
	if (start) s1.addVariable("autostart", "true");
	if (! icons) s1.addVariable("showicons", "false");
	if (theImg != "") s1.addVariable("image", theImg);
	s1.write("player");
	scroll(0,0);
	//setTimeout(s1.write("player"), 1);
}

function getAutoplay()
{
	var autoplay = getCookie('autoplay');
	if (autoplay == 'null')
	{
		autoplay=true;
		setCookie('autoplay', autoplay);
		alert(autoplay);
		
	}
	return autoplay;	
}

function toggleAutoplay()
{
	
	var autoplay = getAutoplay();
	
	if (autoplay == true){
		autoplay = false;
	}
	else if (autoplay == false)
	{
		autoplay = true;
		alert(autoplay);
	}
	deleteCookie('autoplay');
	setCookie('autoplay', autoplay);
	
	return autoplay;
	
}

// Toggle Action Processing
// copyright 9th January 2007, Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the below code in this script (including this
// comment) is used without any alteration
function rC(nam) {var tC = document.cookie.split('; '); for (var i = tC.length - 1; i >= 0; i--) {var x = tC[i].split('='); if (nam = x[0]) return unescape(x[1]);} return '0';} 
function wC(nam,val,expires) { if (!expires) expires = new Date(); expires.setDate(expires.getDate()+1); document.cookie = nam + '=' + escape(val)+ '; expires='+ expires.toGMTString()+ '; path=/';} 
function thisPage() {var page = location.href.substring(location.href.lastIndexOf('\/')+1); pos = page.indexOf('.');if (pos > -1) {page = page.substr(0,pos);} return page;} 
function toggle(nam,expires) {var val = rC(nam); if (val=='1') {wC(nam,'0',expires); return false;} wC(nam,'1',expires); return true;}

// example code to call it - you may modify this as required

var expires = 0;
// note that by default the script saves the cookie for one day
// if you wish to keep the cookie for a longer or shorter period then
// set the expires variable to the required expiry date instead of 0.

function start() {
   if (toggle(thisPage(),expires)) {
      // this code runs for even numbered visits
      alert('welcome');
   } else {
      // this code runs for odd numbered visits
      alert('hello');

   }
   // other code to run every time once page is loaded goes here
}

                  
