/******************************************************************************
 
    The Digital Properties (DP) Object 
    
    Available Libraries Are:
    
        * core
        * combobox
        * datepicker
        * iframes
        * lightbox
        * media
        * scroll
        * titles
        * validations

 ******************************************************************************/

var DP = {
    
        Version         : "1.0",
        loadLibraries   : [ 'core',
                            'media',
                            'ninesquared'
                            //'combobox',
                            //'datepicker',
                            //'iframes',
                            //'lightbox',
                            //'scroll',
                            //'titles',
                            //'validations',
                            //'APPNAME'             // Custom Library for this app
                          ],
        
        require         : function(libName) {
            document.write('<script type="text/javascript" charset="utf-8" src="' + libName + '"></script>');
        },

        load            : function() {
            var s   = document.getElementsByTagName("script");
            for (var x = 0; x < s.length; x++) {
                if (s[x].src && s[x].src.match(/dp\.js(\?.*)?$/)) {
                    DP.jsPath = s[x].src.replace(/dp\.js(\?.*)?$/,'lib/');
                    
                    // Load Prototype.js
                    DP.require(DP.jsPath + 'prototype.js');
                    
                    // Load requested Libraries
                    var includes    = s[x].src.match(/\?.*load=([a-z,]*)/);                 
                    includes        = (includes) ? includes[1].split(',') : DP.loadLibraries;                               
                    for (var y = 0; y < includes.length; y++) {
                        DP.require(DP.jsPath + includes[y] + '.js');
                    }
                }
            }
        }
            
    };
    
DP.load();
    
    
