function insertPlayer()
{    
    $("#catalogactions").append("<div id=\"flashContainer\"><div id=\"flashPlayer\"></div></div>");                     
    
    var hostname = window.location.host.toString().toLowerCase();
    var pathname = "";
	if (hostname.indexOf("localhost") != -1){
		pathname = "http://" + hostname + "/sonypictures-com";
	}
    else{
		pathname = "http://" + hostname;
	} 

    var playerPath = pathname + "/homevideo/bluray/media/videoPlayer.swf";        
    var channel = getChannel(pathname);

    injectBlurayFlashPlayer(playerPath, channel);       
}

function injectBlurayFlashPlayer(playerPath, channel)
{
   var so = new SWFObject(playerPath, "main", "480", "270", "9", "#FFFFFF");
   var url = window.location.href;
   //"../media" for catalog pages, else "media"
   if(url.indexOf("/homevideo/bluray/catalog") != -1)
      var base = "../media";
   else
      var base = "media";      
   so.addParam("base", base); 
   if (channel != null){
   	   so.addVariable("feed", channel);
   }
   so.addVariable("channel", s.channel);
   so.addVariable("prop3", s.prop3);
   so.addVariable("prop4", s.prop4);
   so.addVariable("prop5", s.prop5);    
   so.write("flashPlayer");
}

function getChannel(pathname)
{
	
    if ($("#videofeed").length > 0){
		if(jQuery.browser["msie"]){
			return $("#videofeed").attr("href");
		}
		else{
			return pathname + $("#videofeed").attr("href");	
		}
		
	}
        
    
    return null; // not found
}
