function setCopy(a)
{
    try
    {
        clipboardData.setData('Text',a)
    }
    catch(e)
    {
    }
}
function $ByID()
{
    var a=new Array();
    for(var i=0;i<arguments.length;i++)
    {
        var b=arguments[i];
        if(typeof b=='string')b=document.getElementById(b);
        if(arguments.length==1)return b;
        a.push(b)
    }
    return a
}
function CheckInputNumValue(a)
{
    if(a.value.search("^[1-9][0-9]*$")!=0)
    {
        a.className="inputerr";
        a.focus();
        return false
    }
    else
    {
        a.className="inputok"
    }
}
function ImageResize(a,b,c)
{
    var d=a.width;
    var f=a.height;
    var g=d;
    var h=f;
    if(a==null)
    {
        return
    }
    else if(a!=null&&(d==0||f==0))
    {
        if(b>0)
        {
            a.width=b
        }
        else if(c>0)
        {
            a.height=c
        }
        else
        {
            return
        }
    }
    else
    {
        try
        {
            if((b!=null&&b>0)&&c==0)
            {
                if(d>b)d=b
            }
            else if((c!=null&&c>0)&&b==0)
            {
                if(f>c)f=c
            }
            else if((c!=null&&c>0)&&(b!=null&&b>0))
            {
                if(d>b)
                {
                    var i,j;
                    i=b;
                    j=parseInt(f/d*b);
                    if(j>c)
                    {
                        j=c;
                        i=parseInt(d/f*c)
                    }
                    d=i;
                    f=j
                }
                else if(f>c)
                {
                    f=c;
                    d=parseInt(g/h*c)
                }
            }
        }
        catch(e)
        {
        }
        if(d>0&&f>0)
        {
            a.width=d;
            a.height=f
        }
        else
        {
            if(b!=null&&b>0)
            {
                a.width=b
            }
        }
    }
}
function AutoAdjustPictures(a,b,c)
{
    var d=document.getElementById(a);
    d=d.getElementsByTagName("img");
    for(var i=0;i<d.length;i++)
    {
        ImageResize(d[i],b,c)
    }
}
function ChangeImg(a,b)
{
    document.getElementById(a).src=b
}
function openWin(a,b,w,h)
{
    var x=(window.screen.width-w)/2;
    var y=(window.screen.height-h)/2;
    var c=window.open(a,b,'toolbar=0,location=0,status=0,top='+y+',left='+x+',width='+w+',height='+h);
    c.focus();
    return c
}
var last_img_btn_chg_prd=null;
function suitImage(a,w,h)
{
    var b=new Image();
    b.src=a.src;
    var c=b.width;
    var d=b.height;
    var e=c/d;
    if(c>w)
    {
        c=w;
        d=w/e
    }
    if(d>h)
    {
        d=h;
        c=h*e
    }
    a.width=c;
    a.height=d
}
function ShowMsg(a,b,x)
{
    if(x==null)x="0";
    var c="<DIV id=\"ElectronicNoteArea\" style=\"MARGIN-TOP: 2px; MARGIN-LEFT: "+x+"px; WIDTH: 276px; POSITION: absolute; HEIGHT: 35px;BACKGROUND: url(/Images/showimg/bg_NoticeMsg_Top.gif) no-repeat;PADDING:1.2em 0.5em;\">";
    c+="<div style=\"float:left\">"+b+"</div><div style=\"float:right;MARGIN-RIGHT:7px; \"><a href=\"javascript:void(null)\" onClick=\"javascript:hideElectronicNoteArea();\" style=\"color:#FF7300; text-decoration:underline\" title=\"关闭该提示\">关闭</a></div>";
    c+="</DIV>";
    var d=document.getElementById(a);
    d.innerHTML=c
}
function hideElectronicNoteArea()
{
    $ByID("ElectronicNoteArea").style.display="none"
}
function QGAddProRoCart(b,c,d,e,f)
{
    ajax.get("\/MyCart/User_Cart_Edit.php?Operate=AddToCart&ProID="+b+"&ThisSize="+c+"&nums="+d+"&ThisColor="+e+"&mystart="+f,function(a)
    {
        if(a.responseText=="2")
        {
            ShowMsg("ShowMsg"+b,"<font color=\"#FF0000\">您已经成功更新了购物车!</font><br><a href=\"\/MyCart/User_Cart.php\">点此直接转跳至购物车？</a>",2);
            window.location="\/MyCart/User_Cart.php"
        }
        else if(a.responseText=="3")
        {
            ShowMsg("ShowMsg"+b,"<font color=\"#FF0000\">您已经成功添加到购物车!</font><br><a href=\"\/MyCart/User_Cart.php\">点此直接转跳至购物车？</a>",2);
            window.location="\/MyCart/User_Cart.php"
        }
        else if(a.responseText=="4")
        {
            ShowMsg("ShowMsg"+b,"<font color=\"#FF0000\">该产品当前库存量不足!请选购其他产品或款式</font>",2)
        }
        else if(a.responseText=="5")
        {
            ShowMsg("ShowMsg"+b,"<font color=\"#FF0000\">促销产品已经过期，无法够买!请选购其他产品或款式</font>",2)
        }
        else if(a.responseText=="6")
        {
            ShowMsg("ShowMsg"+b,"<font color=\"#FF0000\">一个会员只能购买同一款式1件!请选购其他产品或款式</font>",2)
        }
    }
    );
    setTimeout("hideElectronicNoteArea()",5000)
}
function AddProRoCart(b)
{
    if($ByID("readColorPhoto1Title").value=="")
    {
        ShowMsg("ShowMsg","<font color=\"#FF0000\">请选择您要的颜色！</font>","-55")
    }
    else if($ByID("sizes").value=="")
    {
        ShowMsg("ShowMsg","<font color=\"#FF0000\">请选择您要的尺寸！</font>","-55")
    }
    else if(!($ByID("nums").value<1000&&$ByID("nums").value>0))
    {
        ShowMsg("ShowMsg","<font color=\"#FF0000\">请输入购买的数量！</font>","-55")
    }
    else
    {
        ajax.get("\/MyCart/User_Cart_Edit.php?Operate=AddToCart&ProID="+b+"&ThisSize="+$ByID("sizes").value+"&nums="+$ByID("nums").value+"&ThisColor="+$ByID("readColorPhoto1Title").value+"&mystart="+mystart,function(a)
        {
            if(a.responseText=="1")
            {
                //ShowMsg("ShowMsg","<a href=\"\/UserPassPort/Login.php\">您还没有登录？</a>","-55");
                //window.location="/UserPassPort/Login.php?forward="+location.href
				if(confirm('您还没有登录，是否登录会员后继续此次购物呢？')){location.href="/UserPassPort/Login.php?forward="+location.href;}
            }
            else if(a.responseText=="2")
            {
                ShowMsg("ShowMsg","<a href=\"\/MyCart/User_Cart.php\">您已经成功更新了购物车！</a>","-55");
                window.location="\/MyCart/User_Cart.php"
            }
            else if(a.responseText=="3")
            {
                ShowMsg("ShowMsg","<a href=\"\/MyCart/User_Cart.php\">您已经成功添加到购物车！</a>","-55");
                window.location="\/MyCart/User_Cart.php"
            }
            else if(a.responseText=="4")
            {
                ShowMsg("ShowMsg","<font color=\"#FF0000\">该产品当前库存量不足!</font>","-55")
            }
            else if(a.responseText=="5")
            {
                ShowMsg("ShowMsg","<font color=\"#FF0000\">促销产品已经过期，无法够买!</font>","-55")
            }
            else if(a.responseText=="6")
            {
                ShowMsg("ShowMsg","<font color=\"#FF0000\">一个会员只能购买同一款式1件!</font>","-55")
            }
        }
        )
    }
    setTimeout("hideElectronicNoteArea()",5000)
}
function AddProRoFavorites(b)
{
    ajax.get("\/MyCart/User_Favorites_Edit.php?Operate=AddToFavorites&ProID="+b,function(a)
    {
        if(a.responseText=="1")
        {
            ShowMsg("ShowMsg","<a href=\"\/UserPassPort/Login.php\">您还没有登录？</a>","-5");
            window.location="\/UserPassPort/Login.php"
        }
        else if(a.responseText=="2")
        {
            ShowMsg("ShowMsg","<a href=\"\/UserPassPort/User_Favorite.php\">您已经成功收藏了该商品</a>","-5");
            window.location="\/UserPassPort/User_Favorite.php"
        }
        else if(a.responseText=="3")
        {
            ShowMsg("ShowMsg","<a href=\"\/UserPassPort/User_Favorite.php\">该产品已经在您的收藏夹里</a>","-5");
            window.location="\/UserPassPort/User_Favorite.php"
        }
    }
    );
    setTimeout("hideElectronicNoteArea()",5000)
}
function DelAllProRoCart()
{
    if(confirm('请您确认是否清空您的购物车?'))
    {
        ajax.get("\/MyCart/User_Cart_Edit.php?&Operate=DelAll");
        parent.$ByID("MyCartToBuy").value="";
        location.reload()
    }
    return false
}
function DelProRoCart(a)
{
    ajax.get("\/MyCart/User_Cart_Edit.php?MyCartID="+a+"&Operate=Del");
    var b=parent.$ByID("MyCartToBuy").value;
    if(b.indexOf(","+a+",")!=-1)
    {
        parent.$ByID("MyCartToBuy").value=b.replace(","+a+",",",")
    }
    location.reload()
}
function AddProToBuy(a)
{
    if(parent.$ByID("MyCartToBuy").value=="")parent.$ByID("MyCartToBuy").value=parent.$ByID("MyCartToBuy").value+",";
    var b=parent.$ByID("MyCartToBuy").value;
    if(b.indexOf(","+a+",")!=-1)
    {
        parent.$ByID("MyCartToBuy").value=b.replace(","+a+",",",")
    }
    else
    {
        parent.$ByID("MyCartToBuy").value=parent.$ByID("MyCartToBuy").value+a+","
    }
}
function scrolltextarea(b,c,d)
{
    CheckInputNumValue(b);
    ajax.get("\/MyCart/User_Cart_Edit.php?MyCartID="+c+"&MyCartAmount="+b.value,function(a)
    {
        if(a.responseText=="2")
        {
            alert("您已经成功更新了更改了购买数量!")
        }
        else if(a.responseText=="4")
        {
            alert("该产品当前库存量不足!");
            b.value=d;
            b.focus()
        }
    }
    )
}
function SumbitToAddress()
{
    var a=$ByID("MyCartToBuy").value.length;
    if(a<=1)
    {
        alert("请至少选择一个商品！");
        return false
    }
}

