﻿function buyIt(type,id,name,memberPrice)
{
    var rn = Book_Default.addShopCart(type,id,name,memberPrice).value;  
    if(rn == -1){alert('请先去登陆!');location.href ="/System/CheckLogin.aspx?url="+encodeURI(location.href);};
    if(rn == 3){
        alert('放入购物车成功');
        var w1 = window.open('/Shopping/ShopCart.aspx','shopcart');
        w1.location.reload(true);
    };
    if(rn == 2){
        alert('已存在购物车中');
    };
    if(rn == 4){
        alert('放入购物车失败');
    };
    if(rn == 5){
        alert('暂时无法购买,请刷新页面');
    };
    return false;
}

function addBFavorite(id)
{
    var rns = Book_Default.addFavorite(id).value;
    if(rns == -1){alert('请先去登陆!');location.href ="/System/CheckLogin.aspx?url="+encodeURI(location.href);};
    if(rns == 1){
         alert('放入收藏夹成功');
         var w2 = window.open('/Myhome/Book/sList.aspx','favorite');
         w2.location.reload(true);
      };
     
      if(rns == 99){alert('已存在收藏夹中');
       };
      
      if(rns == 98) {alert('放入收藏夹失败');};
      return false;
}

function rotator(val,val2)
{
    for(var i= 1; i <=4;i++)
   {
      if(val != document.getElementById("T"+i)) 
     { 
      document.getElementById("T"+i).style.cssText="color:#666;font-weight:bold;border-left:1px #e6e6e6 solid;border-right:1px #e6e6e6 solid;border-bottom:1px #e6e6e6 solid;border-top:1px #e6e6e6 solid;";
      document.getElementById("DT"+i).style.display ="none"; 
      document.getElementById("T"+i).background="img/teacher_06.gif";
     }
     else
     {
      val.style.cssText = "color:#1e388c;font-weight:bold;";
      document.getElementById("T"+i).background="img/teacher_02.gif";  
      document.getElementById("DT"+i).style.display ="block";  
      if(val2 != null) document.getElementsByName("bookcontent")[0].src="bookContent_"+val2+"_.html"; 
     } 
   } 
}
