jQuery(function($) {
	$(".wallpaper a").click(function() {
		var index = $(this).parent().index(".wallpaper ul li");
		var date = new Date();
		date.setDate(date.getDate()+30);
		document.cookie = "bgtype="+index+";path=/;expires="+date+";";
		if (index == 0)
			$("body").css({ "background": "url('') no-repeat 0 0 #fff" });
		else if (index == 1)
			$("body").css({ "background": "url(/images/bg_wallpaper8.jpg) repeat-y 50% 0 #fff" });
		else if (index == 2)
			$("body").css({ "background": "url('') no-repeat 0 0 #cdcdcd" });
		else if (index == 3)
			$("body").css({ "background": "url('') no-repeat 0 0 #d0e705" });
		else if (index == 4)
			$("body").css({ "background": "url('') no-repeat 0 0 #000000" });
		else if (index == 5)
			$("body").css({ "background": "url('') no-repeat 0 0 #fb0086" });
		else if (index == 6)
			$("body").css({ "background": "url('') no-repeat 0 0 #f0453d" });
		else if (index == 7)
			$("body").css({ "background": "url('') no-repeat 0 0 orange" });
		else if (index == 8)
			$("body").css({ "background": "url('') no-repeat 0 0 green" });
		else
			$("body").css({ "background": "url('') no-repeat 0 0 #fff" });
		return false;
	});
	
	var bgtype = $.cookie("bgtype");
	
	if (bgtype == 0)
		$("body").css({ "background": "url('') no-repeat 0 0 #ffffff" });
	else if (bgtype == 1)
		$("body").css({ "background": "url(/images/bg_wallpaper8.jpg) repeat-y 50% 0 #fff" });
	else if (bgtype == 2)
		$("body").css({ "background": "url('') no-repeat 0 0 #cdcdcd" });
	else if (bgtype == 3)
		$("body").css({ "background": "url('') no-repeat 0 0 #d0e705" });
	else if (bgtype == 4)
		$("body").css({ "background": "url('') no-repeat 0 0 #000000" });
	else if (bgtype == 5)
		$("body").css({ "background": "url('') no-repeat 0 0 #fb0086" });
	else if (bgtype == 6)
		$("body").css({ "background": "url('') no-repeat 0 0 #f0453d" });
	else if (bgtype == 7)
		$("body").css({ "background": "url('') no-repeat 0 0 orange" });
	else if (bgtype == 8)
		$("body").css({ "background": "url('') no-repeat 0 0 green" });
	else
		$("body").css({ "background": "url(/images/bg_wallpaper8.jpg) repeat-y 50% 0 #fff" });

	var bannersTop = $(".banners").css("top");
	$(window).scroll(function() {
		$(".banners").animate({ top: parseInt(bannersTop)+$(this).scrollTop() }, { easing: 'easeOutQuint', queue: false, duration: 1000 });
	});
	$(".banners .top").click(function() { $(window).scrollTop(0); return false;});
});
