﻿

function login() {
    $$("log").style.display = "none";
    var username = $$('username').value;
    var pwd = $$('pwd').value;
    var d = new Date();
    if(username != "" && pwd != "")
    {
        var urlstr = "handler/userHandler.ashx?type=login&username=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username) + 
        "&pwd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pwd) : pwd) + "&d="+d.getSeconds();
        $.ajax({
            url: urlstr,
            type: "GET",
            datatype: "html",
            timeout: 20000,
            error: function() {
                alert("error");
            },
            success: function(str) {
                var rst = (parseInt(str)) > 0;
                if (rst) {
                    window.location.href=window.location.href;     
                }
                else 
                {
                    alert("用户名密码错误");
                    $$("log").style.display = "block";
                }
            }
        });
        
    }
    else
    {
        window.alert("对不起，用户名或密码不能为空");
        $$("log").style.display = "block";
        return;
    }
}
function loginquickly() {
    //$$("log").style.display = "none";
    var username = $$('usernamequickly').value;
    var pwd = $$('pwdquickly').value;
    var d = new Date();
    if(username != "" && pwd != "")
    {
        var urlstr = "handler/userHandler.ashx?type=login&username=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username) + 
        "&pwd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pwd) : pwd) + "&d="+d.getSeconds();
        $.ajax({
            url: urlstr,
            type: "GET",
            datatype: "html",
            timeout: 20000,
            error: function() {
                alert("error");
            },
            success: function(str) {
                var rst = (parseInt(str)) > 0;
                if (rst) {
                    window.location.href="Default.aspx";
                }
                else 
                {
                    alert("用户名密码错误");
                    $$("log").style.display = "block";
                }
            }
        });
        
    }
    else
    {
        window.alert("对不起，用户名或密码不能为空");
        $$("log").style.display = "block";
        return;
    }
}
function vote(){
    var voteresult = "";
    var votelist = document.getElementsByName("quicknote");
    for(var i=0;i<votelist.length;i++)
    {
        if(votelist[i].checked == true)
        {            
            voteresult = votelist[i].value;
            break;     
        }        
    }
    if(voteresult == "")
    {
        alert("对不起，您还没有进行选择");
        return;
    }
    var d = new Date();
    urlstr = "handler/userHandler.ashx?type=vote&result=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(voteresult) : voteresult) +"&d="+d.getSeconds() ;

    $.ajax({
        url: urlstr,
        type: "GET",
        datatype: "html",
        timeout: 20000,
        error: function() {
            alert("error");
        },
        success: function(str) {
            if(str == 3)
            {
                alert("请先登陆!");
                return;
            }
            if(str == 2)
            {
                alert("对不起，只有涂料制造商才能投票!");
                return;
            }
            var rst = (parseInt(str)) > 0;
            if (rst) {
                $$("votelist").style.display = 'none';
                $$("voteresult").style.display = 'block';
            }
            else alert("对不起，您已经投过票了!");
        }
    });
    
}

function logout() {
    var d = new Date();

    var urlstr = "handler/userHandler.ashx?type=loginout&d=" + d;
    $.ajax({
        url: urlstr,
        type: "GET",
        timeout: 10000,
        error: function() {
            alert("error");
        },
        success: function(str) {
            var rst = (parseInt(str)) > 0;
            if (rst) {
                $$('pageRight_loginmodule').style.display = 'block';
                $$('pageRight_user_info').style.display = 'none';
            }
            else alert("数据库操作错误");
        }
    });
    
    
}

function reg(){
    window.location.href = "Register.aspx";
}

var exsitUser = false,exsitEmail=false,isuser=true,isemail=true;
var lastusername  = lastpassword = lastemail = "";

