Globals = {

	isIE: function(){
		return navigator.userAgent.indexOf('Gecko')<0;
	},
	
	getIEBody: function(){
		return document.compatMode!="BackCompat" ? document.documentElement : document.body;
	},
	
	getStyle: function(obj){
		return Globals.isIE() ? obj.currentStyle : document.defaultView.getComputedStyle(obj, '')
	},
	
	createDelegate: function(instance, method){
		return function(){
			return method.apply(instance, arguments);
		}
	},
	
	getElementsByClassName: function(name, obj){
		var obj = obj || document.body;
		var a=[],c=null,childs=obj.childNodes,i=0,j=0,child,e;
		
		if(!childs || !childs.length) return null;
				
		for(i=0;i<childs.length; i++){
			child = childs[i];
			if(!child)continue;
			
			if(child.className == name)a.push(child);
			
			
			if(c = Globals.getElementsByClassName(name,child)){
				for(j=0; j<c.length; j++)a.push(c[j]);
			}
			
		}
		return a.length>0 ? a: null;
	},
	
	Debug: {
		writeln: function(txt){
			var nl= Globals.isIE() ? '\n\r' : '\n';
			if( !(_debug=document.getElementById('_debug')) ){
				_debug = document.createElement('textarea');
				_debug.setAttribute('id','_debug');
				_debug.setAttribute('rows','40');
				_debug.setAttribute('cols','80');
				
				document.getElementsByTagName('body')[0].appendChild(_debug);
			}
			txtnode = document.createTextNode(txt+nl)
			_debug.appendChild(txtnode);
		},
		
		listObj: function(obj){
			var s='', c=0, nl= Globals.isIE() ? '\n\r' : '\n';
			if(typeof(obj)!='object')s+=obj+nl;
			else for(i in obj)s+=i+': '+obj[i]+nl;
			s+= '----------------------------------------------------------'+nl;
			Globals.Debug.writeln(s);
		}
	}
	
}


Object.prototype.getStyle = function(){
	return Globals.isIE() ? this.currentStyle : document.defaultView.getComputedStyle(this, '')
}

/* Array.push() not Implemented in IE5.01 */
if(typeof(Array.push)=='undefined'){
	Array.prototype.push = function(val){
		return this[this.length] = val;
	}
}
