/*
JsEventDefs 1.5.0.1

Library released under the LGPL:
http://www.opensource.org/licenses/lgpl-license.php

Author:
Chris Moschini
chris AT newtilt.com
chris AT soopahman.com
*/

/* dynamic root */
if(typeof(sRoot) == 'undefined')
	sRoot = '';
	
if(typeof(sCommon) == 'undefined')
	sCommon = '/js/common';
/* /dynamic root */

/* includes */
function include(sJsFile) {
	document.writeln('<script src="' + sRoot + sJsFile + '"></script>');
}
function includes() {
	for(var iInc = 0; iInc < arguments.length; iInc++) {
		include(arguments[iInc]);
	}
}

function includeCss(sCssFile) {
	document.writeln('<link href="' + sRoot + sCssFile + '" rel="stylesheet" />');
}
/* /includes */

/* common files */
function includeCommon() {
	var core = [
		sCommon + '/js/array.js',
		sCommon + '/js/string.js',
		sCommon + '/js/onload.js',
		sCommon + '/js/functionreflect.js',
		sCommon + '/js/method.js',				//^ functionreflect
		sCommon + '/js/set.js'
	];
	
	var coreExtended = [
		sCommon + '/js/random.js'
	];
	
	var dom = [
		sCommon + '/css/cssclasslist.js',		//^ array
		sCommon + '/dom/attribute.js',
		sCommon + '/dom/pseudoclass.js',
		sCommon + '/dom/simpleselector.js',		//^ pseudoclass, attribute
		sCommon + '/dom/selector.js',			//^ simpleselector
		sCommon + '/dom/tag.js',
		sCommon + '/dom/cssdom.js'				//^ tag, set
	];
	
	var domExtended = [
		sCommon + '/css/color.js',
		sCommon + '/dom/forms.js'				//^ tag, cssdom
	];		


	var events = [	
		sCommon + '/event/eventdefs.js',		//^ cssdom, onload, method
		sCommon + '/event/eventdef.js',
		sCommon + '/event/binding.js',			
		sCommon + '/event/eventhit.js'
	];

	var anim = [
		'/js/common/geometry/point.js',
		'/js/common/geometry/rectangle.js',
		'/js/anim/lib/timer.js'
	];
	
	if(typeof(inUse) == 'undefined')	// if already specified, leave be
		var inUse = [core, dom, events];	// default common includes
	
	for(var iInUse = 0; iInUse < inUse.length; iInUse++) {
		var includeList = inUse[iInUse];
		for(var iInclude = 0; iInclude < includeList.length; iInclude++) {
			include(includeList[iInclude]);
		}
	}
}


if(typeof(EventDefs) == 'object') {
	// common.js has already been included once; this is a problem
	alert('common.js is being included more than once on this page; please remove the extra script src="" tags');
} else {
	includeCommon();
}
/* /common files */