$(document).ready(function(){
	jako();
	przy();
});
/*
function arom() {
	$("#arom").animate({marginLeft: "630px" }, 7000,function () { $("#doda").animate( {opacity: 1 }, 3000 ) });
}

function trad() {
	$("#trad").animate({marginLeft: "150px" }, 7000,function () {  });
}

function doda() {
	$("#doda").animate({marginTop: "30px", opacity: 1 }, 4000,function () {  });
}

function przy() {
	$("#przy").animate({marginTop: "20px", marginLeft: "728px" }, 4000,function () {  });
}

function jako() {
	$("#jako").animate({ opacity: 1 }, 2000, function() { doda(); $("#jako").animate({marginLeft: "100px"}, 3000, function() { $("#jako").animate( {opacity: 0}, 2000, function() { $("#jako").css('marginLeft', "0px").animate( {opacity: 1}, 3000, function() { $("#doda").animate( { opacity: 0.1 }, 3000, function() { arom(); trad(); } ) }) }) }) });
}
*/

function arom() {
	$("#arom").animate({opacity: 1}, 4000,function () { $("#doda").animate( {opacity: 0 }, 5000, function() { jako(); przy(); $("#arom").animate({opacity: 0}, 5000); $("#trad").animate({opacity: 0}, 5000);  } ) });
}

function trad() {
	$("#trad").animate({opacity: 1}, 5000,function () { arom(); });
}

function doda() {
	$("#doda").animate({ opacity: 1 }, 4000,function () {  });
}

function przy() {
	$("#przy").animate({ opacity: 1 }, 5000,function () {  });
}

function jako() {
	$("#jako").animate({ opacity: 1 }, 4000, function() { doda(); $("#jako").animate( {opacity: 0}, 4000, function() { trad(); $('#przy').animate({ opacity: 0}, 4000) }) });
}
$(document).ready( function() {
	if(menu == 0) {
		$(".menu242").mouseenter(function() {
			if ($('#a242').css('display') == 'none') {
				$('.submenu').css("height", (document.getElementById('a242').childNodes.length-2)*22 + 10);
				$('#a242').slideDown('normal');
			}
		}).mouseleave(function() {
			if($('#a242').css('display') == 'block')
				$('#a242').slideUp('normal');
		});
		$(".menu241").mouseenter(function() {
			if ($('#a241').css('display') == 'none') {
				$('.submenu').css("height", (document.getElementById('a241').childNodes.length-2)*22 + 10);
				$('#a241').slideDown('normal');
			}
		}).mouseleave(function() {
			if($('#a241').css('display') == 'block')
				$('#a241').slideUp('normal');
		});
		$(".menu243").mouseenter(function() {
			if ($('#a243').css('display') == 'none') {
				$('.submenu').css("height", (document.getElementById('a243').childNodes.length-2)*22 + 10);
				$('#a243').slideDown('normal');
			}
		}).mouseleave(function() {
			if($('#a243').css('display') == 'block')
				$('#a243').slideUp('normal');
		});
		$(".menu244").mouseenter(function() {
			if ($('#a244').css('display') == 'none') {
				$('.submenu').css("height", (document.getElementById('a244').childNodes.length-2)*22 + 10);
				$('#a244').slideDown('normal');
			}
		}).mouseleave(function() {
			if($('#a244').css('display') == 'block')
				$('#a244').slideUp('normal');
		});
	} else {
		$(".menu242").click(function() {
			if ($('#a242').css('display') == 'none') {
				$('#a242').slideDown('normal', function() {
					this.style.position = "relative";
					this.style.height = (document.getElementById('a242').childNodes.length - 1) * 22 + 10 + "px";
				});
			}
			else 
				$('#a242').slideUp('normal');
		});
		$(".menu241").click(function() {
			if($('#a241').css('display') == 'none')
				$('#a241').slideDown('normal', function() {
					this.style.position = "relative";
					this.style.height = (document.getElementById('a241').childNodes.length - 1) * 22 + 10 + "px";
				});
			else 
				$('#a241').slideUp('normal');
		});
		$(".menu243").click(function() {
			if($('#a243').css('display') == 'none')
				$('#a243').slideDown('normal', function() {
					this.style.position = "relative";
					this.style.height = (document.getElementById('a243').childNodes.length - 1) * 22 + 10 + "px";
				});
			else 
				$('#a243').slideUp('normal');
		});
		$(".menu244").click(function() {
			if($('#a244').css('display') == 'none')
				$('#a244').slideDown('normal', function() {
					this.style.position = "relative";
					this.style.height = (document.getElementById('a244').childNodes.length - 1) * 22 + 10 + "px";
				});
			else 
				$('#a244').slideUp('normal');
		});
	}
		
		if($('#content').length && $('#content')[0].clientHeight < 630) {
			$('#content').css("height", 630 + "px");
		}
		if($(".art").length && $(".art").length>1) {
			var art = $(".art");
			var maxheight = 0;

			jQuery.each(art, function(e) {
				var height = $('#content')[0].clientHeight;
				if($('.naglowek').length != 0) {
					height -= 230;
				}
				if($('#logatable').length != 0) {
					height -= 585;
				}
				if(height > maxheight)
					maxheight = height;
			});
			jQuery.each(art, function(e) {
				//if($(art[e]).html() == '&nbsp;') {
				if($(".aktualnosciBox").length == 0) {
					art[e].style.height = maxheight + 4 + "px";
					art[e].style.marginTop = "-5px";
				}
			});
		}

		
});

function changeDescription(logo, text) {
	$('#logomain')[0].innerHTML = '<img src="loga/'+logo+'.jpg" />';
	$('#logodesc')[0].innerHTML = text;
	$(".logooferta").css("background", "#ffffff").css("padding", "5px 0px 5px 0px");
}
