var Document = function(){
	var t =this;
	t.version = 20070823;
};

Document.prototype.id = function(i, d){

	if(typeof(d) != 'object'){
		d = document;
	};
	
	var e = i;
	
	if(document.getElementById){
		e = d.getElementById(i);
		
	}else if(document.all){
		e = d.all[i];
		
	}else if(document.layers){
		e = d.layers[i];
		
	}else{
		alert('Error:\nClass.DHTML.Document');
	};
	
	return e;
};

var Location = function(){
};

Location.prototype.param =function(n, m, l, a){
	var r = new RegExp(n+'=([^\\&]*)', 'i');
	
	if(a){
		r = new RegExp('([^\\&]*)='+a, 'i');
	};
	
	var ls = false;
	var lt = typeof(l);
	
	if(!l){
		l = window.location;
	};
	
	if(m == 'string'){
		if( (/\?/g).test(l) ){
			ls = l.replace(/(.*)\?/g, '');
			
		}else if( (/#/g).test(l) ){
			ls = l.replace(/(.*)#/g, '');
		};
		
	}else if(m == 'hash'){
		ls = l.hash;
		
	}else{
		ls = l.search;
		
		if(ls == ''){
			ls = l.hash;
		};
	};
	
	if(ls){
		var v = r.exec(ls);
		
		if(v != null){
			return v[1]+'';
			
		}else{
			return '';
		};
		
	}else{
		return false;
	};
};


var Event = function(o){
	var t = this;
	t.d = new Document();
};

Event.prototype.add = function(o, e, f){
	if(!o){
		o = window;
	}
	
	if(window.attachEvent){
		o.attachEvent('on' + e, f);
		
	}else{
		o.addEventListener(e, f, false);
	}
};

