var currentFile = ""; 
var currentItem = 0; 
var previousItem = -1; 

var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
	addListeners();
}


function addListeners() {
	if (player) { 
		player.addControllerListener("ITEM", "itemListener"); 
	} else {
		setTimeout("addListeners()",100);
	}
}


function itemListener(obj) { 
	if (obj.index != currentItem) {
 		previousItem = currentItem;
		currentItem = obj.index;
	}
}

function createPlayer(theFile) {
   var flashvars = {
           file:theFile, 
           autostart:"true",
           playlistsize:"70",
           playlist:"bottom",
           skin: "/public/stylish_slim_c.swf",
           backcolor: "0B0B0B",
           lightcolor:"1e8af4",
           frontcolor:"666666",
           shuffle: "false",
           repeat: "always",
           volume: "10"
   }
   var params = {
           wmode:"transparent", 
           allowfullscreen:"true", 
           allowscriptaccess:"always"
   }

   var attributes = {
           id:"player1",  
           name:"player1"
   }
   swfobject.embedSWF('/public/player.swf', "placeholder1", "100%", "100", "9.0.115", false, flashvars, params, attributes);
}

function createPlayerLarge(theFile) {
   var flashvars = {
           file:theFile, 
           autostart:"false",
           playlistsize:"200",
           playlist:"bottom",
           skin: "/public/stylish_slim_c.swf",
           backcolor: "141414",
           lightcolor:"1e8af4",
           frontcolor:"666666",
           shuffle: "true",
           repeat: "always",
   }
   var params = {
           wmode:"transparent", 
           allowfullscreen:"true", 
           allowscriptaccess:"always"
   }

   var attributes = {
           id:"player1",  
           name:"player1"
   }
   swfobject.embedSWF('/public/player.swf', "placeholder1", "100%", "230", "9.0.115", false, flashvars, params, attributes);
}


var newwindow = null;

function popitout() {

	function itemListener(obj) { 
		if (obj.index != currentItem) {
	 		previousItem = currentItem;
			currentItem = obj.index;
		}
	};
	
	if (player) { 
			player.sendEvent("STOP"); 
			player = null;
		}	

	var uRL = '/public/popoutplayer.html?'+currentItem;
		
	newwindow = window.open(uRL,'name','height=400,width=500,left=100,top=200,resizable=yes');
	newwindow.focus();	
	
	}
