/*
 * (c) 2011 David Krause, Interaktive Gestaltung
 * http://www.interaktive-gestaltung.de
 */

var trace = function (txt)
{
    //if (window.console) console.log(txt);
}

var disableHeaderAnimation = false;

$(document).ready(function()
{
    var header = new Header();
    if (!disableHeaderAnimation)
    {
        header.showAnimation();
    } else
    {
        header.showElements();
    }
});

function Header()
{
    var SELECTOR_PHOTO = '#header .photo';
    var SELECTOR_TEXT = '#header .text';

    this.showAnimation = function()
    {
        photoFadeIn();
        textFadeIn();
    }

    this.showElements = function()
    {
        photoShow();
        textShow();
    }

    /**
     * FadeIn of the photo.
     */
    var photoFadeIn = function ()
    {
        var photo = $(SELECTOR_PHOTO);

        photo.show();
        photo.css({ opacity: 0 });
        photo.fadeTo(1000, 1, 'swing');
    }

    /**
     * FadeIn of the text.
     */
    var textFadeIn = function ()
    {
        var text = $(SELECTOR_TEXT);

        text.show();
        text.css({ opacity: 0 });
        text.delay(300).fadeTo(2000, 1, 'swing');
    }

    /**
     * FadeIn of the text.
     */
    var textFadeIn = function ()
    {
        var text = $(SELECTOR_TEXT);

        text.show();
        text.css({ opacity: 0 });
        text.delay(300).fadeTo(2000, 1, 'swing');
    }

    /**
     * Shows the photo.
     */
    var photoShow = function ()
    {
        var photo = $(SELECTOR_PHOTO);
        photo.show();
        photo.css({ opacity: 1 });
    }

    /**
     * Shows the text.
     */
    var textShow = function ()
    {
        var text = $(SELECTOR_TEXT);
        text.show();
        text.css({ opacity: 1 });
    }


}




