/*
	Autor: Grzegorz Jaworek
	E-mail: grzegorz.jaworek@gmail.com
	www: http://gjaworek.pl 
	Tel.: +48 696 818 300
*/

jQuery(document).ready(function(){
	jQuery('.totop').click(function () {
		scroll(0,0);
		return false;
	});
	
	jQuery('#slideshow').after('<a href="#prev" id="slideshow-prev" /><a href="#next" id="slideshow-next" />').cycle({ 
		fx:     'scrollHorz', 
		speed:  1000, 
		timeout: 0, 
		prev:  '#slideshow-prev', 
		next:  '#slideshow-next'
	});
	
	home = jQuery('.home').height()-jQuery('#lead').height()-80;
	jQuery('.home .sponsor, .home .news, .home .photos').each(function () {
		jQuery(this).height(home);
	});
	
	jQuery('.page-item-2').each(function () {
		if (jQuery(this).hasClass('current_page_item')) {
			jQuery(this).addClass('current_page_parent');
		};
	});
	
	jQuery(".simpleimage img, .thumb img").animate({opacity: 1});
	jQuery('.simpleimage a img, .thumb img').mouseover(function () { jQuery(this).animate({ opacity: .5 }, 200); });
	jQuery('.simpleimage a img, .thumb img').mouseout(function () { jQuery(this).animate({ opacity: 1 }, 200); });
	
	jQuery('#menu > li > ul').not('#menu > li.current_page_parent > ul').hide();
	jQuery('#menu > li').not('#menu > li.current_page_parent').hoverIntent(hoverIn,hoverOut);
	
	jQuery('.toggle p').hide();
	jQuery('.toggle').hoverIntent(toggleIn,toggleOut);
	
	jQuery('font').remove();
});

function hoverIn(){ jQuery(this).children('ul').animate({height: 'toggle'}, 400);}
function hoverOut(){ jQuery(this).children('ul').animate({height: 'toggle'}, 400);}
function toggleIn(){ jQuery(this).children('p').animate({height: 'toggle'}, 400);}
function toggleOut(){ jQuery(this).children('p').animate({height: 'toggle'}, 400);}
