function changeVid(url){
loadSWF(url, 'vidpreview')


}

//Support function: checks to see if target
//element is an object or embed element

function isObject(targetID){

   var isFound = false;
   var el = document.getElementById(targetID);
   if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
   
      isFound = true;
   
   }
   
   return isFound;
}

//Support function: creates an empty
//element to replace embedded SWF object

function replaceSwfWithEmptyDiv(targetID){
	//$(targetID).style.display='none';
	//$('vidpreviewloading').style.display='block';

   var el = document.getElementById(targetID);
   
   if(el){
   
      var div = document.createElement("div");
      el.parentNode.insertBefore(div, el);
 
      //Remove the SWF
      swfobject.removeSWF(targetID);
   
      //Give the new DIV the old element's ID
      div.setAttribute("id", targetID);
      
   }
   
}


function loadSWF(url, targetID){
	

   //Check for existing SWF
   if(isObject(targetID)){
	
      //replace object/element with a new div
      replaceSwfWithEmptyDiv(targetID);
	  }
		 
		
     
   //Embed SWF
   if (swfobject.hasFlashPlayerVersion("7")) {
 
      var attributes = { data: url, width:"240", height:"185" };
      var params = {};
      var obj = swfobject.createSWF(attributes, params, targetID);
   
   }
   

   
}
function loadSWF2(url, targetID,w,h){
	

   //Check for existing SWF
   if(isObject(targetID)){
	
      //replace object/element with a new div
      replaceSwfWithEmptyDiv(targetID);
	  }
		 
		
     
   //Embed SWF
   if (swfobject.hasFlashPlayerVersion("7")) {
   
      var attributes = { data: url, width:w, height:h };
      var params = {};
      var obj = swfobject.createSWF(attributes, params, targetID);
   
   }
   

   
}
