function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function print_r(obj,hideValue){ 
     var objString = '<ul>';
     
     for( var varName in obj ) {
     	objString += '<li>'+ varName +'('+ typeof obj[varName] +')';
     	
     	if ( typeof obj[varName] == 'object' ) {
     		if ( hideValue ) continue;
     		objString += print_r(obj[varName],true);
     	} else {
     		objString += ':'+ escape(obj[varName]);
     	}
     }
     objString += '</ul>';
     return objString;
}

/*has a negative effect on input-field's focus...in IE (whenever deselect is called, the currentinput field, loses its focus)*/
function deselect(){
	if ( document.selection ) document.selection.empty();
	else if ( window.getSelection ) window.getSelection().removeAllRanges();
}

function rdebug(obj){
	debug(print_r(obj));
}

function debug(value){
	document.getElementById('debugOut').innerHTML += '<br>'+value;
}

function stopEvent(event){
	if ( event.stopPropagation ) { event.stopPropagation(); }
	else { event.cancelBubble = true; }
}