var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
var Strhtm="";	
var g_BookId="";
var g_Did="";
var g_MemId="";
var g_Web="";
var g_Type="1";
var g_Res=null;
var g_Top="30";

function GetParam(){
 var pos=0;
 var str="";
 str = window.location.href;
 pos = str.indexOf("=");
 if (pos>0) {
   var tmpId=str.substring(pos+1,str.length);
   if (tmpId.indexOf("#"))    {
     var tmpArray=tmpId.split("#");
     g_Did=tmpArray[0];
    }
   else g_Did=tmpId;
   GetBookContent(g_Did);
  } 
}


function GetGuestOrchidList(pNtop,pVtop,pType,pTag){
 var Res=neworchid.AjaxHomeLib.GetServerGuestXml(pNtop,pVtop,pType);
 g_xmDoc.loadXML(Res.value);
 ShowGuestOrchidList(pTag);
}

function ShowGuestOrchidList(pTag){
 Strhtm="";
 NodeList= g_xmDoc.getElementsByTagName(pTag);
 var CurrList=NodeList.item(0).childNodes;
 if(CurrList.length>0){ 
  for (var i=0; i<CurrList.length; i++) {
   var _Did   =CurrList.item(i).getAttribute("Did");
   var _CName =CurrList.item(i).getAttribute("OName");
   var _Image =CurrList.item(i).getAttribute("LImg");
   var _MId =CurrList.item(i).getAttribute("CNo");
   var _WebUrl="ShowNewOrchid.aspx?Id="+_Did;
   Strhtm+="<div class='box_9_1'><a href=javascript:OpenGuestWin('"+_WebUrl+"');>";
   Strhtm+="<img src="+_Image+" width='80' height='78' border='0'></a>";
   Strhtm+="<br><a href=javascript:OpenGuestWin('"+_WebUrl+"');>"+_CName+"</a></div>";
  }
   document.getElementById("divNewOrchid").innerHTML=Strhtm; 
  }
}

function GetAllData(){
  GetArticleList("10","0");
  GetMaginzeList("4");
  GetSubDescList("10");
  GetGuestOrchidList('12','6','V','VipOList');
  GetParam();
  if (g_Did==""){
    SetClassName(V1,5);
    GetBookList(g_Top,1,g_Type,'0');
    ShowLayer(0);
   }
 }


function GetBookList(pTop,pNum,pType,pTalk){
var pTag="";
 var Res=neworchid.AjaxHomeLib.GetBookXmlList(pTop,pNum,pType,pTalk);
 g_xmDoc.loadXML(Res.value);
 if (pTalk=="0")
   pTag="BKList";
 else pTag="TKList";   
   ShowBookList(pTag);
}

function ShowBookList(pTag){
var NodeList= g_xmDoc.getElementsByTagName(pTag);
var CurrList=NodeList.item(0).childNodes;
if (CurrList.length>0){
Strhtm="";
for (var i=0; i<CurrList.length; i++) {
   Strhtm+="<div style='width:333px;float:left;margin:5px;border:1px solid #cccccc;'><ul class=ul>";
   var _Did      =CurrList.item(i).getAttribute("Did");
   var _BookName =CurrList.item(i).getAttribute("BName");
   var _BookType =CurrList.item(i).getAttribute("Bt");
   var _FileMemo =CurrList.item(i).getAttribute("FileMemo");
   var _Star     =CurrList.item(i).getAttribute("Star");
   var _ViewNum  =CurrList.item(i).getAttribute("ViewNum");
   var _CDate  =CurrList.item(i).getAttribute("CDate");
   Strhtm+="<li>··名称:<a href=javascript:GetBookContent('"+_Did+"');>"+_BookName+"-"+_BookType+"</a></li>";
   Strhtm+="<li>··浏览:"+_ViewNum+"</li>";
   Strhtm+="<li>··星级:"+format(_Star,2)+"</li>";
   Strhtm+="<li>··日期:"+_CDate+"</li>"; 
   Strhtm+="<li class='box_Text' style='height:60px;'>简介:"+_FileMemo+"</li>";
   Strhtm+="</ul></div>";
   }
   document.getElementById("DivBookxmlList").innerHTML=Strhtm;  
 }
}

