﻿function Mover(Dis,n1,n2,n3,Ds,ns1,ns2,ns3)
{
    document.getElementById(Ds).className = "Sp1";
    document.getElementById(ns1).className = "Sp2";
    document.getElementById(ns2).className = "Sp2";
    document.getElementById(ns3).className = "Sp2";
    
    document.getElementById(Dis).style.display = "";
    document.getElementById(n1).style.display = "none";
    document.getElementById(n2).style.display = "none";
    document.getElementById(n3).style.display = "none";
}
function MoverSl(Dis,n1,n2,n3)
{
    $("#"+Dis)[0].style.background = "#E7E5E6";
    $("#"+n1)[0].style.background = "#ffffff";
    $("#"+n2)[0].style.background = "#ffffff";
    $("#"+n3)[0].style.background = "#ffffff";
}


function MoverShi(Dis,n1,n2,n3,n4,n5,n6)
{
    $("#"+Dis)[0].style.background = "#888683";
    $("#"+n1)[0].style.background = "#d8d7d6";
    $("#"+n2)[0].style.background = "#d8d7d6";
    $("#"+n3)[0].style.background = "#d8d7d6";
    $("#"+n4)[0].style.background = "#d8d7d6";
    $("#"+n5)[0].style.background = "#d8d7d6";
    $("#"+n6)[0].style.background = "#d8d7d6";
}

function MoverUse(Dis,n1,n2)
{
    $("#"+Dis)[0].style.background = "#888683";
    $("#"+n1)[0].style.background = "#d8d7d6";
    $("#"+n2)[0].style.background = "#d8d7d6";
}
function similar(left,right)
{
 try
  {
    Lh = document.getElementById(left).clientHeight;
    Rh = document.getElementById(right).clientHeight;
    if(Lh >Rh)
        HH = Lh;
    else
        HH = Rh;
    document.getElementById(left).style.height = HH;
    document.getElementById(right).style.height = HH;     
  }
  catch(e)
  {}
  alert(HH);
}
function CheckUserName()
{
    var UserName = $("#ctl00_Content_TxtName")[0].value;
    if(UserName==null || UserName=="")
        return;
    UserReg.IsExist(UserName,function(res){
        if(res.value != "1")
            alert("用户名验证正确");
        else
        {
            alert("用户名已经被注册，请重新输入。");
             $("#ctl00_Content_TxtName").focus();
        }
    });
}
function load()
{
    var _c = $("#ctl00_Content_code");
    if(_c.val()=="")
    {
        alert("请输入验证码！");
        _c.focus();
        return false;
    }
    if(_c.val().toUpperCase()!= getck('CheckCode').toUpperCase())
    {
        alert("验证码输入错误！");
        $("#code").focus();
        return false;
    }
}
function getck(sname)
{
   var strCookie=document.cookie;
   var acookie=strCookie.split("; ");

    //获取单个cookies
    for(var i=0;i<acookie.length;i++)
    {
        var arr=acookie[i].split("=");
        if(sname==arr[0])
        {
            if(arr.length>1)
                return unescape(arr[1]);
            else
                return "";
        }
    }
    return "";
}

function CheckLand()
{
    var Uname = document.getElementById("ctl00_Content_TxtName").value;
    var Pwd = document.getElementById("ctl00_Content_TxtPwd").value;
    var Cod = document.getElementById("ctl00_Content_code").value;
    if(Uname=="")
    {
        alert("请输入用户名！");
        document.getElementById("ctl00_Content_TxtName").focus();
        return false;
    }
    if(Pwd=="")
    {
        alert("请输入密码！");
        document.getElementById("ctl00_Content_TxtPwd").focus();
        return false;
    }
    if(Cod=="")
    {
        alert("请输入验证码！");
       document.getElementById("ctl00_Content_code").focus();
        return false;
    }
    if(getck('CheckCode').toUpperCase()!="")
    {
        if(Cod.toUpperCase()!= getck('CheckCode').toUpperCase())
        {
            alert("验证码输入错误！");
            document.getElementById("ctl00_Content_code").focus();
            return false;
        }
    }
}
function getck(sname)
{
   var strCookie=document.cookie;
   var acookie=strCookie.split("; ");

    //获取单个cookies
    for(var i=0;i<acookie.length;i++)
    {
        var arr=acookie[i].split("=");
        if(sname==arr[0])
        {
            if(arr.length>1)
                return unescape(arr[1]);
            else
                return "";
        }
    }
    return "";
}
// 全选
function chall()
{  
    var winput = $("input"); 
	for(var i=0;i<winput.length;i++)
	{   
	    if(i<10)
		     id = "ctl00_Content_DList_ctl0"+i+"_Cb";
		else
		    id = "ctl00_Content_DList_ctl"+i+"_Cb";
	    var tempobj = $("#"+id)[0];
	    try
	    {
	        if(tempobj.type == "checkbox")
	        {
			    tempobj.checked = true;
	        }
	    }
	    catch(e)
	    {}
	}
	
}
// 反选
function chNoall()
{
    var winput = $("input"); 
	for(var i=0;i<winput.length;i++)
	{   
	    if(i<10)
		     id = "ctl00_Content_DList_ctl0"+i+"_Cb";
		else
		    id = "ctl00_Content_DList_ctl"+i+"_Cb";
	    var tempobj = $("#"+id)[0];
	    try
	    {
	        if(tempobj.type == "checkbox")
	        {
	           if(tempobj.checked)
			        tempobj.checked = false;
			   else
			        tempobj.checked = true;
	        }
	    }
	    catch(e)
	    {}
	}
}
function CheckStoreShoop(UserId)
{
    if(UserId == 0)
    {
        alert("您还没有登录！");
        return false;
    }
    else
        return true;
}
function showChangePwd()
{
    $("#trPwd")[0].style.display = "";
}
function ddlChange()
{
    var Rimg = "";
    var id = document.getElementById("ctl00_Content_DDlImg").value;
    $("#ctl00_Content_ImgHead")[0].src = "Images/UserHeadImg/"+id;
     $("#ctl00_Content_HidImg")[0].value = id;
}
function CheckInputPwd()
{
    if($("#ctl00_Content_TxtPwd")[0].value =="")
    {
        alert("密码输入不能为空！");
        return false;
    }
    else
    {
        if($("#ctl00_Content_TxtPwd").attr("value").Length > 20)
        {
            alert("密码输入太长！");
            return false;
        }
        if($("#ctl00_Content_TxtPwd").attr("value") != $("#ctl00_Content_TxtPwd2").attr("value"))
        {
            alert("您两次输入的密码不正确！");
            return false;
        }
    }
}

//设置提交的按钮的焦点
function SearGoKey()
{
    if(event.keyCode==13)
    {
        event.keyCode = 9;
        SearchGo();
    }
}
function SearchGo()
{
    if(document.getElementById("SearchTxt").value=="")
    {
        alert('请输入搜索内容！');
        return false;
    }
    else
    {
        var search =document.getElementById("SearchTxt").value;
        window.location.href = "SearchGoods.aspx?Search="+search;
    }
    
}
function CheckMadd()
{
    if($("#ctl00_Content_TxtMeg")[0].value=="")
    {
        alert("请输入留言内容");
        return false;
    }
}
function MaddName()
{
    if($("#ctl00_Content_TxtName")[0].value=="游客")
        $("#ctl00_Content_TxtName")[0].value ="";
}

function MaddNameMove()
{
    if($("#ctl00_Content_TxtName")[0].value=="")
        $("#ctl00_Content_TxtName")[0].value ="游客";
}