
var tablink_idname = new Array("tablink")
var tabcontent_idname = new Array("tabcontent") 
var tabcount = new Array("5")
var loadtabs = new Array("1")  
var autochangemenu = 1;
var changespeed = 10;
var stoponhover = 1;

function easytabs(menunr, active) {if (menunr == autochangemenu){currenttab=active;}if ((menunr == autochangemenu)&&(stoponhover==1)) {stop_autochange()} else if ((menunr == autochangemenu)&&(stoponhover==0))  {counter=0;}menunr = menunr-1;for (i=1; i <= tabcount[menunr]; i++){document.getElementById(tablink_idname[menunr]+i).className='tab'+i;document.getElementById(tabcontent_idname[menunr]+i).style.display = 'none';}document.getElementById(tablink_idname[menunr]+active).className='tab'+active+' tabactive';document.getElementById(tabcontent_idname[menunr]+active).style.display = 'block';}var timer; counter=0; var totaltabs=tabcount[autochangemenu-1];var currenttab=loadtabs[autochangemenu-1];function start_autochange(){counter=counter+1;timer=setTimeout("start_autochange()",1000);if (counter == changespeed+1) {currenttab++;if (currenttab>totaltabs) {currenttab=1}easytabs(autochangemenu,currenttab);restart_autochange();}}function restart_autochange(){clearTimeout(timer);counter=0;start_autochange();}function stop_autochange(){clearTimeout(timer);counter=0;}

window.onload=function(){
var menucount=loadtabs.length; var a = 0; var b = 1; do {easytabs(b, loadtabs[a]);  a++; b++;}while (b<=menucount);
if (autochangemenu!=0){start_autochange();}
}



//畅销排行
function cxphover(theid)
{
  var i;
  for (i=1;i<=5;i++)
  {
    var obj=document.getElementById("ul"+i);
    obj.style.display="none";
    obj=document.getElementById("bcxph"+i);
    obj.style.background="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/paih2.jpg')";
    obj.style.color="#767676";
  }
  var objf=document.getElementById("ul"+theid);
  objf.style.display="block";
  objf=document.getElementById("bcxph"+theid);
  objf.style.background="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/paih1.jpg')";
  objf.style.color="#000103";
  
}
function cityover()
{
  var obj=document.getElementById("cityall");
  obj.style.display="block";
}
function cityout()
{
  var obj=document.getElementById("cityall");
  obj.style.display="none";
}
function mover(theid)
{
  var sss="movermain("+theid.toString()+")";
  setTimeout(sss,600);
}

function movermain(theid)
{
  var imgurl="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/float"+theid+".jpg') no-repeat";
  var obj=document.getElementById("ca"+theid);
  obj.style.background=imgurl;
  var objf=document.getElementById("float"+theid);
  objf.style.display="block";
  var a=300+78*theid+39-(objf.scrollWidth/2);
  if (a<0)
  {
    a=0;
  }
  objf.style.left=a;
  var obja=document.getElementById("a"+theid);
  obja.style.color="#ffffff";
}

function mout(theid)
{
  var sss="moutmain("+theid.toString()+")";
  setTimeout(sss,600);
}

function moutmain(theid)
{
  var obj=document.getElementById("ca"+theid);
  obj.style.background="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/huidi.jpg')";
  var objf=document.getElementById("float"+theid);
  objf.style.display="none";
  var obja=document.getElementById("a"+theid);
  obja.style.color="#045499";
}

function muluover(theid)
{
  var i;
  for (i=1;i<=4;i++)
  {
    var obj=document.getElementById("mu"+i);
    obj.style.display="none";
    obj=document.getElementById("mouse"+i);
    obj.style.background="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/bg002.gif')";
  }
  var objf=document.getElementById("mu"+theid);
  objf.style.display="block";
  objf=document.getElementById("mouse"+theid);
  objf.style.background="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/bg001.gif')";
}

function gosearch()
{

var obj=document.getElementById("Form_ProductSearch");
obj.submit();
/*
var branchid;
var productname;
var theurl;
branchid=document.Form_ProductSearch.BranchId.options[document.Form_ProductSearch.BranchId.options.selectedIndex].value;
productname=document.Form_ProductSearch.ProductName.value;
searchtype=document.Form_ProductSearch.searchtype.options[document.Form_ProductSearch.searchtype.options.selectedIndex].value;
  if (searchtype=="0")
    {
      if (productname=="")
      {
        top.location.href="/Product/Product_Search.aspx?Site="+SiteID+"&branchid="+branchid;
      }
      else
      {
        top.location.href="/Product/Product_Search.aspx?Site="+SiteID+"&ProductName="+productname+"&branchid="+branchid;
      }
      
    }
    else
    {
      if (productname=="")
      {
        top.location.href="/Product/Product_Search.aspx?Site="+SiteID+"&branchid="+branchid;
      }
      else
      {
        top.location.href="/Product/Product_Search.aspx?Site="+SiteID+"&ProductId="+productname+"&branchid="+branchid;
      }
    }
    */
}  

///大图切换

function clickd(n)
{
  var imgurl;
  var preimg=precursor(thiscusor);
  var nowimg=n;
  clearInterval(ee);
  thiscusor=n;
  var objbiao;
  var objtunow;
  //上一副背景字体变
  objbiao=document.getElementById("biao"+preimg);
  imgurl="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/0"+preimg+"1.gif')";
  objbiao.style.background=imgurl;
  //当前标的背景字体变
  objbiao=document.getElementById("biao"+nowimg);
  imgurl="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/0"+nowimg+"2.gif')";
  objbiao.style.background=imgurl;
  
  document.all["oTransContainer"].filters[0].Apply();
  objtunow=document.getElementById("tu"+nowimg);
  objtunow.style.display="block";
  objtunow=document.getElementById("tu"+preimg);
  objtunow.style.display="none";
  document.all["oTransContainer"].filters[0].Play(duration=2);
  if (thiscusor>=allimage) 
  { 
   thiscusor=1; 
  } 
  else 
  { 
  thiscusor=thiscusor+1; 
  }
  ee=setInterval("gonext()",7000);
}

//执行一个页面的切换
function secBoard(n)
{ 
var imgurl;
var objtua;
var objbiao;
var nowimg=n;
var preimg=precursor(n);

if (allimage>4) 
{ 
allimage=4; 
} 
if (n>allimage) 
{ 
n=allimage; 
}

//上一副背景字体变
  objbiao=document.getElementById("biao"+preimg);
  imgurl="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/0"+preimg+"1.gif')";
  objbiao.style.background=imgurl;
  //当前标的背景字体变
  objbiao=document.getElementById("biao"+nowimg);
  imgurl="url('http://img.redbaby.com.cn/upfile/upfiles/new2008/0"+nowimg+"2.gif')";
  objbiao.style.background=imgurl;
  document.all["oTransContainer"].filters[0].Apply();
  var objtunow=document.getElementById("tu"+nowimg);
  objtunow.style.display="block";
  objtunow=document.getElementById("tu"+preimg);
  objtunow.style.display="none";
  document.all["oTransContainer"].filters[0].Play(duration=2);
} 

function precursor(n)
{
  var x;
  if (n==1) x=allimage;
  else x=n-1;
  return x;
}
function gonext() 
{ 
var b=thiscusor; 
secBoard(b); 
if (thiscusor>=allimage) 
{ 
thiscusor=1; 
} 
else 
{ 
thiscusor=thiscusor+1; 
} 
}