var cW, cH, bW, bH, sW, sH;
function MouseEvent(e) {
    this.x = e.pageX;
    this.y = e.pageY;
    this.l = e.clientX;
    this.t = e.clientY;
}


function popupwin(url, name, width, height, options) {
    if ($.browser.msie) {
        var win = window.showModelessDialog(url, window, "status:false;dialogWidth:" + (width) + "px;dialogHeight:" + (height + 30) + "px;edge:Raised; help: 0; resizable: 0; status: 0;scroll:0;");
    }
    else {
        xposition = 0;
        yposition = 0;
        if ((parseInt(navigator.appVersion) >= 4)) {
            xposition = (screen.width - width) / 2;
            yposition = (screen.height - height) / 2;
        }
        theproperty = "width=" + width + "," + "height=" + height + "," + "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition + "," + options;
        var win = window.open(url, name, theproperty);
        win.focus();
    }
    return false;
}

function hide_select(a, b, c) {
    $("select").each(function(i) {
        var t = a == 0 ? "hidden": "visible";
        var r = b == 0 ? "": "[" + b + "*='" + c + "']";
        if ($.browser.version == 6.0) $("select" + r).css({
            visibility: t
        });
    });
}

function layerswich() {
    $("#boxswitch div").click(function() {
        $(this).removeClass().addClass('on').siblings().removeClass().addClass('off');
        $("#" + $(this).attr("title")).removeClass().addClass('show').siblings().removeClass().addClass('hide');
    });
}

function createElem(tagName, intObject) {
    intObject = intObject || {};
    var newTag = document.createElement(tagName);
    for (var i in intObject) {
        newTag[i] = intObject[i];
    }
    return newTag;
}

function preImages(arr) {
    for (i = 0; i < arr.length; i++) {
        var img = new Image();
        img.src = arr[i];
    }
}

function getClientSize() {
    var dd = document.documentElement,
    db = document.body;
    cW = dd.clientWidth;
    cH = dd.clientHeight;
    bW = db.offsetWidth;
    bH = db.offsetHeight;
    sH = dd.scrollHeight;
    sW = dd.scrollWidth;
}
function getScrollTop() {
    function ieTrueBody() {
        return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement: document.body;
    }
    return $.browser.msie ? ieTrueBody().scrollTop: window.pageYOffset;
}