﻿// JScript 文件
function $(id)
{
    return document.getElementById(id);
}
//强制输入数字
function onlyNum() 
{ 
  if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)||event.keyCode==8)) 
//考虑小键盘上的数字键 
    event.returnValue=false; 
} 
//验证日期
function isDate(ID)//对日期格式进行验证 
{
    var ConID = ID.id;
    //要求为2000-2099年  格式为 yyyy-mm-dd 并且可以正常转换成正确的日期
    var MyDate = document.getElementById(ConID);
    var oStartDate = MyDate.value;
    var pat_hd=/^20\d{2}-((0[1-9]{1})|(1[0-2]{1}))-((0[1-9]{1})|([1-2]{1}[0-9]{1})|(3[0-1]{1}))$/;
    var Error = "格式错误!(例:2008-01-01)";

 
  if(!pat_hd.test(oStartDate))
  { 
  
    MyDate.innerText = "";
    MyDate.innerText = Error;
    return false;
  }
  var arr_hd=oStartDate.split("-");
  var dateTmp;
  dateTmp= new Date(arr_hd[0],parseFloat(arr_hd[1])-1,parseFloat(arr_hd[2]));
  if(dateTmp.getFullYear()!=parseFloat(arr_hd[0]) || dateTmp.getMonth()!=parseFloat(arr_hd[1]) -1 || dateTmp.getDate()!=parseFloat(arr_hd[2]))
  {
        MyDate.innerText = "";
        MyDate.innerText = Error;
    return false;
  }
  
  return true;
 
}
//验证数字
function isNum(txtTel)
{
    var txtID = txtTel.split(',');
    
    for(var m = 0; m < txtID.length; m++)
    {
        var Telpattern=/^[0-9]+$/;
        var txttemps = $(txtID[m]);
        if(txttemps.value != "")
        {
            if(!Telpattern.test(txttemps.value))
            {
	            alert(""+txttemps.title+"只能为数字!")
	            return false;
            }
        }
    } 
}
//验证是否为空及电话号码
//  txtId:      所有需要操作的TextBox的ID
//  txtCount:   所有需要操作的TextBox的数量
//  txtTel:     其中需要检验电话号码的TextBox的索引
function  CheckTextBox(txtId)
{
    var txtIdIndex = txtId.split(',');
    
    for(var n = 0; n < txtIdIndex.length; n++)
    {
        var txtTemp = $(txtIdIndex[n]);
        if(txtTemp.value == "")
        {
            alert("请输入"+txtTemp.title+"!");
            txtTemp.focus();
            return false;
        }
    }
}
//验证非空及数字
function  CheckTextBox2(txtId,txtTel)
{
    var txtIdIndex = txtId.split(',');
    
    for(var n = 0; n < txtIdIndex.length; n++)
    {
        var txtTemp = $(txtIdIndex[n]);
        if(txtTemp.value == "")
        {
            alert(""+txtTemp.title+"不能为空!")
            return false;
        }
    }
    
    var txtID = txtTel.split(',');
    
    for(var m = 0; m < txtID.length; m++)
    {
        var Telpattern=/^[0-9]+$/;
        var txttemps = $(txtID[m]);
        if(txttemps.value != "")
        {
            if(!Telpattern.test(txttemps.value))
            {
	            alert(""+txttemps.title+"只能为数字!")
	            return false;
            }
        }
    } 
}
//验证数字
function checkNum(tdNum)
{
    var Telpattern=/^[0-9]+$/;
    var temp = $(tdNum);
    if(temp.value != "")
    {
        if(!Telpattern.test(temp.value))
        {
            alert(""+temp.title+"只能为数字!");
            temp.focus();
            $(tdNum).value = "";
            return false;
        }
    }
}
//验证年
function checkNumYear(tdNum)
{
    var Telpattern=/^[0-9]+$/;
    var temp = $(tdNum);
    if(temp.value != "")
    {
        if(!Telpattern.test(temp.value))
        {
            alert(""+temp.title+"只能为数字!");
            temp.focus();
            $(tdNum).value = "";
            return false;
        }
        else
        {
            if(temp.value.length != 4)
            {
                alert(""+temp.title+"输入错误(正确如：2008)!");
                temp.focus();
                $(tdNum).value = "";
                return false;
            }
        }
    }
}

//电子邮件的验证
function checkEmail(tbEmail)
{
    var temp =$(tbEmail);
    //对电子邮件的验证
    var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if(temp.value!="")
    {
        if(!myreg.test(temp.value))
        {
            alert('请输入有效的Email！');
            temp.value = "";
            temp.focus();
            return false;
        }
    }
}

function YesOrNo()
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
        return true;
    }  
    else
    {
        return false;   
    }
}

