// basics

function getW(obj){
   return obj.offsetWidth;
}

function getH(obj){
   return obj.offsetHeight;
}

function getX(obj){
   return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}

function getY(obj) {
   return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}

function d(obj) {
	if (!document.getElementById(obj)) {
		document.body.innerHTML+="<div id="+obj+"></div>";
	}
	return document.getElementById(obj);
}

function check(_me_out) {
	d("check").innerHTML=_me_out;
}
function replace(string,text,by) {
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}