//<![CDATA[

var _loader         = {
    init          : function() {
        this.core();
    },
    core          : function() {
        var i;

        for (i in libraries) {
            if (libraries[i].init && libraries[i].before) {
                this.array.before.push(libraries[i].url);
            } else if( libraries[i].init && !libraries[i].before) {
                this.array.after.push(libraries[i].url);
            }

            libraries[i].init    = false;
        }

        this.require(this.array.before);
        this.array.before = new Array();
    },
    array         : {
        before    : [],
        after     : []
    },
    require       : function(libs) {
        var i     = 0;
        var limit = libs.length;
        var html  = ''

        for (i; i < limit; i++) {
            html  += '<script src="' + libs[i] + '" type="text/javascript"></script>';
        }

        document.write(html);
    },
    after         : function() {
        _loader.require(_loader.array.after);
        this.array.after         = new Array();
    }

};


var def             = {
    project         : {
        name        : 'diatom',
        path        : '/',
        pathJs      : '/diatom/js/',
        pathSwf     : '/diatom/swf/',
        pathFlv     : '/diatom/flv/',
        pathJson    : '/diatom/json/',
        pathImg     : '/diatom/img/'
    }
};


var libraries       = {

    core            : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'global/_core.js'
    },

    jQuery          : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery-1.3.2.min.js'
    },

    jCorner         : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.corner.js'
    },

    jQswfObject     : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.swfobject.1-0-5.min.js'
    },

    jValidate       : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.validate.js'
    },
    
    jScrollto       : {
        init        : false,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.scrollto.min.js'
    },
    
    jSlider         : {
        init        : false,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.carousel.js'
    },

    jForm       : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jquery.form.js'
    },
    
    Jmaps           : {
        init        : true,
        before      : false,
        //url         : def.project.pathJs + 'lib/jquery.jmap2.js'
		url         : def.project.pathJs + 'lib/googlemaps.js'
    },
    
    Jqmodal         : {
        init        : true,
        before      : false,
        url         : def.project.pathJs + 'lib/jqModal.js'
    }

    /*
	gAnalytics      : {
        init        : true,
        before      : false,
        url         : 'https:' == document.location.protocol ? 'https://ssl.google-analytics.com/ga.js' : 'http://www.google-analytics.com/ga.js',
		code        : 'UA-2039129-17',
        domain      : 'diatom.com.br'
    }
	*/

};


_loader.init();


//]]>

