// JavaScript Document



function videoSwap(theVideo){
	
var theobject3 = '<tre>';
var object1 = '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="320" height="264"><param name="movie" value="player.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="file=video/begin_test.mov&image=video/begin_test.jpg" /><embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf" width="320" height="264" allowscriptaccess="always" allowfullscreen="true" flashvars="file=video/begin_test.mov&image=video/begin_test.jpg"/></object>';

var object2 = '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="320" height="264"><param name="movie" value="player.swf" /><param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="flashvars" value="file=video/testing_500.mov&image=video/testing_500.jpg" /> <embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf"  width="320"  height="264" allowscriptaccess="always"  allowfullscreen="true" flashvars="file=video/testing_500.mov&image=video/testing_500.jpg" /></object>';

if (theVideo == 1){
	//alert("1 is true");	
	clearContent(document.getElementById("videoPlayerDiv"));
	addHTML("videoPlayerDiv", object1, "1");
}
if (theVideo == 2){
	//alert("2 is true");	
	clearContent(document.getElementById("videoPlayerDiv"));
	addHTML("videoPlayerDiv", object2, "1");
}

}




function videoSwap2(theVideo){
	
var theobject3 = '<tre>';
var object1 = '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="320" height="264"><param name="movie" value="player.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="file=video/valvetest1.mov&image=video/valvetest1.jpg" /><embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf" width="320" height="264" allowscriptaccess="always" allowfullscreen="true" flashvars="file=video/valvetest1.mov&image=video/valvetest1.jpg"/></object>';

var object2 = '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="320" height="264"><param name="movie" value="player.swf" /><param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="flashvars" value="file=video/valvetest2.mov&image=video/valvetest2.jpg" /> <embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf"  width="320"  height="264" allowscriptaccess="always"  allowfullscreen="true" flashvars="file=video/valvetest2.mov&image=video/valvetest2.jpg" /></object>';

var object3 = '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="320" height="264"><param name="movie" value="player.swf" /><param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="flashvars" value="file=video/valvetest3.mov&image=video/valvetest3.jpg" /> <embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf"  width="320"  height="264" allowscriptaccess="always"  allowfullscreen="true" flashvars="file=video/valvetest3.mov&image=video/valvetest3.jpg" /></object>';

if (theVideo == 1){
	//alert("1 is true");	
	clearContent(document.getElementById("videoPlayerDiv2"));
	addHTML("videoPlayerDiv2", object1, "1");
}
if (theVideo == 2){
	//alert("2 is true");	
	clearContent(document.getElementById("videoPlayerDiv2"));
	addHTML("videoPlayerDiv2", object2, "1");
}
if (theVideo == 3){
	//alert("2 is true");	
	clearContent(document.getElementById("videoPlayerDiv2"));
	addHTML("videoPlayerDiv2", object3, "1");
}

}



	// JP this function clears out the old content in an element
  function clearContent(el) {
	  // first clone the object, without it’s child elements.
	  nEl = el.cloneNode(false);
	  // Pop the new element in before the old one.
	  el.parentNode.insertBefore(nEl,el);
	  // Now get rid of the one that has all that icky content
	  el.parentNode.removeChild(el);
  }
	
  
  function addHTML(el,theContent){
	document.getElementById(el).innerHTML = theContent;
  }