﻿//获取html元素对象
function getHtmlObjects(objId) {
    return document.getElementById(objId);
}

//替换字符串"
function getReplaceStr(objStr) {
    return objStr.replace('"', '&quot;').replace('"', '&quot;').replace('"', '&quot;').replace('"', '&quot;').replace('"', '&quot;').replace('"', '&quot;').replace('"', '&quot;');
}

var attribobj = "";

var xmlhttp = false;
//******请求状态*******//
var states = ["正在初始化……",
                    "正在加载文件……",
                    "正在获取图标……",
                    "正在解析数据……",
                    "文件读取完成！"];

//------------------------------------------------------------创建XMLHTTP对象----------------------------------------------------------------------//
function CreateXMLHttp() {
    try {
        xmlhttp = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (failed) {
                xmlhttp = false;
            }
        }
    }
    return xmlhttp;
}

//---------------------------------------------异步请求获取产品类型****//参数产品ID-----------------------------------------------//
function RequsetProTypeLoad() {
    var productId = document.getElementById("ctl00_ContentPlaceHolder1_ddl_product").value;
    xmlHttp = CreateXMLHttp(); //获取XMLHTTP对象
    xmlHttp.open("get", "protypeload.aspx?productId=" + productId + "&rid=" + Math.random(), true);
    //注册状态变化时的处理函数
    xmlHttp.onreadystatechange = function() {
        //readyState有5种:
        //0-未初始化，1-载入中，2-已载入，3-交互中，4-完成
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                //200表示一切正常，可以正常处理结果
                var jsontext = xmlHttp.responseText;
                var json = window.eval("(" + jsontext + ")");
                attribobj = json;
                loadProducTtype(json);
            }
        }
    }
    xmlHttp.send(); //一切准备工作做好后，发送请求
}

//-----------------------------------------------------加载产品类型(当3个属性加载)-------------------------------------------------------//
var typeindex = 0;
function loadProducTtype(jsonProTypeStr) {
    if (jsonProTypeStr[0] == null) {
        getHtmlObjects("typetd").innerHTML = "";
        getHtmlObjects("attributetd").innerHTML = "";
        getHtmlObjects("statd").innerHTML = "";
        getHtmlObjects("custd").innerHTML = "";
        return;
    }

    var typeattstr = getHtmlObjects("ctl00_ContentPlaceHolder1_typeattribstr").value;
    if (typeattstr != "") {
        var typeattsp = typeattstr.split(',');
        typeindex = typeattsp[0];
    }

    getHtmlObjects("ctl00_ContentPlaceHolder1_unitname").value = jsonProTypeStr[0].UnitName;
    var typehtml = "";
    if (jsonProTypeStr[0].AttribCount == 3) {
        typehtml += " <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"169pxpx\">";
    }
    if (jsonProTypeStr[0].AttribCount == 2) {
        typehtml += " <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"226px\">";
    }
    if (jsonProTypeStr[0].AttribCount == 4) {
        typehtml += " <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"135px\">";
    }
    typehtml += "<tr>";
    typehtml += "<th height=\"10px\" align=\"left\" style=\"padding-bottom: 3px; padding-top: 3px; padding-left: 3px;\">";
    typehtml += "类型";
    typehtml += "</th>";
    typehtml += "</tr>";
    typehtml += "<tr>";
    typehtml += "<td align=\"center\">";
    if (jsonProTypeStr[0].AttribCount == 3) {
        typehtml += "<select id=\"protype\" size=\"13\" style=\"width: 163px;\" onchange=\"RequsetArrbuteLoad()\" runat=\"server\">";
    }
    if (jsonProTypeStr[0].AttribCount == 2) {
        typehtml += "<select id=\"protype\" size=\"13\" style=\"width: 220px;\" onchange=\"RequsetArrbuteLoad()\" runat=\"server\">";
    }
    if (jsonProTypeStr[0].AttribCount == 4) {
        typehtml += "<select id=\"protype\" size=\"13\" style=\"width: 129px;\" onchange=\"RequsetArrbuteLoad()\" runat=\"server\">";
    }
    //循环属性值
    for (var b = 0; b < jsonProTypeStr.length; b++) {
        if (b == typeindex) {
            typehtml += " <option title=\"" + getReplaceStr(jsonProTypeStr[b].TypeName) + "\" value=\"" + jsonProTypeStr[b].TypeId + "\" selected=\"selected\">" + jsonProTypeStr[b].TypeName + "</option>";
        } else {
            typehtml += " <option title=\"" + getReplaceStr(jsonProTypeStr[b].TypeName) + "\"  value=\"" + jsonProTypeStr[b].TypeId + "\">" + jsonProTypeStr[b].TypeName + "</option>";
        }
    }
    typehtml += "</select>";
    typehtml += "</td>";
    typehtml += "</tr>";
    typehtml += "</table>";
    getHtmlObjects("typetd").innerHTML = typehtml;
    RequsetArrbuteLoad();
}


