/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


var Navigator = {
    
    /**
     *  historie
     *      0 => Array
     *          0 => function
     *          1 => Array
     *              *0 => param1
     *              *1 => param2
     *              *2 => param3
     *              *3 => param4
     *      1 => Array
     *          0 => function
     *          1 => Array
     *              *0 => param1
     *              *1 => param2
     *              *2 => param3
     *              *3 => param4                   
     *      
     *          
     */
    historie : new Array(),
    
    add : function(func, param1, param2, param3, param4){
        
        var params = new Array();
        if ((typeof param1) != "undefined"){
            params.push(param1);
        }
        if ((typeof param2) != "undefined"){
            params.push(param2);
        }
        if ((typeof param3) != "undefined"){
            params.push(param3);
        }
        if ((typeof param1) != "undefined"){
            params.push(param4);
        }        
        
        
        this.historie.push(new Array(func, params));
    },
    
    goBack : function(){
        
        if (this.historie.length > 1){            
            callFunction(this.historie[this.historie.length-2][0], this.historie[this.historie.length-2][1]);            
            this.historie.splice(this.historie.length-2, 2);
        }
    },
    
    reset : function(){
        this.historie = new Array();
    },
    
    printBackTop : function(inElement){
        if (this.historie.length > 1){            
            inElement.prepend("[<a href='javascript:goBack()' class='klein'> zur&uuml;ck </a>]");
        }
    },
    
    printBackBot : function(inElement){
        if (this.historie.length > 1){            
            inElement.append("[<a href='javascript:history.back()' class='klein'> zur&uuml;ck </a>]");
        }        
        
    }    

};


