jQuery.wait = function()
{
 var i=0;
 var date = new Date();
 var curDate = null;

	do { curDate = new Date(); }
	while(curDate-date < arguments[i]);
}

jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$.preloadImages("img/menu/bg.jpg", "img/menu/bg_alpha.png");

$.preloadImages("img/menu/start_btn_off.png", "img/menu/start_btn_on.png");
$.preloadImages("img/menu/sprawozdanie_btn_off.png", "img/menu/sprawozdanie_btn_on.png");
$.preloadImages("img/menu/wladze_btn_off.png", "img/menu/wladze_btn_on.png");
$.preloadImages("img/menu/sklad_btn_off.png", "img/menu/sklad_btn_on.png");
$.preloadImages("img/menu/kontakt_btn_on.png", "img/menu/kontakt_btn_off.png");


// window.onload = startleaves();


$(document).ready(function() {
	$('div.expandable p').expander({
		slicePoint: 300, // default is 100
		expandText: ' [ + przeczytaj ]', // default is 'read more...'
		collapseTimer: 0, // re-collapses after 5 seconds; default is 0, so no re-collapsing
		userCollapseText: ' [ - ukryj ]' // default is '[collapse expanded text]'
	});

	$("#slider").easySlider({
		auto: true,
		continuous: true 
	});

	$("#vert_menu li").hover(function(){
		$(this).animate({
			color: "#910000",
			marginLeft: "19px"
		}, 130);
	
	}, function(){
		$(this).animate({
			color: "#999",
			marginLeft: "17px"
		}, 80);
	});

	$("#container a").hover(function(){
		$(this).animate({
			color: "#3f6114"
		}, 500);
	
	}, function(){
		$(this).animate({
			color: "#910000",
		}, 300);
	});

	$(function() {
		//  class="hint" title="Liscie?"
		$('.hint').hoverbox();
	});


	$(function() {
			$("img.rollover").not("img.on").hover(
				function() {
					this.src = this.src.replace("btn_off","btn_on");
					$(this).animate({
						marginTop: "3px"
					}, 150);
					$(this).animate({
						marginTop: "2px"
					}, 200);
				},
				function() {
					this.src = this.src.replace("btn_on","btn_off");
					$(this).animate({
						marginTop: "-2px"
					}, 100);
					$(this).animate({
						marginTop: "0px"
					}, 150);
				}
			);
		}
	);



	$(".banery img, #jubileusz").hover(function(){
		$(this).animate({
			opacity: "1.0"
		}, 250);
	
	}, function(){
		$(this).animate({
			opacity: "0.5"
		}, 250);
	});







});

