$(document).ready(function()
{
    //return;
//Calculate size of logo
    var size = Math.min(document.body.clientWidth, document.body.clientHeight) * 0.8;

//Create logo
    var animlogo = document.createElement('div');
    animlogo.innerHTML = "<h1>proArte</h1>";
    animlogo.setAttribute('id', 'animlogo');
    document.body.appendChild(animlogo);
    
    animlogo.style.top = (document.body.clientHeight - size) / 2;
    animlogo.style.left = (document.body.clientWidth - size) / 2;
    animlogo.style.width = size;
    animlogo.style.height = size;
    
    animlogo.lastChild.style.fontSize = (2 / 10) * size;
    var t = 0.7 * size;
    animlogo.lastChild.style.marginTop = "" + t;
    
//Create "click logo to continue"-message
    var info = document.createElement('div');
    info.setAttribute('id', 'clickinfoanim');
    info.innerHTML="Click the logo to continue";
    document.body.appendChild(info);
    var fontSize = Math.max(size / 40, 12);
    info.style.fontSize = fontSize + "px";
    info.style.top = (document.body.clientHeight / 2) + size/2 + fontSize;
    info.style.left = (document.body.clientWidth - size) / 2;
    
//Register click-event
    $("#animlogo").click(OnLogoClick);

//Hide mainpage
    document.getElementById('mainframe').style.opacity = 0;
    $("#mainframe").css("filter","alpha(opacity=0)");   //IE hack (as always...)
});

function OnLogoClick()
{
//hide "Click logo to enter"-message
    document.body.removeChild(document.getElementById("clickinfoanim"));
//Start animation
    var h = $('#logo').height();
    var w = $('#logo').width();
    pos = $("#logo").offset();

    $("#animlogo").animate({opacity: 0, left: pos.left, top: pos.top, width: w, height: h}, 2000, OnDone);
    $("#animlogo h1").animate({"margin-top": h * 0.7, fontSize: 0.2*h}, 2000);
}

function OnDone()
{
    //Remove animated logo
    document.body.removeChild(document.getElementById('animlogo'));
    //Fade-in mainpage
    $('#mainframe').fadeTo(1000, 1, Cleanup);
}

function Cleanup()
{
    //IE-hack again... :(
    $("#mainframe").css("filter","none");
}
