	// Update a particular HTML element with a new value
	function updateHTML(elmId, value) {
		document.getElementById(elmId).innerHTML = value;
	}
	
	// Loads the selected video into the player.
	function loadVideo(videoID,caption,description,date) {
		if(ytplayer) {
			ytplayer.loadVideoById(videoID);
		}
	}
	
	// This function is called when an error is thrown by the player
	function onPlayerError(errorCode) {
		//alert("An error occured of type:" + errorCode);
	}
	
	// This function is automatically called by the player once it loads
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytPlayer");
		ytplayer.addEventListener("onError", "onPlayerError");
		ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
	}
	
	function onytplayerStateChange(newState) {
		//alert(newState);
		if (newState == 1) {
			stop_feature('word');
		}
		setytplayerState(newState);
	}
	
	// The "main method" of this sample. Called when someone clicks "Run".
	function loadPlayer() {
	// The video to load
		
		// Lets Flash from another domain call JavaScript
		var params = { allowScriptAccess: "always", wmode: "transparent" };
		// The element id of the Flash embed
		var atts = { id: "ytPlayer" };
		// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
		swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1", "videoDiv", videoWidth, videoHeight, "8", null, null, params, atts);
	}
	
	function _run() {
		loadPlayer();
	}
	google.setOnLoadCallback(_run);

