function gwarSet() {
	jQuery(".gwarList").each(function(i) {
		var boxHeight = 0;
		var ul = jQuery(this).find("ul");
		var li = jQuery(this).find("ul").find("li");

		ul.show();
		ul.width(225 * li.length);
		li.each(function(j) {
			if(jQuery(this).height() > boxHeight) {
				boxHeight = jQuery(this).height();
			}
		});

		jQuery(this).height(boxHeight);
	});
}

function loadNums() {
	var nums = new Array();
	for(i=0; i<8; i++) {
		nums[i] = new Image();
		nums[i].src = "/images/microsites/lotos_quazar/gwar_"+ (i+1) +".gif";
	}
}
loadNums();


jQuery(document).ready(function(){
	jQuery("#formButtonDane").click(function(event) {
		jQuery("#formDane").show();
		jQuery(this).hide();
		return false;
	});


	jQuery(".gwarNext").click(function(){
		var ul = jQuery(this).parent().next().find("ul");
		var img = jQuery(this).parent().find("img");
		var num = parseInt(img.attr("alt"));

		if(!jQuery(this).hasClass("disabled")) {
			ul.animate({left: "-=225px"}, 400);
			jQuery(this).parent().find(".gwarPrev").removeClass("disabled");
			num++;
			img.attr("src", "/images/microsites/lotos_quazar/gwar_" + num + ".gif");
			img.attr("alt", num);
		}

		if(num >= (ul.width()/225)) {
			jQuery(this).addClass("disabled");
		}

		return false;
	});

	jQuery(".gwarPrev").click(function(){
		var ul = jQuery(this).parent().next().find("ul");
		var img = jQuery(this).parent().find("img");
		var num = parseInt(img.attr("alt"));

		if(!jQuery(this).hasClass("disabled")) {
			ul.animate({left: "+=225px"}, 400);
			jQuery(this).parent().find(".gwarNext").removeClass("disabled");
			num--;
			img.attr("src", "/images/microsites/lotos_quazar/gwar_" + num + ".gif");
			img.attr("alt", num);
		}

		if(num <= 1) {
			jQuery(this).addClass("disabled");
		}

		return false;
	});

	gwarSet();

	jQuery(".formula tr").mouseenter(function(){
		jQuery(this).addClass("hover");
	});
	jQuery(".formula tr").mouseleave(function(){
		jQuery(this).removeClass("hover");
	});

	document.title = 'LOTOS Quazar'; // bo ie to syf nad syfy

	// nawigacja w mapach
	jQuery('#aOpt1 input').click(function(e)
	{
		window.location = '../gdzie_kupisz';
	});
	jQuery('#aOpt3 input').click(function(e)
	{
		window.location = 'map/inz_sieci';
	});
});
