﻿function UrlSearch() { //重复时只取最后一个
    var name, value;
    var str = window.location.href; //取得整个地址栏
    var num = str.indexOf("?")
    str = str.substr(num + 1); //取得所有参数
    var arr = str.split("&"); //各个参数放到数组里
    for (var i = 0; i < arr.length; i++) {
        num = arr[i].indexOf("=");
        if (num > 0) {
            name = arr[i].substring(0, num);
            value = arr[i].substr(num + 1);
            this[name] = value;
        }
    }
    this["getall"] = str;
}
var RQ = new UrlSearch(); //实例化
function formatStr(s) {
    if (typeof (s) == "string")
        return s;
    else
        return "";
}
function joinValue(parameter) {
    eval("var temp=RQ." + parameter);
    if ((typeof (temp) == "string") && (typeof (temp) != null)) {
        return "&" + parameter + "=" + temp.replace(/(^\s*)|(\s*$)/g, "");
    }
    else
        return "";
}
function q(parameter) {
    eval("var temp=RQ." + parameter);
    if ((typeof (temp) == "string") && (typeof (temp) != null)) {
        return temp.replace(/(^\s*)|(\s*$)/g, "");
    }
    else
        return "";
}
/*获取当前页页码*/
function thispage() {
    var r = /^\+?[1-9][0-9]*$/;
    if (r.test(q('page')))
        return q('page');
    else
        return "1";
}
//全选
function CheckAll(form) {
    var f;
    if (form == null)
        f = document.getElementsByTagName('FORM')[0];
    else
        f = document.getElementById(form);
    for (var i = 0; i < f.elements.length; i++) {
        var e = f.elements[i];
        if (e.name != 'chkall' && e.type == "checkbox")
            e.checked = document.getElementById("chkall").checked;
    }
}
//全不选
function CheckNo(form) {
    var f;
    if (form == null)
        f = document.getElementsByTagName('FORM')[0];
    else
        f = document.getElementById(form);
    for (var i = 0; i < f.elements.length; i++) {
        var e = f.elements[i];
        if (e.type == "checkbox")
            e.checked = false;
    }
}
function WinFullOpen(url) {
    var newwin = window.open("", "", "scrollbars");
    if (document.all) {
        newwin.moveTo(0, 0);
        newwin.resizeTo(screen.width, screen.height);
    }
    newwin.location = url;
}
String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
String.prototype.LTrim = function() { return this.replace(/(^\s*)/g, ""); }
String.prototype.RTrim = function() { return this.replace(/(\s*$)/g, ""); }




















function SelectAllChkbox(flag) {
    var getChkboxs = document.getElementsByName("chkbox");
    for (var i = getChkboxs.length - 1; i >= 0; i--) {
        getChkboxs[i].checked = flag;
    }
}
function selectAllChkboxs() {
    var getChkboxs = document.getElementsByName("chkbox");
    var getchkbox = document.getElementById("ChkAll");
    for (var i = 0; i < getChkboxs.length; i++) {
        getChkboxs[i].checked = getchkbox.checked;
    }
}
function UnselectChkAllBtn() {
    var getchkbox = document.getElementById("ChkAll");
    if (getchkbox.checked) getchkbox.checked = false;
}






function Do_W_R(str, str1) {
    var TT = $("#" + str).attr("value");
    if (TT == '0') {
        $(str1).html("×");
    }
    $(str1).html("√");
}

$("input").focus(
  function() {
      $(this).addClass("oncus");
  }
);
$("input").blur(
  function() {
      $(this).removeClass("oncus");
  },
  function() {
      $(this).addClass("input01");
  }
);

function doZoom(size) {
    document.getElementById('zoom').style.fontSize = size + 'px'
}