function SumbitToPay()
{
    if($ByID("Linkman").value.search("^[\u4e00-\u9fa5]+$")!=0)
    {
		$ByID("Linkman").style.background="red";
        $ByID("Linkman_err").innerHTML="#请填写中文收货人姓名";
        $ByID("Linkman_err").className='HintMsg';
        return false
    }
    else
    {
		$ByID("Linkman").style.background="";
        $ByID("Linkman_err").innerHTML=""
    }
	
    if($ByID("hw_1").value==""||$ByID("hw_2").value=="")
    {
        $ByID("hw_1_err").className='HintMsg';
        $ByID("hw_1_err").innerHTML="#请填写所在地区";
        return false
    }
    else
    {
        $ByID("hw_1_err").innerHTML=""
    }
	
	
    if($ByID("Address").value=="")
    {
		$ByID("Address").style.background="red";
        $ByID("Address_err").className='HintMsg';
        $ByID("Address_err").innerHTML="#请填写街道地址";
        return false
    }
    else
    {
		$ByID("Address").style.background="";
        $ByID("Address_err").innerHTML=""
    }
	
    if($ByID("ZIP").value!=""){
		if($ByID("ZIP").value.search("^[0-9]{6}$")!=0)
		{
			$ByID("ZIP").style.background="red";
			$ByID("ZIP_err").className='HintMsg';
			$ByID("ZIP_err").innerHTML="#请填写邮政编码址";
			return false
		}
		else
		{
			$ByID("ZIP").style.background="";
			$ByID("ZIP_err").innerHTML=""
			$ByID("Linkman").style.background="";
		}
	}
	
    if($ByID("Tel").value==""&&$ByID("Mobile").value=="")
    {
		$ByID("Tel").style.background="red";
        $ByID("Tel_err").className='HintMsg';
        $ByID("Tel_err").innerHTML="#请填写电话号码或者手机号码";
        return false
    }
    if($ByID("Tel").value!=""&&$ByID("Tel").value.search("^[0-9]{3,4}\-[0-9]{7,8}$")!=0)
    {
		$ByID("Tel").style.background="red";
        $ByID("Tel_err").className='HintMsg';
        $ByID("Tel_err").innerHTML="#请填写电话号码,格式：020-88888888";
        return false
    }
    else
    {
		$ByID("Tel").style.background="";
        $ByID("Tel_err").innerHTML="";
        $ByID("Tel_err").innerHTML=''
    }
	
	
    if($ByID("Mobile").value!=""&&$ByID("Mobile").value.search("^[0-9]{11}$")!=0)
    {
		$ByID("Mobile").style.background="red";
        $ByID("Mobile_err").className='HintMsg';
        $ByID("Mobile_err").innerHTML="#请填写手机号码,格式：13800138000";
        return false
    }
    else
    {
		$ByID("Mobile").style.background="";
        $ByID("Mobile_err").innerHTML="";
        $ByID("Mobile_err").innerHTML=''
    }
	
	
    if($ByID("Email").value.search("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$")!=0)
    {
		$ByID("Email").style.background="red";
        $ByID("Email_err").className='HintMsg';
        $ByID("Email_err").innerHTML="#请填写电子邮箱";
        return false
    }
    else
    {
		$ByID("Email").style.background="";
        $ByID("Email_err").innerHTML=""
    }
	
}