function GetBookContent(pId){
 var ObjBookBase=null;
 var Res=neworchid.AjaxHomeLib.GetBookBaseInfo(pId);
 g_Did=pId;
 if ((!Res.error)&&(Res.value!=null)){
    ObjBookBase=Res.value;
    g_Web=ObjBookBase.WebUrl.toLowerCase();
    g_BookId=ObjBookBase.BookId;
    if(g_Web.indexOf("flv")>0) {
          GetFlvPage();
         }
    else {
         parent.FLV.location.href="Max.htm"; 
         SetClassName(V2,5);
         ShowLayer(1);
         }
    
    ShowBookBase(ObjBookBase)
  }
}

function GetSwfPage(){
  parent.SWF.location.href=g_Web; 
  SetClassName(V5,5);ShowLayer(4);
  
}

function GetWmvPage(){

}

function SetMaxPage(){
  if(g_Web.indexOf("swf")>0) 
   parent.SWF.location.href=g_Web; 
  if(g_Web.indexOf("htm")>0) 
    parent.SWF.location.href=g_Web; 
  if (g_Web.indexOf("wmv")>0){ 
    parent.SWF.location.href="playMoveList.htm?tt="+g_Web; 
    parent.status="";
  }
   SetClassName(V5,5);
   ShowLayer(4);
}

function GetFlvPage(){
 parent.FLV.location.href="playList.htm?tt="+g_Web; 
 parent.SWF.location.href="NoMaxPage.htm";
 SetClassName(V2,5);
 ShowLayer(1);
}

function ShowBookBase(Obj){
 Strhtm="<ul class=ul>";
 Strhtm+="<li>·名称:&nbsp;&nbsp;&nbsp;"+Obj.BookName+"</li>";
 Strhtm+="<li>·作者:&nbsp;&nbsp;&nbsp;<a href=javascript:GetMemBaseInfo('"+Obj.MemId+"');>";
 Strhtm+="<img src='img/arrow.gif' border=0>查看兰友信息</a></li>";
 Strhtm+="<li>·时间:&nbsp;&nbsp;&nbsp;"+Obj.PlayTime+"</li>";
 Strhtm+="<li>·浏览:&nbsp;&nbsp;&nbsp;"+Obj.ViewNum+"</li>";
 Strhtm+="<li>·星级:&nbsp;&nbsp;&nbsp;"+Obj.Star+"</li>";
 var d = new Date(Obj.CreateDate);
 Strhtm+="<li>·日期:&nbsp;&nbsp;&nbsp;"+d.format('yyyy年MM月dd日hh时mm分ss秒')+"</li>";
 Strhtm+="<li class=box_Text>·简介:"+Obj.FileMemo+"</li>";
 Strhtm+="</ul>";
 document.getElementById("DivBookBase").innerHTML=Strhtm;  
 }


function ShowLayer(pId){
if (pId==0){
      document.all.DivBookList.style.display="block";
      document.all.DivBookContent.style.display="none";
      document.all.DivBookExam.style.display="none";
      document.all.DivMyInfo.style.display="none";
      document.all.DivMax.style.display="none";
         
 }
if (pId==1){
      document.all.DivBookList.style.display="none";
      document.all.DivBookContent.style.display="block";
      document.all.DivBookExam.style.display="none";
      document.all.DivMyInfo.style.display="none";
      document.all.DivMax.style.display="none";
      ShowBookEvalList(g_BookId);

  }
if (pId==2){
      document.all.DivBookList.style.display="none";
      document.all.DivBookContent.style.display="none";
      document.all.DivBookExam.style.display="block";
      document.all.DivMyInfo.style.display="none";
      document.all.DivMax.style.display="none";
  }
if (pId==3){
      document.all.DivBookList.style.display="none";
      document.all.DivBookContent.style.display="none";
      document.all.DivBookExam.style.display="none";
      document.all.DivMyInfo.style.display="block";
      document.all.DivMax.style.display="none";
  }
if (pId==4){
      document.all.DivBookList.style.display="none";
      document.all.DivBookContent.style.display="none";
      document.all.DivBookExam.style.display="none";
      document.all.DivMyInfo.style.display="none";
      document.all.DivMax.style.display="block";
  }

}

