/* Application exception handler
 */
//try {
	
	/* readfile include Curious Code namespace
	 */
	/**
 * cc namespace
 */

cc = {
	// Modules
	ui : {},
	
	log: function (m) { alert('Unhandled log: ' + m); },
	pageInit: function (config) {cc.log('Failsafe page init. cccms_body: '+$('cccms_body'));}
};
	
	/* readfile include settings
	 */
	
/* cc namespace init 
 */
if (!cc) cc = {};

/**
 * cc settings
 */
cc.settings = {
	application: 'cccms',
	version: '0.1',
	build: 'live',
	siteName: 'WS',
	loc: { url: {
		ht: 'http://curiouscode.com',
		css: '/css',
		js: '/js',
		image: '/image'
	}}
};
	
	/* readfile include Java Script include func
	 */
	/**
 *  phpied.com - JS includes - the saga continues...
 *  (c) October 25th, 2006 phpied.com
 *
 * Copied off the net from http://www.phpied.com/files/jinc/test_ready.html
 * 
/*--------------------------------------------------------------------------*/

/* cc namespace init 
 */
if (!cc) cc = {};

/* CSS inclusion - IE fires both events, onload first, then onreadystatechange. FF fires nothing.
*/
cc.include_css = function (config) {
	document.write('<'+'link ' +
			'href="' + cc.settings.loc.url.css + '/' + config.file + '" ' +
			'media="screen" type="text/css" ' +
			'rel="stylesheet"/'+'>');

}
/* JS inclusion - IE fires onreadystatechange. FF fires onload. Both will execute the script before firing the event.
// Doesnt work in IE - fucks it up
//	var html_doc = document.getElementsByTagName('head')[0];
//	var js = document.createElement('script');
//	js.setAttribute('type', 'text/javascript');
//	js.setAttribute('src', cc.settings.jsUrl + '/' + config.file);
//	html_doc.appendChild(js);
//	
//	if (config && config.callback) {
//		css.onreadystatechange = function (a, b, c) {
//			if (css.readyState == 'complete') config.callback.call(a, b, c);
//		}
//		css.onload = config.callback;
//	}
*/
cc.include_js = function (config) {
	document.write('<' + 'script ' +
			'language="javascript" type="text/javascript" ' +
			'src="' + cc.settings.loc.url.js + '/' + config.file + '">' +
			'</' + 'script' + '>');
}
	
	/*  Prototype JavaScript framework, version 1.5.1_rc2
	 *  (c) 2005-2007 Sam Stephenson
	 *
	 *  Prototype is freely distributable under the terms of an MIT-style license.
	 *  For details, see the Prototype web site: http://www.prototypejs.org/
	 *
	/*--------------------------------------------------------------------------*/
	cc.include_js ({file: 'prototype/prototype.js'});
	
	
	/*  script.aculo.us scriptaculous.js v1.7.1_beta1, Mon Mar 12 14:40:50 +0100 2007
	 *  Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
	 *
	 *  For details, see the script.aculo.us web site: http://script.aculo.us/
	 *
	/*--------------------------------------------------------------------------*/
	cc.include_js ({file: 'scriptaculous/scriptaculous.js'});
	
	
		
	
	/*
	 * Statemanager from somewhere on the net
	 * 
	 * http://exanimo.com/javascript/using-the-statemanager-in-ajax-apps/
	/*--------------------------------------------------------------------------*/
	cc.include_js ({file: 'statemanager.js'});
	
	
	/* events
	 * written by Dean Edwards, 2005
	 * with input from Tino Zijdel, Matthias Miller, Diego Perini
	 * http://dean.edwards.name/weblog/2005/10/add-event/
	/*--------------------------------------------------------------------------*/
	cc.include_js ({file: 'events.js'});
	
	
	/*
	 * Curious Code
	 * 
	 * @author     Karto <karto@karto.net>
	 * @copyright  Copyright &copy; Karto
	 * @license    http://www.karto.net/license Karto license
	 * 
	/*--------------------------------------------------------------------------*/
	cc.include_js ({file: 'build.js.php' + 
			( cc.settings.build && 'live' != cc.settings.build 
					? '/'+cc.settings.build 
					: '' )});
	
	
	
/* Application exception handler
 */
//} catch (e) {
	/* readfile include exception handler
	 */
	//}
