var modalElm = null;

jQuery(function ($) {
	var intro = {
		init: function () {
  		$('#container_holder').modal({
  		  overlayClose: true,
				onOpen: intro.open,
				onClose: intro.close
  		});
		},
		open: function (d) {
		  modalElm = d;
			d.overlay.fadeIn('slow', function () {
				d.container.fadeIn(200, function () {
					d.data.css('width','960px').css('height','540px').css('overflow','visible').fadeIn(200);
					jwplayer().play();
				});
			});
		},
		close: function (d) {
			modalClose(d);
		}
	};
	intro.init();
});

function modalClose(d) {
	d.data.fadeOut(200, function () {
		d.container.fadeOut(200, function () {
			d.overlay.fadeOut(200, function () {
			  d.data.css('width','0px').css('height','0px').css('overflow','hidden');
			  jwplayer().stop();
				$.modal.close();
			});
		});
	});
}