function YesOrNo2(txtId,txtTel)
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
    
        var txtIdIndex = txtId.split(',');
    
        for(var n = 0; n < txtIdIndex.length; n++)
        {
            var txtTemp = $(txtIdIndex[n]);
            if(txtTemp.value == "")
            {
                alert(""+txtTemp.title+"不能为空!")
                return false;
            }
        }
        
        var txtID = txtTel.split(',');
        
        for(var m = 0; m < txtID.length; m++)
        {
            var Telpattern=/^[0-9]+$/;
            var txttemps = $(txtID[m]);
            if(txttemps.value != "")
            {
                if(!Telpattern.test(txttemps.value))
                {
	                alert(""+txttemps.title+"只能为数字!")
	                return false;
                }
            }
        }
        return true; 
    }  
    else
    {
        return false;   
    }
}

function YesOrNo3(txtTel)
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
        var txtID = txtTel.split(',');
        
        for(var m = 0; m < txtID.length; m++)
        {
            var Telpattern=/^[0-9]+$/;
            var txttemps = $(txtID[m]);
            if(txttemps.value != "")
            {
                if(!Telpattern.test(txttemps.value))
                {
	                alert(""+txttemps.title+"只能为数字!")
	                return false;
                }
            }
        }
        return true; 
    }  
    else
    {
        return false;   
    }
}

function YesOrNo4(txtId)
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
    
        var txtIdIndex = txtId.split(',');
    
        for(var n = 0; n < txtIdIndex.length; n++)
        {
            var txtTemp = $(txtIdIndex[n]);
            if(txtTemp.value == "")
            {
                alert(""+txtTemp.title+"不能为空!")
                return false;
            }
        }
        return true; 
    }  
    else
    {
        return false;   
    }
}

function YesOrNo6(txtId,name)
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
    
        var txtIdIndex = txtId.split(',');
    
        for(var n = 0; n < txtIdIndex.length; n++)
        {
            var txtTemp = $(txtIdIndex[n]);
            if(txtTemp.value == "")
            {
                alert(""+$(name).innerText+"不能为空!")
                return false;
            }
        }
        return true; 
    }  
    else
    {
        return false;   
    }
}

function CheckIDCard(StrNumber) 
{//判断身份证号码格式函数//公民身份号码是特征组合码，//排列顺序从左至右依次为：六位数字地址码，八位数字出生日期码，三位数字顺序码和一位数字校验码 //身份证号码长度判断
    if(StrNumber.length<15||StrNumber.length==16||StrNumber.length==17||StrNumber.length>18)
        {
            alert("填写的身份证号码长度不正确，请重新填写!");
            return false;
         }
}

function getTXT()
{
    var pp = $("province").value;
    var cc = $("city").value;				    
}

function YesOrNo5()
{
    var show = window.confirm("确定执行此操作?“确定”继续/“取消”停止");
    if (show) 
    {
        getTXT();
        return true;
    }  
    else
    {
        return false;   
    }
}
    