//-------------------------------------异步请求获取属性和属性值****//参数产品类型ID------------------------------------------//
function RequsetArrbuteLoad() {
    var typeId = getHtmlObjects("protype").value;
    xmlHttp = CreateXMLHttp(); //获取XMLHTTP对象
    xmlHttp.open("get", "attbload.aspx?typeId=" + typeId + "&rid=" + Math.random(), true);
    //注册状态变化时的处理函数
    xmlHttp.onreadystatechange = function() {
        //readyState有5种:
        //0-未初始化，1-载入中，2-已载入，3-交互中，4-完成
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                //200表示一切正常，可以正常处理结果
                var jsontext = xmlHttp.responseText;
                var json = window.eval("(" + jsontext + ")");
                loadProductArrbute3(json);
            }
        }
    }
    xmlHttp.send(); //一切准备工作做好后，发送请求
}

var index = 0;
//----------------------------------------------------------加载产品属性（3个属性）------------------------------------------------------//
function loadProductArrbute3(jsonstr) {
    attribobj = jsonstr;
    if (jsonstr.length == 0) {
        getHtmlObjects("attributetd").innerHTML = "";
        return;
    }
    var proattribhtml = "";
    proattribhtml += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
    proattribhtml += "<tr>";
    //循环遍历属性
    for (var i = 0; i < jsonstr.length; i++) {
        var typeattstr = getHtmlObjects("ctl00_ContentPlaceHolder1_typeattribstr").value;
        if (typeattstr == "undefined") {
            var typeattsp = typeattstr.split(',');
            index = typeattsp[i + 1];
        }

        var jsonattribvalue = window.eval("(" + jsonstr[i].AttribValueJson + ")");
        proattribhtml += "<td>";

        //加载对应属性个数的界面
        if (jsonstr.length == 3) {
            proattribhtml += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"169px\">";
        }
        if (jsonstr.length == 2) {
            proattribhtml += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"226px\">";
        }
        if (jsonstr.length == 4) {
            proattribhtml += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t1\" width=\"135px\">";
        }
        proattribhtml += "<tr>";
        proattribhtml += "<th height=\"10px\" align=\"left\" style=\"padding-bottom: 3px; padding-top: 3px; padding-left: 3px;\">";
        //属性名称
        proattribhtml += jsonstr[i].AttribName;
        proattribhtml += "</th>";
        proattribhtml += "</tr>";
        proattribhtml += "<tr>";
        proattribhtml += "<td align=\"center\">"

        if (jsonstr.length == 3) {
            proattribhtml += "<select id=\"attrib" + i + "\" name=\"att\" size=\"13\" style=\"width: 163px;\" onchange=\"Standard();Customize()\" >";
        }
        if (jsonstr.length == 2) {
            proattribhtml += "<select id=\"attrib" + i + "\" name=\"att\" size=\"13\" style=\"width: 220px;\" onchange=\"Standard();Customize()\">";
        }
        if (jsonstr.length == 4) {
            proattribhtml += "<select id=\"attrib" + i + "\" name=\"att\" size=\"13\" style=\"width: 129px;\" onchange=\"Standard();Customize()\">";
        }
        //循环属性值
        for (var j = 0; j < jsonattribvalue.length; j++) {
            if (j == index) {

                proattribhtml += " <option title=\"" + getReplaceStr(jsonattribvalue[j].ValueName) + "\" value=\"" + jsonattribvalue[j].ValueId + "\" selected=\"selected\">" + jsonattribvalue[j].ValueName + "</option>";
            } else {
                proattribhtml += " <option title=\"" + getReplaceStr(jsonattribvalue[j].ValueName) + "\" value=\"" + jsonattribvalue[j].ValueId + "\" >" + jsonattribvalue[j].ValueName + "</option>";
            }
        }
        proattribhtml += "</select>";
        proattribhtml += "</td>";
        proattribhtml += "</tr>";
        proattribhtml += "</table>";
        proattribhtml += "</td>";
    }
    proattribhtml += "</tr>";
    proattribhtml += "</table>";
    //显示属性框
    getHtmlObjects("attributetd").innerHTML = proattribhtml;
    Standard();
    Customize();
    setagotypeattrivalue();
}

