$(document).ready(function(){

//
// hover effect for buttons in superbox (left column of superbox)
//			
	$('input.button').hover(function() {
			$(this).css('background-position','-84px');
		},
		function() {
			$(this).css('background-position','0px');
		}
	);


//
// hover effect for scroll buttons (right column of superbox)
//
	$('.scroll img').hover(function() {
			$(this).css('margin-left','-20px');
		},
		function() {
			$(this).css('margin-left','0px');
		}
	);


//
// animate hover effect for shortcuts in superbox (slid-up mode)
//
	$(".skroty a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-32"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-45"}, "fast");
	});


//
// fade out effect for timetable in superbox
//
	$('#min .minutes-tips')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:250})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})
		
	//full time table on subpage	
	$('#min-full .minutes-tips')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:250})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})

//
// Main menu drop down
//
		$('#menu .sub').hover(function() {
			$(this).addClass('drop');
			return false;
		},
		function() {
			$(this).removeClass('drop');
		});


//
// hover effect for main menu
//
	//first
	$('.mainmenu-container .main-menu ul li.first').hover(function() {
			$(this).css('background','#C4C4C4 url(fileadmin/templates/main/img/bckg-menu-left-2.gif) no-repeat 0px -42px');
		},
		function() {
			$(this).css('background','url(fileadmin/templates/main/img/bckg-menu-left-2.gif) no-repeat 0px -1px');
		}
	);
	
	//last
	$('.mainmenu-container .main-menu ul li#last').hover(function() {
			$(this).css('background','#C4C4C4 url(fileadmin/templates/main/img/bckg-menu-right.gif) no-repeat right -42px');
			$(this).css('height','40px');
		},
		function() {
			$(this).css('background','url(fileadmin/templates/main/img/bckg-menu-right.gif) no-repeat right -1px');
		}
	);
	
	//sub
	$('.mainmenu-container .main-menu ul li.sub').hover(function() {
			$(this).css('height','40px');
		},
		function() {
			$(this).css('height','39px');
		}
	);
	
	//if no sub
	$('.mainmenu-container .main-menu ul li.mapa-trasy').hover(function() {
			$(this).css('background-color','#C4C4C4');
			$(this).css('background-image','none');
		},
		function() {
			$(this).css('background','transparent');
		}
	);
	//if no sub
	$('.mainmenu-container .main-menu ul li.przetargi').hover(function() {
			$(this).css('background-color','#C4C4C4');
			$(this).css('background-image','none');
		},
		function() {
			$(this).css('background','transparent');
		}
	);


//
// IE6 background flicker bug fixed
//
	//-- for IE6 but not IE7, Moz, Safari, Opera...
	if (typeof document.body.style.maxHeight == "undefined") {
		try {
			document.execCommand('BackgroundImageCache', false, true);
		} catch(e) { /* unless it's not IE6... */ }
	} 
	// end if



//
// show/hide importing route form
//
	$("#click-import").click(function(event) {
		event.preventDefault();
		$(".import-form").slideToggle();
	});

	$(".import-form #close-form").click(function(event) {
		event.preventDefault();
		$(".import-form").slideUp();
	});


//
// ticker
//
	//entire click
	$("#hideme .text").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});
	//hover
	$('#hideme').hover(function() {
			$(this).css('background-color','#FBE3E3');
			$(this).css('cursor','pointer');
		},
		function() {
			$(this).css('background-color','#FDF4F7');
		}
	);
	//hover (close button)
	$('.close-ticker').hover(function() {
			$(this).css('color','#FF1000');
		},
		function() {
			$(this).css('color','#F2CACB');
		}
	);
	//close ticker
	$("#hideme .close-ticker").click(function(){
	  $("#hideme").animate({ opacity: "hide" }, "slow");
	  $.cookie("ticker", "closed", {expires: 1 });
	});
	
	// COOKIES
    var ticker = $.cookie('ticker');
    if (ticker == 'closed') {
        $('#hideme').css("display","none");
    };




});