
function DisplayMyFansBox(total,currentPage,totalPage,userId,contentDivId,SessionUserId)
{if(currentPage<1||currentPage>totalPage||userId=='')
{return;}
var callback=function(res)
{var response=res.responseText;if(response!=''||response!=null)
{var htmlcontent='';eval('var data = '+response+';');htmlcontent+="<table width=\"240\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";htmlcontent+="<tr><td class=\"header\">";htmlcontent+="<div class=\"headerWords\">"+total+"位Fans</div>";if(userId!=SessionUserId)
{htmlcontent+="<span class=\"headerLink\">";htmlcontent+="<img src=\"/images/icon_AddGourmet_o.gif\" class=\"icons\" />";htmlcontent+=" &nbsp;<a href=\"javascript:void(0)\" onclick=\"ShowPopup('TextDialog','/myopenrice/AddBookMarkUserConfirm.htm?IdolUserId="+userId+"')\">儲存為心水食家</a>";htmlcontent+="</span>";}
htmlcontent+="</td></tr>";if(data.length>0)
{htmlcontent+="<tr><td class=\"content\">";htmlcontent+="<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">";htmlcontent+="<tr>";for(var i=0;i<data.length;i++)
{htmlcontent+="<td>";htmlcontent+="<a href=\"/restaurant/userinfo.htm?userid="+data[i]["UserId"]+"\">";if(data[i]["HasPhoto"]==0)
{htmlcontent+="<img src=\"/images/no_one.jpg\" alt=\""+data[i]["Username"]+"\" title=\""+data[i]["Username"]+"\" width=\"45\" height=\"45\" border=\"0\"/>";}
else
{htmlcontent+="<img src=\""+data[i]["PhotoUrl"]+"\" alt=\""+data[i]["Username"]+"\" title=\""+data[i]["Username"]+"\" width=\"45\" height=\"45\" border=\"0\"/>";}
htmlcontent+="</a></td>";if((i+1)%4==0)
{htmlcontent+="</tr><tr>";}}
htmlcontent+="</tr></table>";htmlcontent+="</td></tr>";htmlcontent+="<tr><td class=\"content\">";if(currentPage>1)
{htmlcontent+="<img src=\"/images/btn_GourmetPre.gif\" onclick=\"DisplayMyFansBox("+total+","+(currentPage-1)+","+totalPage+",'"+userId+"','FansBox')\" style=\"cursor:pointer\" border=\"0\">";}
else
{htmlcontent+="<img src=\"/images/btn_GourmetPre.gif\" border=\"0\" style='visibility:hidden'/>";}
htmlcontent+="&nbsp;&nbsp;&nbsp;";if(currentPage<totalPage)
{htmlcontent+="<img src=\"/images/btn_GourmetNext.gif\" onclick=\"DisplayMyFansBox("+total+","+(currentPage+1)+","+totalPage+",'"+userId+"','FansBox')\" style=\"cursor:pointer\" border=\"0\">";}
else
{htmlcontent+="<img src=\"/images/btn_GourmetNext.gif\" border=\"0\" style='visibility:hidden'/>";}
htmlcontent+="</td></tr>";}
else
{}
htmlcontent+="</table></div>";parent.$(contentDivId).innerHTML=htmlcontent;}}
var page="/Block/MyFansBox/"+userId+".htm";var postbody="&page="+currentPage;new Ajax.Request(page,{method:'post',postBody:postbody,onComplete:callback});}
function AddBookMarkUser(IdolUserId,ContentDivId,SessionUserId)
{if(IdolUserId==''||IdolUserId==null||IdolUserId<0)
{AutoHidenPopup('發生不明錯誤。');return;}
if(SessionUserId==''||SessionUserId==null||SessionUserId<0)
{AutoHidenPopup('請先登入。');return;}
var callback=function(res)
{var responseText=res.responseText;if(responseText==''||responseText==null)
{AutoHidenPopup('發生不明錯誤。');}
else
{eval('var result = '+responseText+';');if(result.error)
{AutoHidenPopup(result.errmsg);}
else
{if(parent.$(ContentDivId))
{DisplayMyFansBox(result.result.total,1,result.result.totalpage,IdolUserId,ContentDivId,SessionUserId);}
AutoHidenPopup('成功儲存!');}}}
var page="/MyOpenRice/AddBookMarkUser.htm";var postbody="&IdolUserId="+IdolUserId;new Ajax.Request(page,{method:'post',postBody:postbody,onComplete:callback});}
function DelBookMarkUser(IdolUserId,FanUserId)
{if(IdolUserId==''||IdolUserId==null||IdolUserId<0)
{AutoHidenPopup('發生不明錯誤。');return;}
if(FanUserId==''||FanUserId==null||FanUserId<0)
{AutoHidenPopup('請先登入。');return;}
var callback=function(res)
{var responseText=res.responseText;if(responseText==''||responseText==null)
{AutoHidenPopup('發生不明錯誤。');}
else
{eval('var result = '+responseText+';');if(result.error)
{AutoHidenPopup(result.errmsg);}
else
{parent.location.reload();AutoHidenPopup(result.result);}}}
var page="/MyOpenRice/DelBookmarkUser.htm";var postbody="&IdolUserId="+IdolUserId;new Ajax.Request(page,{method:'post',postBody:postbody,onComplete:callback});}
function AutoHidenPopup(errmsg)
{$('resultmsg').innerHTML=errmsg;$('hiddenmsg').style.display='';$('btnSubmit').style.display='none';window.setTimeout('parentHidePopup()',5000);}