/* Video Player Object */

// instantiate object namespace
if( typeof(SNI)=='undefined' ) {
	SNI = {};
}
if( typeof(SNI.MarketPlace)=='undefined' ) {
	SNI.MarketPlace = {};
}
if( typeof(SNI.MarketPlace.Player)=='undefined' ) {
	SNI.MarketPlace.Player = {};
}


SNI.MarketPlace.Player.Configs = {
	FullSize : {
		dimensions : {
			width:'576',
			height:'610'
		},
		flashvars : {
			config: BASE.BaseUrl + "assets/xml/sourced/snap/templates/fooduk-player-fullsize.xml?ver=2",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",
			allowScriptAccess:"always",
			wmode:"transparent"
		}
	},

	FullSizeNoPlaylist : {
		dimensions : {
			width:'576',
			height:'460'
		},
		flashvars : {
			config:"http://images.foodnetwork.com/webfood/fn20/snap-configs/food-player-fullsize-noplaylist.xml",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	RightRail : {
		dimensions : {
			width:'320',
			height:'360'
		},
		flashvars : {
			config:"http://images.foodnetwork.com/webfood/fn20/snap-configs/food-player-rightrail.xml",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	Blog : {
		dimensions : {
			width:'320',
			height:'263'
		},
		flashvars : {
			config:"http://images.foodnetwork.com/webfood/fn20/snap-configs/food-player-blog.xml",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	Lead : {
		dimensions : {
			width:'400',
			height:'300'
		},
		flashvars : {
			config:"http://images.foodnetwork.com/webfood/fn20/snap-configs/food-player-lead.xml",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	DynamicLead : {
		dimensions : {
			width:'365',
			height:'324' /*23px taller than video*/
		},
		flashvars : {
			config:BASE.BaseUrl + "assets/xml/sourced/snap/templates/dynamic_lead.xml?ver=2",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	ProductDetails : {
		dimensions : {
			width:'305',
			height:'277' /*23px taller than video*/
		},
		flashvars : {
			config:"js/snap/xml/templates/product_details.xml",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	},
	
	VideoDetails : {
		dimensions : {
			width:'519',
			height:'406' /*23px taller than video*/
		},
		flashvars : {
			config:BASE.BaseUrl + "assets/xml/sourced/snap/templates/video_details.xml?ver=3",
			channel:'',									// initial channel id to load
			channelurl:'',								// initial channel feed url to load
			videoid:''									// initial video id of channel to play
		},
		params : {
			menu:"false",
			scale:"noscale",
			allowFullScreen:"true",						// this is a flash thing and should be set to true
			allowScriptAccess:"always",					// we want to leave this at true
			wmode:"transparent"
		}
	}
};




// video library version of player
SNI.MarketPlace.Player.FullSize = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.FullSize, channelId, videoId);
};
SNI.MarketPlace.Player.Big = SNI.MarketPlace.Player.FullSize;							// alias
SNI.MarketPlace.Player.VideoLibrary = SNI.MarketPlace.Player.FullSize;				// alias


// single video asset version of player
SNI.MarketPlace.Player.FullSizeNoPlaylist = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.FullSizeNoPlaylist, channelId, videoId);
};
SNI.MarketPlace.Player.VideoAsset = SNI.MarketPlace.Player.FullSizeNoPlaylist;		// alias


// right rail version of player
SNI.MarketPlace.Player.RightRail = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.RightRail, channelId, videoId);
};


// blog version of player (no playlist)
SNI.MarketPlace.Player.Blog = function(divId, channelId, videoId) {
	buildChannelFeedUrlForBlogs = function(chId) {
		return 'http://www.diynetwork.com/diy/channel/xml/0,,' + chId + '-PSA,00.xml';
		//return 'http://www.foodnetwork.com/food/channel/xml/0,,' + chId + ',00.xml';
	};

	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.Blog, channelId, videoId, buildChannelFeedUrlForBlogs);
};


// lead/dynamic-lead version of player
SNI.MarketPlace.Player.Lead = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.Lead, channelId, videoId);
};

// dynamic lead version of player with no playlist
SNI.MarketPlace.Player.DynamicLead = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.DynamicLead, channelId, videoId);
};

// ProductDetails version of player
SNI.MarketPlace.Player.ProductDetails = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.ProductDetails, channelId, videoId);
};


// VideoDetails of player
SNI.MarketPlace.Player.VideoDetails = function(divId, channelId, videoId) {
	return new SNI.Player.SNAP(divId, SNI.MarketPlace.Player.Configs.VideoDetails, channelId, videoId);
};



