function sayYes(){
	jQuery.cookie("startflash_cookie", 1, {path: "/"});
	$("body #startFlash").hide();
	window.location.href='http://mazda3.ru/mazdasportcup/';
}
function sayNo(){
	jQuery.cookie("startflash_cookie", 1, {path: "/"});
	$("body #startFlash").hide();
	window.location.href='http://mazda3.ru/board/index.php?showforum=230';
}
function killPopup(){
$("body #startFlash").hide();
$("body #startFlash").children().remove();
$("body #shtorka").remove();
$("body #exit").remove();
$("body #startFlash").remove();
}
function initStartFlash(){
		$("body").append('<div id="startFlash"></div>');
		$("body").append('<div id="shtorka"></div>');
		$("body #startFlash").append('<div id="dw" align="center"><div id="inner"></div></div>');
		var body_height=$(window).height();
		$("body #shtorka").css({height:body_height,"z-index":300});
		$("body #shtorka").fadeTo(0,0.7);
		$("body #startFlash #dw").css({"z-index":301});
		$("body #startFlash #dw").animate({width:'600px',height:'450px',marginTop:'-225px',marginLeft:'-300px'},300);    
		setTimeout(function(){
		$("body #startFlash #dw #inner").hide();
		$("body #startFlash #dw #inner").html('<img src="http://webadminka.ru/partners/mazda3ru/afisha/mazda.sport.cup.banner.jpg" width="600" height="450" /><br /><br /><div class="noFlashText">Хочу стать участником!<br /><br /><button onclick="sayYes()">ДА</button>&nbsp;&nbsp;&nbsp;<button onclick="sayNo()">НЕТ</button></div>');
		setTimeout(function(){
							jQuery.cookie("startflash_cookie", 1, {path: "/"});
							$("body #startFlash #dw #inner").flash("/images/startflash/msc_banner_8c.swf", {width:600, height:450, flashvars:{}, paremeters:{} });
							$("body #startFlash").append('<a href="javascript:void(0);" id="exit";><img src="/images/startflash/exit.png" border="0" /></a>');
							$("body #startFlash #exit").click(function(){
							$("body #startFlash #inner").hide();$("body #startFlash #dw").animate({width:'0',height:'0',marginTop:'0',marginLeft:'0'},300);$("body #shtorka").fadeTo(300,0);
							  setTimeout(function(){killPopup();},50);
							});
							$("body #startFlash #dw #inner").show();
							$("#exit").css({"z-index":99999});
							},50);
		},300);		
}
$(document).ready(function(){
	var getCookie = jQuery.cookie("startflash_cookie");
	if(!getCookie AND navigator.cookieEnabled)
	{
		if(!$.browser.msie)
		{
			initStartFlash();
		}
		else
		{
			if(jQuery.browser.version.substr(0,1)!=6)
			{
				initStartFlash();
			}
		}
	}
});




