/**
 *	Extend String Object
 */

String.prototype.trim = function() { 
	return this.replace(/^\s+|\s+$/, ''); 
}

String.prototype.hilight = function ( color ) {
	return '<span style="color:'+color+';">'+this+'</span>';
}

/**
 *	Extend Arrays Object
 */

Array.prototype.inArray = function( needle ) { 
	for (var i = 0; i < this.length; i++) {
		if (this[i] == needle) {
			return true;
		}
	}
	return false;
}

/**
 *	Extend Document Object
 *
 *	If this script is executing Jscript instead of Javascript (i.e. using 
 *	and older version of Internet Explorer, point document.getElementById
 *	so it can be used as if it were Javascript.
 *	document.all			= MSIE 4
 *	document.layers			= Netscape 4
 *	document.getElementById	= MSIE 5+, NS6+, Mozilla, Opera5
 */
if ( document.all && !document.getElementById ) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}

/**
 *	Halo8Base object
 */
function Halo8Base() {
	this.included_files = new Array();
	this.h8Path			= '/elements/include/class/halo8/';
	this.jsPath			= this.h8Path;
	this.cssPath		= this.h8Path;
	
	this.includeOnce = function ( script_filename ) {
		//debug alert( script_filename );
		if ( !this.included_files.inArray( script_filename )) {
			this.included_files[this.included_files.length] = script_filename;
			this.include(script_filename);
		}
	}
	
	this.include = function ( script_filename ) {
	    var js = document.createElement( 'script' );
	    js.setAttribute( 'language', 'javascript' );
	    js.setAttribute( 'type', 'text/javascript' );
	    js.setAttribute( 'src', script_filename );
	    document.getElementsByTagName('head').item(0).appendChild( js );
	    return false;
	}
	
	this.includeStyle = function ( script_filename ) {
		var css = document.createElement('link');
		css.setAttribute( 'rel', 'stylesheet' );
		css.setAttribute( 'type', 'text/css' );
		css.setAttribute( 'href', script_filename );
	    document.getElementsByTagName('head').item(0).appendChild( css );
	    return false;
	}
}

var h8Base = new Halo8Base();
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsError.js' );
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsWindow.js' );
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsElementBase.js' );
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsElementEffects.js' );
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsElementSelectList.js' );
h8Base.includeOnce( h8Base.h8Path + 'Halo8JsElementWindow.js' );



