If you need to control youtube iframes with Javascript here's a couple places to look: stackoverflow.com and Youtube API Reference

The nut and bolts of the needed code are:

Note: This code came from stackoverflow.com


var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

var ytfullplayer;

function onYouTubePlayerAPIReady() {
  ytplayer = new YT.Player('ytPlayer', {
    events: {
      'onReady': ytEvent,
      'onPlaybackQualityChange': ytEvent,
      'onStateChange': ytEvent,
      'onError': ytEvent
    }
  });
}

function ytEvent( e ){
  // do something.
  // use e.data to find out what the player is doing
}