// Courtesy of http://www.quirksmode.org

function getObj( name ) {
	var mydomain = document;
	if ( getObj.arguments[1] )
		mydomain = getObj.arguments[1];
	if (mydomain.getElementById) {
		this.obj = mydomain.getElementById(name);
		if ( this.obj )
			this.style = mydomain.getElementById(name).style;
	} else if (mydomain.all) {
		this.obj = mydomain.all[name];
		if ( this.obj )
			this.style = mydomain.all[name].style;
	} else if (mydomain.layers) {
		this.obj = getObjNN4(mydomain,name);
		this.style = this.obj;
	}
}

function getObjNN4(obj,name) {
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++) {
		if (x[i].id == name)
			foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

function getStyle( el, styleProp ) {
	var x = new getObj( el );
	var y = null;
	if ( window.getComputedStyle )
		var y = window.getComputedStyle( x.obj, null ).getPropertyValue( styleProp );
	else if ( x.obj.currentStyle )
		var y = eval( 'x.obj.currentStyle.' + styleProp );
	return y;
}

// End of http://www.quirksmode.org

function screenObj() {
	this.screenW = 780;
	this.screenH = 400;
	if ( window.innerWidth ) {
	//if browser supports window.innerWidth
		this.screenW = window.innerWidth;
		this.screenH = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
	// Explorer 6 Strict Mode
		this.screenW = document.documentElement.clientWidth;
		this.screenH = document.documentElement.clientHeight;
	} else if ( document.all ) {
	//else if browser supports document.all (IE 4+)
		this.screenW = document.body.clientWidth;
		this.screenH = document.body.clientHeight;
	}
}

function addEvent( obj, evType, fn ) {
	if ( obj.addEventListener ) {
		obj.addEventListener( evType, fn, false );
		return true;
	} else if ( obj.attachEvent ) {
		obj.attachEvent( "on" + evType, fn );
		return true;
	} else {
		return false;
	}
}
