function getid(a, b) {
  $("#" + a).val(b),
  dialog.list.temp.close()
}
function get_tips() {
  var a = location.hostname,
  b = ".co|.cn|.net|.cc|.me|.la|.org|.gov|.so|.tel|.info|.hk|.tv|.mobile|.name|.asia|.biz",
  c = b.split("|");
  for (i = 0; i < c.length; i++) if ( - 1 != a.indexOf(c[i])) {
    a = a.replace("http://", "");
    var d = "http://www.eycms.cn/plug/api.asp?type=biz&key=" + a;
    jQuery.getScript(d,
    function() {
      $("#tips").html(noticedata.str)
    });
    break
  }
}
function Get_Notice(a, b) {
  var c = "http://www.eycms.cn/plug/api.asp?type=notice&t0=" + a;
  jQuery.getScript(c,
  function() {
    var c = jQuery("#" + b);
    1 == a ? c.html(getBoxHtml(nicedata)) : c.html("<i>&#xe600;</i>" + getBoxlink(noticedata.url, noticedata.title))
  })
}
function getBoxHtml(a) {
  var b = "<ul class='official'>";
  for (var c in a) b += "<li>" + a[c] + "</li>";
  return b += "</ul>"
}
function getBoxlink(a, b) {
  return '<i></i><a href="' + a + '" target="_blank">' + b + "</a>"
}
function checksearch(a) {
  return "" == a.keyword.value || "\u8bf7\u8f93\u5165\u5173\u952e\u5b57" == a.keyword.value ? ($.fn.tips({
    content: "\u8bf7\u8f93\u5165\u5173\u952e\u5b57"
  }), a.keyword.focus(), false) : void 0
}
function checkselect(a, b) {
  var c = a.checked ? "selected": "";
  $("#" + b).find("option").attr("selected", c)
}
function auto_home(a, b, c) {
  var d = window.top.$("#html_staus");
  return $.ajax({
    cache: false,
    url: "html/index.asp?admin_name=" + a + "&loginbase=" + b + "&loginkey=" + c,
    async: false,
    success: function(a) {
      1 == a.substring(1) && d.html(d.html() + "<ul>\u9996\u9875\u751f\u6210\u5b8c\u6bd5</ul>"),
      d[0].scrollTop = d[0].scrollHeight
    }
  }),
  true
}
function auto_class(a, b, c, d, e) {
  var g, f = window.top.$("#html_staus");
  for (j = 1; d >= j && ($.ajax({
    cache: false,
    async: false,
    url: "html/list.asp?admin_name=" + a + "&loginbase=" + b + "&loginkey=" + c + "&classid=" + e + "&page=" + j,
    success: function(a) {
      var b = a.substring(0, 1);
      g = a.substring(1),
      1 == b && f.html(f.html() + "<ul>\u5217\u8868\u7b2c" + j + "\u9875\u751f\u6210\u5b8c\u6bd5</ul>"),
      f[0].scrollTop = f[0].scrollHeight
    }
  }), j != g); j++);
  return j == d || j == g ? (html = true, f.html(f.html() + "<ul>\u5217\u8868\u751f\u6210\u5b8c\u6bd5</ul>"), f[0].scrollTop = f[0].scrollHeight, true) : void 0
}
function auto_content(a, b, c, d, e) {
  var f = window.top.$("#html_staus");
  return $.ajax({
    cache: false,
    url: "html/show.asp?admin_name=" + a + "&loginbase=" + b + "&loginkey=" + c + "&id=" + d + "&page=" + e,
    async: false,
    success: function(g) {
      var h = g.substring(0, 1),
      i = g.substring(1);
      return 1 == h && (f.html(f.html() + "<ul>\u5185\u5bb9\u9875\u7b2c" + e + "\u9875\u751f\u6210\u5b8c\u6bd5</ul>"), f[0].scrollTop = f[0].scrollHeight),
      e != i ? auto_content(a, b, c, d, e + 1) : (f.html(f.html() + "<ul>\u5185\u5bb9\u9875\u751f\u6210\u5b8c\u6bd5</ul>"), f[0].scrollTop = f[0].scrollHeight, void 0)
    }
  }),
  true
}
function calendar(a, b) {
	var df="%Y-%m-%d";
	if (b==1){df="%Y-%m-%d %H:%M:%S"};
	Calendar.setup({
	weekNumbers: true,
	inputField : a,
	trigger    : a,
	dateFormat: df,
	showTime: true,
	minuteStep: 1,
	onSelect   : function() {this.hide();}
	});
}
$(function() {
  $(".goback").click(function() {
    history.go( - 1)
  }),
  $("#tablelist tr").mouseover(function() {
    if ($(this).attr('class')!="hover"){$(this).css("background", "#EBF4FC")}
  }),
  $("#tablelist tr").mouseout(function() {
    if ($(this).attr('class')!="hover"){$(this).css("background", "#FFF")}
  }),
  $(".dropdown").hover(function() {
    $("dl", this).stop(true, true).slideDown(300)
  },
  function() {
    $("dl", this).stop(true, true).slideUp(300)
  }),
  $("#color").click(function() {
    var a = $(this).width();
    $(this).height();
    var c = $(this).offset().top,
    d = $(this).offset().left;
    $.fn.colorpicker({
      x: c,
      y: d + a,
      inputid: "s2",
      backid: "color"
    })
  }),
  $(".bnt").click(function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = b[0],
    d = b[1],
    e = b[2],
    f = b[3];
    top.dialog({
      title: "EYCMS\u6587\u4ef6\u4e0a\u4f20",
      content: "<iframe src='upload.asp?filetype=" + d + "&cid=" + e + "&classid=" + f + "' width='600' height='400' frameborder='0' id='webuploader"+c+"'></iframe>",
      padding: "10px",
	  ok: function() {
		var a = $("#filelist", window.top.document.getElementById("webuploader"+c).contentWindow.document).html();
		if ((a != null) && (a != "")) {
			var b = a.substring(1);
			$("input[name=" + c + "]").attr("value", b);
		}
	  },
      cancel: true
    }).showModal()
  }),
  $(".bnt_cut").click(function() {
	var e = $(this).attr("config"),
	t = e.split(":"),
	n = t[0],
	r = t[1],
	i = t[2],
	s = t[3];
	top.dialog({
	  id:"swfcut",
	  title: "EyCMS\u6587\u4ef6\u4e0a\u4f20",
	  content: "<iframe src='upload_cut.asp?cateid=" + $("#myclassid").attr("value") + "&filetype=" + r + "&cid=" + i + "&classid=" + s + "&url=" + $("input[name=" + n + "]").attr("value") +"' width='650' height='400' frameborder='0' id='webuploader"+n+"'></iframe>",
	  padding: "10px",
	  lock: true,
	  opacity: "0.5",
	  ok: function() {
        var a = $("#filelist", window.top.document.getElementById("webuploader"+n).contentWindow.document).html();
        if ((a != null) && (a != "")) {
          var d = a.substring(1);
          $("input[name=" + n + "]").attr("value", d);
		  top.dialog().close().remove();
        }
	  },
	  onclose: function() {
        var a = $("#filelist", window.top.document.getElementById("webuploader"+n).contentWindow.document).html();
        if ((a != null) && (a != "")) {
          var d = a.substring(1);
          $("input[name=" + n + "]").attr("value", d);
		  top.dialog().close().remove();
        }
	  },
	  cache: false
	}).showModal()
  }),
  $(".bnt_img").click(function() {
	var e = $(this).attr("config"),
	t = e.split(":"),
	n = t[0],
	r = t[1],
	i = t[2],
	s = t[3],
	u = t[4];
	top.dialog({
	  title: "EyCMS\u6587\u4ef6\u4e0a\u4f20",
	  content: "<iframe src='upload.asp?filetype=" + r + "&cid=" + i + "&classid=" + s + "&url=" + u + "' width='600' height='400' frameborder='0' id='webuploader"+n+"'></iframe>",
	  padding: "10px",
	  lock: true,
	  opacity: "0.5",
	  ok: function() {
        var a = $("#filelist", window.top.document.getElementById("webuploader"+n).contentWindow.document).html();
        if ((a != null) && (a != "")) {
          var d = a.substring(1);
          $("input[name=" + n + "]").attr("value", d)
        }
	  },
	  cancelVal: "\u53d6\u6d88",
	  cancel: true
	}).showModal()
  }),
  $(".bnt_temp").live("click",function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = b[0],
    d = b[1],
    e = dialog({
      id: "temp",
      title: "\u6a21\u677f\u9009\u62e9",
      padding: 20,
      width: 300
    }).showModal();
    $.ajax({
      url: "?act=loadtemp&t0=" + d + "&t1=" + c,
      success: function(a) {
        e.content(a)
      },
      cache: false
    })
  }),
  $(".bnt_clear").live("click",function() {
    var a = $(this).attr("config");
    $("#" + a).val("")
  }),
  $(".bnt_quote").click(function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = $("#" + b[0]).val(),
    d = b[1];
    "" == c ? $.fn.tips({
      content: "\u7f29\u7565\u56fe\u4e0d\u80fd\u4e3a\u7a7a"
    }) : (UE.getEditor(d).setContent(UE.getEditor(d).getContent() + '<div align="center"><img src="' + c + '"></div>'), $(this).css("display", "none"))
  }),
  $(".bnt_pinyin").click(function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = b[0],
    d = b[1],
    e = this;
    if ("" == $("#" + c)[0].value) $.fn.tips({
      content: "\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a"
    });
    else {
      $(this).attr("value", "\u5904\u7406\u4e2d..."),
      $(this).attr("disabled", "disabled");
      var f, g;
      f = "?act=pinyin",
      g = "t0=" + encodeURIComponent($("#" + c)[0].value),
      $.ajax({
        type: "post",
        cache: false,
        url: f,
        data: g,
        success: function(a) {
          0 == a.substring(0, 1) ? $.fn.tips({
            content: a.substring(1)
          }) : ($("#" + d).val(a), $(e).attr("value", "\u62fc\u97f3"), $(e).attr("disabled", false))
        }
      })
    }
  }),
  $(".bnt_english").click(function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = b[0],
    d = b[1],
    e = this;
    if ("" == $("#" + c)[0].value) $.fn.tips({
      content: "\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a"
    });
    else {
      $(this).attr("value", "\u5904\u7406\u4e2d..."),
      $(this).attr("disabled", "disabled");
      var f, g;
      f = "?act=english",
      g = "t0=" + encodeURIComponent($("#" + c)[0].value),
      $.ajax({
        type: "post",
        cache: false,
        url: f,
        data: g,
        success: function(a) {
          0 == a.substring(0, 1) ? $.fn.tips({
            type: "error",
            content: a.substring(1)
          }) : ($("#" + d).val(a), $(e).attr("value", "\u82f1\u6587"), $(e).attr("disabled", false))
        }
      })
    }
  }),
  $(".bnt_tags").click(function() {
    var a = $(this).attr("config"),
    b = a.split(":"),
    c = b[0],
    d = b[1],
    e = b[2],
    f = this;
    if ("" == $("#" + c)[0].value) $.fn.tips({
      content: "\u6807\u9898\u4e0d\u80fd\u4e3a\u7a7a"
    });
    else {
      $(this).attr("value", "\u63d0\u53d6\u4e2d..."),
      $(this).attr("disabled", "disabled");
      var g, h;
      g = "ey_content.asp?act=gettags&classid=" + e,
      h = "t0=" + encodeURIComponent($("#" + c)[0].value),
      $.ajax({
        type: "post",
        cache: false,
        url: g,
        data: h,
        success: function(a) {
          0 == a.substring(0, 1) ? ($.fn.tips({
            content: "\u6ca1\u6709\u53ef\u63d0\u53d6\u7684Tags"
          }), $("#" + d).val(""), $(f).attr("value", "\u6839\u636e\u6807\u9898\u63d0\u53d6"), $(f).attr("disabled", false)) : ($("#" + d).val(a), $(f).attr("value", "\u6839\u636e\u6807\u9898\u63d0\u53d6"), $(f).attr("disabled", false))
        }
      })
    }
  }),
  $("#likesearch").click(function() {
    var a = $("#key").val(),
    b = $("#key").attr("config"),
    c = b.split(":"),
    d = c[0],
    e = c[1];
    if (("" == e || null == e) && (e = 0), "" == a || "\u8bf7\u8f93\u5165\u5173\u952e\u5b57" == a) return $.fn.tips({
      content: "\u8bf7\u8f93\u5165\u5173\u952e\u5b57"
    }),
    $("#key").focus(),
    false;
    var f, g;
    f = "ey_content.asp?act=likedb&classid=" + d + "&id=" + e,
    g = "key=" + encodeURIComponent(a),
    $.ajax({
      type: "post",
      cache: false,
      url: f,
      data: g,
      success: function(a) {
        0 == a.substring(0, 1) ? $.fn.tips({
          content: a.substring(1)
        }) : $("#golike").html(a.substring(1))
      }
    })
  }),
  $(".bnt_search").click(function() {
    var a = $("#key").val();
    if ("" == a || "\u8bf7\u8f93\u5165\u5173\u952e\u5b57" == a) return $.fn.tips({
      content: "\u8bf7\u8f93\u5165\u5173\u952e\u5b57"
    }),
    $("#key").focus(),
    false;
    var b, c;
    b = "?act=likedb",
    c = "key=" + encodeURIComponent(a),
    $.ajax({
      type: "post",
      cache: false,
      url: b,
      data: c,
      success: function(a) {
        0 == a.substring(0, 1) ? $.fn.tips({
          type: "error",
          content: a.substring(1)
        }) : $("#likeprotop").html(a.substring(1))
      }
    })
  }),
  $(".proadd").live("click",
  function() {
    var a = $(this).attr("proid"),
    b = $(this).attr("protitle"),
    c = $(this).attr("proprice");
    $(this).parent().parent().remove();
    var d = "";
    d += "<tr>",
    d += '	<td class="txt_left"><a>' + b + "</a></td>",
    d += "	<td><u>" + c + "</u></td>",
    d += '	<td><input type="text" name="price" id="' + a + '" value="" size="8" class="ordnum" old="' + c + '" data-rule="\u6d3b\u52a8\u4ef7:required;digits;"></td>',
    d += '	<td><input type="hidden" name="id" value="' + a + '"><a href="javascript:;" class="prodel" proid="' + a + '"></a></td>',
    d += "</tr>",
    $("#tablelist").prepend(d)
  }),
  $(".aprice").live("blur",
  function() {
    var a = $(this).attr("old"),
    b = $(this).attr("value");
    if ("" == b) return $.fn.tips({
      type: "warn",
      content: "\u8bf7\u8f93\u5165\u6d3b\u52a8\u4ef7\u683c"
    }),
    false;
    var c = /^[+]?(([1-9]\d*[.]?)|(0.))(\d{0,2})?$/;
    return c.test(b) ? (a = parseFloat(a), b = parseFloat(b), b >= a ? ($.fn.tips({
      type: "error",
      content: "\u6d3b\u52a8\u4ef7\u683c\u4e0d\u80fd\u5927\u4e8e\u7b49\u4e8e\u539f\u4ef7"
    }), false) : void 0) : ($.fn.tips({
      type: "error",
      content: "\u6d3b\u52a8\u4ef7\u683c\u8f93\u5165\u9519\u8bef"
    }), $(this).attr("value", ""), false)
  }),
  $(".prodel").live("click",
  function() {
    $(this).parent().parent().remove()
  }),
  $("#usersel").click(function(){
	top.dialog({
	  title: '所属客户',
	  url: "ey_popup.asp?uid="+$('#uid').val(),
	  width: 800, 
	  height: 500,
	  id: 'uid',
	  onclose: function(){
		 if (this.returnValue) {
			 var rValue = this.returnValue;
		     $("#uid").val(rValue.split('|')[0]);
		     $("#usersel").val(rValue.split('|')[1]);
		 }
	  },
      cancel: true
	}).showModal()
  }),
  $(".singlesel").click(function() {
	var t = $(this).attr("config"),
	n = t.split(":"),
	m = n[0],
	e = n[1];
	top.dialog({
	  title: '请选择',
	  url: 'ey_popup_model.asp?modeid='+m+'&lx=0&uf='+e+'&uv='+$('#'+e).val(),
	  width: 800, 
	  height: 500,
	  id: e,
	  onclose: function(){
		 if (this.returnValue) {
			 var rValue = this.returnValue;
			 $("#"+e).val(rValue.split('|')[0]);
			 $("#"+e+"show").val(rValue.split('|')[1]);
		 }
	  },
      cancel: true
	}).showModal()
  }),
  $(".multisel").click(function() {
	var t = $(this).attr("config"),
	n = t.split(":"),
	m = n[0],
	e = n[1];
	top.dialog({
	  title: '请选择',
	  url: 'ey_popup_model.asp?modeid='+m+'&lx=1&uf='+e+'&uv='+$('#'+e).val(),
	  width: 800, 
	  height: 500,
	  id: e,
	  onclose: function(){
		 if (this.returnValue) {
			 var rValue = this.returnValue;
			 $("#"+e).val(rValue.split('|')[0]);
			 var selids=rValue.split('|')[1];
			 getsellist(e,selids);
		 }
	  },
      cancel: true
	}).showModal()
  })
});
function getsellist(e,ids){
	$.ajax({
	  type: "get",
	  cache: false,
	  url: "ey_popup_model.asp?act=loadlist&ids=" + ids,
	  error: function() {
		$.fn.tips({type: "error",content: "\u670d\u52a1\u5668\u9519\u8bef\uff0c\u64cd\u4f5c\u5931\u8d25\uff01"})
	  },
	  success: function(a) {
		a.substring(0, 1) == 0 ? $.fn.tips({type: "error",content: a.substring(1)}) : $("#"+e+"show").html(a.substring(1))
	  }
	})
}
function showimg(t0){
	top.dialog({
		fixed: true,
		title: '查看图片',
		align: 'top left',
		content: '<img src="'+t0+'" onload="javascript:if(this.width>600)this.width=600;"/>', 
		id: 'picshow'
	}).showModal(document.getElementById('option-align'));
}