﻿var ARTICLE_COMMENT_TYPE=0;var PHOTO_COMMENT_TYPE=1;var oraginalName="";function drawLoginDiv(a){a.innerHTML="<table><tr><td   align=\"right\"><a href=\"javascript:register()\">注册</a></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td align=\"right\"><a href=\"javascript:login()\">登录</a></td><tr></table>"}function register(a){if(!a){a=""}document.location.href=a+"blogRegister.htm"}function login(a,b){if(!b){b=""}document.location.href=b+"myBlogLogin.htm?blogId="+a}function copy(s){setCopy(s);alert("已经把该BLOG网址复制到系统剪贴板，您可以使用（Ctrl+V或鼠标右键）粘贴功能。")}function myAlbum(a,b,c){if(!c){c=""}document.location.href=c+"main/myAlbum.htm?blogId="+a+"&albumKindId="+b}function listKindArticle(a,b,c){if(!c){c=""}var s=c+"articleList.htm?blogId="+b;if(a!=null&&a!=""){document.location.href=s+"&kindId="+a}else{document.location.href=s}}function listComment(a,b){if(!b){b=""}document.location.href=b+"commentList.htm?blogId="+a}function listAllFriendLink(a,b){if(!b){b=""}document.location.href=b+"friendList.htm?blogId="+a}function listMessages(a,b,c){if(!a){a=""}var d=a+"messageList.htm?blogId="+b ;if(c){d+="&messageId="+c}document.location.href=d}function viewComment(a,b,c){if(!c){c=""}if(b!=null&&b!=""){document.location.href=c+"viewComment.htm?blogId="+a+"&articleId="+b}}function viewCommentById(a,b,c,d,e){if(!e){e=""}var f=e;if(b!=null&&b!=""){if(c==PHOTO_COMMENT_TYPE){f+="viewPhoto.htm?photoId="+b}else if(c==ARTICLE_COMMENT_TYPE){f+="viewComment.htm?blogId="+a+"&articleId="+b}if(d!=null&&d!=""){f+="&commentId="+d}document.location.href=f}}function setCommentVisible(a){var b=document.getElementById(a);if(!b){return}var c="none";if(b.style.display=="none"){c="block"}b.style.display=c}function setDivVisible(a){var b=null;if(document.getElementById(a+"_ONE").style.display=="none"){b="block"}else{b="none"}if(document.getElementById(a+"_ONE")!=null){document.getElementById(a+"_ONE").style.display=b}if(document.getElementById(a+"_TWO")!=null){document.getElementById(a+"_TWO").style.display=b}if(document.getElementById(a+"_THREE")!=null){document.getElementById(a+"_THREE").style.display=b}}function viewArticle(a,b){if(!b){b=""}var c=b+"viewArticle.htm";if(a!=null&&a!=""){c=c+"?articleId="+a}else{return}document.location.href=c}function fixArticleUrl(){alert("To be implemented!")}function scrollToComment(a){var b=getPosition(a);window.scrollTo(0,b.y-150)}function setAnonymityName(a){if(a.checked){if(document.getElementById("nickName")!=null){oraginalName=document.getElementById("nickName").value}if(document.getElementById("vistorAnonymityName")!=null){if(document.getElementById("nickName")!=null){document.getElementById("nickName").value=document.getElementById("vistorAnonymityName").value}}}else{if(document.getElementById("nickName")!=null){document.getElementById("nickName").value=oraginalName}}}function refreshPage(){location.href=location.href}function setMessageDivVisible(a){var b=null;if(document.getElementById(a+"_TWO").style.display=="none"){b="block"}else{b="none"}if(document.getElementById(a+"_ONE")!=null){document.getElementById(a+"_ONE").style.display=b}if(document.getElementById(a+"_TWO")!=null){document.getElementById(a+"_TWO").style.display=b}if(document.getElementById(a+"_THREE")!=null){document.getElementById(a+"_THREE").style.display=b}}function setReplyViblable(a,b){if(b){viewEditor(b)}var c=null;if(document.getElementById(a+"_FOUR").style.display=="block"){c="none"}else{c="block"}document.getElementById(a+"_FOUR").style.display=c}function drawActionMsg(a,i){var b=" <img src=\"../images/admin/icon_green.gif\" width=\"14\" height=\"14\" align=\"absmiddle\" /> ";var c="float:left;border:solid 1px #00BE00;background-color:#E6FFE6;color: black;";var d="float:left;border:solid 1px #FF6600;background-color:#FFF2E9;color: black;";var e=" <img src=\"../images/admin/icon_red.gif\" width=\"14\" height=\"14\" align=\"absmiddle\" /> ";var f=a.getResult();if(f.actionMessages&&f.actionMessages.length>0){var g=document.getElementById("actionError"+i);if(g){g.style.cssText=c;g.innerHTML=b+f.actionMessages}}else if(f.actionErrors&&f.actionErrors.length>0){var g=document.getElementById("actionError"+i);if(g){g.style.cssText=d;g.innerHTML=e+f.actionErrors}}}function drawErrorMessages(a){var b="float:left;border:solid 1px #00BE00;background-color:#E6FFE6;";var c=" <img src=\"images/admin/icon_red.gif\" width=\"14\" height=\"14\" align=\"absmiddle\" /> ";var d=" <img src=\"images/admin/icon_green.gif\" width=\"14\" height=\"14\" align=\"absmiddle\" /> ";var e=a.getResult();if(e.actionMessages&&e.actionMessages.length>0){var f=document.getElementById("groupActionError");if(f){f.style.cssText=b;f.innerHTML=d+e.actionMessages}}else if(e.actionErrors&&e.actionErrors.length>0){var f=document.getElementById("groupActionError");if(f){f.style.cssText=errorStyle;f.innerHTML=c+e.actionErrors}}}function removeComments(c,d){if(c!=null&&c.length>0){if(!confirm("你确定要删除此评论吗？")){return}}buffalo.remoteCall("remoteIndexComment.htm","removeCommentsByIds",[c],function(a){if(hasErrors(a)){drawMessages(a)}else{var b=document.getElementById(d);if(b){b.removeNode(true)}}})}function Comment(a,b,c,d,e,f,g,h,i){this.id=a;this.blogId=b;this.receiverId=c;this.content=d;this.senderId=e;this.senderName=f;this.commentLevel=parseInt(h,10);this.type=parseInt(i,10);this.creationTime=g}function addComment(c,d,e,f,g){if(isSubmitting){return}if(document.getElementById("anonymity")!=null&&document.getElementById("anonymity").checked==true){d=null}var h="addComment";if(document.getElementById("commentId").value!=null&&document.getElementById("commentId").value!=""){h="modifyComment"}var i=new Comment(document.getElementById("commentId").value,g,c,f,d,document.getElementById("nickName").value,null,document.getElementById("commentLevelSelect").options[document.getElementById("commentLevelSelect").selectedIndex].value,e);if(document.getElementById("anonymity")!=null&&document.getElementById("anonymity").checked){i.senderId=""}isSubmitting=true;buffalo.remoteCall("remoteIndexComment.htm",h,[i],function(a){if(hasErrors(a)){drawMessages(a);isSubmitting=false}else{clearMessages("actionError");drawMessages(a);isSubmitting=false;setCommentHTML("");loadComment(a.getResult().value);document.getElementById("commentId").value="";var b=document.getElementById("commentHeadLineText");if(b){b.innerHTML="添加评论"}}})}function editComment(b){var c=document.getElementById("commentHeadLineText");c.innerHTML="修改评论";scrollToComment(c);buffalo.remoteCall("remoteIndexComment.htm","getCommentById",[b],function(a){if(hasErrors(a)){drawMessages(a)}else{document.getElementById("commentContent").value=a.getResult().value;document.getElementById("commentId").value=b;setCommentHTML(document.getElementById('commentContent').value)}})}function Message(a,b,c,d,e){this.id=a;this.content=b;this.senderId=c;this.receiverId=d;this.isWhisper=e}function addMessage(a){document.location.href="addMessage.htm?blogId="+a}var isSubmitSuccess=false;function updateMessage(c,d){if(isSubmitSuccess==true){return}var e="addMessage";var f=null;if(document.getElementById("messageId")!=null){f=document.getElementById("messageId").value;if(f!=null&&f!=""){e="modifyMessage"}}var g=new Message(f,FCKeditorAPI.GetInstance("content").EditorDocument.body.innerHTML,c,d,document.getElementById("whisperId").checked?1:0);buffalo.remoteCall("admin/remoteMessage.htm",e,[g],function(a){drawMessages(a);if(!hasErrors(a)){isSubmitSuccess=true;var b="refreshMessagePage('"+d+"')";setTimeout(b,200)}})}function replyMessage(b,i,c,d,e){var f=new Message(b,FCKeditorAPI.GetInstance("replycontent"+i).EditorDocument.body.innerHTML,e,null,0);buffalo.remoteCall("admin/remoteMessage.htm","add",[f],function(a){if(hasErrors(a)){drawActionMsg(a,i)}else{drawActionMsg(a,i);setTimeout("refreshMessagePage('"+d+"',"+c+")",200)}})}function removeMessage(b){var c=new Array();c[0]=b;if(!confirm("您确定要删除所选的留言记录吗?")){return}buffalo.remoteCall("admin/remoteMessage.htm","remove",[c],function(a){if(hasErrors(a)){drawMessages(a)}else{drawMessages(a);location.href=location.href}})}function editMessage(b){var c=document.getElementById("messageHeadLineText");c.innerHTML="修改留言";scrollToComment(c);buffalo.remoteCall("admin/remoteMessage.htm","getMessage",[b],function(a){if(hasErrors(a)){drawMessages(a)}else{FCKeditorAPI.GetInstance("content").EditorDocument.body.innerHTML=a.getResult().value.content;document.getElementById("messageId").value=b;document.getElementById("whisperId").checked=a.getResult().value.isWhisper==1?true:false}})}function clearMessageErrorMessage(){clearMessages("actionError")}function refreshMessagePage(a,b){document.location.href="messageList.htm?blogId="+a+"&pageIndex="+b}function showJionBlogGroup(a,b,c){dialogs=new dialog('images/admin/');dialogs.init();dialogs.set('width',400);dialogs.set('height',200);dialogs.set('title','申请加入博客群');var d='';d+='<FORM name="loginForm" action="javascript:addApply(\''+a+'\',\''+b+'\',\''+c+'\')" method="post">';d+='<table width="100%"><tr><td align="left" width="22%" height="20">申请加入理由：</td><td width="78%" algin="left"><span id="groupActionError"></span></td></tr>';d+='<tr><td align="left" width="100%" colspan="2" height="95"><textarea id="description" name="description"  rows="4" cols="45"></textarea></td></tr>';d+='<tr><td align="center" colspan="2" width="100%" height="20">';d+='<INPUT style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND: url(images/admin/smb_btn_bg.gif); BORDER-LEFT: 0px; WIDTH: 64px; LINE-HEIGHT: 20px; BORDER-BOTTOM: 0px; HEIGHT: 22px;cursor:hand;" type="submit" value="提交" alt="提交" name="Submit2">&nbsp;&nbsp;&nbsp;';d+='<INPUT style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND: url(images/admin/smb_btn_bg.gif); BORDER-LEFT: 0px; WIDTH: 64px; LINE-HEIGHT: 20px; BORDER-BOTTOM: 0px; HEIGHT: 22px;cursor:hand;" type=button value="取消" alt="取消"name=Submit2 onclick="dialogs.reset()">';d+='</td></tr>';d+='<tr><td align="center" colspan="2" width="100%" height="30">';d+='<div id="descriptionError"></div>';d+='</td></tr></table></FORM>';dialogs.html(d)}function JoinGroupApply(a,b,c,d){this.groupName=a;this.userId=b;this.nickName=c;this.description=d}function addApply(b,c,d,e){if(!e){e=""}var f=document.loginForm;var g=document.getElementById("description").value;var h=new JoinGroupApply(b,c,d,g);openActionPrompt("系统正在保存信息，请稍侯...");buffalo.remoteCall(e+"admin/addApply.htm","addApply",[h],function(a){closeActionPrompt();if(hasErrors(a)){clearMessages('actionError');drawMessages(a)}else{drawMessages(a);drawClientMessage('descriptionError',"");$('descriptionError').innerHTML=$('actionError').innerHTML;clearMessages('actionError')}})}var inMenu=false;var timerInstance=null;var inImageMenu=false;function getPosition(a){l=a.offsetLeft;t=a.offsetTop;while(a=a.offsetParent){l+=a.offsetLeft;t+=a.offsetTop}return{x:l,y:t}}function setMenuPosition(){var a=document.getElementById("groupText");var b=document.getElementById("splidContainer");if(a==null){return}var c=getPosition(a);var x=c.x;var y=c.y;b.style.left=c.x+"px";b.style.top=(c.y+a.offsetHeight)+"px"}function showMenu(){setMenuPosition();document.getElementById("splidContainer").style.visibility="visible";inImageMenu=true}function inImgMenu(){inImageMenu=true}function outImgMenu(){inImageMenu=false;hideMenu()}function inDivMenu(){inMenu=true}function outDivMenu(){inMenu=false;hideMenu()}function hideMenu(){if(inMenu||inImageMenu){return}if(timerInstance!=null){window.clearInterval(timerInstance)}timerInstance=window.setInterval("timerTask()",200)}function timerTask(){if(!inMenu&&!inImageMenu){document.getElementById("splidContainer").style.visibility="hidden";if(timerInstance!=null){window.clearInterval(timerInstance)}}}function changeBlog(a,b){if(a==""){return}if(!b){b=""}location.href=b+a}function gotoBlog(a){var b=document.getElementById("myBlogs").value;if(b==""){return}if(!a){a=""}location.href=a+b}function Appeal(a,b,c,d){this.appealId=a;this.appealType=b;this.appealUrl=c;this.appealContent=d}var appealDialog=null;var appealId="";var appealType="";var appealUrl="";var appealBaseUrl="";var appealDialogCancelFunction=null;function openAddAppealDialog(a,b,c,d){appealId=a;appealType=parseInt(b);appealUrl=encodeURIComponent(document.location.href);appealBaseUrl=d;if(!appealDialog){appealDialog=new Ext.BasicDialog("appealDiv",{width:400,height:230,shadow:false,shim:false,proxyDrag:true});appealDialog.addButton("确定",addAppeal,appealDialog);appealDialog.addButton("取消",appealDialog.hide,appealDialog)}initAppealDialog();appealDialog.center();appealDialog.show();if(typeof(appealDialogCancelFunction)=="function"){appealDialogCancelFunction.call(this)}}function addAppeal(){var b=document.getElementById("appealContent").value;if(!b||trim(b).length==0){drawClientError_noScroll("appealError","请正确填写不良信息描述！");return}var c=new Appeal(appealId,appealType,appealUrl,b);buffalo.remoteCall(appealBaseUrl+"remoteAppeal.htm","addAppeal",[c],function(a){drawMessages(a,"appealError");if(!hasErrors(a)){window.setTimeout("clearAppealDialog();",2000)}})}function clearAppealDialog(){if(appealDialog){document.getElementById("appealContent").value="";clearMessages("appealError");appealDialog.hide()}}function initAppealDialog(){document.getElementById("appealContent").value="";clearMessages("appealError")}document.write("<div id =\"appealDiv\" style=\"display:none;\">");document.write("<div class=\"x-dlg-hd\">举报-不良信息反馈</div>");document.write("<div id=\"articleContent\" class=\"x-dlg-bd\">");document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");document.write("<tr><td style=\"line-height: 22px;text-align:left;\">不良信息描述：(请将长度控制在1000个字符以内)</td></tr>");document.write("<tr><td><textarea id=\"appealContent\" cols=\"47\" rows=\"6\" style=\"width:370px;height:92px;\"></textarea></td></tr>");document.write("<tr><td><div id=\"appealError\"></div></td></tr>");document.write("</table>");document.write("</div>");document.write("</div>");