//标准规格
function Standard() {
    //标准规格Type
    var selectedTypeName = getReplaceStr(getHtmlObjects("protype").options[getHtmlObjects("protype").selectedIndex].text);
    var attvaluearr = new Array();
    var attvaluearrid = new Array();
    for (var m = 0; m < attribobj.length; m++) {

        var selattobj = getHtmlObjects("attrib" + m);

        attvaluearr[m] = getReplaceStr(selattobj.options[selattobj.selectedIndex].text);
        attvaluearrid[m] = selattobj.value;
    }

    //-----------------------------------------------------标准规格-------------------------------------------------------//
    var standardhtml = "";
    standardhtml += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\" >";
    standardhtml += " 类型：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txttypename\" type=\"hidden\" value=\"类型\" /><input id=\"txttypevalue\" type=\"text\" value=\"" + selectedTypeName + "\" readonly=\"readonly\" class=\"smallInput3\" />";
    standardhtml += "</td>";
    standardhtml += "</tr>";


    for (var h = 0; h < attribobj.length; h++) {
        standardhtml += " <tr>";
        standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\" >";
        standardhtml += attribobj[h].AttribName + "：";
        standardhtml += " </td>";
        standardhtml += " </td>";
        standardhtml += " <td width=\"80%\">";
        standardhtml += "<input id=\"txtattrib" + h + "\" type=\"hidden\" value=\"" + attribobj[h].AttribName + "\" /><input id=\"txtattribvalue" + h + "\" type=\"text\" value=\"" + attvaluearr[h] + "\" class=\"smallInput3\" readonly=\"readonly\" />";
        standardhtml += "<input id=\"txtattribvalueid" + h + "\" type=\"hidden\" value=\"" + attvaluearrid[h] + "\" />";
        standardhtml += "</td>";
        standardhtml += "</tr>";
    }
    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\" >";
    standardhtml += "款数：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txtcount\" type=\"hidden\" value=\"款数\" /><input id=\"txtcountvalue\" type=\"text\" value=\"1\" size=\"4\" class=\"smallInput4\" onblur=\"showprice()\" onkeyup=\"value=value.replace(/[^\\d]/g,'')\" /><br />";
    standardhtml += "</td>";
    standardhtml += "</tr>";

    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\" >";
    standardhtml += "单位：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txtunit\" type=\"hidden\" value=\"单位\" /><input id=\"txtunitvalue\" type=\"text\" value=\"" + getHtmlObjects("ctl00_ContentPlaceHolder1_unitname").value + "\" size=\"4\" class=\"smallInput3\" readonly=\"readonly\" /><br />";
    standardhtml += "</td>";
    standardhtml += "</tr>";
    standardhtml += "</table>";
    getHtmlObjects("statd").innerHTML = standardhtml;
    //设置类型属性信息

}

