
function showWindow(width, height, index) {
    location.href = "#";
    var windowstr = document.getElementById("popLayer").innerHTML;
    document.getElementById("infoDiv").innerHTML = windowstr;
    document.getElementById("infoDiv").style.left = ((document.body.clientWidth - width) > 0 ? (document.body.clientWidth - width) : 0) / 2 + "px";
    document.getElementById("infoDiv").style.top = 50 + "px";
    document.getElementById("infoDiv").style.zIndex = 10001;
    document.getElementById("infoDiv").style.width = width;
    document.getElementById("infoDiv").style.height = height;
    document.getElementById("infoDiv").style.border = "3px solid #0099ff";
    document.getElementById("tranDiv").style.height = document.body.clientHeight + "px";
    document.getElementById("tranDiv").style.width = document.body.clientWidth + "px";
    document.getElementById("tranDiv").style.display = "";
    document.getElementById("tranDivBack").style.display = "";
    document.getElementById("tranDivBack").style.zIndex = 10000;
    document.getElementById("infoDiv").style.display = "";

    var GetProductID = document.getElementById("GetTryID" + index);
    var setTryID = document.getElementById("ctl00_ContentPlaceHolder1_GetTryID");
    setTryID.value = GetProductID.value;
}
function closeWindow() {
    document.getElementById("tranDiv").style.display = "none";
}

//function onblur() {
//    var ConmentBox = document.getElementById("ctl00_ContentPlaceHolder1_ContentBox");
//    var DivError = document.getElementById("ShowError");

//    if (ConmentBox.value == "") {
//        DivError.innerHTML = "内容不能为空";
//        DivError.className = "onError";
//    }
//    
//    else if (ConmentBox.value.length > 10) {
//        DivError.innerHTML = "内容过长";
//        DivError.className = "onError";
//      }

//  }

//  function onFocus() {
//      var DivError = document.getElementById("ShowError");

//     DivError.innerHTML = "";
//     DivError.className = "";
//      
//  }
  /*验证商品名称******************************************************************************/
  function onblurProductName()
  {
      var ProductNameBox=document.getElementById("ctl00_ContentPlaceHolder1_ProductNameBox");
      var DivError=document.getElementById("ProductNameDiv");
      if (ProductNameBox.value == "") {
          DivError.innerHTML = "商品名称不能为空！";
          DivError.className = "onError";
      }
      else if (ProductNameBox.value.length > 10) {
          DivError.innerHTML = "商品名称不能超过10个字！";
          DivError.className = "onError";
      }
  }
  /*验证商品名称******************************************************************************/

  function onfocusName(Control) {
      var DivError = document.getElementById(Control);
      DivError.innerHTML = "";
      DivError.className = "";
  }

  /**********************************验证是否已上传商品图片*************************************/
  function CodeFileUpload() {
      var FileUpload1 = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload1");
      var DivError = document.getElementById("UploadDiv");
      if (FileUpload1.value <=0) {
          DivError.innerHTML = "需要上传商品图片";
          DivError.className = "onError";
      }
  }


  /*****************************8***验证是否已上传图片******************************************/

  function CodeProductNumber() {
      var ProductNum = document.getElementById("ctl00_ContentPlaceHolder1_ProductNumBox");
      var DivError = document.getElementById("ProductNumDiv");
      if (parseInt(ProductNum.value)<=0 || ProductNum.value=="") {
          DivError.innerHTML = "发布商品数必须是大于0的正整数";
          DivError.className = "onError";
      }
  }