var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;

function getMouseXY(e) {

  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
    tempY = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  

  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

}
function create(name) {
	return document.createElement(name);	
}
if(!Array.indexOf){ // IE duuuh! fix				///////	
	Array.prototype.indexOf = function(obj){		///////
		for(var arrayIndexCounter=0; arrayIndexCounter<this.length; arrayIndexCounter++){			///////
			if(this[arrayIndexCounter]==obj){						///////
				return arrayIndexCounter;							///////
			}										///////
		}											///////
		return -1;									///////
	}												///////
}
if (!Array.filter) { //more IE duuh! fixes
	Array.prototype.filter = function(filterFunction) {
		Collection = new Array();
		for (arrayFilterCounter = 0; arrayFilterCounter < this.length; arrayFilterCounter++) {
			flag = filterFunction(this[arrayFilterCounter], arrayFilterCounter, this);
			if (flag) Collection.push(this[arrayFilterCounter]);
		}
		return Collection;
	}

}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
function hitTestArea(ARGS, x,y) {
	retHit = false;
	for (i = 0; i < ARGS.length; i++) {
		elem = ARGS[i];
		offsets = absoluteObjectPosition(elem);
		offsetLeft = offsets.left;
		offsetTop = offsets.top;
		L = offsetLeft ;
		R = offsetLeft + elem.offsetWidth ;
		T = offsetTop ;
		B = offsetTop + elem.offsetHeight ;
		if((L < x && x < R) && (T < y && y < B ) ) {
			retHit = true; break;
		}
	}
	return retHit;
}
function getE(name) {
	return document.getElementById(name);
}
function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
		target.onmousedown=function(){return false}
	target.style.cursor = "default"
}
function addslashes(str) {
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}
function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\0/g,'\0');
	str=str.replace(/\\\\/g,'\\');
	return str;
}
function HTMLDecode(str) {
	str = decodeURI(str);
	str = unescape(str);
	tx = create('textarea');
	tx.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
	return tx.value;
}
function stopPropogation(e) {
	var event = e || window.event;
	if (event.stopPropagation) event.stopPropagation();
	else event.cancelBubble = true;
}
function absoluteObjectPosition(obj, anchor) {
	var curleft = 0;
	var curtop = 0;
	if (obj.offsetParent) {
		do {
				if (anchor) if (obj == anchor) break;
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return {left:curleft, top:curtop};
}
function getDisplayDimentions() {
	if (IE) return {width: document.body.clientWidth, height: document.body.clientHeight};
	else return {width: innerWidth, height: innerHeight};
}	

