$(document).ready(function(){
   $(document).bind("contextmenu",function(){
        return false;
    });
    Shadowbox.init(); 
    droplinemenu.buildmenu("droplinetabs1");
    
    /*$('#lepkemenuSubDiv').height($(document).height()-310-60);
    $('#lepkemenuSubDiv2').height($(document).height()-310-60);
    $('#lepkemenuSubDiv3').height($(document).height()-310-60);*/
    
    $('#lepkemenuSubDiv').height($('#lepketable').height()+60);
    $('#lepkemenuSubDiv2').height($('#lepketable').height()+60);
    $('#lepkemenuSubDiv3').height($('#lepketable').height()+60);
});

$('ul[id^="topnav"] li a').click(function(event){
        if ($(this).parent().children('ul').is(':visible'))
        {
            $(this).parent().children('ul').hide('fast');
            $.ajax({
               type: "GET",
               url: "menuremember.php",
               data: ({lepkemenuid : $(this).attr('id'), onoff: "off"})              
             });
        }
        else
        {
            $(this).parent().children('ul').show('fast');
            $.ajax({
               type: "GET",
               url: "menuremember.php",
               data: ({lepkemenuid : $(this).attr('id'), onoff: "on"})              
             });
        }
    });


$('[id^="idtabs"]').click(function(){
        $.ajax({
           type: "GET",
           url: "menuremember2.php",
           data: ({ordering : $(this).attr('id')})              
         });
         $('#rendszertanPrevNext').hide();
         $('#genusPrevNext').hide();
         $('#fajPrevNext').hide();
         if ($(this).attr('id')=='idtabs-1') $('#rendszertanPrevNext').show();
         if ($(this).attr('id')=='idtabs-2') $('#genusPrevNext').show();
         if ($(this).attr('id')=='idtabs-3') $('#fajPrevNext').show();
    })
    
$(window).load(function () {
    $("a.anchorLink").anchorAnimate()  //scrolling link
});

jQuery.fn.anchorAnimate = function(settings) {
 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}
