$(function() { $("input").attr("autocomplete","off"); });
$(function() { $("a[rel*=external]").attr( "target", "_blank" ); });
$(function() { $("a[rel*=nofollow]").attr( "target", "_blank" ); });

$(document).ready(function(){ 

$("#submenu").bind("mouseenter", function(){ $(".sub_menu").css({ "visibility": "visible" }); $('#submenu').addClass('sub'); });
$(".sub_menu").bind("mouseleave", function(){  $(".sub_menu").css({ "visibility": "hidden" }); $('#submenu').removeClass('sub');  });
$("#menu2").bind("mouseenter", function(){ $(".sub_menu").css({ "visibility": "hidden" }); $('#submenu').removeClass('sub'); });
$("#menu4").bind("mouseenter", function(){ $(".sub_menu").css({ "visibility": "hidden" }); $('#submenu').removeClass('sub'); });


var numer=1;
var timer; 

$('.thumb').click(function() {

numer = $("img", this).attr("id");
numer = parseInt(numer.replace('foto', ''));

var img = $("img", this).attr("src");
img = img.replace('foto/mini', 'foto/med');


$("#show").fadeOut(200, function () { 
$(".lupa2").hide();
$("#show").attr("src", '');	
$("#show").attr("src", img);
$('#show').load(function() { $('#show').fadeIn(200); $(".lupa2").show();	});
});
return false;	});



$('.next').click(function() {
if(numer=='4') { numer=0; } else { numer = numer; }; 
numer=numer+1;

var img = $("#foto"+numer).attr("src");
img = img.replace('foto/mini', 'foto/med');

$("#show").fadeOut(200, function () { 
$(".lupa2").hide();	
$("#show").attr("src", '');	
$("#show").attr("src", img);
$('#show').load(function() { $('#show').fadeIn(200); $(".lupa2").show();	});

});
return false;	});

$('.prev').click(function() {
if(numer=='1') { numer=5; } else { numer = numer; }; 
numer=numer-1;

var img = $("#foto"+numer).attr("src");
img = img.replace('foto/mini', 'foto/med');

$("#show").fadeOut(200, function () { 
$(".lupa2").hide();	
$("#show").attr("src", '');	
$("#show").attr("src", img);
$('#show').load(function() { $('#show').fadeIn(200); $(".lupa2").show();	});

});
return false;	});


timer = setInterval(function() {  $('.next').click();   }, 3000); 
$('.galeria').hover(	function() { clearInterval(timer); }, function() {  timer = setInterval(function() {  $('.next').click(); },3000); });
});