function checkIdcard(idcard)
{
    var Errors=new Array("验证通过!","身份证号码位数不对!","身份证号码出生日期超出范围或含有非法字符!","身份证号码校验错误!","身份证地区非法!");
    var area={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
    var idcard,Y,JYM;
    var S,M;
    var idcard_array = new Array();
    idcard_array = idcard.split("");
    //地区检验
    if(area[parseInt(idcard.substr(0,2))]==null) return Errors[4];
    //身份号码位数及格式检验
    switch(idcard.length)
    {
        case 15:
        if ( (parseInt(idcard.substr(6,2))+1900) % 4 == 0 || ((parseInt(idcard.substr(6,2))+1900) % 100 == 0 && (parseInt(idcard.substr(6,2))+1900) % 4 == 0 ))
        {
            ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/;//测试出生日期的合法性
        } 
        else 
        {
            ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/;//测试出生日期的合法性
        }
        if(ereg.test(idcard)) return Errors[0];
        else return Errors[2];
        break;
        case 18:
        //18位身份号码检测
        //出生日期的合法性检查 
        //闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))
        //平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))
        if ( parseInt(idcard.substr(6,4)) % 4 == 0 || (parseInt(idcard.substr(6,4)) % 100 == 0 && parseInt(idcard.substr(6,4))%4 == 0 ))
        {
            ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/;//闰年出生日期的合法性正则表达式
        } 
        else 
        {
            ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/;//平年出生日期的合法性正则表达式
        }
        if(ereg.test(idcard))
        {
            //测试出生日期的合法性
            //计算校验位
            S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7
            + (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9
            + (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10
            + (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5
            + (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8
            + (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4
            + (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2
            + parseInt(idcard_array[7]) * 1 
            + parseInt(idcard_array[8]) * 6
            + parseInt(idcard_array[9]) * 3 ;
            Y = S % 11;
            M = "F";
            JYM = "10X98765432";
            M = JYM.substr(Y,1);//判断校验位
            if(M == idcard_array[17]) 
                return Errors[0]; //检测ID的校验位
            else 
                return Errors[3];
        }
            else return Errors[2];
            break;
            
            default:
                return Errors[1];
            break;
    }

}

//倒计时跳转     
function countDown(secs,surl,lbl)
{         
     if(--secs>-1)
     {     
         setTimeout("countDown("+secs+",'"+surl+"','"+lbl+"')",1000);
         $(lbl).innerText = secs;     
     }     
     else
     {       
         location.href=surl;     
     }     
}  

/*******************************************************************************************************************************************************/
/*******************************************************   registeOne.aspx   ***************************************************************************/




//验证页面非空项
function CheckTheNameNow(String)
{ 
    var Letters = "~`!@#$%^&*{}[]:;'<,>.?/()-_+=|\\\" ";
    var c;
    for(var i = 0; i < String.length; i ++ )
    {
        c = String.charAt( i );
        if (Letters.indexOf( c ) > 0)
            return false;        
    }
    return true;
}

function CheckName(RegName)
{
    var tName = $(RegName);
    if(tName.value.length > 0)
    {
        var Telpattern=/^[0-9]+$/;
        if(Telpattern.test(tName.value.substr(0,1)))
        {
            tName.focus();
            tName.value = "";
            $('errorName4').style.display = 'block';
            $('errorName3').style.display = 'none';
            $('errorName2').style.display = 'none';
            $('errorName').style.display = 'none';
            $('NoName').style.display = 'none';
            $('HaveName').style.display = 'none';
            $('imgName').style.visibility = 'hidden';
            return false;
        }
        else
        {
            for(i=0;i<tName.value.length;i++)
            {
                var c = tName.value.substr(i,1);
                var ts = escape(c);
                if(ts.substring(0,2) == "%u")
                {
                    tName.focus();
                    tName.value = "";
                    $('NoName').style.display = 'none';
                    $('HaveName').style.display = 'none';
                    $('errorName4').style.display = 'none';
                    $('errorName3').style.display = 'block';
                    $('errorName2').style.display = 'none';
                    $('errorName').style.display = 'none';
                    $('imgName').style.visibility = 'hidden';
                    return false;
                }
            }
            if(!CheckTheNameNow(tName.value))
			{
			    tName.focus();
                tName.value = "";
                $('NoName').style.display = 'none';
                $('HaveName').style.display = 'none';
                $('errorName4').style.display = 'none';
                $('errorName3').style.display = 'block';
                $('errorName2').style.display = 'none';
                $('errorName').style.display = 'none';
                $('imgName').style.visibility = 'hidden';
                return false;
			}
            if(tName.value.length < 4 || tName.value.length >20)
            {
                tName.focus();
                tName.value = "";
                $('NoName').style.display = 'none';
                $('HaveName').style.display = 'none';
                $('errorName4').style.display = 'none';
                $('errorName3').style.display = 'none';
                $('errorName2').style.display = 'block';
                $('errorName').style.display = 'none';
                $('imgName').style.visibility = 'hidden';
                return false;
            }  
            else
            {
                $('NoName').style.display = 'block';
                $('HaveName').style.display = 'none';
                $('errorName4').style.display = 'none';
                $('errorName3').style.display = 'none';
                $('errorName2').style.display = 'none';
                $('errorName').style.display = 'none';
                CheckNameHave(RegName)
            }
        }
    }
}
//验证密码
function CheckPass(RegPass)
{
    var tPass = $(RegPass);
    if(tPass.value.length > 0)
    {
        for(i=0;i<tPass.value.length;i++)
        {
            var c = tPass.value.substr(i,1);
            var ts = escape(c);
            if(ts.substring(0,2) == "%u")
            {
                tPass.focus();
                tPass.value = "";
                $('imgPass').style.visibility = 'hidden';
                $('errorPass').style.display = 'block';
                $('errorPassH').style.display = 'none';
                return false;
            }
        }
        if(tPass.value.length < 6 || tPass.value.length >20)
        {
            tPass.focus();
            tPass.value = "";
            $('imgPass').style.visibility = 'hidden';
            $('errorPass2').style.display = 'block';
            $('errorPassH').style.display = 'none';
            return false;
        }
        else
        {
            $('imgPass').style.visibility = 'visible';
            $('errorPass').style.display = 'none';
            $('errorPass2').style.display = 'none';
            $('errorPassH').style.display = 'none';
            CheckTwoPass2('txtuserPwd','txtuserPwd2');
        }
    }
}
//密码确认
function CheckTwoPass(RegPass1,RegPass2)
{
    if($(RegPass2).value.length > 0)
    {
        if($(RegPass1).value != $(RegPass2).value)
        {
            $(RegPass2).focus();
            $(RegPass2).value = "";
            $('imgPass2').style.visibility = 'hidden';
            $('errorPass3').style.display = 'block';
            $('errorPassH2').style.display = 'none';
            return false;
        }
        else
        {
            $('imgPass2').style.visibility = 'visible';
            $('errorPass3').style.display = 'none';
            $('errorPassH2').style.display = 'none';
            return true;
        }
    }
}
//密码确认
function CheckTwoPass2(RegPass1,RegPass2)
{
    if($(RegPass2).value.length > 0 && $(RegPass1).value.length > 0)
    {
        if($(RegPass1).value != $(RegPass2).value)
        {
            $(RegPass2).focus();
            $(RegPass2).value = "";
            $('imgPass2').style.visibility = 'hidden';
            $('errorPass3').style.display = 'block';
            $('errorPassH2').style.display = 'none';
            return false;
        }
        else
        {
            $('imgPass2').style.visibility = 'visible';
            $('errorPass3').style.display = 'none';
            $('errorPassH2').style.display = 'none';
            return true;
        }
    }
}

//验证验证码是否输入
function ShowVcode(tVcode,tshow)
{
    if($(tVcode).value != "")
    {
        $(tshow).style.display = 'none';
    }
    else
    {
        $(tshow).style.display = 'block';
    }
}
//输入显示提示
function ShowImg(tHave,tImg,tNull)
{
    if($(tHave).value != "")
    {
        $(tImg).style.visibility = 'visible';
    }
    else
    {
        $(tImg).style.visibility = 'hidden';
    }
    $(tNull).style.display = 'none';
}
//输入显示提示2
function ShowOlImg(tHave,tImg)
{
    if($(tHave).value != "")
    {
        $(tImg).style.visibility = 'visible';
    }
    else
    {
        $(tImg).style.visibility = 'hidden';
    }
}
//号码为文字则清空表单
function LetNull(tPath)
{
    for(i=0;i<$(tPath).value.length;i++)
    {
        var c = $(tPath).value.substr(i,1);
        var ts = escape(c);
        if(ts.substring(0,2) == "%u")
        {
            $(tPath).value = "";
        }
    } 
}
//验证是否输入电话
function checkNumHave(tNum,tdQH,tImg)
{
    if($(tNum).value != "")
    {
        if($(tdQH).value == "" || $(tdQH).value == '区号')
        {
            alert("请输入"+$(tdQH).title+"");
            $(tdQH).focus();
            $(tdQH).value = "";
            $(tImg).style.visibility = 'hidden';
            return false;
        }
        if($(tNum).value == "电话号码")
        {
            $(tNum).focus();
            $(tNum).value = "";
            $(tImg).style.visibility = 'hidden';
            return false;
        }
        else
        {
            $(tImg).style.visibility = 'visible';
        }
    }
}
//验证是否查看规定
function ReadIt(tRead,tshow)
{
    if($(tRead).checked != true)
    {
        $(tshow).style.display = 'block';
        $(tRead).focus();
        return false;
    }
    else
    {
        $(tshow).style.display = 'none';
    }
}
//验证登录名是否使用
function CheckNameHave(tName)
{
    if($(tName).value != "")
    {
        bounbary_REG_registeOne.CheckUserName($(tName).value,CheckResult);
    }
}
//判断登录名是否有的结果
function CheckResult(IsHave)
{
    if(IsHave.value == "0")
    {
        $('NoName').style.display = 'block';
        $('imgName').style.visibility = 'visible';
    }
    else
    {
        $('HaveName').style.display = 'block';
        $('NoName').style.display = 'none';
        $('txtuserName').value = "";
        $('txtuserName').focus();
    }
}

/******************************************************************   registeTwo.aspx   ***************************************************************/
//是否跳过
function GoToNext()
{
    var show = window.confirm("是否确定跳过,跳过将放弃激活信息发送功能！");
    if (show) 
    {
        return true;
    }  
    else
    {
        return false;   
    }
}
//验证邮箱是否存在
function CheckEmailHave(tEmail)
{
    if($(tEmail).value != "")
    {
        bounbary_REG_registeTwo.CheckTheEmail($(tEmail).value,CheckResult2);
    }
}
//判断邮箱是否有的结果
function CheckResult2(IsHave)
{
    if(IsHave.value == "0")
    {
        $('NoEmail').style.display = 'block';
        $('HaveEmail').style.display = 'none';
        $('errorEmail').style.display = 'none';
        $('txtsafeEmail').style.visibility = 'visible';
    }
    else
    {
        $('HaveEmail').style.display = 'block';
    }
}
//判断非空
function  IsAllNull(txtId,tShow)
{
    var txtIdIndex = txtId.split(',');
    var txtShow = tShow.split(',');
    var nCount = 0;
    
    for(var n = 0; n < txtIdIndex.length - 1; n++)
    {
        var txtTemp = $(txtIdIndex[n]);
        var txtTshow = $(txtShow[n]);
        if(txtTemp.value == "")
        {
            nCount++;
            txtTshow.style.display = 'block';
        }
    }
    if($(txtIdIndex[txtIdIndex.length-1]).checked != true)
    {
        nCount++;
        $(txtShow[txtIdIndex.length-1]).style.display = 'block';
    }
    if(nCount > 0)
    {
        $('errorName4').style.display = 'none';
        $('errorName3').style.display = 'none';
        $('errorName2').style.display = 'none';
        $('errorPass').style.display = 'none';
        $('errorPass2').style.display = 'none';
        $('errorPass3').style.display = 'none';
        
        return false;
    }
    else
    {
        return true;
    }
}
//判断非空
function  IsAllNull2(txtId,tShow)
{
    var txtIdIndex = txtId.split(',');
    var txtShow = tShow.split(',');
    var nCount = 0;
    
    for(var n = 0; n < txtIdIndex.length; n++)
    {
        var txtTemp = $(txtIdIndex[n]);
        var txtTshow = $(txtShow[n]);
        if(txtTemp.value == "")
        {
            nCount++;
            txtTshow.style.display = 'block';
        }
    }
    if(nCount > 0)
    {
        return false;
    }
    else
    {
        return true;
    }
}
//验证邮箱
function checkthisEmail(tbEmail,tImg)
{
    var temp =$(tbEmail);
    //对电子邮件的验证
    var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if(temp.value!="")
    {
        if(!myreg.test(temp.value))
        {
            $('errorEmail').style.display = 'block';
            $('NoEmail').style.display = 'none';
            temp.value = "";
            temp.focus();
            $(tImg).style.visibility = 'hidden';
            return false;
        }
        else
        {
            $('errorEmail').style.display = 'none';
            $('HaveEmail').style.display = 'none';
            $(tImg).style.visibility = 'visible';
            CheckEmailHave(tbEmail);
        }
    }
}
//验证数字
function checkTheNum(tdNum,tImg)
{
    var Telpattern=/^[0-9]+$/;
    var temp = $(tdNum);
    if(temp.value != "")
    {
        if(!Telpattern.test(temp.value))
        {
            alert(""+temp.title+"只能为数字!");
            temp.focus();
            $(tdNum).value = "";
            $(tImg).style.visibility = 'hidden';
            return false;
        }
        else
        {
            $(tImg).style.visibility = 'visible';
        }
    }
}
/************************************************************************   registeThree.aspx   *********************************************************************/
//查找企业类型
function showNext(sid,obj)
{ 
    if(sid==null || sid=="" || sid.length<1)
        return;     
    var slt =$(obj);
    var v = bounbary_REG_registeThree.getNextClass(sid).value; // 类的名称
    if (v != null)
    {      
        if(v != null && typeof(v) == "object")
		{		
		    slt.length = 0;
		    slt.options.add(new Option("-请选择-",0));
			for(var i=0; i<v.Rows.length; i++)
			{
				var txt = v.Rows[i].ename; //这个地方需要注意区分大小写
				var vol = v.Rows[i].eid; //跟dataset表的列名称要一致
				slt.options.add(new Option(txt,vol));
			}
		}
   }	
   return;
}
//查找市场
function showPClass(sid,obj)
{
    if(sid==null || sid=="" || sid.length<1)
    return;     
    var slt =$(obj);
    var v = bounbary_REG_registeThree.getNextAClass(sid).value; // 类的名称
    if (v != null)
    {      
        if(v != null && typeof(v) == "object")
		{		
		    slt.length = 0;
		    slt.options.add(new Option("-请选择-",0));
			for(var i=0; i<v.Rows.length; i++)
			{
				var txt = v.Rows[i].afName; //这个地方需要注意区分大小写
				var vol = v.Rows[i].afid; //跟dataset表的列名称要一致
				slt.options.add(new Option(txt,vol));
			}
		}
   }
   	
   GetTheAgorInfo('ddlaInfo',$('hidfldP1').value,$('hidfldC1').value,$('ddlTypep').value,$('ddlTypef').value);
   return;
}
//添加主营行业
function AddGid(AllGid,NewGid,tGetIt,tImg,tError)
{
    var AddGid = $(NewGid);
    if($(AllGid).value != null && $(AllGid).value != "")
    {
        if(AddGid.length < 5)
        {
            var nowGid = bounbary_REG_registeThree.GetNowGid($(AllGid).value)
            if(nowGid != null)
            {
                if(nowGid != null && typeof(nowGid) == "object")
		        {	
			        var txt = nowGid.value.Rows[0].typeName; //这个地方需要注意区分大小写
			        var vol = nowGid.value.Rows[0].GID; //跟dataset表的列名称要一致
			        new_opt = document.createElement("OPTION");
			        var Bf_index = AddGid.selectedIndex;
			        AddGid.add(new_opt,Bf_index);
        			
			        new_opt.innerText=txt; // 添加 的值
                    new_opt.value=vol;
                    new_opt.id=vol;
                    
                    var lstindex=$(AllGid).selectedIndex;
                    if(lstindex>=0)
                    {
                        lstindex=Number(lstindex);
                        $(AllGid).remove(lstindex);
                    }
                    
                    $(tGetIt).value += vol + ",";
                    
                    CheckGid(NewGid,tImg,tError);
		        }
            }
        }
    }
}
//移除主营行业
function RemoveGid(tGid,tBGid,tGetIt,tImg,tError)
{
    var lstindex=$(tGid).selectedIndex;
    var tNow = $(tGetIt).value.split(',');
    $(tGetIt).value = "";
    if(lstindex>=0)
    {
        lstindex=Number(lstindex);
        for(var i = 0;i < $(tGid).length;i++)
        {
            if(i != lstindex)
            {
                $(tGetIt).value += tNow[i] + ",";
            }
            else
            {
                var nowGid = bounbary_REG_registeThree.GetNowGid($(tGid).value)
                if(nowGid != null)
                {
                    if(nowGid != null && typeof(nowGid) == "object")
		            {	
			            var txt = nowGid.value.Rows[0].typeName; //这个地方需要注意区分大小写
			            var vol = nowGid.value.Rows[0].GID; //跟dataset表的列名称要一致
			            new_opt = document.createElement("OPTION");
			            var Bf_index = $(tBGid).selectedIndex;
			            $(tBGid).add(new_opt,Bf_index);
            			
			            new_opt.innerText=txt; // 添加 的值
                        new_opt.value=vol;
                        new_opt.id=vol;
		            }
                }
            }
        }
        $(tGid).remove(lstindex);
        CheckGid(tGid,tImg,tError);
    }
}
//清空主营行业
function RemoveAll(tGid,tBGid,tGetIt,tImg,tError)
{
    if($(tGid).length > 0)
    {
        $(tBGid).length = 0;
        var nowGid = bounbary_REG_registeThree.GetgoodsClassAgain().value;
        if(nowGid != null)
        {
            if(nowGid != null && typeof(nowGid) == "object")
		    {	
		        for(var i = 0; i < nowGid.Rows.length; i++)
		        {
		            var txt = nowGid.Rows[i].typeName; //这个地方需要注意区分大小写
			        var vol = nowGid.Rows[i].GID; //跟dataset表的列名称要一致
			        $(tBGid).options.add(new Option(txt,vol));
		        }
		    }
		}
		$(tGid).length = 0;
    }
    $(tGetIt).value = "";
    CheckGid(tGid,tImg,tError); 
}
//验证主要经营地点
function GetTheCitys(tCitys,tAddress,tImg,terror)
{
    if($(tCitys).value != "" && $(tAddress).value != "")
    {
        $(tImg).style.visibility = 'visible';
        $(terror).style.display = 'none';
    }
    else
    {
        $(tImg).style.visibility = 'hidden';
    }
}
//验证主营行业
function CheckGid(tGid,tImg,terror)
{
    if($(tGid).length > 0)
    {
        $(tImg).style.visibility = 'visible';
        $(terror).style.display = 'none';
    }
    else
    {
        $(tImg).style.visibility = 'hidden';
    }
}
//验证主营方向
function CheckAspect(tImg,tError)
{
    $(tImg).style.visibility = 'visible';
    $(tError).style.display = 'none';
}
//验证企业类型
function CheckEnterpriseClass(tClass)
{
    if($(tClass).value == "0")
    {
        $('errorClass').style.display = 'block';
        $('imgClass').style.visibility = 'hidden';
    }
    else
    {
        $('errorClass').style.display = 'none';
        $('imgClass').style.visibility = 'visible';
    }
}
//验证非空
function CheckRegT()
{
    var nCount = 0;
    if($('txtoffName').value == "")
    {
        $('erroroffName').style.display = 'block';
        nCount++;
    }
    else
    {
        $('erroroffName').style.display = 'none';
    }
    if($('ddlEnterprise').value == "0")
    {
        $('errorClass').style.display = 'block';
        nCount++;
    }
    else
    {
        $('errorClass').style.display = 'none';
    }
    if($('hidfldC').value == "" || $('txtoffAdd').value == "")
    {
        $('erroroffAdd').style.display = 'block';
        nCount++;
    }
    else
    {
        $('erroroffAdd').style.display = 'none';
    }
    if($('hidfldGid').value == "")
    {
        $('errorGid').style.display = 'block';
        nCount++; 
    }
    else
    {
        $('errorGid').style.display = 'none';
    }
    if($('txtaspectX').checked != true && $('txtaspectC').checked != true && $('txtaspectL').checked != true)
    {
        $('erroraspect').style.display = 'block';
        nCount++; 
    }
    else
    {
        $('erroraspect').style.display = 'none';
    }
    if(nCount >0 )
    {
        return false;
    }
    else
    {
        return true;
    } 
}

/************************************************************************************************************************************************/
//加载市场
function GetTheAgorInfo(obj,tProvince,tCity,tTypeOne,tTypeTwo)
{    
    var slt =$(obj);
    var v = bounbary_REG_registeThree.SelectTheInfo(tProvince,tCity,tTypeOne,tTypeTwo).value; // 类的名称
    if (v != null)
    {      
        if(v != null && typeof(v) == "object")
		{		
		    slt.length = 0;
		    slt.options.add(new Option("-请选择-",0));
			for(var i=0; i<v.Rows.length; i++)
			{
				var txt = v.Rows[i].arName; //这个地方需要注意区分大小写
				var vol = v.Rows[i].arid; //跟dataset表的列名称要一致
				slt.options.add(new Option(txt,vol));
			}
		}
   }	
   return;
}

function GettypeF()
{
    GetTheAgorInfo('ddlaInfo',$('hidfldP1').value,$('hidfldC1').value,$('ddlTypep').value,$('ddlTypef').value);
}

//添加市场
function AddInfo(AllGid,NewGid,tGetIt)
{
    var AddGid = $(NewGid);
    var nCount = 0;
    if($(tGetIt).value != "" && $(tGetIt).value != "")
    {
        var tID = $(tGetIt).value.split(',');
        for(var i = 0;i < tID.length;i++)
        {
            if($(AllGid).value == tID[i])
            {
                nCount++;
            }
        }
    }
    if(nCount == 0)
    {
        if($(AllGid).value != null && $(AllGid).value != "")
        {
            if(AddGid.length < 5)
            {
                var nowGid = bounbary_REG_registeThree.GetNewInfo($(AllGid).value)
                if(nowGid != null && nowGid.value.Rows.length >0)
                {
                    if(nowGid != null && typeof(nowGid) == "object")
		            {	
			            var txt = nowGid.value.Rows[0].arName; //这个地方需要注意区分大小写
			            var vol = nowGid.value.Rows[0].arid; //跟dataset表的列名称要一致
			            new_opt = document.createElement("OPTION");
			            var Bf_index = AddGid.selectedIndex;
			            AddGid.add(new_opt,Bf_index);
            			
			            new_opt.innerText=txt; // 添加 的值
                        new_opt.value=vol;
                        new_opt.id=vol;
                        
                        $(tGetIt).value += vol + ",";
		            }
                }
            }
        }
    }
}

//移除主营行业
function RemoveInfo(tGid,tGetIt)
{
    var lstindex=$(tGid).selectedIndex;
    var tNow = $(tGetIt).value.split(',');
    $(tGetIt).value = "";
    if(lstindex>=0)
    {
        lstindex=Number(lstindex);
         for(var i = 0;i < $(tGid).length;i++)
        {
            if(i != lstindex)
            {
                $(tGetIt).value += tNow[i] + ",";
            }
        }
        $(tGid).remove(lstindex);
        //CheckGid(tGid,tImg,tError);
    }
}

//清空主营行业
function RemoveAllInfo(tGid,tGetIt)
{
    if($(tGid).length > 0)
    {
		$(tGid).length = 0;
    }
    $(tGetIt).value = "";
    //CheckGid(tGid,tImg,tError); 
}

function GetEid(tGet,tDDl)
{
    if($(tDDl).value != "0")
    {
        $(tGet).value = $(tDDl).value;
    }
}

/********************************************************************  RetakePasswdByAnswer.aspx  ******************************************************************/

function GetSaveQuestion(tName,tShowQ,tGetR,tOk,tError,tA)
{
    if($(tName).value != null && $(tName).value != "")
    {
        var tQuestion = bounbary_REG_RetakePasswdByAnswer.GetQuestion($(tName).value);
        if(tQuestion != null)
        {
            if(tQuestion != null && typeof(tQuestion) == "object" && tQuestion.value.Rows.length > 0)
            {	
                $(tShowQ).innerText = tQuestion.value.Rows[0].safeQuestion; //这个地方需要注意区分大小写
                $(tGetR).value = tQuestion.value.Rows[0].safeResult; //跟dataset表的列名称要一致
                $(tOk).style.display = 'block';
                $(tError).style.display = 'none';
                $(tA).disabled = false;
            }
            else
            {
                $(tName).focus();
                $(tName).value = "";
                $(tOk).style.display = 'none';
                $(tError).style.display = 'block';
                return false;
            }
        }
    }
}

function CheckAnswer(tA,tA2,tS,tS2)
{
    if($(tA).value != null && $(tA).value != "" && $(tA2).value != null && $(tA2).value != "")
    {
        if($(tA).value == $(tA2).value)
        {
            $(tS).style.display = 'block';
            $(tS2).style.display = 'none';
            return true;
        }
        else
        {
            $(tA).focus();
            $(tA).value = "";
            $(tS).style.display = 'none';
            $(tS2).style.display = 'block';
            return false;
        }
    }
}

//输入显示提示
function CheckInputV(tHave,tImg,tNull)
{
    if($(tHave).value != "")
    {
        $(tImg).style.visibility = 'visible';
        $(tNull).style.display = 'none';
    }
    else
    {
        $(tNull).style.display = 'block';
        $(tImg).style.visibility = 'hidden';
    }
} 

function CheckAllInput(tP,tP2,tV,tR,tR2,tR3)
{
    var nCount = 0;
    if($(tP).value == "")
    {
        nCount++;
        $(tR).style.display = 'block';
    }
    else
    {
        $(tR).style.display = 'none';
    }
    
    if($(tP2).value == "")
    {
        nCount++;
        $(tR2).style.display = 'block';
    }
    else
    {
        $(tR2).style.display = 'none';
    }
    
    if($(tV).value == "")
    {
        nCount++;
        $(tR3).style.display = 'block';
    }
    else
    {
        $(tR3).style.display = 'none';
    }
    if(nCount != 0)
    {
        return false;
    }
    else
    {
        return true; 
    }
}

/*********************************************************   RetakePasswdByEmail.aspx   ***************************************************************/
function GetSafeEmail(tName,tEmail,tNo,tHave,tCEmail)
{
    if($(tName).value != null && $(tName).value != "")
    {
        var tTheEmail = bounbary_REG_RetakePasswdByEmail.GetSafeEmail($(tName).value);
        if(tTheEmail != null && typeof(tTheEmail) == "object")
        {	
            if(tTheEmail.value.Rows.length > 0)
            {
                $(tHave).style.display = 'block';
                $(tNo).style.display = 'none';
                if(tTheEmail.value.Rows[0].safeEmail != "")
                {
                    $(tEmail).value = tTheEmail.value.Rows[0].safeEmail;
                    $(tCEmail).disabled = false;
                }
                else
                {
                    alert("对不起,您还没有填写邮箱！");
                    window.location="RecoverPasswd.aspx";
                }
            }
            else
            {
                $(tName).focus();
                $(tName).value = "";
                $(tHave).style.display = 'none';
                $(tNo).style.display = 'block';
                $(tEmail).value = "";
                return false;
            }
        }
        else
        {
            $(tName).focus();
            $(tName).value = "";
            $(tHave).style.display = 'none';
            $(tNo).style.display = 'block';
            $(tEmail).value = "";
            return false;
        }
    }
}

function CheckTheSE(tA,tA2,tS,tS2)
{
    if($(tA).value != null && $(tA).value != "" && $(tA2).value != null && $(tA2).value != "")
    {
        if($(tA).value == $(tA2).value)
        {
            $(tS).style.display = 'block';
            $(tS2).style.display = 'none';
            return true;
        }
        else
        {
            $(tA).focus();
            $(tA).value = "";
            $(tS).style.display = 'none';
            $(tS2).style.display = 'block';
            return false;
        }
    }
}

function showddlPlace(tParentCode,tSelfDll,tddl,tGet)
{
    if(tParentCode != "" && tParentCode != null && tddl != "" && tddl != null)
    {
        var tNowDll = $(tddl);
        var tPlaces = bounbary_REG_registeThree.GetNextPlace(tParentCode).value;
        if(tPlaces != "" && tPlaces != null && typeof(tPlaces) == "object")
        {
            tNowDll.length = 0;
            tNowDll.options.add(new Option("-请选择-",""));
            for(var i = 0;i < tPlaces.Rows.length;i++)
            {
                var txt = tPlaces.Rows[i].codeName;
                var val = tPlaces.Rows[i].code;
                tNowDll.options.add(new Option(txt,val));
            }
        }
    }
    if(tParentCode != "" && tParentCode != null)
    {
        $(tGet).value = $(tSelfDll).options[$(tSelfDll).selectedIndex].text;
    }
} 


function showddlPlace3(tParentCode,tSelfDll,tddl,tGet)
{
    if(tParentCode != "" && tParentCode != null && tddl != "" && tddl != null)
    {
        var tNowDll = $(tddl);
        var tPlaces = bounbary_REG_registeThree.GetNextPlace(tParentCode).value;
        if(tPlaces != "" && tPlaces != null && typeof(tPlaces) == "object")
        {
            tNowDll.length = 0;
            tNowDll.options.add(new Option("-请选择-",""));
            for(var i = 0;i < tPlaces.Rows.length;i++)
            {
                var txt = tPlaces.Rows[i].codeName;
                var val = tPlaces.Rows[i].code;
                tNowDll.options.add(new Option(txt,val));
            }
        }
    }
    if(tParentCode != "" && tParentCode != null)
    {
        $(tGet).value = $(tSelfDll).options[$(tSelfDll).selectedIndex].text;
    }
    GetTheAgorInfo('ddlaInfo',$("hidfldP1").value,$("hidfldC1").value,document.getElementById('ddlTypep').value,document.getElementById('ddlTypef').value);
} 

//智能地位
//function GetCookie(name)   
//{   
//    var arg = name + "=";   
//    var alen = arg.length;   
//    var clen = document.cookie.length;   
//    var i = 0;   
//    while(i<clen)   
//    {   
//        var j = i + alen;   
//        if(document.cookie.substring(i,j) == arg)   
//            return getCookieVal(j);   
//        i = document.cookie.indexOf(" ",i) + 1;   
//        if(i==0)   
//            break;     
//    }   
//    return null;   
//}   
//        
//function getCookieVal(offset)   
//{   
//    var endstr = document.cookie.indexOf(";",offset);   
//    if(endstr ==  -1)  
//        endstr = document.cookie.length;   
//    return unescape(document.cookie.substring(offset,endstr));   
//}   

//function SetCookie(name,value)   
//{   
//    document.cookie = name + "=" + escape(value); 
//}  

//window.onload = document.body.scrollTop=GetCookie('posy');
//window.onunload = SetCookie('posy',document.body.scrollTop);





