var closetimer;
var dropdownmenuitem;

function dropdown_open() {
dropdown_canceltimer();
dropdown_close();
dropdownmenuitem = $(this).find('.inbl').css('display', 'inline-block');
}

function dropdown_close() {
if(dropdownmenuitem) {dropdownmenuitem.css('display', 'none');}
}

function dropdown_timer() {
closetimer = window.setTimeout(dropdown_close, 500);
}

function dropdown_canceltimer() {
if(closetimer) {window.clearTimeout(closetimer);}
}


var currentPhoto = 1;
var maxPhoto = 1;

function loadGalFolder(id) {
$("#photolist").fadeOut(250);
$("#photos").fadeOut(250,function() {
$("#photos").load("/ajaxgallery.php?id="+id,function() {
$("#photos").fadeIn(250);
$("#photolist").load("/ajaxphotolist.php?id="+id,function() {
$("#photolist").fadeIn(250);
});
gotoPhoto(1);
currentPhoto=1;
});
});
}

function gotoPhoto(numer) {

if (numer == "next") {
currentPhoto++;
if (currentPhoto > maxPhoto) {currentPhoto = 1;
}
} else if (numer == "prev") {
currentPhoto--;
if (currentPhoto < 1) {currentPhoto = maxPhoto;
}
} else {
currentPhoto=numer;
}

$("#photos2").animate({"left": 419-(currentPhoto*419)+"px"},500);


var jedzieszdo = (0-((currentPhoto-3)*113));

$("#photolist2").animate({"left": jedzieszdo+"px"},500);



}

function checkformmain(e) {
if ($('#mm1').val()!='' && $('#mm3').val()!='') {
return true;
} else {
alert(e);
return false;
}
}


$(document).ready(function(){
$("a").live("click", function(){$(this).blur();});
$("a").live("mouseout", function(){$(this).blur();});
$('#dropdown > .dropme').live('mouseover', dropdown_open);
$('#dropdown > .dropme').live('mouseout', dropdown_timer);
$("body").live('click', dropdown_close);
});
