var g_xmDoc = new ActiveXObject("Msxml2.DOMDocument");
var g_MemId="";
var Strhtm="";
var g_Id="";
var ObjOrchid=null;
var ObjOrchidList=new Array();

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_Id=tmpArray[0];
    }
   else g_Id=tmpId;
   ShowHomeImage(g_Id);
   } 
}

function ShowHomeImage(pId){
 var Res=neworchid.AjaxHomeLib.GetServerOrchidDetail(pId);
 if ((!Res.error) && (Res.value!=null)){
    ObjOrchid=Res.value;
    ShowImage(ObjOrchid.Did,ObjOrchid.OrchidName,ObjOrchid.Largeimage,ObjOrchid.CustNo)
  }
}

function GetMemBaseInfo(pMemId){
 var ObjMemBase=null;
 var Res=neworchid.AjaxHomeLib.GetServerMemBaseInfo(pMemId);
 if ((!Res.error) && (Res.value!=null)){
    ObjMemBase=Res.value;
    ShowMemBase(ObjMemBase);
   }
}

function ShowMemOrchidList(pId){
 var Res=neworchid.AjaxHomeLib.GetServerMemOrchidList(pId);
 Strhtm="";
 if ((!Res.error) && (Res.value!=null)){
    ObjOrchidList=Res.value;
     for (var i=0;i<ObjOrchidList.length;i++){
     var _Did    =ObjOrchidList[i].Did;
     var _CName  =ObjOrchidList[i].OrchidName;
     var _Image  =ObjOrchidList[i].Largeimage; 
      Strhtm+="<div class='box_9_1' ><a href=javascript:ShowImageDetail('"+_Did+"','"+_CName+"','"+_Image+"');>";
      Strhtm+="<img src="+_Image+" width='80' height='78' border='0'></a>";
      Strhtm+="<br><a href=javascript:ShowImageDetail('"+_Did+"','"+_CName+"','"+_Image+"');>"+_CName+"</a></div>";
     }
     document.getElementById("DivGusetTop").innerHTML=Strhtm;   
     }
}


function ShowMemBase(Obj){
 Strhtm="<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>";
 document.getElementById("DivCust").innerHTML=Strhtm;  
 }


function ShowOrchidDetail(pDid){
 Strhtm="";
 var Res=neworchid.AjaxHomeLib.GetServerOrchidDetail(pDid);
 if ((!Res.error) && (Res.value!=null)){
    ObjOrchid=Res.value;
    Strhtm+="类型:"+ObjOrchid.OrchidType+"<br>"; 
    Strhtm+="产地:"+ObjOrchid.PlaceName+"<br>"; 
    Strhtm+="花名:"+ObjOrchid.OrchidName+"<br>"; 
    Strhtm+="价格:"+ObjOrchid.OrchidName+"<br>"; 
    ObjOrchid.ViewNum++;
    Strhtm+="浏览:"+ObjOrchid.ViewNum+"<br>"; 
    Strhtm+="星级:"+ObjOrchid.Star+"<br>"; 
    Strhtm+="简介:"+ObjOrchid.orchidDesc; 
    ShowLayer();
    document.all.altdesc.innerHTML=Strhtm;
   }
}

function ShowLayer(){
 if (document.all.Layer1.style.visibility=="hidden")
    document.all.Layer1.style.visibility="visible";
 else    
    document.all.Layer1.style.visibility="hidden";
    
}

function ShowImageDetail(pId,pName,pImage){
 document.all.OName.innerHTML=pName+"<a href=javascript:ShowOrchidDetail("+pId+")><img src=img/i_ico28_060708.gif border=0 alt=详细说明></a>";
 document.all.divImage.innerHTML="<img src="+pImage+" width='400px' height='430' border='0'>";
 SaveViewNum("GUEST",pId);
}

function ShowImage(pId,pName,pImage,pMemid){
 document.all.OName.innerHTML=pName+"<a href=javascript:ShowOrchidDetail("+pId+")><img src=img/i_ico28_060708.gif border=0 alt=详细说明></a>";
 document.all.divImage.innerHTML="<img src="+pImage+" width='400px' height='430' border='0'>";
 g_MemId=pMemid;
}

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");
   Strhtm+="<div class='box_9_1'><a href=javascript:ShowImage("+_Did+",'"+_CName+"','"+_Image+"','"+_MId+"');>";
   Strhtm+="<img src="+_Image+" width='80' height='78' border='0'></a>";
   Strhtm+="<br><a href=javascript:ShowImage("+_Did+",'"+_CName+"','"+_Image+"','"+_MId+"');>"+_CName+"</a></div>";
  }
   document.getElementById("DivMove").innerHTML=Strhtm; 
   if (g_Id==""){
    var pId=CurrList.item(0).getAttribute("Did");
    ShowHomeImage(pId);
  } 
 }
}

