

	// some variables to save
	var currentItem;

	// this function is caught by the JavascriptView object of the player.
	function sendEvent(typ,prm) { thisMovie("promote_3flash").sendEvent(typ,prm); };
	// these functions is called by the JavascriptView object of the player.
	function getUpdate(typ,pr1,pr2,swf) { 
		if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100);}
	};
	function getItemData(idx) {
		var obj = thisMovie("promote_3flash").itemData(idx);
		var tmp = document.getElementById("promote-flash-text-title"); if (tmp) { tmp.innerHTML = "<b>" +  obj["title"] + "</b>"; } 
		var tmp = document.getElementById("promote-flash-text-descrtiption"); if (tmp) { tmp.innerHTML = "" + obj["description"] + ""; } 
	};
	// This is a javascript handler for the player and is always needed.
	function thisMovie(movieName) {
		if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};
	// This creates the player after the page has finished loading (onload).
	function createPlayer() {
		var s1 = new SWFObject("http://www.thaitv3.com/ch3/libs/mediaplayer/player_loop.swf","promote_3flash","240","190","8");
		s1.addParam("allowfullscreen","true");
		s1.addParam("allowscriptaccess","always");
		s1.addVariable("overstretch","fit");

		s1.addVariable("file","http://www.thaitv3.com/ch3/xml/promote/flash.xml");
		s1.addVariable("shuffle","true");
		s1.addVariable("linktarget","_self");

		s1.addVariable("enablejs","true");
		s1.addVariable("javascriptid","promote_3flash");

		s1.addVariable("width","240");
		s1.addVariable("height","190");
		s1.addVariable("displayheight","190");

		s1.addVariable("autoscroll","true");

		s1.addVariable("frontcolor",""); 
		s1.addVariable("lightcolor",""); 
		s1.addVariable("showicons","true");
		s1.addVariable("autostart","false");
		s1.addVariable("thumbsinplaylist","true");

		s1.addParam("wmode", "transparent"); //blocks fullscreen!

		s1.write("promote-flash-video");
	};

	// Event Window Onload
	window.onload = function(){createPlayer()}
	