function changeYoutubeVideo(url, title, img, a) {
  var obj = $('youtubeObject');
  var ih = obj.innerHTML;

  /* For the standard YouTube Player */
  /*url = url + '&amp;fs=1&amp;color1=0xffbf23&amp;color2=0xfff8c8&amp;border=1';
  ih = ih.replace(/data="?[^ "]*"?/i, 'data="' + url + '"');
  ih = ih.replace(/name="movie" value="?[^ "]*"?/i, 'name="movie" value="' + url + '"');
  ih = ih.replace(/name="src" value="?[^ "]*"?/i, 'name="src" value="' + url + '"');*/
  
  /* JW Player */
  ih = ih.replace(/name="flashvars" value="?[^ "]*"?/gi, 'name="flashvars" value="plugins=ltas&amp;channel='
    +ltas_Channel+'&amp;image='+img+'&amp;file='+url+'&amp;backcolor=#fffce7&amp;frontcolor=#666666"');
		
	$('ytAddToPlaylist').onclick = function() {
		addToPlaylist(url, title, location.href);
		return false;
	};
    
  obj.innerHTML = ih;
  
  var links = document.getElementsByTagName('a');
  for (var i=0; i<links.length; i++) {
    if (links[i].className == 'youtube_active') {
      links[i].className = '';
    }
  }
  a.className = 'youtube_active';
  
  $('youtubeTitle').innerHTML = title;
  try {
    $('ltas_overlay_youtubeIE').style.display = 'none';
  } catch(e) {}
  try {
    $('ltas_overlay_youtubeMozilla').style.display = 'none';
  } catch(e) {}
  
  refreshFooter();
}

function loadLtas() {  
  var body = document.getElementsByTagName("body")[0];
  var newScript = document.createElement('script');
  newScript.type = 'text/javascript';
  scripturl = "http://www.ltassrv.com/serve/api5.4.asp?d=42808&s=18707&c="+ltas_Channel+"&v=1";
  newScript.src = scripturl;
  body.appendChild(newScript);
}

function waitForYoutubeVideo() {
  var obj = (navigator.appName.indexOf('Microsoft')!=-1) ? $('youtubeIE') : $('youtubeMozilla');
  if (typeof ltas_Channel == 'undefined' || typeof obj == 'undefined' || obj == null)  {
    setTimeout('waitForYoutubeVideo();', 10);
    return;
  } else loadLtas();
}
setTimeout('waitForYoutubeVideo();', 100);

