﻿
var trofeoscelta = 
{ 
    // Controls
    controls : [
                    'trofeoscelta.galeria',
                    'trofeoscelta.login',
                    'trofeoscelta.menu',
                    'trofeoscelta.panelNavegable',
                    'trofeoscelta.pngFix'
               ],
    // Lang
    lang : null,
    
    // Init
    init : function()
    {        
        // Load controls
        if(this.controls != null)
        {
            $.each(this.controls, function(key, control)  
            {
                $('head').append('<script type="text/javascript" src="' + $('.Root').val() + '_js/trofeoscelta/' + control + '.js"></' + 'script>');
                libraryConstructor(control, window, arguments);
            });
        }
    }
};

$(document).ready
(   
    function()
    {
        // Init
        trofeoscelta.init();
    }
);

function libraryConstructor(item, context /*, args */) 
{  
    var args = Array.prototype.slice.call(arguments).splice(2);  
    var namespaces = item.split(".");  
    var func = namespaces.pop();  
    for(var i = 0; i < namespaces.length; i++) 
    {    
        context = context[namespaces[i]];  
    }  
    return context[func].apply(this, args);
}