//-------------------------------------------------自定义规格------------------------------------------------------//
function Customize() {
    //自定义规格type
    var selectedTypeName = getReplaceStr(getHtmlObjects("protype").options[getHtmlObjects("protype").selectedIndex].text);
    var attvaluearr = new Array();
    var attvaluearrid = new Array();
    for (var m = 0; m < attribobj.length; m++) {
        var selattobj = getHtmlObjects("attrib" + m);
        attvaluearr[m] = getReplaceStr(selattobj.options[selattobj.selectedIndex].text);
        attvaluearrid[m] = selattobj.value;
    }

    //自定义规格
    var standardhtml = "";
    standardhtml += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\">";
    standardhtml += " 类型：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txtcustypename\" type=\"hidden\" value=\"类型\" /><input id=\"txtcustypevalue\" type=\"text\" onblur=\"setTypeorAttribInfo();inputcustypeattrib()\" value=\"" + selectedTypeName + "\"  class=\"smallInput5\" />";
    standardhtml += "</td>";
    standardhtml += "</tr>";

    for (var h = 0; h < attribobj.length; h++) {
        standardhtml += " <tr>";
        standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\">";
        standardhtml += attribobj[h].AttribName + "：";
        standardhtml += " </td>";
        standardhtml += " </td>";
        standardhtml += " <td width=\"80%\">";
        standardhtml += "<input id=\"txtcusattrib" + h + "\" type=\"hidden\" value=\"" + attribobj[h].AttribName + "\" /><input id=\"txtcusattribvalue" + h + "\" type=\"text\" onblur=\"setTypeorAttribInfo();inputcustypeattrib()\" value=\"" + attvaluearr[h] + "\" class=\"smallInput5\"/>";
        standardhtml += "<input id=\"txtcusattribvalueid" + h + "\" type=\"hidden\"  value=\"" + attvaluearrid[h] + "\" />";
        standardhtml += "</td>";
        standardhtml += "</tr>";
    }
    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\">";
    standardhtml += "款数：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txtcuscount\" type=\"hidden\" value=\"款数\" /><input id=\"txtcuscountvalue\"  type=\"text\" onblur=\"setTypeorAttribInfo();inputcustypeattrib()\" value=\"1\" size=\"4\" class=\"smallInput5\"  onkeyup=\"value=value.replace(/[^\\d]/g,'')\" /><br />";
    standardhtml += "</td>";
    standardhtml += "</tr>";
    standardhtml += " <tr>";
    standardhtml += "<td  align=\"right\" width=\"20%\" style=\"font-size: 12px;height:21px;\">";
    standardhtml += "单位：";
    standardhtml += " </td>";
    standardhtml += " <td width=\"80%\">";
    standardhtml += "<input id=\"txtcusunit\" type=\"hidden\" value=\"单位\" /><input id=\"txtcusunitvalue\" type=\"text\" onblur=\"setTypeorAttribInfo();inputcustypeattrib()\" value=\"" + getHtmlObjects("ctl00_ContentPlaceHolder1_unitname").value + "\" size=\"4\" class=\"smallInput3\" readonly=\"readonly\" /><br />";
    standardhtml += "</td>";
    standardhtml += "</tr>";
    standardhtml += "</table>";
    getHtmlObjects("custd").innerHTML = standardhtml;
    setTypeorAttribInfo();
    showprice();

}


