
/*
**
    This file is meant for turning PHP variables into JS variables
    This should be reserved for global variables only
**
*/

var config;
config = {
	   URL            : 'http://tnyb.it',
	   jsURL          : 'http://tnyb.it/assets/js',
	   PagesURL       : 'http://tnyb.it/views/content/pages',
	   ajaxFile       : 'http://tnyb.it/assets/js/ajax/url.php',
	   FaceboxImages  : 'http://tnyb.it/assets/images/scripts',
	   issueText      : "Silly, you don't need to shorten that URL.",
	   invalidUrlText : "Oops! URL was invalid. please, try it again."
};


/*-------------------------------------------------------------------------------------------------------
   
    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: <script src='http://domain.com/js/jquery/jquery-ui.js' type='text/javascript'></script>

-------------------------------------------------------------------------------------------------------*/

config.loadComponents = function (components) {
    for ( var key in components ) {
	  var obj = components[key];
	  
	  for (var prop in obj) {
		var fileName = obj[prop];
		
		file = config.jsURL + '/' + key + "/" + fileName;
		
		document.write(unescape("%3Cscript src='" + file + "' type='text/javascript'%3E%3C/script%3E"));
	  }
    }
}
