var g_xmDoc = new ActiveXObject("Msxml2.DOMDocument");
var g_CustNo="";
var g_Web="";
var Strhtm="";
var ObjTopList=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_CustNo=tmpArray[0];
    }
   else g_CustNo=tmpId;
   GetCustBaseInfo(); 
   } 
}

function GetCustBaseInfo(){
 var ObjCustBase=null;
 var Res=neworchid.AjaxHomeLib.GetServerCustBaseInfo(g_CustNo);
 if ((!Res.error) ||(Res.value!=null)){
    ObjCustBase=Res.value;
    ShowCustBase(ObjCustBase)
    ShowCustTopInfo(g_CustNo,'CUST');
  }
}


function ShowCustBase(Obj){
 Strhtm="<div id='divimg' class='imgbox'></div>"
 Strhtm+="<ul class=ul >";
 Strhtm+="<li>兰园名称:&nbsp;&nbsp;&nbsp;"+Obj.CName+"</li>";
 Strhtm+="<li>兰主姓名:&nbsp;&nbsp;&nbsp;"+Obj.Contact+"</li>";
 Strhtm+="<li>所在省份:&nbsp;&nbsp;&nbsp;"+Obj.Province+"</li>";
 Strhtm+="<li>所在城市:&nbsp;&nbsp;&nbsp;"+Obj.City+"</li>";
 Strhtm+="<li>联系地址:&nbsp;&nbsp;&nbsp;"+Obj.Address+"</li>";
 Strhtm+="<li>联系电话:&nbsp;&nbsp;&nbsp;"+Obj.Tel+"</li>";
 Strhtm+="<li>邮箱地址:&nbsp;&nbsp;&nbsp;"+Obj.Email+"</li>";
 Strhtm+="<li>浏览次数:&nbsp;&nbsp;&nbsp;"+Obj.ViewNum+"</li>";
 Strhtm+="<li>兰园介绍:</li>";
 Strhtm+="<li class=box_Text>"+ForCharsSpecialHtml(Obj.OrchidDesc)+"</li>";
 Strhtm+="</ul>";
 document.getElementById("DivCust").innerHTML=Strhtm;  
 document.getElementById("divimg").innerHTML="<img src="+Obj.My_Image+" width=145 height=125>";  
}

function ShowCustTopInfo(pCustNo,pCh){
 Strhtm="";
 var Res=neworchid.AjaxHomeLib.GetServerTopList(pCustNo,pCh);
 if ((!Res.error) ||(Res.value!=null)){
    ObjTopList=Res.value;
    for (var i=0;i<ObjTopList.length;i++){
     var _Did       =ObjTopList[i].Did;
     var _CustNo    =ObjTopList[i].CustNo;
     var _CName     =ObjTopList[i].OrchidName;
  //   var _Image     =ObjTopList[i].Smallimage;
  //    if (_Image=="")
      _Image        =ObjTopList[i].Largeimage; 
    if (ObjTopList.length>=16){
       Strhtm+="<div class='box_9_1' ><a href=javascript:ShowImageDetail("+_Did+",'"+_CName+"','"+_Image+"');>";
       Strhtm+="<img src="+_Image+" width='80' height='78' border='0'></a>";
      }
     else {
      Strhtm+="<div class='box_10_1'><a href=javascript:ShowImageDetail("+_Did+",'"+_CName+"','"+_Image+"');>";
      Strhtm+="<img src="+_Image+" width='115' height='105' border='0'></a>";
      } 
     Strhtm+="<br><a href=javascript:ShowImageDetail("+_Did+",'"+_CName+"','"+_Image+"');>"+_CName+"</a></div>";
    }
   document.getElementById("DivCustTop").innerHTML=Strhtm;   
  }
}

