function centerContent() {
    var de = document.documentElement;
    var windowWidth = (self.innerWidth || (de && de.clientWidth) || document.body.clientWidth);
    var windowHeight = (self.innerHeight || (de && de.clientHeight) || document.body.clientHeight);
    $("#content").hide();
    $("#content").css({
        left: ((windowWidth - 800) / 2) + "px",
        top: ((windowHeight - 600) / 2) + "px"
    });
    $("#content").show();
}

function infoWindow(url) {
    var de = document.documentElement;
    var windowWidth = (self.innerWidth || (de && de.clientWidth) || document.body.clientWidth);
    var windowHeight = (self.innerHeight || (de && de.clientHeight) || document.body.clientHeight);
    var w = windowWidth * 0.66;
    var h = windowHeight * 0.8;
    var options = '';
    options += 'toolbar=no';
    options += ',location=no';
    options += ',status=yes';
    options += ',status=yes';
    options += ',menubar=no';
    options += ',scrollbars=yes';
    options += ',resizable=yes';
    options += ',width=' + w;
    options += ',height=' + h;
    window.open(url, 'TURING TABLES', options);
}
function loadTicker() {
    $("#ticker").load("ticker.html", 
    	{}, 
    	function() { setTimeout('showTicker()', 100); }
    );
}
function showTicker() {
	$("#ticker").css("visibility", "visible");
}

$(document).ready(function() {
    // Center content vertically and horizontally
    // Init visibility of layers
    $("#menu").hide();
    $("#archive").hide();
    $("#additional").hide();
    // Init menu and attach actions
    $('#menu_info').click(function(event) {
        event.preventDefault(); // Handle click event ONLY here
        $('#menu_info').addClass('active');
        $('#menu_archive').removeClass('active');
        $('#menu_additional').removeClass('active');
        $('#archive').fadeOut();
        $('#additional').fadeOut();
        infoWindow('text06_about.html');
    });
    $('#menu_archive').click(function(event) {
        event.preventDefault();
        $('#menu_info').removeClass('active');
        $('#menu_archive').addClass('active');
        $('#menu_additional').removeClass('active');
        $('#additional').fadeOut(400);
        $('#archive').fadeIn(600);
    });
    $('#menu_additional').click(function(event) {
        event.preventDefault();
        $('#menu_info').removeClass('active');
        $('#menu_archive').removeClass('active');
        $('#menu_additional').addClass('active');
        $('#archive').fadeOut(400);
        $('#additional').fadeIn(600);
    });
    centerContent();
});

$(window).resize(function() {
    centerContent();
});

$(window).load(function() {
    setTimeout('$("#reveal").hide()', 19000);
    setTimeout('$("#menu").fadeIn(400)', 18600);
    setTimeout('loadTicker()', 19400);
});