var config; config = { URL : 'http://doyouprefer.it', PagesURL: 'http://doyouprefer.it/core/pages', ajaxURL : 'http://doyouprefer.it/core/modules/ajax.php', FaceboxImages: 'http://doyouprefer.it/images/scripts', jsURL: 'http://doyouprefer.it/js' }; /*------------------------------------------------------------------------------------------------------- Function for looping through long lists of JS includes this function, when fed an array will write the script tag to include the specified files as JS include files. NOTE: This written to look in the 'js' folder under the site's root folder (http://domain.com/js/) Directions: config.loadComponents( { foldername:['filename.js'] } ); Example: config.loadComponents( { jquery:['jquery-ui'] } ); OUTPUT: -------------------------------------------------------------------------------------------------------*/ config.loadComponents = function (components) { for ( var key in components ) { var obj = components[key]; for (var prop in obj) { var file = obj[prop]; file = config.jsURL + '/' + key + "/" + file; document.write(unescape("%3Cscript src='" + file + "' type='text/javascript'%3E%3C/script%3E")); } } } config.loadComponents( { 'jquery':[ 'jquery-1.4.2.js' ,'plugins.js' ,'facebox.js' ] ,'scripts':[ 'zeroclipboard/ZeroClipboard.js' ] ,'app':['app.js'] }); // Because of the overhead of the anmials and cufon // we won't load these on the iPhone if(!navigator.userAgent.match(/iPhone/i)){ cufonFonts = 'comfortaa_400-comfortaa_700-all.font.js'; if (config.URL == 'http://doyouprefer.it') { cufonFonts = 'Comfortaa_400-Comfortaa_700.font.js'; } config.loadComponents( { 'app':['animals.js'] ,'scripts':[ 'cufon-yui.js' ,cufonFonts ] }); }