
var pf = {};
pf.ie = /MSIE/.test(navigator.userAgent);

pf.ge = function(x) { return document.getElementById(x); };
pf.ce = function(x, top, left) { 
    var elt = document.createElement(x); 
    elt.style.position = 'absolute';
    elt.style.top = top + 'px';
    elt.style.left = left + 'px';
    return elt;
};

pf.ac = function(x,y) { return x.appendChild(y); };
pf.lc = function(s) { return s.toLowerCase(); };

pf.event = function(e) {
    if (e) return e;
    return window.event;
};

pf.mouseX = function (e) {
    if (e.pageX) return e.pageX;

    ds = document.documentElement.scrollLeft;
    if (e.clientX) return e.clientX + (ds ? ds : document.body.scrollLeft);

    return null;
};

pf.mouseY = function (e) {
    if (e.pageY) return e.pageY;

    ds = document.documentElement.scrollTop;
    if (e.clientY) return e.clientY + (ds ? ds : document.body.scrollTop);

    return null;
};

// strip trailing 'px' from CSS values
pf.numeric = function(val) {
    return 1 * val.substr(0, val.lastIndexOf('p'));
};

pf.resize = function(img, w, h)
{
    img.width = w;
    img.height = h;

    // IE
    img.style.width = w + 'px';
    img.style.height = h + 'px';
};

pf.loadXML = function(url, handler)
{
    var r = new XMLHttpRequest();

    r.onreadystatechange = function() {
        if (r.readyState == 4 && r.status == 200) {
            handler(r.responseXML);
        };
    };

    r.open("GET", url);
    r.send(null);    
};


