  function isDate(year,month,day)
  {
    var iYear,iMonth,iDay;
    var monLeapDays=new Array(0,31,29,31,30,31,30,31,31,30,31,30,31);
    var monDays=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
    var bLeap;
    
    if (year<1900)
    {
      iYear = (new Date()).getYear();
    }
    else
    {
      iYear=year;
    }
    if ((month>0) && (month<13))
    {
      iMonth=month;
    }
    else
    {
      iMonth=1;
    }
    if ((day>0) && (day<32))
    {
      iDay=day;
    }
    else
    {
      iDay=1;
    }
    
    if ((iYear % 4) == 0)
    {
      bLeap = (((iYear % 100) > 0) || ((iYear %  400) == 0));
    }
    
    if (bLeap)
    {
      if (iDay>monLeapDays[iMonth])
      {
        return false;
      }
      else
      {
        return true;
      }
    }
    else
    {
      if (iDay>monDays[iMonth])
      {
        return false;
      }
      else
      {
        return true;
      }
    }
  }

  function login()
  {
    if ((document.login.username.value!="") && (document.login.password.value!=""))
    {
      document.login.submit();
    }
    else
      alert("亲爱的顾客,会员代码和会员密码都不能为空！");
  }
  
  function search() {
    if (document.search.content.value!="") 
    {
      document.search.submit();
    }
    else
     alert("亲爱的顾客,您必须输入查询的内容");
  }
  
  function gotochannel(obj) 
  {
    if (obj.options[obj.selectedIndex].value!="")
      document.location.href=obj.options[obj.selectedIndex].value;
  }

function putbook(guid,chid) {
  if (guid.length==0) {
    alert("请选择书籍!");
    return;
  }
  win=window.open("/cgi-bin/shoppingcart_new/putbook.asp?guid=" + guid + "&chid=" + chid + "&total=1","放入购物篮","menubar=yes,toolbar=no,scrollbars=yes,resizable=yes");
  win.focus();
}

function viewshoppingcart () {
  win=window.open("/cgi-bin/shoppingcart_new/viewshoppingcart.asp","查看购物篮","menubar=yes,toolbar=no,scrollbars=yes,resizable=yes");
  win.focus();
}

function gotoBuy () {
  win=window.open("/cgi-bin/shoppingcart_new/huiyuan.asp","去收银台","menubar=yes,toolbar=no,scrollbars=yes,resizable=yes");
  win.focus();
}

function sureUser(url) {
  win=window.open(url ,"确认用户信息","top=100,left=100,width=537,height=400,scrollbars=yes");
  win.focus();
}

function tofriend(id,kind) {
  win=window.open("/cgi-bin/tofriend/tofriend.asp?id=" + id + "&kind=" + kind ,"推荐给朋友","top=100,left=100,width=400,height=360,scrollbars=yes");
  win.focus();
} 

function toyourfriend(word,url) {
  win=window.open("/cgi-bin/toyourfriends/toyourfriend.asp?word=" + word + "&url=" + escape(url) ,"推荐给朋友","top=100,left=100,width=500,height=360,scrollbars=yes");
  win.focus();
}	

function puttobookroom(bkguid,chid) {
  if ((bkguid.length==0) || (chid.length==0))
  {
    alert("请选择书籍!");
    return;
  }
  win=window.open("/cgi-bin/bookroom/puttobookroom.asp?BKGUID=" + bkguid + "&CHID=" + chid + "&bookquantity=1" , "放入书房","top=100,left=100,width=330,height=300");
  win.focus();	 
}

function openNewWin(url) {
    win=window.open(url,"blank","left=100,top=100,width=570,height=362,scrollbars=yes,resizable");
    win.focus();
}

function openWin(url) {
    win=window.open(url,"blank","top=80,left=100,width=600,height=400,scrollbars=yes,resizable");
    win.focus();
}

function openBigImgWin(imgGuid,flag) {
    alert("ok!")
    win=window.open("/cgi-bin/getimages/getbigimg.asp?GUID="+imgGuid+"&FLAG="+flag,"blank","top=80,left=100,width=600,height=400,scrollbars=yes,resizable");
    win.focus();
}	