/*----------------------------------设置类型、属性、和款数--------------------------------*/
function setTypeorAttribInfo() {

    var productInfo = "";
    var productname = getHtmlObjects("ctl00_ContentPlaceHolder1_ddl_product").options[getHtmlObjects("ctl00_ContentPlaceHolder1_ddl_product").selectedIndex].text;
    getHtmlObjects("ctl00_ContentPlaceHolder1_productname").value = productname;

    var iscusorstdflag = getHtmlObjects("ctl00_ContentPlaceHolder1_cusisstdflag").value;
    //标准规格
    if (iscusorstdflag == "标准") {
        var typename = getHtmlObjects("txttypename").value;
        var typevalue = getHtmlObjects("txttypevalue").value;
        productInfo += typename + ":" + typevalue + "##";
        for (var q = 0; q < attribobj.length; q++) {
            productInfo += getHtmlObjects("txtattrib" + q).value + ":" + getHtmlObjects("txtattribvalue" + q).value + "##";
        }
        var count = getHtmlObjects("txtcount").value;
        var countvalue = getHtmlObjects("txtcountvalue").value;
        var unitvalue = getHtmlObjects("txtunitvalue").value;

        getHtmlObjects("ctl00_ContentPlaceHolder1_procount").value = countvalue;
        getHtmlObjects("ctl00_ContentPlaceHolder1_unit").value = unitvalue;
    }

    //自定定义
    if (iscusorstdflag == "自定义") {

        var typename = getHtmlObjects("txtcustypename").value;
        var typevalue = getHtmlObjects("txtcustypevalue").value;

        productInfo += typename + ":" + typevalue + "##";
        for (var q = 0; q < attribobj.length; q++) {

            productInfo += getHtmlObjects("txtcusattrib" + q).value + ":" + getHtmlObjects("txtcusattribvalue" + q).value + "##";
        }
        var count = getHtmlObjects("txtcuscount").value;
        var countvalue = getHtmlObjects("txtcuscountvalue").value;
        var unicustvalue = getHtmlObjects("txtcusunitvalue").value;


        getHtmlObjects("ctl00_ContentPlaceHolder1_procount").value = countvalue;
        getHtmlObjects("ctl00_ContentPlaceHolder1_unit").value = unicustvalue;

    }

    getHtmlObjects("ctl00_ContentPlaceHolder1_productinfo").value = productInfo;
}

/*----------------------------获取自定义规格输入值---------------------------*/
function inputcustypeattrib() {
    var typeattb = "";
    var typevalue = getHtmlObjects("txtcustypevalue").value;
    typeattb += typevalue + "|";
    for (var q = 0; q < attribobj.length; q++) {
        typeattb += getHtmlObjects("txtcusattribvalue" + q).value + "|";
    }

    var countvalue = getHtmlObjects("txtcuscountvalue").value;
    var unicustvalue = getHtmlObjects("txtcusunitvalue").value;
    typeattb += countvalue + "|" + unicustvalue;

    getHtmlObjects("ctl00_ContentPlaceHolder1_custypeattrib").value = typeattb;

}

/*---------------------------------------------------标准产品报价------------------------------------------------------*/
function showprice() {
    var keys = "";
    var count = parseInt(getHtmlObjects("txtcountvalue").value);
    if (!textsizvalidate(getHtmlObjects("txtcountvalue").value)) {
        return;
    }
    for (var q = 0; q < attribobj.length; q++) {
        keys += getHtmlObjects("txtattribvalueid" + q).value + ",";
    }
    xmlHttp = CreateXMLHttp(); //获取XMLHTTP对象
    xmlHttp.open("get", "calculationprice.aspx?keys=" + keys + "&count=" + count + "&rid=" + Math.random(), true);

    xmlHttp.onreadystatechange = function() {
        getHtmlObjects("pricetd").innerHTML = "<img src='/images/loadprice.gif'/><h2 style=\"color: Red;\">正在处理<h2>";
        //0-未初始化，1-载入中，2-已载入，3-交互中，4-完成
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                //200表示一切正常，可以正常处理结果
                var price = xmlHttp.responseText;
                var pricehtml = "";
                if (price == "0") {
                    pricehtml += " <h3 style=\"color: Red;\">暂无估算报价</h3>";
                } else {
                    pricehtml += " <font color=\"blue\">估算合计价格</font>（<font color=\"red\" size=\"2px\">不包含后加工</font>）:<br /><h2 style=\"color: Red;\">￥" + price + "</h2>";
                }

                getHtmlObjects("pricetd").innerHTML = pricehtml;
                setTypeorAttribInfo();
                getHtmlObjects("ctl00_ContentPlaceHolder1_price").value = price;
                if (getHtmlObjects("ctl00_ContentPlaceHolder1_cusisstdflag").value != "标准") {
                    cusprocess();
                }
            }
        }
    }
    xmlHttp.send();
}

