        function updateHTML(elmId, value) {
          document.getElementById(elmId).innerHTML = value;
        }
 
        function setytplayerState(newState) {
          updateHTML("playerstate", newState);
        }
 
        function onYouTubePlayerReady(playerId) {
          ytplayer = document.getElementById("myytplayer");
//          setInterval(updateytplayerInfo, 250);
//          updateytplayerInfo();
          ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
          ytplayer.addEventListener("onError", "onPlayerError");
        }
 
        function onytplayerStateChange(newState) {
          setytplayerState(newState);
        }
 
        function onPlayerError(errorCode) {
          alert("An error occurred: "+ errorCode);
        }
 
        function updateytplayerInfo() {
          updateHTML("bytesloaded", getBytesLoaded());
          updateHTML("bytestotal", getBytesTotal());
          updateHTML("videoduration", getDuration());
          updateHTML("videotime", getCurrentTime());
          updateHTML("startbytes", getStartBytes());
        }
 
        // functions for the api calls
        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 show_info(a, link){
    try {
      
     // allowScriptAccess must be set to allow the Javascript from one domain to access the swf on the youtube domain
      var params = { allowScriptAccess: "always" };
      // this sets the id of the object or embed tag to 'myytplayer'. You then use this id to access the swf and make calls to the player's API
      var atts = { id: "myytplayer" };
    // Change this information with what you want. To get the code that is needed, go to YouTube.com and find the Video that you want, Over on the Right side it gives you an option to either copy the Link (or) Embedded Code... You want the Embedded Code. Take the link out of it, and please it below. Leaving the:  &amp;border=0   Only replacing everything in the URL before it..... Enjoy, and have fun.
      swfobject.embedSWF(link+"?version=3&amp;border=0&amp;enablejsapi=1&amp;playerapiid=ytplayer", 
                         "ytapiplayer", "700", "555", "8", null, null, params, atts);
      document.getElementById(a).style.display="inline"; 
    } catch (e) {}
    try {
      play();
    } catch (e) {}
  }
  function close_info(a){
    try {
      stop();
    } catch (e) {}
    try {
      document.getElementById(a).style.display="none"; 
    } catch (e) {}
  }


