$(document).ready(function() {


// input focus in login-form

$('.login-form .input-txt').focusin(function() {
	$(this).parent().addClass('field-focusin');
}).focusout(function() {
	$(this).parent().removeClass('field-focusin');
});

var l = document.getElementById('login') ;
if (l && l.value == '') {
    l.focus() ;
}

// slider

$('.anythingSlider').show().anythingSlider({
	easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
	autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
	delay: 5000,                    // How long between slide transitions in AutoPlay mode
	startStopped: false,            // If autoPlay is on, this can force it to start stopped
	animationTime: 10,             // How long the slide transition takes
	hashTags: false,                 // Should links change the hashtag in the URL?
	buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
	pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
	startText: "Go",             // Start text
	stopText: "Stop"               // Stop text
});

// lightbox

$("a.fancybox").fancybox();

$('#more-pros').click(function(){
    showPros() ;
    return false;
}) ;   


    
$('#more-changes, #pros-more-changes').click(function(){    
    showChanges () ;
    return false ;
});

if (!!document.location.hash && document.location.hash === $('#more-pros')[0].hash) {
    showPros() ;
} else if (readCookie && readCookie('logcount') > 3) {
    showChanges () ;
    $('h1').click(function() {
        $('#mail-changes-all, #mail-pros-all').hide();
        $('#main-content').show();
        return false ;
    }) ;
}

});

function showPros () {
    $('#main-content, #mail-changes-all').hide();
    $('#mail-pros-all').show();
    document.body.scrollTop = 0 ;
} 

function showChanges () {
    $.ajax({
      url: WEBMAIL_PATH+"ajax-changelog.html",
      cache: true,
      success: function(html){
        $('#main-content, #mail-pros-all').hide();
        $("#mail-changes-all").empty().append(html).show();
        $('#changes-more-pros').click(function(){
            showPros() ;
            return false;
        }) ; 
        $(".log-more-content").quickPager({pageSize:5});    
      }
    }) ;
}
