
function scareTimer(leftTime,pastTime){
  var block=document.getElementById("scareTimer");
  var time;
  var intervalId=setInterval(function(){
    if(leftTime<=0&&pastTime>0){
      time=pastTime;
      //var day = time/(1000*60*60*24);
      //if(day<=1){
        var h=Math.floor(time/(1000*60*60));
        var m=Math.floor(time/(1000*60))%60;
        var s=Math.floor(time/(1000))%60;
        block.innerHTML="<li class='fst'>剩余<br/>时间</li><li class='num'>" + h + "</li><li>时</li>"+ "<li class='num'>"+m+ "</li><li>分</li>"+ "<li class='num'>"+s+ "</li><li>秒</li>";
      //}
      pastTime-=1000;
    }
    if(leftTime>0){
      time=leftTime;
      //var day = time/(1000*60*60*24);
      //if(day<=1){
        var h1=Math.floor(time/(1000*60*60));
        var m1=Math.floor(time/(1000*60))%60;
        var s1=Math.floor(time/(1000))%60;
        block.innerHTML="<li class='fst'>距离<br/>开始</li><li class='num'>" + h1 + "</li><li>时</li>"+ "<li class='num'>"+m1+ "</li><li>分</li>"+ "<li class='num'>"+s1+ "</li><li>秒</li>";
      //}
      leftTime-=1000;
    }
    if(pastTime<=0){
      block.innerHTML="<li></li><li class='num'>00</li><li>时</li><li class='num'>00</li><li>分</li><li class='num'>00</li><li>秒</li>";
      clearInterval(intervalId);
    }
  },1000);
}
_compLastIdx=1;
_lastcommendId=1;
function showDetail(idx,cid){
  if(_compLastIdx!=idx && _lastcommendId ==cid){
    document.getElementById("c"+cid+"_"+idx).style.display="none";
    document.getElementById("c"+cid+"_"+idx+"_d").style.display="block";
    document.getElementById("c"+cid+"_"+_compLastIdx).style.display="block";
    document.getElementById("c"+cid+"_"+_compLastIdx+"_d").style.display="none";
    _compLastIdx=idx;
  }
  _lastcommendId=cid;
}
function changeTag(columnId,sortId,count){
      if(count==1){
       jQuery("#one"+columnId + count).attr("class","curr");
       jQuery("#one"+ columnId + "2").attr("class","");
      }else{
       jQuery("#one"+ columnId + count).attr("class","curr");
       jQuery("#one" + columnId + "1").attr("class","");
      }
      jQuery("#con_one"+columnId).load("/NewDefault/IndexInclude/IncludeLeftCommend.do",{commendId:sortId});
      _compLastIdx=1;
      _lastcommendId=sortId;
      showDetail(1,sortId);
    }

