
/**
 * @requires FlvPlayerProxy.js
 */
var VideoPlayer = (function(window, document, $, bam) {


	

    return new FlvPlayerProxy({
        containerId : "video_player",
        elemId : "milbFlvPlayer",
        width : 640,
        height : 360,
        debugMode : false,
        autoHideSkin : true,
        skin : "/flash/video/y2010/mlb_vpp2010.swf",
        config : function() {},		
		// auditude default companion ad override
		showDefaultCompanionAd : function() {				
			if(~document.location.search.indexOf("debug")) console.log("showDefaultCompanionAd", arguments);	
			$("#videoCompanionAd").dcRefreshableAd({interval:120}); 		
        },
        showCompanionAd : function() {
		
			
			if(~document.location.search.indexOf("debug")) console.log("showCompanionAd", arguments);
		
            var companionAds, ad,
                adContainerID = "videoCompanionAd";            
			
            if (arguments.length > 0) {

			
				$("#videoCompanionAd").dcRefreshableAd('destroy');
                companionAds = Array.prototype.slice.call(arguments[0]);

                if (companionAds.length > 0) {
                    $.each(companionAds, function(i, companionAd) {
                        var tagName = (companionAd.type === "iframe") ? "iframe" : "div",
                            ad = $("<" + tagName + " />", {
                                height : parseInt(companionAd.height, 10),
                                width : parseInt(companionAd.width, 10)    
                            });

                        if (companionAd.type === "iframe") {
                            ad.attr("src", companionAd.data)
                              .attr("marginwidth", "0")
                              .attr("marginheight", "0")
                              .attr("frameborder", "0")
                              .attr("scrolling", "no");
                        } else {
                            ad.html(companionAd.data);
                        }
                        
                        if (companionAds.length > 1) {
                            ad.appendTo("#" + adContainerID);
                        } else {
                            $("#" + adContainerID).empty().append(ad);
                        }
                        
                    });
                }
            }
        }
    });

})(this, this.document, this.$, this.bam);


