

function embedYoutube(containerId, vidId) {
	var embedString = '<object width="320" height="240"><param name="movie" value="http://www.youtube.com/v/'+vidId+'=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+vidId+'=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="320" height="240"></embed></object>';
	var containerObj = document.getElementById(containerId);
	containerObj.innerHTML = embedString;
}

function buildQueryString()
{
	var origUrl = "";
	var newUrl = "";
	var y=false;
	origUrl = document.getElementById("frm_v").value;
	if (origUrl=="") 
		{
		alert ("Please enter a YouTube video page URL");
		return;
		}
		
	if ((origUrl.indexOf("youtube")==-1) || (origUrl.indexOf("watch")==-1))
	{
		alert("Please check the URL. It doesn't seem complete");
		return;
	}
	
	newUrl = origUrl.replace("youtube", "rphunt");
	newUrl = newUrl.replace("watch", "yt.php");

	
	var chkMpg4 = document.getElementById("mpg4").checked;
	if (chkMpg4==true) 
	{
		newUrl = newUrl.replace("&fmt=18","");
		newUrl +="&fmt=18";
	}
	
	document.location.href = newUrl;
}

function submitCancel()
{
	alert ("Please click the \"Create Link\" link");
	return false;	
}

function embedJWPlayer(fileName)
{
    var embedString = '<embed ' 
      +'src="code/player.swf" '
      +'width="300" '
      +'height="20" '
      +'allowscriptaccess="always" '
      +'allowfullscreen="true" '
      +'flashvars="file='+fileName+'&autostart=true" '
    +'/>';	

	document.getElementById("playerHolder").innerHTML=embedString;
}

function embedJWPlayerVid(fileName)
{
    var embedString = '<embed ' 
      +'src="code/player.swf" '
      +'width="320" '
      +'height="240" '
      +'allowscriptaccess="always" '
      +'allowfullscreen="true" '
      +'flashvars="file='+fileName+'&autostart=true" '
    +'/>';	

	document.getElementById("playerHolder").innerHTML=embedString;
}