$(function(){
    centerSplash();

    /*
     * ToolTip section
     * This will show, hide etc. the tooltips
     */
    var _menu = $('#menu a'); //define menu items
    var _toolTipIDPrefix = 'tooltip-'; //define tooltip id prefix
    var _toolTipName = ''; //last and active tooltip that shown
    var toolTipTimeOut = null;

    _menu.live('mouseover mouseout', function(ev){
        switch(ev.type){
            case 'mouseover':
                if(toolTipTimeOut != null) {
                    clearTimeout(toolTipTimeOut);
                }
                _toolTipName = $(this).attr('tooltip');
                $('#'+_toolTipIDPrefix+_toolTipName).siblings().hide();
                $('#'+_toolTipIDPrefix+_toolTipName).fadeIn(300);
                break;
            case 'mouseout':
                _toolTipName = $(this).attr('tooltip');
                toolTipTimeOut = setTimeout((function(){$('#tooltip-viewport p').hide();}), 10000);
                break;
            default:
                return false;
                break;
        }
    });
    /*
     * End tooltip section
     */

});

$(window).load(function(){
    $('body').fadeIn(500);
});

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


/*
 * name: centerSplash
 * @no variables neede
 * this function centering the splash div
 * please call it on document ready and on window resize events
 */
function centerSplash(){
    this.splash = $('#splash');
    this.wH = $(window).height();
    this.sH = this.splash.height();
    this.splashTop = (this.wH/2) - (this.sH/2);
    this.splashTop = (this.splashTop < 0) ? '20em' : this.splashTop;
    this.splash.css('top', this.splashTop);
    this.splash.fadeIn(500); //show the slpash after alignment
    return false;
};