/**
 * @author Vlad Yakovlev (red.scorpix@gmail.com)
 * @link www.scorpix.ru
 * @requires jQuery
 * @requires jCommon
 * @version 0.1
 * @date 2010-04-01
 */
$(function() {
	var
		width = 696,
		height = 390,
		rootEl = $('#header .video');

	if (!rootEl.length) return;

	rootEl.find('img').click(function() {
		var
			id = 'id' + Math.round(Math.random() * 10000),
			template = '<div class="home_video"><div class="fader"></div><div class="video"><div id="' + id + '"></div><ins class="circle png"></ins><span class="close"><span class="pseudo">' + rootEl.find('.close').text() + '</span></span></div></div>',
			el = $(template);

		el.appendTo('body');
		el.find('.video').css({
			height: height,
			marginLeft: -Math.round(width / 2),
			marginTop: -Math.round(height / 2),
			width: width
		});
		el.find('.fader, .circle, .close').click(function() {
			el.remove();
		});

		swfobject.embedSWF('/f/global/media/uflvplayer.swf', id, width, height, '10.0.0', null, {
			way: '/f/home/yoga.flv',
			swf: '/f/global/media/uflvplayer.swf',
			w: 400,
			h: 300,
			autoplay: 1,
			replay: 1,
			tools: 0,
			skin: 'white',
			volume: 30,
			q: 1
		}, {
			bgcolor: '#ffffff',
			wmode: 'opaque',
			allowFullScreen: 'true',
			allowScriptAccess: 'always',
			movie: '/f/global/media/uflvplayer.swf'
		}, {});
	});
});
