var player = null;
	function playerReady(thePlayer) {
		player = document.getElementById(thePlayer.id);
		addListeners();
	}
	 
	 
	function addListeners() {
		
		if (player) {
			player.addModelListener("STATE", "stateListener");
		} else {
			setTimeout("addListeners()",100);
		}
	}
	 
	 
	function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
		currentState = obj.newstate; 
		previousState = obj.oldstate;
		if ((currentState == "COMPLETED")&&(previousState == "IDLE")) {
			if((obj.id!=='tlvi')&&(obj.id!=='trvi')&&(obj.id!=='chl_cost_vid')) {
				$('#video_box').html(load_contents);
			}
			if(obj.id == 'wisdomvid') {
				$('#wisdom').empty();
			}
		}
	}
	 
	 
	function createPlayer(filename, div, width, height, autoplay, repeat, controlbar, stretching, id) {
		var flashvars = {
			file:filename, 
			autostart:autoplay,
			repeat:repeat,
			controlbar:controlbar,
			stretching:stretching
		}
	 
		var params = {
			allowfullscreen:"flase", 
			allowscriptaccess:"always",
			wmode:"transparent"
		}
	 
		var attributes = {
			id:id,  
			name:id
		}
	 
		swfobject.embedSWF("/player.swf", div, width, height, "9.0.115", false, flashvars, params, attributes);
	}
