// ----------------------------------------------
// Author: (c) Andreas 'decoman' Fay
// ----------------------------------------------
// Version:    1.3.0
// ----------------------------------------------
// Functionindex
// ----------------------------------------------
// v0.1 - fadeIn
// v0.1 - fadeStatus_set
// v0.1 - fadeOut
// ----------------------------------------------


function fader(objElement, strObject)
{
    // Attributes -------------------------------
    var element                                  =  objElement;
    this.fadeStatus                              =  0.00;
    var objectName                               =  strObject;
    this.stepFade                                =  0.01;
    this.stepTime                                =  10;


    // ------------------------------------------
    // Method (privileged)
    // ------------------------------------------
    // Name:        fadeIn
    // Description:
    // Input:       
    // Output:
    // ------------------------------------------
    // Version:     0.1
    // ------------------------------------------
    // ChangeLog
    // ------------------------------------------
    // v0.1 (14.07.2007)
    // ------------------------------------------
    this.fadeIn                                  =  function()
    {
        if (this.fadeStatus < 1)
        {
            this.fadeStatus                      += this.stepFade;
            fadeStatus_set(this.fadeStatus);
            
            window.setTimeout(objectName+".fadeIn('"+objectName+"')", this.stepTime);
        }
    }


    // ------------------------------------------
    // Method (private)
    // ------------------------------------------
    // Name:        fadeStatus_set
    // Description:
    // Input:       (dbl) FadeStatus
    // Output:      
    // ------------------------------------------
    // Version:     0.1
    // ------------------------------------------
    // ChangeLog
    // ------------------------------------------
    // v0.1 (14.07.2007)
    // ------------------------------------------
    fadeStatus_set                               =  function(intFadeStatus)
    {
        element.style.filter                     =  "alpha(opacity:"+(intFadeStatus*100)+")";
        element.style.opacity                    =  intFadeStatus;
    }


    // ------------------------------------------
    // Method (privileged)
    // ------------------------------------------
    // Name:        fadeOut
    // Description:
    // Input:
    // Output:
    // ------------------------------------------
    // Version:     0.1
    // ------------------------------------------
    // ChangeLog
    // ------------------------------------------
    // v0.1 (14.07.2007)
    // ------------------------------------------
    this.fadeOut                                  =  function()
    {
        if (fadeStatus > 1)
        {
            this.fadeStatus                      -= this.stepFade;
            fadeStatus_set(this.fadeStatus);
            
            window.setTimeout(objectName+".fadeOut('"+objectName+"')", this.stepTime);
        }
    }
    
    fadeStatus_set(this.fadeStatus);
}