// JavaScript Document

function moveToPage(pageNo) {
				   
	currentPage = pageNo;
	
	$("#ikony").show().animate({top: -((currentPage-1)*520)},"slow");
	
	if(currentPage==totalPages-1)
	{
		$("#arrow_down").fadeIn();
	}
	
	if(currentPage==1)
	{
		$("#arrow_up").fadeOut();

	}
	
	
	if(currentPage==totalPages)
	{
		$("#arrow_down").fadeOut();
	}
	
	if(currentPage==2)
	{
		$("#arrow_up").fadeIn();
	}

}





$(document).ready(function () {
$("ul.menu_body li:even").addClass("alt");

$('#menu_galerie').mouseover(function () {
$('#podmenu_galerie').slideDown('medium');
});

$('#menu_home_galerie').mouseover(function () {
$('#podmenu_galerie').slideToggle('fast');
});

$('#podmenu_wrap').mouseleave(function () {
$('#podmenu_galerie').slideUp('medium');
});

$('#menu').mouseleave(function () {
$('#podmenu_galerie').slideUp('medium');
});

$('.menu_item').mouseover(function () {
$(this).css('background-position', "0px -28px");
});

$('.menu_item').mouseout(function () {
$(this).css('background-position', "0px 0px");
});


$('.podmenu_item').mouseover(function () {
$(this).css('background-position', "-87px 0px");
});

$('.podmenu_item').mouseout(function () {
$(this).css('background-position', "0px 0px");
});


$('.podmenu_start_item').mouseover(function () {
$(this).css('background-position', "-87px 0px");
});

$('.podmenu_start_item').mouseout(function () {
$(this).css('background-position', "0px 0px");
});


$('.menu2_item').mouseover(function () {
$(this).css('background-position', "0px -15px");
});

$('.menu2_item').mouseout(function () {
$(this).css('background-position', "0px 0px");
});


$('.menu_home_item').mouseover(function () {
$(this).css('background-position', "0px 0px");
});

$('.menu_home_item').mouseout(function () {
$(this).css('background-position', "0px -25px");
});

$('.galerie_menu_item').mouseover(function () {

	$(this).css('background-position', "-393px 0px");
	$('#galerie_img_1').hide(0);
	$('#galerie_img_2').hide(0);
	$('#galerie_img_3').hide(0);
	$('#galerie_img_4').hide(0);
	$('#galerie_img_5').hide(0);
	
	
	if($(this).attr('id')=='galerie_menu_1'){
		$('#galerie_img_1').fadeIn('fast');
		}
	else if($(this).attr('id')=='galerie_menu_2'){
		$('#galerie_img_2').fadeIn('fast');
		}
	else if($(this).attr('id')=='galerie_menu_3'){
		$('#galerie_img_3').fadeIn('fast');
		}
	else if($(this).attr('id')=='galerie_menu_4'){
		$('#galerie_img_4').fadeIn('fast');
		}
	else if($(this).attr('id')=='galerie_menu_5'){
		$('#galerie_img_5').fadeIn('fast');
		}
		
});

$('.galerie_menu_item').mouseout(function () {
$(this).css('background-position', "0px 0px");
});



$('#arrow_down').mouseover(function () {
$('#arrow_down').css('top', '0px');
});

$('#arrow_down').mouseout(function () {
$('#arrow_down').css('top', '-19px');
});

$('#arrow_up').mouseover(function () {
$('#arrow_up').css('top', '0px');
});

$('#arrow_up').mouseout(function () {
$('#arrow_up').css('top', '-19px');
});








$('#arrow_up').click(function () {
	moveToPage(currentPage-1);
});



$('#arrow_down').click(function () {
	moveToPage(currentPage+1);
});





$('.ikona_foto').mouseover(function () {

	var cur_ikona = 'ikona_foto'+current;
	if(cur_ikona !== $(this).attr('id')){					 
		$(this).toggleClass('ikona_on ikona_foto');
	}
});


$('.ikona_foto').mouseout(function () {
	var cur_ikona = 'ikona_foto'+current;
	if(cur_ikona !== $(this).attr('id')){					 
		$(this).toggleClass('ikona_on ikona_foto');
	}
});




$('#nav_left').mouseover(function () {
	if(current!==1){
	$('#nav_left_img').css('background-image', 'url("images/arrow_left.png")');
	}
});

$('#nav_left').mouseout(function () {
	$('#nav_left_img').css('background-image', '');
});



$('#nav_right').mouseover(function () {
	if(current!==totalFiles){
	$('#nav_right_img').css('background-image', 'url("images/arrow_right.png")');
	}
});

$('#nav_right').mouseout(function () {
	$('#nav_right_img').css('background-image', '');
});


$('#nav_left').click(function () {
	PrevPhoto();
});

$('#nav_right').click(function () {
	NextPhoto();
});





});






$(document).keyup(function(e) {

  
	  
	  
    if (e.keyCode == 37) {


		PrevPhoto();



  }   // arrow left
	  
	
	
  if (e.keyCode == 39) {
	  
	

	NextPhoto();

		
  } // arrow right
	
});

