﻿var LastNewsRow_count;
var LastNewsRow_interval;
var old_LastNewsRow = 0;
var current_LastNewsRow = 0;

jQuery(document).ready(function () {
    LastNewsRow_count = jQuery("div.LastNewsRow").size();
    jQuery("div.LastNewsRow:eq(" + current_LastNewsRow + ")").css('top', '5px');

    LastNewsRow_interval = setInterval(LastNewsRow_rotate, 5000); //time in milliseconds
    jQuery('#LastNewsContent').hover(function () {
        clearInterval(LastNewsRow_interval);
    }, function () {
        LastNewsRow_interval = setInterval(LastNewsRow_rotate, 5000); //time in milliseconds
        LastNewsRow_rotate();
    });
});

function LastNewsRow_rotate() {
    current_LastNewsRow = (old_LastNewsRow + 1) % LastNewsRow_count;
    jQuery("div.LastNewsRow:eq(" + old_LastNewsRow + ")").animate({ top: -205 }, "slow", function () {
        jQuery(this).css('top', '210px');
    });
    jQuery("div.LastNewsRow:eq(" + current_LastNewsRow + ")").show().animate({ top: 5 }, "slow");
    old_LastNewsRow = current_LastNewsRow;
}

function ShowDetails(ctlSummary, ctlDetails, ctlImage) {
    jQuery(".Summary").show(1000);
    jQuery(".ArchivesNewsRow").hide(1000);
    jQuery(".imgIcon").hide(1000);
    if (document.getElementById(ctlDetails).style.display == 'none') {
        jQuery("#" + ctlDetails).show(1000);
        jQuery("#" + ctlSummary).hide(1000);
        jQuery("#" + ctlImage).fadeIn(1000);
    } else {
        jQuery("#" + ctlSummary).show(1000);
        jQuery("#" + ctlDetails).hide(1000);
        jQuery("#" + ctlImage).fadeOut(1000);
    }
}
