﻿function enlarge(pid, vid) {
    window.open("showpicture.aspx?pid=" + pid + "&vid=" + vid, "ShowPhoto", "menubar=0, toolbar=0, status=0, width=760, height=680, scrollbars=0, top=" + (screen.height - 680) / 2 + ", left=" + (screen.width - 760) / 2)
}

var xhr = null;
function createXHR(xhrObj) {
    if (xhrObj && xhrObj.readyState < 4 && browser.isGecko) {
        xhrObj.abort();
        xhrObj = null;
    }
    if (!xhrObj) {
        if (window.XMLHttpRequest) {
            try {
                xhrObj = new XMLHttpRequest();
            } catch (e) {
                xhrObj = null;
            }
        } else if (window.createRequest) {
            try {
                xhrObj = window.createRequest();
            }
            catch (e) {
                xhrObj = null;
            }
        } else if (window.ActiveXObject) {
            try {
                xhrObj = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xhrObj = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    xhrObj = null;
                }
            }
        }
    }
    return xhrObj;
}

var cX = 0;
var cY = 0;
var rX = 0;
var rY = 0;
var lw = 0;
var lh = 0;

function UpdateCursorPosition(e) { cX = e.pageX; cY = e.pageY; }
function UpdateCursorPositionDocAll(e) { cX = event.clientX; cY = event.clientY; }
if (document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
    if (self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if (document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if (document.all) {
        cX += rX;
        cY += rY;
    }
    lw = d.offsetWidth;
    lh = d.offsetHeight + 30;
    d.style.left = (cX - lw / 2) + "px";
    d.style.top = (cY - lh) + "px";
}

function hide_popup(d) {
    document.getElementById(d).style.display = "none";
}

function show_popup(d) {
    if (document.getElementById(d).style.display != "") {
        document.getElementById(d).style.display = "";
        var dd = document.getElementById(d);
        AssignPosition(dd);
    }
    else {
        document.getElementById(d).style.display = "none";
    }
}