function Comment(){
this.CommenterID=null;
this.CommenterName=null;
this.CommenterPhotoUrl=null;
this.CommentTypeName=null;
this.CommentText=null;
this.CommentDate=null;
this.GroupName=null;
this.GroupID=null;
}
var CommentRules={pivot:0,pageSize:5,commentCount:0,divID:"",GetComments:function(_1){
if(_1||_1==0){
CommentRules.pivot=_1;
}
var _2;
if(Friend.CustomerID){
_2=Friend.CustomerID;
}else{
_2=User.CustomerID;
}
var _3=new Array("UserID","Pivot");
var _4=new Array(_2,CommentRules.pivot);
var _5=XmlObj.Create("GetUserComments",_3,_4);
Bjax.SendRequest("POST",AjaxUrl.ApiV2,_5,CommentRules.GetCommentsComplete);
},GetCommentsComplete:function(_6){
var _7=_6.responseXML.documentElement;
var _8=_7.getElementsByTagName("status")[0].childNodes[0].nodeValue;
var _9=_7.getElementsByTagName("message")[0].childNodes[0].nodeValue;
if(_8=="true"){
var _a=_7.getElementsByTagName("Comments")[0].hasChildNodes()?parseInt(_7.getElementsByTagName("Comments")[0].getAttribute("count")):0;
CommentRules.commentCount=parseInt(_7.getElementsByTagName("Comments")[0].getAttribute("truecount"));
var _b=new Array();
for(var i=0;i<_a;i++){
_b[i]=new Comment();
_b[i].CommentID=_7.getElementsByTagName("CommentID")[i].childNodes[0].nodeValue;
_b[i].CommenterID=_7.getElementsByTagName("CommenterID")[i].childNodes[0].nodeValue;
_b[i].CommenterName=_7.getElementsByTagName("CommenterName")[i].childNodes[0].nodeValue;
_b[i].CommentText=_7.getElementsByTagName("CommentText")[i].childNodes[0].nodeValue;
_b[i].CommentDate=_7.getElementsByTagName("CommentDate")[i].childNodes[0].nodeValue;
_b[i].CommenterPhotoUrl=_7.getElementsByTagName("CommenterPhotoUrl")[i].hasChildNodes()?_7.getElementsByTagName("CommenterPhotoUrl")[i].childNodes[0].nodeValue:noPhotoUrl;
}
CommentRules.ShowComments(_b);
}else{
$("UserCommentsContent").innerHTML=_9;
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",false);
}
},ShowComments:function(_d){
if(_d.length>0){
var _e=new Array();
if(CommentRules.commentCount<=CommentRules.pageSize){
btnPrevComments.disabled=true;
btnNextComments.disabled=true;
}
if(CommentRules.pivot>=CommentRules.pageSize){
btnPrevComments.disabled=false;
}else{
btnPrevComments.disabled=true;
}
var _f=CommentRules.pivot+CommentRules.pageSize;
if(CommentRules.commentCount>_f){
btnNextComments.disabled=false;
}else{
btnNextComments.disabled=true;
}
for(var i=0;i<_d.length;i++){
_e.push("<div class='panelcontent' style='text-align:left; border:1px dotted #cccccc;'>");
_e.push("<div style='width:400px; border:1px none #00cc00'>&nbsp;</div>");
_e.push("\t<div style='float:left; margin:0px 15px 7px 7px; border:2px none #FF9900;'>");
_e.push("\t\t<div style='border:2px solid #cccccc;'><a href='/profile/friend/?cid="+_d[i].CommenterID+"'><img src='"+_d[i].CommenterPhotoUrl+"' width='70' height='70' border='0'></a></div>");
_e.push("\t</div>");
_e.push("\t<div style='float:left; border:2px none #FF9900; width:400px;'>");
_e.push("\t\t<div class='text2'>On "+_d[i].CommentDate+",</div>");
_e.push("\t\t<div class='text2'><a href='/profile/friend/?cid="+_d[i].CommenterID+"'>"+_d[i].CommenterName+"</a> commented:</div>");
_e.push("\t\t<div>&nbsp;</div>");
_e.push("\t\t<div class='text13'>"+ConvertToBrTags(_d[i].CommentText)+"</div>");
_e.push("\t\t<div>&nbsp;</div>");
if(!Friend.CustomerID){
_e.push("\t\t<div id='lnkDeleteUserComment"+i+"' align='right'><a class='link5' href='javascript:CommentRules.DeleteUserComment("+_d[i].CommentID+", -1, "+i+");'>Delete</a></div>");
}
_e.push("\t</div>");
_e.push("<div style='width:400px; border:1px none #ff2000'>&nbsp;</div>");
_e.push("</div>");
}
$("UserCommentsContent").innerHTML=_e.join("");
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",true);
}else{
$("UserCommentsContent").innerHTML="No comments yet.";
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",false);
}
},GetGroupComments:function(_11){
if(_11||_11==0){
CommentRules.pivot=_11;
}
var _12;
if(Group.ID){
_12=Group.ID;
}else{
_12=User.CustomerID;
}
var _13=new Array("GroupID","Pivot");
var _14=new Array(_12,CommentRules.pivot);
var _15=XmlObj.Create("GetGroupComments",_13,_14);
Bjax.SendRequest("POST",AjaxUrl.ApiV2,_15,CommentRules.GetGroupCommentsComplete);
},GetGroupCommentsComplete:function(_16){
var _17=_16.responseXML.documentElement;
var _18=_17.getElementsByTagName("status")[0].childNodes[0].nodeValue;
var _19=_17.getElementsByTagName("message")[0].childNodes[0].nodeValue;
if(_18=="true"){
var _1a=_17.getElementsByTagName("Comments")[0].hasChildNodes()?parseInt(_17.getElementsByTagName("Comments")[0].getAttribute("count")):0;
CommentRules.commentCount=parseInt(_17.getElementsByTagName("Comments")[0].getAttribute("truecount"));
var _1b=new Array();
for(var i=0;i<_1a;i++){
_1b[i]=new Comment();
_1b[i].CommentID=_17.getElementsByTagName("CommentID")[i].childNodes[0].nodeValue;
_1b[i].CommenterID=_17.getElementsByTagName("CommenterID")[i].childNodes[0].nodeValue;
_1b[i].CommenterName=_17.getElementsByTagName("CommenterName")[i].childNodes[0].nodeValue;
_1b[i].CommentText=_17.getElementsByTagName("CommentText")[i].childNodes[0].nodeValue;
_1b[i].CommentDate=_17.getElementsByTagName("CommentDate")[i].childNodes[0].nodeValue;
_1b[i].CommenterPhotoUrl=_17.getElementsByTagName("CommenterPhotoUrl")[i].hasChildNodes()?_17.getElementsByTagName("CommenterPhotoUrl")[i].childNodes[0].nodeValue:noPhotoUrl;
}
CommentRules.ShowGroupComments(_1b);
}else{
$("UserCommentsContent").innerHTML=_19;
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",false);
}
},ShowGroupComments:function(_1d){
if(_1d.length>0){
var _1e=new Array();
var _1f=document.getElementById("btnPrevComments");
var _20=document.getElementById("btnNextComments");
if(CommentRules.commentCount<=CommentRules.pageSize){
_1f.disabled=true;
_20.disabled=true;
}
if(CommentRules.pivot>=CommentRules.pageSize){
_1f.disabled=false;
}else{
_1f.disabled=true;
}
var _21=CommentRules.pivot+CommentRules.pageSize;
if(CommentRules.commentCount>_21){
_20.disabled=false;
}else{
_20.disabled=true;
}
for(var i=0;i<_1d.length;i++){
_1e.push("<div class='panelcontent' style='text-align:left; border:1px dotted #cccccc;'>");
_1e.push("<div style='width:400px; border:1px none #00cc00'>&nbsp;</div>");
_1e.push("\t<div style='float:left; margin:0px 15px 7px 7px; border:2px none #FF9900;'>");
_1e.push("\t\t<div style='border:2px solid #cccccc;'><a href='/profile/friend/?cid="+_1d[i].CommenterID+"'><img src='"+_1d[i].CommenterPhotoUrl+"' width='70' height='70' border='0'></a></div>");
_1e.push("\t</div>");
_1e.push("\t<div style='float:left; border:2px none #FF9900; width:400px;'>");
_1e.push("\t\t<div class='text2'>On "+_1d[i].CommentDate+",</div>");
_1e.push("\t\t<div class='text2'><a href='/profile/friend/?cid="+_1d[i].CommenterID+"'>"+_1d[i].CommenterName+"</a> commented:</div>");
_1e.push("\t\t<div>&nbsp;</div>");
_1e.push("\t\t<div class='text13'>"+ConvertToBrTags(_1d[i].CommentText)+"</div>");
_1e.push("\t\t<div>&nbsp;</div>");
_1e.push("\t</div>");
_1e.push("<div style='width:400px; border:1px none #ff2000'>&nbsp;</div>");
_1e.push("</div>");
}
$("UserCommentsContent").innerHTML=_1e.join("");
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",true);
}else{
$("UserCommentsContent").innerHTML="No comments yet.";
ShowLayer("UserCommentsLoader",false);
ShowLayer("UserCommentsContent",true);
ShowLayer("UserCommentsNavigator",false);
}
},GetNewComments:function(){
var _23=new Array("UserID");
var _24=new Array(User.CustomerID);
var _25=XmlObj.Create("GetNewComments",_23,_24);
Bjax.SendRequest("POST",AjaxUrl.ApiV2,_25,CommentRules.GetNewCommentsComplete);
},GetNewCommentsComplete:function(_26){
var _27=_26.responseXML.documentElement;
var _28=_27.getElementsByTagName("status")[0].childNodes[0].nodeValue;
var _29=_27.getElementsByTagName("message")[0].childNodes[0].nodeValue;
if(_28=="true"){
var _2a=_27.getElementsByTagName("Comments")[0].hasChildNodes()?parseInt(_27.getElementsByTagName("Comments")[0].getAttribute("count")):0;
CommentRules.commentCount=parseInt(_27.getElementsByTagName("Comments")[0].getAttribute("truecount"));
var _2b=new Array();
for(var i=0;i<_2a;i++){
_2b[i]=new Comment();
_2b[i].GroupID=_27.getElementsByTagName("GroupID")[i].hasChildNodes()?_27.getElementsByTagName("GroupID")[i].childNodes[0].nodeValue:"";
_2b[i].GroupName=_27.getElementsByTagName("GroupName")[i].hasChildNodes()?_27.getElementsByTagName("GroupName")[i].childNodes[0].nodeValue:"";
_2b[i].CommentID=_27.getElementsByTagName("CommentID")[i].childNodes[0].nodeValue;
_2b[i].CommenterID=_27.getElementsByTagName("CommenterID")[i].childNodes[0].nodeValue;
_2b[i].CommenterName=_27.getElementsByTagName("CommenterName")[i].childNodes[0].nodeValue;
_2b[i].CommentText=_27.getElementsByTagName("CommentText")[i].childNodes[0].nodeValue;
_2b[i].CommentDate=_27.getElementsByTagName("CommentDate")[i].childNodes[0].nodeValue;
_2b[i].CommenterPhotoUrl=_27.getElementsByTagName("CommenterPhotoUrl")[i].hasChildNodes()?_27.getElementsByTagName("CommenterPhotoUrl")[i].childNodes[0].nodeValue:noPhotoUrl;
}
CommentRules.ShowNewComments(_2b);
}else{
$("InboxDataCommentsContent").innerHTML=_29+"<br/><br/>";
ShowLayer("InboxDataCommentsLoader",false);
ShowLayer("InboxDataCommentsContent",true);
}
},PrepNewComments:function(){
$("InboxMenuGroups").className="button1";
$("InboxMenuMessages").className="button1";
$("InboxMenuFriends").className="button1";
$("InboxMenuComments").className="button2";
$("InboxDataCommentsLoaderText").innerHTML="loading. . .";
ShowLayer("InboxMessages",false);
ShowLayer("InboxDataGroups",false);
ShowLayer("InboxDataFriends",false);
ShowLayer("InboxDataComments",true);
ShowLayer("InboxDataCommentsLoader",true);
ShowLayer("InboxDataCommentsContent",false);
CommentRules.GetNewComments();
},ShowNewComments:function(_2d){
var _2e="";
if(_2d.length>0){
var _2f=new Array();
for(var i=0;i<_2d.length;i++){
_2e="UserComment";
_2f.push("<div class='panelcontent' style='text-align:left; border:1px dotted #cccccc;'>");
_2f.push("<div style='width:400px; border:1px none #00cc00'>&nbsp;</div>");
_2f.push("\t<div style='float:left; margin:0px 15px 7px 7px; border:2px none #FF9900;'>");
_2f.push("\t\t<div style='border:2px solid #cccccc;'><a href='/profile/friend/?cid="+_2d[i].CommenterID+"'><img src='"+_2d[i].CommenterPhotoUrl+"' width='70' height='70' border='0'></a></div>");
_2f.push("\t</div>");
_2f.push("\t<div style='float:left; border:2px none #FF9900; width:475px;'>");
_2f.push("\t\t<div class='text2'>On "+_2d[i].CommentDate+",</div>");
_2f.push("\t\t<div class='text2'><a href='/profile/friend/?cid="+_2d[i].CommenterID+"'>");
_2f.push(_2d[i].CommenterName+"</a> commented");
if(_2d[i].GroupID!=""){
_2e="GroupComment";
_2f.push(" on your group, ");
_2f.push("<a href='/groups/?gid="+_2d[i].GroupID+"'>"+_2d[i].GroupName+"</a>:");
}
_2f.push("\t\t</div>");
_2f.push("\t\t<div>&nbsp;</div>");
_2f.push("\t\t<div class='text13'>"+ConvertToBrTags(_2d[i].CommentText)+"</div>");
_2f.push("\t\t<div>&nbsp;</div>");
_2f.push("\t\t<div style='border:1px none #000000;'>");
_2f.push("\t\t\t<span><a href='javascript:CommentRules.UpdateCommentStatus("+_2d[i].CommentID+", &quot;"+_2e+"&quot;, 1)' class='button3'>approve</a></span>");
_2f.push("\t\t\t<span><a href='javascript:CommentRules.UpdateCommentStatus("+_2d[i].CommentID+", &quot;"+_2e+"&quot;, -1)' class='button3'>reject</a></span>");
_2f.push("\t\t</div>");
_2f.push("\t</div>");
_2f.push("<div style='width:400px; border:1px none #ff2000'>&nbsp;</div>");
_2f.push("</div>");
}
$("InboxDataCommentsContent").innerHTML=_2f.join("");
}
ShowLayer("InboxDataCommentsLoader",false);
ShowLayer("InboxDataCommentsContent",true);
},DeleteUserComment:function(id,_32,idx){
var _34="lnkDeleteUserComment"+idx;
document.getElementById(_34).innerHTML="deleting . . .";
this.divID=_34;
var nme=new Array("CommentID","CommentType","CommentStatus");
var val=new Array(id,"UserComment",_32);
var _37=XmlObj.Create("UpdateCommentStatus",nme,val);
Bjax.SendRequest("POST",AjaxUrl.ApiV2,_37,CommentRules.DeleteUserCommentComplete);
},DeleteUserCommentComplete:function(_38){
CommentRules.GetComments(0);
},UpdateCommentStatus:function(_39,_3a,_3b){
$("InboxDataCommentsLoaderText").innerHTML="updating. . .";
ShowLayer("InboxDataCommentsLoader",true);
ShowLayer("InboxDataCommentsContent",false);
var _3c=new Array("CommentID","CommentType","CommentStatus");
var _3d=new Array(_39,_3a,_3b);
var _3e=XmlObj.Create("UpdateCommentStatus",_3c,_3d);
Bjax.SendRequest("POST",AjaxUrl.ApiV2,_3e,CommentRules.UpdateCommentStatusComplete);
},UpdateCommentStatusComplete:function(_3f){
var _40=_3f.responseXML.documentElement;
var _41=_40.getElementsByTagName("status")[0].childNodes[0].nodeValue;
if(_41=="true"){
Inbox.NewCommentCount--;
Inbox.ShowNewBreakdownCount();
CommentRules.GetComments();
}
CommentRules.PrepNewComments();
}};


