jQuery(document).ready(function(){
	var link = jQuery('.menu a[href="/#"], .popup');
	link.click(function(){
		var overlay = jQuery('<div>',{
			'class' : 'overlay',
			'style' : 'display:none;'
		});
		var flash = jQuery('<div>',{
			'class' : 'flashblock'
		});
		var fHold = jQuery('<div>',{
			'class' : 'flashholder'
		});
		var fContent = jQuery('<div>',{
			'id' : 'flashContent'
		});
		var closebutton = jQuery('<a>',{
			'class' : 'closebutton',
			'href' : '#'
		});
		jQuery('body').prepend(overlay);
		overlay.fadeIn('normal',function(){
			jQuery(this).after(flash);
			var top = jQuery(window).scrollTop();
			var h = jQuery(window).height() / 2;
			var h2 = 300;
			var mt = top+h-h2;
			flash.css('margin-top',mt+'px')
			flash.append(fHold);
			fHold.append(fContent)
			flash.prepend(closebutton);
			var hasFlash = swfobject.hasFlashPlayerVersion('10.0.0');
				var flashvars = {
					group_id:"1",
					xml_folder:"http://partner.caesarstyle.ru/goods/flash/",
					api_url:"/goods/flash/send.php"
				};
				var params = {};
				var attributes = {};
				var path = "http://partner.caesarstyle.ru/goods/flash/";
				swfobject.embedSWF(
					path + "caesar.swf",
					"flashContent",
					"800",
					"600",
					"10.0.0",
					path + "scripts/expressInstall.swf",
					flashvars,
					params,
					attributes
				);
		});
		return false;
	});
	jQuery('.closebutton').live('click',function(){
		jQuery('.flashholder').remove();
		jQuery('.flashblock, .overlay, .closebutton').fadeOut('normal',function(){
			jQuery(this).remove();
		});
		return false;
	});
})