function SumbitToTrue()
{
    var a=document.formDataGrid.PayID.length;
    var b=false;
    for(i=0;i<a;i++)
    {
        if(document.formDataGrid.PayID[i].checked==true)
        {
            b=true
        }
    }
    if(!b)
    {
        alert("请至少选择一个付款方式！");
        return false
    }
    a=document.formDataGrid.ExpressID.length;
    var c=false;
    for(i=0;i<a;i++)
    {
        if(document.formDataGrid.ExpressID[i].checked==true)
        {
            c=true
        }
    }
    if(!c)
    {
        alert("请至少选择一个快递方式！");
        return false
    }
}
function checkss(a,n)
{
    if(n==0&&$ByID("SearchValue").value=="输入商品关键字...")
    {
        $ByID("SearchValue").value="";
        return false
    }
    if(n==1)
    {
        if($ByID("SearchValue").value=="输入商品关键字...")
        {
            $ByID("SearchValue").value=""
        }
    }
    if(n==2&&$ByID("SearchValue").value=="")
    {
        $ByID("SearchValue").value="输入商品关键字..."
    }
    if(n==4&&($ByID("SearchValue").value==""||$ByID("SearchValue").value=="输入商品关键字..."))
    {
        alert("输入商品关键字...");
        $ByID("SearchValue").focus();
        return false
    }
    return true
}
function TopSearchOrder(a,n)
{
    if(n==0&&a.value=="订单号码录入框")
    {
        a.value="";
        return false
    }
    if(n==1)
    {
        if(a.value=="订单号码录入框")
        {
            a.value=""
        }
    }
    if(n==2&&a.value=="")
    {
        a.value="订单号码录入框"
    }
    if(n==4&&(a.value==""||a.value=="订单号码录入框"))
    {
        alert("请重新输入...");
        a.focus();
        return false
    }
    return true
}
function TopSearchEamil(a,n)
{
    if(n==0&&a.value=="邮件地址录入框")
    {
        a.value="";
        return false
    }
    if(n==1)
    {
        if(a.value=="邮件地址录入框")
        {
            a.value=""
        }
    }
    if(n==2&&a.value=="")
    {
        a.value="邮件地址录入框"
    }
    if(n==4&&(a.value==""||a.value=="邮件地址录入框"))
    {
        alert("请重新输入...");
        a.focus();
        return false
    }
    return true
}
function GetImages(a,b,c,d)
{
    var e=new Image();
    e.src=a;
    var f=e.width;
    var g=e.height;
    var h=f/g;
    if(f>c)
    {
        f=c;
        g=c/h
    }
    if(g>d)
    {
        g=d;
        f=d*h
    }
    if(g==0||g==null)g=d;
    if(f==0||f==null)f=c;
    document.writeln("<a href="+b+" target=\"_0\"><IMG height=\""+g+"\" src=\""+a+"\" width=\""+f+"\" alt=\"ih"+g+"---iw"+f+"\"/></a>")
}
function autoResize()
{
    try
    {
        $ByID("test").style.height=test.document.body.scrollHeight
    }
    catch(e)
    {
    }
}
function UserLogin()
{
$().ready(function()
{
    $('#dialog').jqm()
}
);
document.writeln("<style type='text/css'>"+".jqmWindow { width:400px; margin-top:130px;border:none;}"+"</style>"+"<div class=\"jqmWindow\" id=\"dialog\">"+"<IFRAME id=\"ThisUserLogin\" src=\"\/UserPassPort/This_UserLogin.php\" frameBorder=\"0\" width=\"100%\" scrolling=\"no\" height=\"26\"></IFRAME>"+"</div>")
}
function GetImagesSwf(a,b,c,d,e)
{
    var f="";
    if(a)
    {
        f="image="+a
    }
    if(e)
    {
        e=e
    }
    else
    {
        e="_1"
    }
    if(b)
    {
        f=f+"&imageLink="+b+"&windowOpen="+e
    }
    if(!c)
    {
        c=90
    }
    if(!d)
    {
        strh=90
    }
    document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,29,0\" width=\""+c+"\" height=\""+d+"\">");
    document.writeln("<param name=\"movie\" value=\"\/images/swfoto.swf?"+f+"\"> ");
    document.writeln("<param name=\"wmode\" value=\"transparent\">");
    document.writeln("<embed src=\"\/images/swfoto.swf?"+f+"\" width=\""+c+"\" height=\""+d+"\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" type=\"application\/x-shockwave-flash\">");
    document.writeln("<\/embed>");
    document.writeln("<\/object>")
}
function SumbitToPrevious(a)
{
    document.formDataGrid.action=a;
    document.formDataGrid.submit()
}
function CheckCouponID(b,c)
{
    if(b.value)
    {
        ajax.get("\/Js/Check_CouponID.php?CouponID="+b.value+"&GetProId="+c,function(a)
        {
            if(a.responseText)
            {
                $ByID("err").className='HintMsg';
                $ByID("err").innerHTML=a.responseText
            }
        }
        )
    }
}
function GETCouponID(b,c,obj)
{
	var ctype="";
	if(c)ctype="&GetType="+c;
	
    if(b)
    {
        ajax.get("\/Js/GET_CouponID.php?UserName="+b+ctype,function(a)
        {
            if(a.responseText)
            {
                $ByID("backmsg").className='HintMsg';
                $ByID("backmsg").innerHTML=a.responseText
            }
        }
        )
    }
	obj.disabled=true;
}

function checkstar(a,b)
{
    document.getElementById("mystar").className="star-rating"+a;
    document.getElementById("Stars").value=a;
    document.getElementById("Starsshow").innerHTML=b
}



// JScript 文件
function ShowTabs(TabTitleID,TabContentID,curID){
  for( var i=0;TabTitleID[i];i++)
  {
		  if(i!=curID)
		  {
			TabTitleID[i].className='';
			TabContentID[i].style.display='none';
			}
		  else
		  {
			TabTitleID[i].className='selected';
			TabContentID[i].style.display='';
		  }	  
  }
}