var lastaction;
var refreshing = 8*1000; // 60 * 1000 = 1 Minute (1000 = millisekunden, 60 = sekunden)
var refreshId=0;

$(document).ready(function() {    
    
    $('a#cms_login_click').click(function() {
        $('#loginform').dialog('open');
        return false;
    });
    $('#loginform').dialog({
        bgiframe: true,
        autoOpen: false,
        modal: true,
        title: "LOGIN",
        buttons: {
            'Login': function() {
                $.post("/login.php",$('#form_loginform').serialize(), function(response) {
                    response = eval(response);
                    if (response) {
                        location=$('#langlink_site').attr("href");
                    } else {
                        alert("login nicht erfolgreich");
                    }
                },"JSON"
                );	
                return false;	            
            }
        },
        close: function() {
		
        }
    });
    
    
    $('input.date').datepicker({
        dateFormat:'yy-mm-dd'
    });
	
    $('a.lightbox').hover(function() {
        $('a.lightbox').removeClass("active").addClass("notactive");
        $(this).addClass("active").removeClass("notactive");
    },function() {
        $('a.lightbox').removeClass("notactive").removeClass("active");
    });
	
    $('#fileupload_iframe').remove();
    
    
    $('li.notactive a.categorytitle img',$('ul#categoryNavigation')).animate({'opacity':'0.6'});
    $('li.notactive a.categorytitle',$('ul#categoryNavigation')).hover(function() {
       $('img',$(this)).stop().animate({'opacity':'1','width':'48px'},'fast'); 
    },function() { 
        $('img',$(this)).stop().animate({'opacity':'0.6','width':'40px'},'fast');
    });
    
    
    
    
    
        
    $('div.imgchanger').mouseenter(function() {
        $('img',this).attr("oldsrc",$('img',this).attr("src"));
        $('img',this).attr("src",$('img',this).attr("newsrc"));
    }).mouseleave(function() {
        $('img',this).attr("src",$('img',this).attr("oldsrc"));
    });
    
    $('li.gallerypicture a.lightbox').hover(function() {
       $('img.zoom',$(this)).stop().animate({'right':'0px'},'fast').animate({'right':'-10px'},'normal'); 
       $('img.zoomplus',$(this)).stop().animate({'width':'45px'},'fast'); 
    },function() { 
        $('img.zoom',$(this)).stop().animate({'right':'-30px'},'fast');
        $('img.zoomplus',$(this)).stop().animate({'width':'30px'},'fast'); 
    });
    
    $('li.subnavigation a',$('ul.listsubnavigation')).hover(function() {
       $('img.zoom',$(this)).stop().animate({'right':'-10px'},'fast').animate({'right':'-20px'},'normal'); 
       $('img.zoomplus',$(this)).stop().animate({'width':'35px'},'fast'); 
    },function() { 
        $('img.zoom',$(this)).stop().animate({'right':'-30px'},'fast');
        $('img.zoomplus',$(this)).stop().animate({'width':'30px'},'fast'); 
    });
});