_compLastCid=8005;
function changeCompositor(cid){
  if(_compLastCid!=cid){
    showDetail(1,_compLastCid);
    showDetail(1,cid);
    var tabCurr=document.getElementById("comp_tab_"+cid);
    var tabOther=document.getElementById("comp_tab_"+_compLastCid);
    if(cid==8005){
      tabCurr.className="current";
      tabCurr.setAttribute("class", "current");
      tabOther.className="link2";
      tabOther.setAttribute("class", "link2");
    }else{
      tabCurr.className="current2";
      tabCurr.setAttribute("class", "current2");
      tabOther.className="link";
      tabOther.setAttribute("class", "link");
    }
    document.getElementById("compositor_"+cid).style.display="block";
    document.getElementById("compositor_"+_compLastCid).style.display="none";
    _compLastCid=cid;
  }
}
_noticeLastIdx=1;
function changeNotice(idx){
  if(_noticeLastIdx!=idx){
    var tabCurr=document.getElementById("noticeLayer"+idx);
    var tabOther=document.getElementById("noticeLayer"+_noticeLastIdx);
    var isDisabled=true;
    if(idx==1){
      tabCurr.className="shopCur";
      tabCurr.setAttribute("class", "shopCur");
      tabOther.className="login";
      tabOther.setAttribute("class", "login");
      document.getElementById("affucgeLayer").style.zIndex="3";
      document.getElementById("loginLayer").style.zIndex="1";
      var form=document.getElementById("loginForm");
      if(form!=null){
        form.loginId.blur();
        form.password.blur();
        form.validateCode.blur();
      }
    }else{
      tabCurr.className="loginCur";
      tabCurr.setAttribute("class", "loginCur");
      tabOther.className="shop";
      tabOther.setAttribute("class", "shop");
      document.getElementById("affucgeLayer").style.zIndex="1";
      document.getElementById("loginLayer").style.zIndex="3";
    }  
    _noticeLastIdx=idx;
  }
}
_discountLastIdx=1;
function changeDiscountTab(idx){
  if(_discountLastIdx!=idx){
    var box=document.getElementById("discountBox");
    var tab1=document.getElementById("discountTab"+idx);
    var tab2=document.getElementById("discountTab"+_discountLastIdx);
    if(idx==1){
      box.className="mizone";
      box.setAttribute("class", "mizone");
      tab1.className="mizoneCur";
      tab1.setAttribute("class", "mizoneCur");
      tab2.className="hotSellLink";
      tab2.setAttribute("class", "hotSellLink");
      document.getElementById("discountContent1").style.display="block";
      document.getElementById("discountContent2").style.display="none";
    }else{
      box.className="hotSell";
      box.setAttribute("class", "hotSell");
      tab1.className="hotSellCur";
      tab1.setAttribute("class", "hotSellCur");
      tab2.className="mizoneLink";
      tab2.setAttribute("class", "mizoneLink");
      document.getElementById("discountContent2").style.display="block";
      document.getElementById("discountContent1").style.display="none";
    }
    _discountLastIdx=idx;
  }
}
_lastHotIdx=1;
function changeHotSell(cid,idx){
  if(_lastHotIdx!=idx){
    jQuery("#hotSellContent").load(_param.frontPath+"/"+_param.webIndex+"/IndexInclude/HotSellContent.do",{cid:cid});
    var curr=document.getElementById("hotColumn"+idx);
    var last=document.getElementById("hotColumn"+_lastHotIdx);
    curr.className="current";
    curr.setAttribute("class", "current");
    last.className="";
    last.setAttribute("class", "");
    _lastHotIdx=idx;
  }
}
function lastBrandPage(page,cid){
  jQuery("#brandContent").load(_param.frontPath+"/"+_param.webIndex+"/IndexInclude/HotSellBrandContent.do",{ccid:cid,page:page-1});
}
function nextBrandPage(page,cid){
  jQuery("#brandContent").load(_param.frontPath+"/"+_param.webIndex+"/IndexInclude/HotSellBrandContent.do",{ccid:cid,page:page+1});
}
_lastSubIdx=1;
function changeSubColumn(pid,cid,style,idx,count){
  if(_lastSubIdx!=idx){
    jQuery("#columnBox"+pid).load(_param.frontPath+"/"+_param.webIndex+"/IndexInclude/ColumnBoxStyle"+style+".do",{cid:cid});
    var curr=document.getElementById("subColumn"+pid+"_"+idx);
    var last=document.getElementById("subColumn"+pid+"_"+_lastSubIdx);
    var nomalClass=count==_lastSubIdx?"last":"";
    curr.className="current";
    curr.setAttribute("class", "current");
    last.className=nomalClass;
    last.setAttribute("class", nomalClass);
    if(_lastSubIdx>1)document.getElementById("subColumn"+pid+"_"+(_lastSubIdx-1)).removeAttribute("style");
    if(idx>1)document.getElementById("subColumn"+pid+"_"+(idx-1)).style.background="none";
    _lastSubIdx=idx;
  }
}


function addfavorite(){
    var a="http://www.myrainbow.cn";
    var b="网上天虹";
    if(document.all){
    window.external.AddFavorite(a,b)
    }else if(window.sidebar){
    window.sidebar.addPanel(b,a,"");
    }else{
    alert("对不起，您的浏览器不支持此操作!\n请您使用菜单栏或Ctrl+D收藏本站。")}
    }


