function publicateFlexibleVars(vars,params,attrs) {

}

var autokidsCtrl = {
    popupName:'autokids',
    superbrainUrl:'http://superbrain.autokids.de/',
    gameBaseUrl:'flash/embed',
    currentPopup:false,
    games: {},
    gamePopup:function(game, width, height, newBaseUrl, params)
    {
        if (typeof(width) == 'undefined' || typeof(height) == 'undefined') {
            if (typeof(this.games[game])!='undefined') {
               width = this.games[game]['width'];
               height = this.games[game]['height'];
            }
        }
        var baseUrl = this.gameBaseUrl + '?game='+game;
        if (typeof(newBaseUrl) != 'undefined') {
            baseUrl = newBaseUrl;
        }
        var popupUrl = baseUrl + '&height='+height+'&width='+width;
        
        if (typeof(params) != 'undefined')  {
            for (var k in params) {
                popupUrl += '&' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
            }
        }
        
        this.currentPopup = window.open(popupUrl, 'autokids','width='+width+',height='+height);
        if (this.currentPopup) {
            this.currentPopup.focus();
        }
    },
    ecomicPopup:function(ecomic) {
        if (typeof(ecomic) != 'undefined') {
            this.gamePopup(null, 550, 400, 'flash/ecomic?', {'ecomic':ecomic});
        } else {
            this.gamePopup(null, 550, 400, 'flash/ecomic?');
        }
    },
    superbrainPopup:function() {
        var popupUrl = this.superbrainUrl;
        this.currentPopup = window.open(popupUrl, 'autokids','width=900,height=580');
        if (this.currentPopup) {
            this.currentPopup.focus();
        }
    },
    ecomicCheck:function()
    {
        var href = document.location.href;
        if (href.lastIndexOf('ecomic=')!=-1) {
            var ecomic = href.substring(href.lastIndexOf('ecomic=')+7).substring(0,32);
            this.ecomicPopup(ecomic);
        }
    }
}
autokidsCtrl.games['einparkspiel'] = {'width':550,'height':400}
autokidsCtrl.games['eishockey'] = {'width':550,'height':400}
autokidsCtrl.games['verkehrsspiel'] = {'width':550,'height':400}
autokidsCtrl.games['jumpnrun'] = {'width':550,'height':400}
autokidsCtrl.games['sudoku'] = {'width':550,'height':400}
autokidsCtrl.games['velothon'] = {'width':550,'height':400}
autokidsCtrl.games['flossfahren'] = {'width':550,'height':400}
autokidsCtrl.games['spaziergang'] = {'width':550,'height':400}
autokidsCtrl.games['schiebepuzzle'] = {'width':550,'height':400}
autokidsCtrl.games['garage'] = {'width':550,'height':400}
autokidsCtrl.games['memorino'] = {'width':550,'height':400}
autokidsCtrl.games['wettrennen'] = {'width':550,'height':400}
autokidsCtrl.games['tdf'] = {'width':550,'height':400}

jQuery(document).ready(function() {
    autokidsCtrl.ecomicCheck();
});

var navigationCtrl = {
    init : function(){
        jQuery('.navigator li').each(function() {
            var content = jQuery(this).find('>div.content');
            console.log(content);
            jQuery(this).find('>div.navigation').data('mycontent', content).click(function() {
                jQuery(this).data('mycontent').toggle();
            });
            content.hide();
        });
    }
}

jQuery(document).ready(function() {
    //navigationCtrl.init();
});