function chkEmail()
{
  var e = $$("email").value;
  if(e==lastemail) return;
  else lastemail =e;
  if(e!=""){
      var reg = new RegExp("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$");
      var rst = reg.test(e);
      ShowMsg ("SEmail","请填写正确的Email地址",!rst,"l red");
      if(rst) {isemail=true;chkExsitEmail();}
      else {exsitEmail=false};
   }
}
function chkExsitEmail()
{
   var d = new Date();
   var e = $$("email").value;
   var getUrl =  "handler/userHandler.ashx?type=email&email="+(is_ie && document.charset == 'utf-8' ? encodeURIComponent(e) : e)+"&d="+d.getSeconds();
   $.ajax({
    url: getUrl,
    type: 'GET',
    timeout: 10000,
    error: function(){
        alert('异步操作出现异常');
    },
    success: function(str){
     var rst = (parseInt(str))>0;
     if(rst) ShowMsg ("SEmail","邮箱已被使用",rst,"l red");
     else ShowMsg ("SEmail","可以使用",!rst,"l green");
     exsitEmail = rst;
    }
});

}
function chkUser()
{
  var n  =$$("username").value;
  if(n=="") return;
  var msg ="";
  if (n.match(/[\/|!|#|$|%|&|\(|\)|\*|+|,|\-|.|:|<|>|\?|@|\/|\"|\'|\\|\[|\]|\^|`|\{|\=|\;|\||\}]/ig))
    msg="用户名不能出现!%$#&等特殊字符";
  if (n.match(/[\s|　]/ig)) {msg = "用户名不允许包含空格";}
  var unlen = n.replace(/[^\x00-\xff]/g, "**").length;
    if(unlen < 6 || unlen > 16) {
	    msg=unlen < 6 ? "长度不能小于6个字符" : "长度不能超过16个字符";
    }
  //if(n.match(/[\u4e00-\u9fa5]+$/ig)) msg="由小写英文字母(a-z)和数字(0-9)组合";
  ShowMsg("SReg",msg,msg!="","l red");
  if(msg!="") {isuser=false;}
  else{isuser=true;}
   
}
function chkExsitUser()
{
   if(!isuser) return;
   var e = $$("username").value;
   if(e=="") return;
   if(e==lastusername) return;
   else lastusername =e;
   var d = new Date();
   var getUrl =  "handler/userHandler.ashx?type=user&username="+(is_ie && document.charset == 'utf-8' ? encodeURIComponent(e) : e)+"&d="+d.getSeconds();
   $.ajax({
    url: getUrl,
    type: 'GET',
    timeout: 10000,
    error: function(){
        alert('异步操作出现异常');
    },
    success: function(str){
     var rst = (parseInt(str))>0;
     if(rst) ShowMsg ("SReg","用户名已存在",rst,"l red");
     else ShowMsg ("SReg","可以使用",!rst,"l green");
     exsitUser = rst;
    }
});
}
function chkPwd()
{
  var m = $$("pwd").value;
  var htmlSpan = new Array(3);
  htmlSpan = ["PRuo","PZhong","PQiang"];
  var _num=0;
  if(m.length>=10&&m.length<=15)  _num=1;
  if (m.length >= 16) _num = 2;

  for(var i=0;i<3;i++)
  {
        
     $$(htmlSpan[i]).style.display= (_num==i) ? "block":"none";
  }
}
function chkRePwd()
{
  var pwd1 = $$("pwd").value;
  var pwd2 = $$("repwd").value;
  if(pwd1!=pwd2)
  ShowMsg("SPwd","两次输入的密码不一样",true,"l red");
  else ShowMsg("SPwd","输入正确",true,"l green");

}

function chkReal()
{
    var realname = $$("realname").value;
    
}

function ShowMsg(hobj,msg,sbool,newstyle)
{
  var _obj = $$(hobj);
  if(_obj&&sbool)
  {
    if(_obj.style.display=="none") _obj.style.display="block";
    _obj.innerHTML = msg;
    if(newstyle&&newstyle!="") _obj.className=newstyle;
  }
}

function prev() {
    $$("youmoinfo").style.display = "none";
    $$("paintinfo").style.display = "none";
    $$("nextcode").style.display = "none";
    var mustlist = document.getElementsByName("must");
    for (var i = 0; i < mustlist.length; i++) {
        mustlist[i].style.display = "block";
    }
}

function chk() {
    

  if(!isuser)
  {
    alert("请填写正确的用户名");
    $$("username").focus();
    return;
  }
  if(!isemail)
  {
    alert("请填写正确的Email");
    $$("email").focus();
    return;
  }
  if($$("username").value=="")
  {
    alert("用户名不能为空");
    $$("username").focus();
    return;
  }
  if(exsitUser)
  {
    alert("用户名已经存在");
    $$("username").focus();
    return;
  }
  if($$("pwd").value=="")
  {
    alert("登录密码不能为空");
    $$("pwd").focus();
    return;
  }
  else if($$("pwd").value == '' || /[\'\"\\]/.test($$("pwd").value )) {
			alert("密码不能包含特殊字符");
			return ;
  } 

    if($$("repwd").value=="")
  {
    alert("请填写确认密码");
    $$("repwd").focus();
    return;
  }
  if($$("email").value=="")
  {
    alert("请填写Email");
    $$("email").focus();
    return;
  }
  if(exsitEmail)
  {
     alert("Email已被使用");
    $$("email").focus();
    return;
  }
  
  if($$("realname").value=="")
  {
    alert("真实姓名不能为空");
    $$("realname").focus();
    return;
  }
  
  if($$("companyname").value=="")
  {
    alert("公司名称不能为空");
    $$("companyname").focus();
    return;
  }
  
  if($$("businessarea").selectedIndex == 0)
  {
    alert("请选择业务范围");
    $$("businessarea").focus();
    return;
  }
  
  if($$("workdep").selectedIndex == 0)
  {
    alert("请选择工作部门");
    $$("workdep").focus();
    return;
  }
  
  if($$("workpos").selectedIndex == 0)
  {
    alert("请选择工作职责");
    $$("workpos").focus();
    return;
  }
  
  if($$("comadd").value == "")
  {
    alert("公司地址不能为空");
    $$("comadd").focus();
    return;
  }
  
  if($$("postcode").value == "")
  {
    alert("邮政编码不能为空");
    $$("postcode").focus();
    return;
  }
  
  if($$("province").selectedIndex == 0)
  {
    alert("请选择省份");
    $$("province").focus();
    return;
  }
  
  if($$("tel").value == "")
  {
    alert("联系电话不能为空");
    $$("tel").focus();
    return;
  }
  
  if($$("tel").value != "" && isNumber($$("tel").value))
  {
    alert("联系电话只能为数字");
  }
  
  if($$("mobilephone").value == "")
  {
    alert("手机号码不能为空");
    $$("mobilephone").focus();
    return;
  }
  
  if($$("businessarea").value == "涂料制造商")
  {

  }


  if ($$("businessarea").value == "涂料制造商") {
      var mustlist = document.getElementsByName("must");
      for (var i = 0; i < mustlist.length; i++) {
          mustlist[i].style.display = "none";
      }
      $$("paintinfo").style.display = "block";
      $$("nextcode").style.display = "block";
  }
  else {

      var un = $$("username").value;
      var pwd = $$("pwd").value;
      var email = $$("email").value;
      var rn = $$("realname").value;
      var cn = $$("companyname").value;
      var dn = $$("depname").value;
      var cp = $$("comprop").value;
      var ma = $$("marketarea").value;
      var cu = $$("comurl").value;
      var ba = $$("businessarea").value;
      var wd = $$("workdep").value;
      var wp = $$("workpos").value;
      var ca = $$("comadd").value;
      var pc = $$("postcode").value;
      var pv = $$("province").value;
      var tel = $$("tel").value;
      var fax = $$("fax").value;
      var mp = $$("mobilephone").value;
      var d = new Date();
      var getUrl = "handler/userHandler.ashx?type=register&username=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(un) : un) +
                 "&pwd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pwd) : pwd) +
                 "&email=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(email) : email) +
                 "&realname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(rn) : rn) +
                 "&companyname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cn) : cn) +
                 "&depname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(dn) : dn) +
                 "&comprop=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cp) : cp) +
                 "&marketarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ma) : ma) +
                 "&comurl=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cu) : cu) +
                 "&buinessarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ba) : ba) +
                 "&workdep=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wd) : wd) +
                 "&workpos=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wp) : wp) +
                 "&comadd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ca) : ca) +
                 "&postcode=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pc) : pc) +
                 "&province=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pv) : pv) +
                 "&tel=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(tel) : tel) +
                 "&fax=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(fax) : fax) +
                 "&mobilephone=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(mp) : mp) +
                 "&d=" + d.getSeconds();
      $.ajax({
          url: getUrl,
          type: "GET",
          datatype: "html",
          timeout: 20000,
          error: function() {
              alert("error");
          },
          success: function(str) {
              var rst = (parseInt(str)) > 0;
              if (rst) {
                  window.location.href = "Success.aspx?type=1";
              }
              else window.location.href = "Error.aspx?type=1";
          }
      });
  }
}

function submitReg(){
    if($$("businessarea").value == "油墨制造商"){
    
        if($$("paint_imarket_result").innerHTML == "")
        {
            alert("对不起，您至少选择一项市场应用范围！");
            return ;
        }
        
        if($$("paint_ishuzhi_result").innerHTML == ""){
            alert("对不起，您至少选择一项树脂/成膜物质！");
            return ;
        }

        if ($$("paint_izhuji_result").innerHTML == "") {
            alert("对不起，您至少选择一项颜料/填料/助剂！");
            return;
        }
        
        if($$("iamountperyear").value == ""){
            alert("对不起，您必须填写涂料产量！");
            return ;
        }
        
        var un = $$("username").value;
        var pwd = $$("pwd").value;
        var email = $$("email").value;
        var rn = $$("realname").value;
        var cn = $$("companyname").value;
        var dn = $$("depname").value;
        var cp = $$("comprop").value;
        var ma = $$("marketarea").value;
        var cu = $$("comurl").value;
        var ba = $$("businessarea").value;
        var wd = $$("workdep").value;
        var wp = $$("workpos").value;
        var ca = $$("comadd").value;
        var pc = $$("postcode").value;
        var pv = $$("province").value;
        var tel = $$("tel").value;
        var fax = $$("fax").value;
        var mp = $$("mobilephone").value;
        
        var irmlist = document.getElementsByName("fin_selected_imarket");
        var finally_imarket_result = "";
        for(var i=0;i<irmlist.length;i++){
            finally_imarket_result += "-" + irmlist[i].innerHTML;
        }        
        
        var iszlist = document.getElementsByName("fin_selected_ishuzhi");
        var finally_ishuzhi_result = "";
        for(var i=0;i<iszlist.length;i++){
            finally_ishuzhi_result += "-" + iszlist[i].innerHTML;
        }

        var izjlist = document.getElementsByName("fin_selected_izhuji");
        var finally_izhuji_result = "";
        for (var i = 0; i < izjlist.length; i++) {
            finally_izhuji_result += "-" + izjlist[i].innerHTML;
        }
        
        var iamountpy = $$("iamountperyear").value;
        
        var d = new Date();
        var getUrl = "handler/userHandler.ashx?type=register_ink&username=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(un) : un) +
             "&pwd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pwd) : pwd) +
             "&email=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(email) : email) +
             "&realname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(rn) : rn) +
             "&companyname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cn) : cn) +
             "&depname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(dn) : dn) +
             "&comprop=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cp) : cp) +
             "&marketarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ma) : ma) +
             "&comurl=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cu) : cu) +
             "&buinessarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ba) : ba) +
             "&workdep=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wd) : wd) +
             "&workpos=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wp) : wp) +
             "&comadd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ca) : ca) +
             "&postcode=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pc) : pc) +
             "&province=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pv) : pv) +
             "&tel=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(tel) : tel) +
             "&fax=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(fax) : fax) +
             "&mobilephone=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(mp) : mp) +
             "&ink_market=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_imarket_result) : finally_imarket_result) +
             "&ink_shuzhi=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_ishuzhi_result) : finally_ishuzhi_result) +
             "&ink_zhuji=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_izhuji_result) : finally_izhuji_result) +
             "&ink_amount=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(iamountpy) : iamountpy) +
             "&d=" + d.getSeconds();
        
        $.ajax({
        url: getUrl,
        type: "GET",
        datatype: "html",
        timeout: 20000,
        error: function() {
          alert("error");
        },
        success: function(str) {
          var rst = (parseInt(str)) > 0;
          if (rst) {
              window.location.href = "Success.aspx?type=1";
          }
          else window.location.href = "Error.aspx?type=1";
        }
        });
    }
    else if($$("businessarea").value == "涂料制造商"){
        if($$("paint_market_result").innerHTML == "")
        {
            alert("对不起，您至少选择一项市场应用范围！");
            return ;
        }
        
        if(($$("uv").checked == false) && ($$("diandu").checked == false) &&
         ($$("powder").checked == false) && ($$("water").checked == false) && 
         ($$("rongji").checked == false) && ($$("guti").checked == false)){
            
            alert("对不起，您至少选择一项涂料体系或涂料技术！");
            return;
        }
        
        if($$("paint_shuzhi_result").innerHTML == ""){
            alert("对不起，您至少选择一项树脂/成膜物质！");
            return ;
        }

        if ($$("paint_zhuji_result").innerHTML == "") {
            alert("对不起，您至少选择一项颜料/填料/助剂！");
            return;
        }
        
        if($$("amountperyear").value == ""){
            alert("对不起，您必须填写涂料产量！");
            return ;
        }
        
        var un = $$("username").value;
        var pwd = $$("pwd").value;
        var email = $$("email").value;
        var rn = $$("realname").value;
        var cn = $$("companyname").value;
        var dn = $$("depname").value;
        var cp = $$("comprop").value;
        var ma = $$("marketarea").value;
        var cu = $$("comurl").value;
        var ba = $$("businessarea").value;
        var wd = $$("workdep").value;
        var wp = $$("workpos").value;
        var ca = $$("comadd").value;
        var pc = $$("postcode").value;
        var pv = $$("province").value;
        var tel = $$("tel").value;
        var fax = $$("fax").value;
        var mp = $$("mobilephone").value;
        
        var rmlist = document.getElementsByName("fin_selected_market");
        var finally_market_result = "";
        for(var i=0;i<rmlist.length;i++){
            finally_market_result += "-" + rmlist[i].innerHTML;
        }
        
        var ptlist = document.getElementsByName("paint_tech");
        var finally_tech_result = "";
        for(var i=0;i<ptlist.length;i++){
            if(ptlist[i].checked == true){
                finally_tech_result += "-" + ptlist[i].value;
            }            
        }
        
        var szlist = document.getElementsByName("fin_selected_shuzhi");
        var finally_shuzhi_result = "";
        for(var i=0;i<szlist.length;i++){
            finally_shuzhi_result += "-" + szlist[i].innerHTML;
        }

        var zjlist = document.getElementsByName("fin_selected_zhuji");
        var finally_zhuji_result = "";
        for (var i = 0; i < zjlist.length; i++) {
            finally_zhuji_result += "-" + zjlist[i].innerHTML;
        }
        
        var amountpy = $$("amountperyear").value;
        
        var d = new Date();
        var getUrl = "handler/userHandler.ashx?type=register_paint&username=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(un) : un) +
             "&pwd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pwd) : pwd) +
             "&email=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(email) : email) +
             "&realname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(rn) : rn) +
             "&companyname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cn) : cn) +
             "&depname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(dn) : dn) +
             "&comprop=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cp) : cp) +
             "&marketarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ma) : ma) +
             "&comurl=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cu) : cu) +
             "&buinessarea=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ba) : ba) +
             "&workdep=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wd) : wd) +
             "&workpos=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(wp) : wp) +
             "&comadd=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ca) : ca) +
             "&postcode=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pc) : pc) +
             "&province=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(pv) : pv) +
             "&tel=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(tel) : tel) +
             "&fax=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(fax) : fax) +
             "&mobilephone=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(mp) : mp) +
             "&paint_market=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_market_result) : finally_market_result) +
             "&paint_tech=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_tech_result) : finally_tech_result) +
             "&paint_shuzhi=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_shuzhi_result) : finally_shuzhi_result) +
             "&paint_zhuji=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(finally_zhuji_result) : finally_zhuji_result) +
             "&paint_amount=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(amountpy) : amountpy) +
             "&d=" + d.getSeconds();
        
        $.ajax({
        url: getUrl,
        type: "GET",
        datatype: "html",
        timeout: 20000,
        error: function() {
          alert("error");
        },
        success: function(str) {
          var rst = (parseInt(str)) > 0;
          if (rst) {
              window.location.href = "Success.aspx?type=1";
          }
          else window.location.href = "Error.aspx?type=1";
        }
        });
    
    }
}



function select(obj){
    var elementid = "s" + obj;
    if(hasselected(elementid)){
        removeItem(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_market").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_market\" class=\"selectedcontent\" onclick=\"removeItem('" + elementid + "')\">" + elementvalue + "</div>"
}

function removeItem(obj){
    $$("selecteditembox_market").removeChild($$(obj));
}

function removeselected_market(obj) {
    $$("selecteditembox_market").removeChild($$(obj));
    $$("paint_market_result").removeChild($$("r" + obj).parentNode);
}

function removeselected_imarket(obj) {
    $$("selecteditembox_imarket").removeChild($$(obj));
    $$("paint_imarket_result").removeChild($$("r" + obj).parentNode);
}

function removeselected_shuzhi(obj) {
    $$("selecteditembox_shuzhi").removeChild($$(obj));
    $$("paint_shuzhi_result").removeChild($$("r" + obj).parentNode);
}

function removeselected_ishuzhi(obj) {
    $$("selecteditembox_ishuzhi").removeChild($$(obj));
    $$("paint_ishuzhi_result").removeChild($$("r" + obj).parentNode);
}

function removeselected_zhuji(obj) {
    $$("selecteditembox_zhuji").removeChild($$(obj));
    $$("paint_zhuji_result").removeChild($$("r" + obj).parentNode);
}

function removeselected_izhuji(obj) {
    $$("selecteditembox_izhuji").removeChild($$(obj));
    $$("paint_izhuji_result").removeChild($$("r" + obj).parentNode);
}

function select2(obj) {
    var elementid = "s" + obj;
    if (hasselected(elementid)) {
        removeItem2(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_shuzhi").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_shuzhi\" class=\"selectedcontent\" onclick=\"removeItem2('" + elementid + "')\">" + elementvalue + "</div>"
}

function select3(obj) {
    var elementid = "s" + obj;
    if (hasselected(elementid)) {
        removeItem3(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_zhuji").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_zhuji\" class=\"selectedcontent\" onclick=\"removeItem3('" + elementid + "')\">" + elementvalue + "</div>"
}

function select4(obj) {
    var elementid = "s" + obj;
    if (hasselected(elementid)) {
        removeItem3(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_imarket").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_imarket\" class=\"selectedcontent\" onclick=\"removeItem4('" + elementid + "')\">" + elementvalue + "</div>"
}

function select5(obj) {
    var elementid = "s" + obj;
    if (hasselected(elementid)) {
        removeItem3(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_ishuzhi").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_ishuzhi\" class=\"selectedcontent\" onclick=\"removeItem5('" + elementid + "')\">" + elementvalue + "</div>"
}

function select6(obj) {
    var elementid = "s" + obj;
    if (hasselected(elementid)) {
        removeItem3(elementid);
        return;
    }
    var elementvalue = $$(obj).innerHTML;
    $$("selecteditembox_izhuji").innerHTML += "<div id=\"" + elementid + "\" name=\"hassel_izhuji\" class=\"selectedcontent\" onclick=\"removeItem6('" + elementid + "')\">" + elementvalue + "</div>"
}

function removeItem2(obj) {
    $$("selecteditembox_shuzhi").removeChild($$(obj));
}

function removeItem3(obj) {
    $$("selecteditembox_zhuji").removeChild($$(obj));
}

function removeItem4(obj) {
    $$("selecteditembox_imarket").removeChild($$(obj));
}

function removeItem5(obj) {
    $$("selecteditembox_ishuzhi").removeChild($$(obj));
}

function removeItem6(obj) {
    $$("selecteditembox_izhuji").removeChild($$(obj));
}

function hasselected(obj){
    var s = $$(obj);
    
    if(s) return true;
    else return false;
}



function confirm_market() {
    $$("paint_market_result").innerHTML = "";
    var selected_marketlist = document.getElementsByName("hassel_market");
    if (selected_marketlist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_marketlist.length; i++) {
            var mlresultid = "r" + selected_marketlist[i].id;
            var mlresultinner = selected_marketlist[i].innerHTML;
            
            $$("paint_market_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_market('" + selected_marketlist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + mlresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_market\" for=\"" + mlresultid + "\" class=\"checkboxlabel\">" + mlresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function confirm_imarket() {
    $$("paint_imarket_result").innerHTML = "";
    var selected_imarketlist = document.getElementsByName("hassel_imarket");
    if (selected_imarketlist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_imarketlist.length; i++) {
            var imlresultid = "r" + selected_imarketlist[i].id;
            var imlresultinner = selected_imarketlist[i].innerHTML;
            
            $$("paint_imarket_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_imarket('" + selected_imarketlist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + imlresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_imarket\" for=\"" + imlresultid + "\" class=\"checkboxlabel\">" + imlresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function confirm_shuzhi() {
    $$("paint_shuzhi_result").innerHTML = "";
    var selected_shuzhilist = document.getElementsByName("hassel_shuzhi");
    if (selected_shuzhilist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_shuzhilist.length; i++) {
            var szresultid = "r" + selected_shuzhilist[i].id;
            var szresultinner = selected_shuzhilist[i].innerHTML;

            $$("paint_shuzhi_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_shuzhi('" + selected_shuzhilist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + szresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_shuzhi\" for=\"" + szresultid + "\" class=\"checkboxlabel\">" + szresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function confirm_ishuzhi() {
    $$("paint_ishuzhi_result").innerHTML = "";
    var selected_ishuzhilist = document.getElementsByName("hassel_ishuzhi");
    if (selected_ishuzhilist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_ishuzhilist.length; i++) {
            var iszresultid = "r" + selected_ishuzhilist[i].id;
            var iszresultinner = selected_ishuzhilist[i].innerHTML;

            $$("paint_ishuzhi_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_ishuzhi('" + selected_ishuzhilist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + iszresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_ishuzhi\" for=\"" + iszresultid + "\" class=\"checkboxlabel\">" + iszresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function confirm_zhuji() {
    $$("paint_zhuji_result").innerHTML = "";
    var selected_zhujilist = document.getElementsByName("hassel_zhuji");
    if (selected_zhujilist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_zhujilist.length; i++) {
            var zjresultid = "r" + selected_zhujilist[i].id;
            var zjresultinner = selected_zhujilist[i].innerHTML;

            $$("paint_zhuji_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_zhuji('" + selected_zhujilist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + zjresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_zhuji\" for=\"" + zjresultid + "\" class=\"checkboxlabel\">" + zjresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function confirm_izhuji() {
    $$("paint_izhuji_result").innerHTML = "";
    var selected_izhujilist = document.getElementsByName("hassel_izhuji");
    if (selected_izhujilist.length == 0) {
        alert("对不起，您还没有选择内容！");
        return;
    }
    else {
        for (var i = 0; i < selected_izhujilist.length; i++) {
            var izjresultid = "r" + selected_izhujilist[i].id;
            var izjresultinner = selected_izhujilist[i].innerHTML;

            $$("paint_izhuji_result").innerHTML += "<div class=\"checkdiv\">" +
                                    "<input onclick=\"removeselected_izhuji('" + selected_izhujilist[i].id + "')\" checked=\"checked\" class=\"checkbox\" id=\"" + izjresultid + "\" type=\"checkbox\"/>" +
                                    "<label name=\"fin_selected_izhuji\" for=\"" + izjresultid + "\" class=\"checkboxlabel\">" + izjresultinner + "</label>" +
                                    "</div>";
        }
    }
}

function showhome(num)
 {
	  var divtar = document.getElementById("list"+num);
	  divtar.style.display = "";
	  var i;
	   for(i=1;i<=4;i++){
      var divtar2 = document.getElementById("list"+i);
      var divtar3 = document.getElementById("menu"+i);
      divtar3.className="menuitemDH_"+i;
	  divtar2.style.display = "none";
	  
	   }
 }
 function showhome_prm(num)
 {
	  var divtar = document.getElementById("list"+num+"_prm");
	  divtar.style.display = "";
	  var i;
	   for(i=1;i<=3;i++){
      var divtar2 = document.getElementById("list"+i+"_prm");
      var divtar3 = document.getElementById("menu"+i+"_prm");
      divtar3.className="menuitemDH_"+i+"_prm";
	  divtar2.style.display = "none";
	   }
 }
function showlist(num){
var i;
for(i=0;i<=4;i++){
  var divtar = document.getElementById("list"+i);
  var divsour = document.getElementById("menu"+i);
  if(num == i){
	divsour.className="menuitemSH_"+i;
    divtar.style.display = "";
  }else{
	divsour.className="menuitemDH_"+i;
    divtar.style.display = "none";
  }
}
}
function showlist_prm(num){
var i;
for(i=0;i<=3;i++){
  var divtar = document.getElementById("list"+i+"_prm");
  var divsour = document.getElementById("menu"+i+"_prm");
  if(num == i){
	divsour.className="menuitemSH_"+i+"_prm";
    divtar.style.display = "";
  }else{
	divsour.className="menuitemDH_"+i+"_prm";
    divtar.style.display = "none";
  }
}
}
function showsubitem(num){
    var i;
    for(i=0;i<4;i++){
        var divtar = document.getElementById("submenuitem_block_"+i);
        if(i==num){            
            divtar.style.display="block";
        }
        else{
            divtar.style.display="none";
        }
    }
    
}

function closesubitem(){
    var i;
    for(i=0;i<4;i++){
        var divtar = document.getElementById("submenuitem_block_"+i);        
        divtar.style.display="none";
    }
}


function show_training1()
{
    document.getElementById("Training1").style.display = "block";
    document.getElementById("Training2").style.display = "none";


}

function show_training2()
{
    document.getElementById("Training1").style.display = "none";
    document.getElementById("Training2").style.display = "block";

}

function zonyl_survey() {
    var un = $$("username").value;
    var cn = $$("companyname").value;
    var dep = $$("dep").options[$$("dep").selectedIndex].value;
    var email = $$("email").value;
    var tel = $$("tel").value;
    if(un==""||cn==""||dep==""||email==""||tel=="")
    {
    alert("请填写您的个人资料");
    return;
    }

    var keneng = "";
    var kenenglist = document.getElementsByName("keneng");
    for (var i = 0; i < kenenglist.length; i++) {
        if (kenenglist[i].checked == true)
            keneng = kenenglist[i].value;
    }
    if (keneng == "") {
        alert("您还没有回答问题");
        return;
    }

    var youdian = "";
    var youdianlist = document.getElementsByName("jiazhi");
    for (var i = 0; i < youdianlist.length; i++) {
        if (youdianlist[i].checked == true)
            youdian += youdianlist[i].value + "#";
    }
    if (youdian == "") {
        alert("您还没有回答问题");
        return;
    }
    youdian=youdian.substring(0, youdian.length - 1);

    var gaishan = "";
    var gaishanlist = document.getElementsByName("gaishan");
    for (var i = 0; i < gaishanlist.length; i++) {
        if (gaishanlist[i].checked == true)
            gaishan += gaishanlist[i].value + "#";
    }
    if (gaishan == "") {
        alert("您还没有回答问题");
        return;
    }
    gaishan = gaishan.substring(0, gaishan.length - 1);

    var yongdao = "";
    var yongdaolist = document.getElementsByName("yongdao");
    for (var i = 0; i < yongdaolist.length; i++) {
        if (yongdaolist[i].checked == true)
            yongdao += yongdaolist[i].value;
    }
    if (yongdao == "") {
        alert("您还没有回答问题");
        return;
    }

    var jiage = $$("jiage").value;
    if (jiage == "") {
        alert("您还没有回答问题");
        return;
    }

    var xuyao = "";
    var xuyaolist = document.getElementsByName("xuyao");
    for (var i = 0; i < xuyaolist.length; i++) {
        if (xuyaolist[i].checked == true)
            xuyao += xuyaolist[i].value;
    }
    if (xuyao == "") {
        alert("您还没有回答问题");
        return;
    }

    var jishu = $$("jishuzhichi").value;
    if (jishu == "") {
        alert("您还没有回答问题");
        return;
    }
    var d = new Date();
    var urlstr = "../handler/userHandler.ashx?type=zonyl&un=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(un) : un) +
                "&cn=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(cn) : cn) +
                "&dep=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(dep) : dep) +
                "&email=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(email) : email) +
                "&tel=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(tel) : tel) +
                "&keneng=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(keneng) : keneng) +
                "&youdian=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(youdian) : youdian) +
                "&gaishan=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(gaishan) : gaishan) +
                "&yongdao=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(yongdao) : yongdao) +
                "&jiage=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(jiage) : jiage) +
                "&xuyao=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(xuyao) : xuyao) +
                "&jishu=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(jishu) : jishu) +
                "&d=" + d.getSeconds();
    $.ajax({
        url: urlstr,
        type: "GET",
        datatype: "html",
        timeout: 20000,
        error: function() {
            alert("error");
        },
        success: function(str) {
            var rst = (parseInt(str)) > 0;
            if (rst) {
                alert("您的资料已发送，请耐心等待审核");
                window.location.href = "http://zonyl.tuliao100.com";
            }
            else {


            }
        }
    });

}

var count = 1;
function addFriend() {
    ++count;
    var ss = $$("friend").innerHTML;
    ss += "<div><span>您好友的名字:<input type='text' id='friendname" + (count) + "' name='friendname' /></span><span>您好友的邮件地址:<input type='text' id='friendemail" + count + "' name='friendemail' /></span></div>";
    $$("friend").innerHTML = ss;
    $$("HiddenField1").Value = count;
}

function sendemail() {
    var fname = "";
    var femail = "";
    var ftitle = "";
    var fcontent = "";
    for (var i = 1; i <= count; i++) {
        fname += $$("friendname" + i).value + ",";
        femail += $$("friendemail" + i).value + ",";
    }
    fname = fname.substring(0, fname.length - 1);
    femail = femail.substring(0, femail.length - 1);
    ftitle = $$("preview_title").innerText;
    fcontent = $$("preview_content").innerText;
    //alert(ftitle +"    "+ fcontent);
    var urlstr = "Information.aspx?type=friendshare&fname=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(fname) : fname) +
        "&femail=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(femail) : femail);
    "&ftitle=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(ftitle) : ftitle);
    "&fcontent=" + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(fcontent) : fcontent);
    $.ajax({
        url: urlstr,
        type: "GET",
        datatype: "html",
        timeout: 20000,
        error: function() {
            alert("error");
        },
        success: function(str) {
            var rst = (parseInt(str)) > 0;
            if (rst) {
                alert("发送成功");
                window.location.href = window.location.href;
            }
            else {


            }
        }
    });
        
}