(function($) {

	Namespace('MFMedia', {
		'readyVideo': false,
		
		'main': function() {
			$('#imgembed').html('<img src="'+MFMediaSettings.templateUrl+'/flash/bg-video.jpg" width="5px" height="5px" />');
			MFMedia.BackgroundVideo.init('videoembed');
			MFMedia.ResizeManager.init(function() {
				$('#bgvideo').css('height', $('body').height() - 400);
				$('#imgembed').find('img').css('top', $('#bgvideo').height()/2);
			});
			
			MFMedia.BackgroundVideo.isloaded();
			
			$('#videoembed').css('display', 'none');
			
			$('#imgembed').find('img').animate({width : "50%", paddingLeft : '25%'}, 3000, null, function() { 
				$('#imgembed').find('img').animate({height: ($('body').height() - 400), 'top' : '0'}, 3000, null, function() {
					MFMedia.readyVideo = true;
					$('#videocontainer').css({'width' : '50%', 'height' : '100%', paddingLeft: '25%'});
					MFMedia.BackgroundVideo.play();
					
				});
			});
		},
		
		'makeContentAutofit': function(content)
		{
			MFMedia.ResizeManager.addHandler(function() {
				content.css('height', content.parent().height() 
						- parseInt(content.css('padding-top'))
						- parseInt(content.css('padding-bottom')));
			});
		}
	});

})(jQuery);

jQuery(document).ready(MFMedia.main);

