	// <![CDATA[
	function openNewWindow(URLtoOpen, windowName) { newWindow=window.open(URLtoOpen, windowName, 'height=640,width=880,titlebar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes');}
	var AAMB1 = "";
	var AAMB2 = "";
	var AAMB3 = "";
	var AAMB4 = "";
	var AAMB5 = "";

    var queryString = "";

    function notifyOpener() {
		if(self.opener && !self.opener.thePlayerWin)
			self.opener.thePlayerWin = self;
	}

	setInterval( notifyOpener, 200 );

	self.focus();

    // get our flash movie object
    var flashMovie;
    function init() {
 		if (document.getElementById) {
		    flashMovie = document.getElementById("player");
	    }

		fullURL = parent.document.URL;
		if (fullURL.indexOf('?') != -1)
		{
			queryString = fullURL.substring(fullURL.indexOf('?'), fullURL.length);
		}
    }

    function closeApp() {
		//callDeleteCookie();
    }

	function checkForData()
	{
		//alert(" checkForData  " + queryString);
		addPlaylistItem(queryString);	

	}

    // wait for the page to fully load before initializing
    window.onload = init;

	//This function is called from Flash Actionscript when the media is selected to be played
	function callGetAd(a1, a2, a3)
	{
		//alert("YEAH");
		AAMB1 = unescape(a1);
		AAMB2 = unescape(a2);
		AAMB3 = unescape(a3);
		
		show300x250Ad();
		show728x90Ad();
		show88x31Ad();
	}

	//----------- New Function ---------------------------------------
	function callGetCampAdOnly(a2)
	{
		AAMB2 = unescape(a2);
		hide300x250Ad();
		show234x60Ad();
	}
	//----------------------------------------------------------------

	function callDeleteCookie()
	{
		//alert("YEAH");
		eraseCookie('playListItem');
	}

	function addPlaylistItem(x) {
		//alert(x + " addPlaylistItem  " + flashMovie);
		if (flashMovie) {
		 	flashMovie.sendPlaylistItemToFlash(unescape(x));
	    }
	}
	
	function addShowItem(x) {
		//alert(x + "   " + flashMovie);
		if (flashMovie) {
		 	flashMovie.sendPlaylistItemToFlash(unescape(x));
	    }
	}
	
	
	//----------------------------------
	// Book Marking funtions 
	//----------------------------------
	
	function bookmarkShowItem(x) {
		//alert(x + "   " + flashMovie);
		if (flashMovie) {
		 	flashMovie.sendPlaylistItemToFlash(unescape(x));
	    }
	}
	
	function bookmarkProgramItem(x) {
		//alert(x + "   " + flashMovie);
		if (flashMovie) {
		 	flashMovie.sendPlaylistItemToFlash(unescape(x));
	    }
	}


	//----------------------------------
	// Ad Functions.
	//----------------------------------

	// Used to hide the 300x250 Ad.
	function hide300x250Ad()
	{
		var ad300x250 = document.getElementById('adunitl');
		ad300x250.innerHTML = '';
		ad300x250.style.visibility = 'hidden';
	}

	// Used to show the 300x250 Ad.
	function show300x250Ad()
	{
		var ad300x250 = document.getElementById('adunitl');
		ad300x250.innerHTML = unescape(AAMB1);
		ad300x250.style.visibility = 'visible';
	}
	
	// Used to hide the 728x90 Ad.
	function hide88x31Ad()
	{
		
		var ad88x31 = document.getElementById('adunitSmall');
		ad88x31.innerHTML = '';
		ad88x31.style.visibility = 'hidden';
	}

	// Used to show the 728x90 Ad.
	function show88x31Ad()
	{
		var ad88x31 = document.getElementById('adunitSmall');
		ad88x31.innerHTML = unescape(AAMB3);
		ad88x31.style.visibility = 'visible';
	}


	// Used to hide the 728x90 Ad.
	function hide728x90Ad()
	{
		
		var ad728x90 = document.getElementById('adunit');
		ad728x90.innerHTML = '';
		ad728x90.style.visibility = 'hidden';
	}

	// Used to show the 728x90 Ad.
	function show728x90Ad()
	{
		var ad728x90 = document.getElementById('adunit');
		ad728x90.innerHTML = unescape(AAMB2);
		ad728x90.style.visibility = 'visible';
	}

	function process(x) {
		//parse the data
		addPlaylistItem(x);
	}
	
	
	function pingWatched(url){
		//alert(unescape(url) + "<----- URL PINGED");
		var myimg = new Image();
		myimg.src = unescape(url);
	}
	

	//constantPoll("playListItem");

   // ]]>