	
	function updateHTML(elmId, value) {
          document.getElementById(elmId).innerHTML = value;
    }
	function updateHTMLmusic(elmId, value){

		var bytes = $('#bytesloaded').html();
		var bytestotal = $('#bytestotal').html();
		document.getElementById(elmId).innerHTML = value;
		var estado = $('#playerstate').html();
		
		if(bytes == -1){
			mute();	
		}
		if(estado == 1){
			var total = $('#videoduration').html();
			var tiempo = $('#videotime').html();
			// TIEMPO EN SEGUNDOS DE PRECARGA
			//if(tiempo > 1 || (bytes == bytestotal && bytes != -1)){
				$('#btn_video').fadeIn('slow');
			//}
		}

	}
	function setytplayerState(newState) {
	  updateHTML("playerstate", newState);
	}
	function onYouTubePlayerReady(playerId) {
	  ytplayer = document.getElementById("myytplayer");
	  setInterval(updateytplayerInfo, 1000);
	  updateytplayerInfo();
	  ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
	  ytplayer.addEventListener("onError", "onPlayerError");
	}
	function onPlayerError(errorCode) {
	  alert("An error occured: " + errorCode);
	}
	function onytplayerStateChange(newState) {
	  setytplayerState(newState);
	}
	function updateytplayerInfo() {
	  updateHTML("bytesloaded", getBytesLoaded());
	  updateHTML("bytestotal", getBytesTotal());
	  updateHTMLmusic("videoduration", getDuration());
	  //updateHTML("videoduration", getDuration());
	  updateHTML("videotime", getCurrentTime());
	  //updateHTML("startbytes", getStartBytes());
	  //updateHTML("volume", getVolume());
	}
	// functions for the api calls
	function loadNewVideo(id, startSeconds) {if (ytplayer) {ytplayer.loadVideoById(id, parseInt(startSeconds));}}
	function cueNewVideo(id, startSeconds) {if (ytplayer) {ytplayer.cueVideoById(id, startSeconds);}}
	function play() {if (ytplayer) {ytplayer.playVideo();}}
	function pause() {if (ytplayer) {ytplayer.pauseVideo();}}
	function stop() { if (ytplayer) {ytplayer.stopVideo(); }}
	function getPlayerState() {if (ytplayer) {return ytplayer.getPlayerState();}}
	function seekTo(seconds) {if (ytplayer) {ytplayer.seekTo(seconds, true);}}
	function getBytesLoaded() {if (ytplayer) {return ytplayer.getVideoBytesLoaded();}}
	function getBytesTotal() { if (ytplayer) {return ytplayer.getVideoBytesTotal();}}
	function getCurrentTime() {if (ytplayer) {return ytplayer.getCurrentTime();}}
	function getDuration() {if (ytplayer) {return ytplayer.getDuration();}}
	function getStartBytes() {if (ytplayer) {return ytplayer.getVideoStartBytes();}}
	function mute() {if (ytplayer) {ytplayer.mute();}}
	function unMute() {if (ytplayer) {ytplayer.unMute();}}
	function getEmbedCode() {alert(ytplayer.getVideoEmbedCode());}
	function getVideoUrl() {alert(ytplayer.getVideoUrl());}
	function setVolume(newVolume) {if (ytplayer) {ytplayer.setVolume(newVolume);}}
	function getVolume() {if (ytplayer) {return ytplayer.getVolume();}}
	function clearVideo() {if (ytplayer) {ytplayer.clearVideo();}}

      
      var params = { allowScriptAccess: "always", bgcolor: "#000",allowfullscreen:"true" };
      var atts = { id: "myytplayer" };
      swfobject.embedSWF("http://www.youtube.com/v/gvo_mE7Bopc?border=0&enablejsapi=1&playerapiid=ytplayer&autoplay=1&fs=1",
                         "movie", "500", "350", "9", null, null, params, atts);

//FUNCIONES PACO  vDLefKLj8DE 1cCSD7n2rSc
function rpacoc_rep(){
	
	seekTo(0, true);
	$('#cont_video').css('height','400px');
	unMute();
	$("#shadow").css("height", $(document).height()).hide();
	 $("#shadow").show();
	 $('#btn_video2').show();
}
function rpacoc_norep(){
	
	mute();
	$('#cont_video').css('height','0px');
	
	$("#shadow").css("height", $(document).height()).hide();
	$("#shadow").hide();
	$('#btn_video2').hide();
}
