$(document).ready(function(){ 
	$("ul.sf-menu").superfish({ 
		delay:     1200 ,
		autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
		dropShadows:   false,               // completely disable drop shadows by setting this to false 
		disableHI:     false 				// 1.2 second delay on mouseout 
	}); 
	
	$('.slideshow').cycle({
		fx: 'fade',
		timeout: 5000
	});

	
	var arrDown = true;
	var elemh = $('#wrap1').height() + 20 - $(window).height();
	$('#arrow').click(function(e) {
		e.preventDefault();
		if (arrDown) {
			//na dol
			$('html, body').stop().animate({scrollTop: elemh}, 800);
			$(this).css('background-image','url(images/arrow2.png)');
			arrDown = false;
		} else {
			//do gory
			$('html, body').stop().animate({scrollTop: '0px'}, 800);
			$(this).css('background-image','url(images/arrow.png)');
			arrDown = true;
		}
	});
	
	var scrollPosition = $(window).height()/2 + $(window).scrollTop(); 
	$('#arrow').css('top', scrollPosition);
	
	$(window).scroll(function () { 
		var scrollPosition = $(window).height()/2 + $(window).scrollTop(); 
		$('#arrow').css('top', scrollPosition);
	});
	
	$(window).resize(function() {
		var scrollPosition = $(window).height()/2 + $(window).scrollTop(); 
		$('#arrow').css('top', scrollPosition);
		elemh = $('#wrap1').height() + 20 - $(window).height();
	});
	
	$(document).everyTime(1600, function () {
		$("#arrow").fadeTo(800, 0.33).fadeTo(760, 1);
	});
}); 
