Cufon.replace('.cufonSwiss, .headerTopNavi, .mainMenu li, .button',{fontFamily: 'Swis721 Win95BT', fontWeight: '700'});
Cufon.replace('.cufonHelvetica',{fontFamily: 'HelveticaNeue LT 65 Medium', fontWeight: '400'});
Cufon.replace('.cufonMyriad, .textContent h1, .textContent h2, .message-header',{fontFamily: 'Myriad Pro', fontWeight: '300'});
Cufon.replace('.cufonMyriadBold, .bannerClaim span strong',{fontFamily: 'Myriad Pro', fontWeight: '700'});
Cufon.replace('.bannerClaim span',{fontFamily: 'Nebraska', fontWeight: '400'});

var t;
var s;

function swapRightDetail() {
	var cur = $("#bgDetailRight .active");
	var nxt = $(cur).next();
	if(nxt.length == 0) nxt = $("#bgDetailRight img").first();
	//alert(nxt);

	$(cur).fadeOut(1500,function(){$(this).removeClass("active");});
	$(nxt).fadeIn(1500,function(){$(this).addClass("active");});
	s = setTimeout("swapRightDetail()", 10000);
}

function smoothClaim() {

	$(".bannerClaimMask").animate({
		left: "320px"
	}, 1800, "swing", function(){
		$(this).css({left: "-300px"});
		swapRightDetail();
	});
	t = setTimeout("smoothClaim()", 10000);

}

function blink(obj) {
	obj.fadeOut(60,function(){
		obj.fadeIn(60,function(){blink(obj.next());});
	});
}

function animateBanner(){
	$(".bannerTriangleLeft").animate({
		top: 0
	},700,"swing");

	$(".bannerTriangleRight").animate({
		bottom: 0
	},700,"swing");

	$(".bannerStripeBg").animate(
		{width: "563px"},
		1200,
		"swing",
		function(){
			$(this).animate({
				height: "80px"
			},500,"swing",function(){
				$(".bannerArrow").fadeIn("500");
				$(".bannerClaim").fadeIn("500",function(){
					swapRightDetail();
				});
			});
		}
	);

	//smoothClaim();
	
}

$(document).ready(function (){

	$(".mainMenu a, .subMenuItem a").hover(function(){
		$(this).parent().addClass("hover");
	}, function(){
		$(this).parent().removeClass("hover");
	} );

	$(".formRow .input").hover(function(){
		$(this).addClass("hover");
	}, function(){
		$(this).removeClass("hover");
	} );


	$(".formRow input[type='text'], .formRow textarea").focus(function(){
		var $label = $(this).parent().find("label");
		var left = $(this).parent().width() - $label.outerWidth();

		$label.animate({
			left: left+"px",
			opacity: 0.5
		},500,"linear");
	});

	$(".formRow input[type='text'], .formRow textarea").blur(function(){
		if($(this).val() == "") {
			var $label = $(this).parent().find("label");
			
			$label.animate({
				left: "0px",
				opacity: 1
			},500,"linear");
		}
	});


	$("a[rel='colorbox']").colorbox({
		current: "Zdjęcie {current} z {total}"
	});

	$(".msBoxImage .msBoxSprite, .msBoxImage .button").hover(function(){
		$(this).parent().find(".msBoxSprite").css({backgroundPosition: "0px -130px"});
	}, function(){
		$(this).parent().find(".msBoxSprite").css({backgroundPosition: "0px 0px"});
	});

});

$(window).load(function(){
	animateBanner();
});