function ShowBookEvalList(pBookId){
 var ObjEvalList=new Array();
 var Res=neworchid.AjaxHomeLib.GetBookEvalList(pBookId);
 if ((!Res.error)&&(Res.value!=null)){
     ObjEvalList=Res.value;
     Strhtm="<ul class=ul>";
     for (var i=0;i<ObjEvalList.length;i++)
      {
       Strhtm+="<li>·网友:<a href=javascript:GetMemBaseInfo('"+ObjEvalList[i].MemId+"');>";
       Strhtm+="<img src='img/arrow.gif' border=0>查看兰友信息</a>";
       var d = new Date(ObjEvalList[i].PoatDate);
       Strhtm+="·时间:"+d.format('yyyy年MM月dd日hh时mm分ss秒')+"</li>";
       Strhtm+="<li class=box_Text>"+ObjEvalList[i].EvalContant+"</li>";
      }
     Strhtm+="</ul>";
     document.getElementById("DivEvalList").innerHTML=Strhtm;  
     }
}

function SaveBookFeed(){
if (g_BookId=="") {
    alert("请选择一资料!!!");
    return;
   }
if (CheckData()){
    var Obj=new Object;
    var ObjList=new Array();
    var Res=neworchid.AjaxHomeLib.GetAuthInfo();
     ObjList=Res.value;
    if (ObjList[0]!=""){
      Obj.MemId=ObjList[0];
     }
    else {
        alert("您还未登陆,系统不能提交您的交易信息!!!\n\r如果您不是成员，请注册"); 
        return;
        }
    Obj.BookId=g_BookId;
    Obj.EvalContant=document.all.Content.value;    
    var Res=neworchid.AjaxHomeLib.SaveBookEval(Obj); 
     if (!Res.error){ 
        alert("恭喜您提交评价信息成功!!!");
        document.all.Content.value="";
        ShowBookEvalList(g_BookId);
        }
     else  alert("您提交评价信息失败!!!");
 }
}


function CheckData(){
 if (document.all.Content.value.length==0)
   {
    alert("请输入评价内容!!!");
    return false;
   }
else return true;
}

function SetClassName_1(t,n){
for (var i=1;i<=n;i++){
  var obj=eval("V"+i);
   if (obj.id==t.id)
      obj.className="Active";
  else  obj.className="Active_no";
  }
}

function GetMemBaseInfo(pMemId){
 var ObjMemBase=null;
 var Res=neworchid.AjaxHomeLib.GetServerMemBaseInfo(pMemId);
 if ((!Res.error) && (Res.value!=null)){
    ObjMemBase=Res.value;
    ShowMemBase(ObjMemBase);
   }
}


function ShowMemBase(Obj){
 Strhtm="<div style='clear:both'></div>";
 Strhtm="<div class='listBox_8' style='float:none;'><ul class=ul>";
 Strhtm+="<li>··兰友姓名:&nbsp;&nbsp;&nbsp;"+Obj.MemName+"</li>";
 Strhtm+="<li>··所在省份:&nbsp;&nbsp;&nbsp;"+Obj.Province+"</li>";
 Strhtm+="<li>··所在城市:&nbsp;&nbsp;&nbsp;"+Obj.Area+"</li>";
 Strhtm+="<li>··联系地址:&nbsp;&nbsp;&nbsp;"+Obj.Address+"</li>";
 Strhtm+="<li>··联系电话:&nbsp;&nbsp;&nbsp;"+Obj.MemTel+"</li>";
 Strhtm+="<li>··邮箱地址:&nbsp;&nbsp;&nbsp;"+Obj.MemEmail+"</li>";
 Strhtm+="<li>··兰友QQ&nbsp;:&nbsp;&nbsp;&nbsp;"+Obj.QQ+"</li>";
 Strhtm+="<li>··兰友msn&nbsp;:&nbsp;&nbsp;&nbsp;"+Obj.Msn+"</li>";
 Strhtm+="<li>··互宝通  :&nbsp;&nbsp;&nbsp;"+Obj.Gid+"</li>";
 Strhtm+="<li>··兰友星级:&nbsp;&nbsp;&nbsp;"+Obj.Star+"</li>";
 Strhtm+="<li>··自我介绍:</li>";
 Strhtm+="<li class=box_Text>"+Obj.OwnDesc+"</li>";
 Strhtm+="</ul></div>";
 document.getElementById("DivMyInfo").innerHTML=Strhtm;  
 ShowLayer(3);
 SetClassName(V4,5)
 } 
 
 function GetMemberInfo(){
   var ObjList=new Array();
   var Res=neworchid.AjaxHomeLib.GetAuthInfo();
     ObjList=Res.value;
    if (ObjList[0]!="")
       g_MemId=ObjList[0];
    else g_MemId="";   
 } 