function GetMemFeedList(pId){
 var Res=neworchid.AjaxHomeLib.GetServerMemFeed(pId);
 if ((!Res.error) && (Res.value!=null)){
    var ObjFeed=Res.value;
    Strhtm="";
    var m=0;
     for (var i=0;i<ObjFeed.length;i++){
     var _Did       =ObjFeed[i].Did;
     var _Title     =ObjFeed[i].Titel;
     var _Message   =ObjFeed[i].Message; 
     var _PostDate  =ObjFeed[i].PostDate; 
     var _MemId     =ObjFeed[i].NmemId; 
     m=i+1;
     var d = new Date(_PostDate);
     Strhtm+="<Div class=box_3 style='Text-align:left;margin-left: 2px;margin-right: 2px;'>"+m+")"+_Title;
     Strhtm+="--(<a href=javascript:GetMemBaseInfo('"+_MemId+"')>兰友^_^</a>--";
     Strhtm+="<img src='img/o1.gif'>---"+d.format('yyyy年MM月dd日')+")</Div>";
     Strhtm+="<Div style='Text-align:left;background-color:#ffffff;text-indent:24px'>"+_Message+"</Div>";
     }
    document.getElementById("DivFeedList").innerHTML=Strhtm;   
   }  

}

function SetClassName(t,n){
for (var i=1;i<=n;i++){
  var obj=eval("V"+i);
   if (obj.id==t.id)
      obj.className="btnActive";
  else  obj.className="btnActive_no";
  }
}

function ShowFace(pCh){
 if(pCh==0) {
    document.all.DivCustMove.style.display="none";
    document.all.DivtopMove.style.display="block";
    document.all.DivImgList.style.display="none";
    document.all.PlayImage.style.display="block";
    document.all.DivRegUser.style.display="none";
    document.all.DivFeed.style.display="none";
 } 
 if(pCh==1){
    document.all.DivCustMove.style.display="block";
    document.all.DivtopMove.style.display="none";
    document.all.DivImgList.style.display="none";
    document.all.PlayImage.style.display="none";
    document.all.DivRegUser.style.display="none";
    document.all.DivFeed.style.display="block";
    GetMemBaseInfo(g_MemId);
    GetMemFeedList(g_MemId);
  }
  if(pCh==2) {
    document.all.DivCustMove.style.display="none";
    document.all.DivtopMove.style.display="block";
    document.all.DivImgList.style.display="none";
    document.all.PlayImage.style.display="none";
    document.all.DivRegUser.style.display="block";
    document.all.DivFeed.style.display="none";
    parent.GuestReg.src="GuestRegForm.aspx";
    parent.GuestReg.location.href="GuestRegForm.aspx";
  
 } 
  if(pCh==3) {
    document.all.DivCustMove.style.display="none";
    document.all.DivtopMove.style.display="none";
    document.all.DivImgList.style.display="block";
    document.all.PlayImage.style.display="block";
    document.all.DivRegUser.style.display="none";
    document.all.DivFeed.style.display="none";
    ShowMemOrchidList(g_MemId);
 } 
}
     
function GetOrchidByPage(pTop,pNum,pTag){
 Res=neworchid.AjaxHomeLib.GetOrchidXmlByPage(pTop,pNum);
 if ((!Res.error) && (Res.value!=null)){
  g_xmDoc.loadXML(Res.value);
  ShowGuestOrchidList(pTag);
 }
}

function SaveMemFeed(){
var ObjList=new Array();
var Res=neworchid.AjaxHomeLib.GetAuthInfo();
    ObjList=Res.value;
 if (ObjList[0]!=""){
   var Obj=new Object();
    Obj.Did       ="1";
    Obj.CustNo    =g_MemId;
    Obj.Titel     =document.all.Title.value;
    Obj.Message   =document.all.Content.value;
    Obj.PostDate  ="2006-10-01";
    Obj.NickName  ="SYS"
    Obj.NmemId    =ObjList[0];
    Res=neworchid.AjaxHomeLib.SaveServerMemFeed(Obj,"ADD");
    if (!Res.error) {
      alert("恭喜您提交反馈信息成功!!!");
     document.all.Title.value="";
     document.all.Content.value="";
     GetMemFeedList(g_MemId);
    }
  else  alert("sorry,您提交反馈信息失败!!!"); 
 }
 else alert("您还未登陆,系统不能提交您的交易信息!!!\n\r如果您不是成员，请注册");
}

function CheckFeedData(){
if (document.all.Title.length==0){
  alert("请输入标题");
  return false; 
 }
}







