﻿function huadong(id)
{
    for(i=1;i<5;i++){
      document.getElementById("vipzq"+i+"").style.background="url('img/vipt.jpg')";
      document.getElementById("svipzq"+i+"").style.display="none";
      
    }
    if(id==1)
    {
        document.getElementById('vipzq2').style.borderBottom="1px solid #999091";
    }
    document.getElementById("vipzq"+id+"").style.background="url('img/vipb.jpg')";
    document.getElementById("svipzq"+id+"").style.display="block";
}

function innerhtml(id)
{
    var aa = document.getElementById(""+id+"").innerHTML;
    if(aa=="")
    {
        document.getElementById(""+id+"").style.display="none";
    }
}

function c1it(tabName,btnId,tabNumber){
 for(i=0;i<tabNumber;i++){
  document.getElementById("a"+tabName+i).style.display = "none";
  document.getElementById("a"+tabName+i).className = "off";
  document.getElementById(tabName+i).style.background="";
 }
 document.getElementById("a"+tabName+btnId).style.display = "block";
 document.getElementById("a"+tabName+btnId).className = "on";
 document.getElementById(tabName+btnId).style.background="url('img/shopbai.jpg')";
}
function nbg(id)
{
    for(i=0;i<8;i++){
      document.getElementById("nav"+i).className = "dnav";
      document.getElementById("nav"+i).style.background="";
      document.getElementById("xnav"+i+"").style.color="#3d3d3d";
    }
    document.getElementById(""+id+"").className = "xnav";
    document.getElementById("x"+id+"").style.color="#ffffff";
    document.getElementById(""+id+"").style.background="url('img/xnavbg.jpg')";
}
function DrawImage(ImgD,FitWidth,FitHeight){
      var image=new Image();
      image.src=ImgD.src;
      if(image.width>0 && image.height>0){
          if(image.width/image.height>= FitWidth/FitHeight){
              if(image.width>FitWidth){
                  ImgD.width=FitWidth;
                  ImgD.height=(image.height*FitWidth)/image.width;
              }else{
                  ImgD.width=image.width; 
                 ImgD.height=image.height;
              }
          } else{
              if(image.height>FitHeight){
                  ImgD.height=FitHeight;
                  ImgD.width=(image.width*FitHeight)/image.height;
              }else{
                  ImgD.width=image.width; 
                 ImgD.height=image.height;
              } 
         }
      }
      var top = (FitHeight - ImgD.height) / 2;
      ImgD.style.paddingTop = top+"px";
      ImgD.style.paddingBottom = top+"px";
}
