/*
 * Name:		main.js
 * Description:	Sets global config item and includes all other JavaScript files
 */

var config = [];	// Global config array
var S2 = {};		// Global namespace


/*
| -------------------------------------------------------------------
|  SITE_FOLDER
| -------------------------------------------------------------------
| 
| Location of the application root folder
| Used mainly to locate assets when HTML page is called from a subdirectory
| of the root directory. If it is in the root leave it empty, otherwise
| make sure there is a trailing slash on the end of the folder list:
| 
|	'example/folder/'
|
*/
config['SITE_FOLDER'] = '';


/*
| -------------------------------------------------------------------
|  Load the scripts
| -------------------------------------------------------------------
|
*/
// base url of website
config['BASE_URL'] = location.protocol+'//'+location.host+'/'+config['SITE_FOLDER'];

// define scripts array for inclusion
var load_scripts = new Array(
	'assets/scripts/jquery/jquery-1.4.2.min.js',
	'assets/scripts/jquery/jquery-ui-1.8.2.custom.min.js',
	'assets/scripts/jquery/jquery.easing.1.2.js',
	'assets/scripts/jquery/jquery.anythingslider.js',
	'assets/scripts/controller.js'
);

// print script tags
for(var i=0, len=load_scripts.length; i<len; i++){
	try{
		// inserting via DOM fails in Safari 2.0, so brute force approach
		document.write('<script type="text/javascript" src="'+config['BASE_URL']+load_scripts[i]+'"><\/script>');
	}
	catch(e){
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = load_scripts[i];
		document.getElementByTagName('head')[0].appendChild(script);
	}
}
