﻿
(function() {

    pnx = {};

    pnx.GetXY = function(XY) {
        return (XY == 'x') ? event.clientX + document.body.scrollLeft : event.clientY + document.body.scrollTop;
    };

    pnx.eventXY = function(event, XY) {
        return (XY == 'x') ? event.clientX + document.body.scrollLeft : event.clientY + document.body.scrollTop;
    };


    pnx.closeWin = function(returnObj) {
        window.returnValue = returnObj;
        window.close();
    };

    pnx.closeObj = function(returnObj) {
    Obj.returnValue = returnObj;
    Obj.close();
    };

    pnx.IsSure = function(GO, MSG) {
        if (confirm(MSG)) { eval(GO); }
    };


    pnx.OnlyNum = function() {
        if (event.keyCode < 48 || event.keyCode > 57) { event.keyCode = 0; }
    };


    pnx.OnlyEng = function() {
        if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 97 && event.keyCode <= 122)) {
            return
        }
        else {
            event.keyCode = 0;
        }
    };



    pnx.IsTel = function(TEL) {
        var i, j, strTemp;
        strTemp = '0123456789-()#';
        for (i = 0; i < TEL.length; i++) {
            j = strTemp.indexOf(TEL.charAt(i));
            if (j == -1) {
                return false;
            }
        }
        return true;
    };


    pnx.IsNum = function(NUM) {
        var i, j, strTemp;
        strTemp = '0123456789';
        if (NUM.length == 0) {
            return false;
        }
        for (i = 0; i < NUM.length; i++) {
            j = strTemp.indexOf(NUM.charAt(i));
            if (j == -1) {
                return false;
            }
        }
        return true;
    };



    pnx.IsCn = function(str) {
        var strSource = '_.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        var ch;
        var i;
        var temp;
        for (i = 0; i <= (str.length - 1); i++) {
            ch = str.charAt(i);
            temp = strSource.indexOf(ch);
            if (temp == -1) {
                return false;
            }
        }
        if (strSource.indexOf(ch) == -1) {
            return false;
        }
        else {
            return true;
        }
    };



    pnx.IsEmail = function(a) {
        if (Txt(a) == 0) {
            return false;
        }
        var i = a.length;
        var temp = a.indexOf('@');
        var tempd = a.indexOf('.');
        if (temp > 1) {
            if ((i - temp) > 3) {
                if ((i - tempd) > 0) {
                    return true;
                }
            }
        }
        return false;
    };



    pnx.strLen = function(strTemp) {
        var i, sum;
        sum = 0;
        for (i = 0; i < strTemp.length; i++) {
            if ((strTemp.charCodeAt(i) >= 0) && (strTemp.charCodeAt(i) <= 255)) {
                sum = sum + 1;
            }
            else {
                sum = sum + 2;
            }
        }
        return sum;
    };






    pnx.IsTxt = function(a) {
        if (a.length < 1) { return false; }
        if (a.indexOf("'") != -1) { return false; }
        if (a.indexOf(",") != -1) { return false; }
        if (a.indexOf("/") != -1) { return false; }
        if (a.indexOf("\\\\") != -1) { return false; }
        if (a.indexOf("\\ ") != -1) { return false; }
        if (a.indexOf("<") != -1) { return false; }
        if (a.indexOf(">") != -1) { return false; }
        return true;
    };



    pnx.IsTxt2 = function(a) {
        if (a.length < 1) {
            return false;
        }
        return true;
    };



    pnx.IsTxt3 = function(a) {
        if (a.length < 1) { return false; }
        if (a.indexOf("'") != -1) { return false; }
        if (a.indexOf(",") != -1) { return false; }
        if (a.indexOf("/") != -1) { return false; }
        if (a.indexOf("\\\\") != -1) { return false; }
        if (a.indexOf("<") != -1) { return false; }
        if (a.indexOf(">") != -1) { return false; }
        return true;
    };







    pnx.Checked = function(FormName, Field) {
        T = 'document.all.L.' + Field + '.length;';
        c = 0; len = eval(T);

        for (i = 0; i < len; i++) {
            T = 'document.all.L.' + Field + '[' + i + '].checked;';
            if (eval(T)) { c++; }
        }

        if (c > 0) {
            return true;
        }
        else {
            return false;
        }
    };



    pnx.CheckAll = function(FormName, SelName) {
        T = 'for (var i=0;i<' + FormName + '.elements.length;i++)';
        T += '{';
        T += 'var e =' + FormName + '.elements[i];';
        T += 'if (e.name == "' + SelName + '"){e.checked =' + FormName + '.chkall.checked;}';
        T += '}';
        eval(T);
    };


    pnx.OpenMenu = function(obj) {
        onmouseout = document.getElementById(obj).style.display = ""
    }


    pnx.CloseMenu = function(obj) {
        onmouseout = document.getElementById(obj).style.display = "none"
    };




    pnx.Co = function(j) {
        T = 'if(document.getElementById("' + j + '").style.display=="none"){document.getElementById("' + j + '").style.display="";}else{document.getElementById("' + j + '").style.display="none";}';
        eval(T);
    };

    pnx.CoX = function(j) {
        T = 'if(document.getElementById("' + j + '").style.display=="none"){document.getElementById("' + j + '").style.display="";document.images.P' + j + '.src="NX_Public/img/line_0_1.gif";}else{document.getElementById("' + j + '").style.display="none";document.images.P' + j + '.src=\"NX_Public/img/line_2_1.gif";}';
        eval(T);
    };

    pnx.XL = function(j) {
        T = 'if(' + j + '.style.display=="none"){' + j + '.style.display="";document.images.P' + j + '.src=CssUrl+"/img/line_0.gif";}else{' + j + '.style.display="none";document.images.P' + j + '.src=CssUrl+"/img/line_2.gif";}';
        eval(T);
    };


    pnx.DisplayNone = function(obj) {
        document.getElementById(obj).style.display = "none"
    };


    pnx.Display = function(obj) {
        document.getElementById(obj).style.display = ""
    };


    pnx.CSize = function(obj) {
        y = eval('parseFloat(document.all.' + obj + '.offsetHeight)');
        x = eval('parseFloat(document.all.' + obj + '.offsetWidth)');
        ex = parseInt(event.clientX);
        ey = parseInt(event.clientY);

        eval('document.all.' + obj + '.style.width=ex');
        eval('document.all.' + obj + '.style.height=ey');

    };




    pnx.ResSize = function(obj, obj2) {
        y = eval('parseFloat(document.all.' + obj2 + '.Y.value)');
        x = eval('parseFloat(document.all.' + obj2 + '.X.value)');
        eval('document.all.' + obj + '.style.width=x');
        eval('document.all.' + obj + '.style.height=y');
    };



    pnx.Line = function(css, h) {
        document.write("<table class='body_width " + css + "' cellspacing=0 cellpadding=0><td height=" + h + "></td></table>");
    };




 pnx.DisFloat=function(obj)
{
x=document.body.scrollLeft;
y=document.body.scrollTop;
GD=document.getElementById(obj);
GD.style.top=y
GD.style.left=x
GD.style.display=""
}

 pnx.CG=function(obj)
{
x=parseInt(document.getElementById(obj).style.left)
y=parseInt(document.getElementById(obj).style.top)
w=parseInt(document.body.clientWidth)
h=parseInt(document.body.clientHeight)
document.getElementById(obj).style.left=x+(w-550)/2
document.getElementById(obj).style.top=y+(h-300)/2

}









})();