function ShowTopDetail(pDid){
 Strhtm="";
 var Res=neworchid.AjaxHomeLib.GetServerTopDetail(pDid);
 if ((!Res.error) ||(Res.value!=null)){
    ObjTopDetail=Res.value;
    Strhtm+="<UL class='ul'>"
    Strhtm+="<li>类型:"+ObjTopDetail.OrchidType+"</li>"; 
    Strhtm+="<li>产地:"+ObjTopDetail.PlaceName+"</li>"; 
    Strhtm+="<li>花名:"+ObjTopDetail.OrchidName+"</li>"; 
    Strhtm+="<li>价格:"+ObjTopDetail.OrchidName+"</li>";
    Strhtm+="<li>浏览:"+ObjTopDetail.ViewNum+"</li>"; 
    Strhtm+="<li>星级:"+ObjTopDetail.Star+"</li>"; 
    Strhtm+="<li>简介:"+ObjTopDetail.OrchidDesc+"</li>"; 
    Strhtm+="</UL>"
    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:ShowTopDetail("+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'>";
}

function GetCustList(pTop,pType,pTag){
 var Res=neworchid.AjaxHomeLib.GetServerCustXml(pTop,pType);
 g_xmDoc.loadXML(Res.value);
 ShowCustList(pTag);
}

function ShowCustList(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 _CustNo  =CurrList.item(i).getAttribute("CustNo");
   var _CName   =CurrList.item(i).getAttribute("CName");
   var _My_Image=CurrList.item(i).getAttribute("My_Image");
   var _WebUrl="ShowCustBaseInfo.aspx?Id="+_CustNo;
   Strhtm+="<div class='box_10_1'><a href=javascript:GetCustMoveInfo('"+_CustNo+"');>";
   Strhtm+="<img src="+_My_Image+" width='120' height='100' border='0'></a>";
   Strhtm+="<br><a href=javascript:GetCustMoveInfo('"+_CustNo+"');>"+_CName+"</a></div>";
  }
   document.getElementById("DivMove").innerHTML=Strhtm; 
   if (g_CustNo==""){
   var pCustNo=CurrList.item(0).getAttribute("CustNo");
   GetCustMoveInfo(pCustNo);
  } 
 } 
}

function GetCustMoveInfo(pCustNo){
 g_CustNo=pCustNo
 GetCustBaseInfo();
 ShowFace(1);
 SetClassName(V1,4);
}

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==1){
    document.all.DivCustMove.style.display="block";
    document.all.DivtopMove.style.display="block";
    document.all.DivImgList.style.display="none";
    document.all.PlayImage.style.display="none";
    document.all.DivRegUser.style.display="none";
    document.all.DivFeedTopList.style.display="none";
  }
 if(pCh==0) {
    document.all.DivCustMove.style.display="none";
    document.all.DivtopMove.style.display="none";
    document.all.DivFeedTopList.style.display="none";
    document.all.DivImgList.style.display="block";
    document.all.PlayImage.style.display="block";
    document.all.DivRegUser.style.display="none";
    if (ObjTopList.length>0){
     var Did   =ObjTopList[0].Did;
     var Cname =ObjTopList[0].OrchidName;
     var Cimage=ObjTopList[0].Largeimage;
     ShowImageDetail(Did,Cname,Cimage);
    }
   }
 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.DivFeedTopList.style.display="none";
    parent.CustReg.src="CustRegForm.aspx";
    parent.CustReg.location.href="CustRegForm.aspx";
 } 
  if(pCh==3) {
    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="none";
    document.all.DivFeedTopList.style.display="block";
    ShowCustFeedByPage(g_CustNo,30,1,"C");
  } 
}
     
function GetCustByPage(pTop,pNum,pTag){
 Res=neworchid.AjaxHomeLib.GetCustXmlByPage(pTop,pNum);
 if ((!Res.error) && (Res.value!=null)){
  g_xmDoc.loadXML(Res.value);
  ShowCustList(pTag);
 }
}

function ShowCustFeedByPage(pCustNo,pTop,pNum,pType){
Strhtm="";
var Res=neworchid.AjaxHomeLib.GetCustFeedByPage(pCustNo,pTop,pNum,pType);
 if ((!Res.error) ||(Res.value!=null)){
   var ObjFeed=Res.value;
     var m=0;
     for (var i=0;i<ObjFeed.length;i++){
     var _Did       =ObjFeed[i].m_id;
     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 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="<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("altdesc").innerHTML=Strhtm;  
 ShowLayer();
 }
 
 function SaveCustFeed(){
 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_CustNo;
    Obj.Titel     =document.all.Title.value;
    Obj.Message   =document.all.Content.value;
    Obj.PostDate  ="2006-10-01";
    Obj.NickName  ="SYS";
    Obj.FeedType  ="C";
    Obj.NmemId    =ObjList[0];
    Res=neworchid.AjaxHomeLib.SaveServerCustFeed(Obj,"ADD");
    if (!Res.error) {
      alert("恭喜您提交反馈信息成功!!!");
     document.all.Title.value="";
     document.all.Content.value="";
    }
  else  alert("sorry,您提交反馈信息失败!!!"); 
 }
 else alert("您还未登陆,系统不能提交您的交易信息!!!\n\r如果您不是成员，请注册");
}

function CheckFeedData(){
if (document.all.Title.length==0){
  alert("请输入标题");
  return false; 
 }
}







