jsf_browser = (document.all ? "IE" : (window.opera ? "OPERA" : "MOZILLA"));

function jsfFindObj(n, d)
{
	var p,i,x;
	if(!d) {
		d = document;
	}

	if((p=n.indexOf("?")) > 0 && parent.frames != null && parent.frames.length) {
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}

	if(!(x = d[n]) && d.all) {
		x = d.all[n];
	}

	for(i = 0; !x && d.layers && i < d.layers.length; i++) {
		x = jsfFindObj(n,d.layers[i].document);
	}

	if(!x && d.getElementById) {
		x=d.getElementById(n);
	}
	
    return x;
}

function jsfGetMouseX(e)
{
    if(jsf_browser == "OPERA") {
        return e.clientX;
    }
    else {
        if(jsf_browser == "IE") {
            return document.body.scrollLeft + event.clientX;
        }
        else {
            if(jsf_browser == "MOZILLA") return e.pageX;
        }
    }
}

function jsfGetMouseY(e)
{
    if(jsf_browser == "OPERA") {
        return e.clientY;
    }
    else {
        if(jsf_browser == "IE") {
             return document.body.scrollTop+event.clientY;
        }
        else {
            if(jsf_browser == "MOZILLA") return e.pageY;
        }
    }
}

function jsfGetObjectX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function jsfGetObjectY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function jsfGetObjectWidth(obj)
{
    return obj.offsetWidth;
}

function jsfSetObjectWidth(obj, width)
{
    obj.style.width = width;
}


function jsfGetObjectHeight(obj)
{
    return obj.offsetHeight;
}

function jsfSetObjectHeight(obj, height)
{
    obj.style.height = height;
}

function jsfCreateFlash(id, src, width, height)
{
    return '<EMBED id="'+id+'" src="'+src+'" quality="high" bgcolor="#FFFFFF"  WIDTH="'+width+'" HEIGHT="'+height+'" NAME="'+id+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
}

function jsfGetBrowserWidth()
{
    if(jsf_browser == "IE") return document.body.offsetWidth;
    return document.body.clientWidth;
}

function jsfGetBrowserHeight()
{
    if(jsf_browser == "IE") return document.body.offsetHeight;
    return document.body.clientHeight;
}