/*---------------------------自定义规格处理---------------------*/
function cusprocess() {

    getHtmlObjects("pricetd").innerHTML = "<h4 style=\"color: Red;\">自定义规格报价需提交,<br>通过人工审核得出报价</h4>";
    getHtmlObjects("ctl00_ContentPlaceHolder1_price").value = "0";
    setproducttypeenbale();
}

/*--------------------设置产品类型和属性不能选择-----------------*/
function setproducttypeenbale() {
    getHtmlObjects("ctl00_ContentPlaceHolder1_cusisstdflag").value = "自定义";
    setTypeorAttribInfo();

    getHtmlObjects("protype").disabled = true;

    for (var m = 0; m < attribobj.length; m++) {
        var selattobj = getHtmlObjects("attrib" + m);
        selattobj.disabled = true;
    }
}

/*--------------------设置产品类型和属性可以用------------------*/
function setproducttypedisabled() {
    getHtmlObjects("ctl00_ContentPlaceHolder1_cusisstdflag").value = "标准";
    setTypeorAttribInfo();
    getHtmlObjects("ctl00_ContentPlaceHolder1_ddl_product").disabled = false;
    getHtmlObjects("protype").disabled = false;

    for (var m = 0; m < attribobj.length; m++) {
        var selattobj = getHtmlObjects("attrib" + m);
        selattobj.disabled = false;
    }
}


/*----------------------获取选择的后加工---------------------------*/
function getpalferprocess() {
    getHtmlObjects("ctl00_ContentPlaceHolder1_processText").value = "";
    var processarr = document.getElementsByName("cbprocess");
    for (var i = 0; i < processarr.length; i++) {
        if (processarr[i].checked) {
            getHtmlObjects("ctl00_ContentPlaceHolder1_processText").value += processarr[i].value + ";";
        }
    }
}


/*-----------------获取URL参数--------------------*/
function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}

/*-----------------显示后加工和备注---------------*/
function showprocessorremark() {
    getHtmlObjects("typrocess").style.display = "block";
    getHtmlObjects("tyremark").style.display = "block";
    getHtmlObjects("tynext").style.display = "block";
    getHtmlObjects("contacttype").style.display = "block";
}

/*-----------------隐藏后加工和备注---------------*/
function hideprocessremark() {
    getHtmlObjects("typrocess").style.display = "none";
    getHtmlObjects("tyremark").style.display = "none";
    getHtmlObjects("tynext").style.display = "none";
    getHtmlObjects("contacttype").style.display = "none";
}

/*------------------验证文件框最大只能输入100-----------------*/
function textsizvalidate(str) {

    if (str.length == 0) {
        alert("必须输入款数！");
        return false;
    }

    if (parseInt(str) < 1) {
        alert("款数不能小于1！");
        return false;
    }

    if (parseInt(str) > 100) {
        alert("最大款数不能超过100！");
        return false;
    }


    return true;
}


/*------------------设置上一次类型值和属性值-------------------------*/
function setagotypeattrivalue() {
    //标准
    if (getHtmlObjects("ctl00_ContentPlaceHolder1_cusisstdflag").value == "自定义") {
        var g = 0;
        setTab('one', 2, 2);
        showprocessorremark();
        //自定义
        var agotypeattriinfo = getHtmlObjects("ctl00_ContentPlaceHolder1_custypeattrib").value.split('|');
        getHtmlObjects("txtcustypevalue").value = agotypeattriinfo[0];

        for (var q = 0; q < attribobj.length; q++) {
            getHtmlObjects("txtcusattribvalue" + q).value = agotypeattriinfo[q + 1];
            g = q + 1;
        }

        getHtmlObjects("txtcuscountvalue").value = agotypeattriinfo[g + 1];
        getHtmlObjects("txtcusunitvalue").value = agotypeattriinfo[g + 2];

    }
}

