var Item=function(){
this.communityID=-1;
this.communityUrl="";
this.url="";
this.description="";
this.itemID=-1;
this.votingOption="Allow";
this.userName="";
this.points=0;
this.userVoted=0;
this.commentCount=0;
};
Item.prototype.WriteHtml=function(sb,_2){
var _3="";
if(this.itemType=="Url"){
_3+="<div class='url'>";
_3+="<a href='"+HtmlEncodeJS(this.GetUrl())+"' target='_blank' class='title' rel='nofollow'>"+HtmlEncode(this.title)+"</a>";
if(this.description!=""){
_3+="<br/><span class='itemDescription'>"+HtmlEncode(this.description,true)+"</span>";
}
}else{
if(this.itemType=="Discussion"){
_3+="<div class='discussion'>";
_3+="<span style=\"font-weight:bold\">[Discussion]</span>";
_3+="&nbsp;<a href='"+HtmlEncodeJS(this.GetUrl())+"' target='_new' class='title'>"+HtmlEncode(this.title)+"</a>";
if(this.description!=""){
_3+="<br/><span class='itemDescription'>"+HtmlEncode(this.description,true)+"</span>";
}
}
}
_3+="</div>";
_3+="<div class='itemDetails'>";
if(this.points>-1){
_3+="<span class='points'>"+this.points+" votes</span>";
}
_3+=" by <a class='user' href='http://zooov.com/user/"+this.userName+"'>"+this.userName+"</a>&#160;"+" <span class='postDate'>on "+this.postDate+"</span>&#160;&#160; ";
var _4="comments";
if(this.commentCount==1){
_4="comment";
}
if(this.communityID==-1){
_3+="<a class='comment' href='http://zooov.com/user/"+this.userName+"/item/"+this.itemID+"'>"+this.commentCount+" "+_4+"</a>&#160;&#160; ";
}else{
_3+="<a class='comment' href='"+this.GetItemPageUrl()+"'>"+this.commentCount+" "+_4+"</a>&#160;&#160; ";
}
if(_2){
_3+="<a href='#' class='editCommand' onclick=\"Editing.ItemEdit_Begin("+this.itemID+");return false;\">[edit]</a>"+"&#160;<a href='#' class='editCommand' onclick=\"Editing.ItemDelete_Begin("+this.itemID+");return false;\">[delete]</a>";
if(this.communityID!=-1&&Page.inItemPage&&Page.inItemPage==true){
_3+="<a href='#' class='editCommand' onclick=\"Editing.ItemMove_Begin("+this.itemID+");return false;\">[move]</a>";
}
}
_3+="</div>";
sb.write(_3);
};
Item.prototype.WriteBoxInnerHtml=function(sb,_6){
sb.write("<table><tr><td valign='top'><div class='voteDiv'>");
if(this.votingOption!="HideVoting"){
if(this.userVoted==true){
sb.write("<a href='#' class='voted' onclick='alert(\"Oops. You already voted for this item.\");return false;'></a>");
}else{
sb.write("<a href=\"#\" class=\"voteUp\" "+"onclick=\"Editing.CastVote_Begin('"+this.itemID+"', 'Up', "+"this.parentNode.parentNode.parentNode);return false;\">Vote</a>");
}
}
sb.write("</div></td><td>");
sb.write(this.WriteHtml(sb,_6));
sb.write("</td></tr></table>");
};
Item.prototype.WriteEditHtml=function(sb){
var _8="";
_8+="<table class=\"lightFormTable\" border=\"0\">";
_8+="<tr><td>Title</td><td>"+"<input type=\"text\" id=\""+this.itemID+".title\" value=\""+HtmlEncode(this.title)+"\" /></td></tr>";
if(this.itemType=="Url"){
_8+="<tr><td>URL</td><td><input type=\"text\" id=\""+this.itemID+".url\" value=\""+HtmlEncode(this.url)+"\" /></td></tr>"+"<tr><td>Description<br/><span style=\"color:#888\">(optional)</span></td><td><textarea id=\""+this.itemID+".description\">"+HtmlEncode(this.description)+" </textarea></td></tr>";
}else{
if(this.itemType=="Discussion"){
_8+="<tr><td>Details</td><td><textarea id=\""+this.itemID+".description\">"+HtmlEncode(this.description)+" </textarea>"+"</td></tr>";
}
}
_8+="</table>";
sb.write(_8);
};
Item.prototype.UpdateFromEditHtml=function(_9,_a){
if(this.itemType=="Url"){
this.url=(document.getElementById(_9.itemID+".url").value);
}
this.title=(document.getElementById(_9.itemID+".title").value);
this.description=(document.getElementById(_9.itemID+".description").value);
};
Item.prototype.LoadFromHtml=function(_b){
var _c;
_c=YAHOO.util.Dom.getElementsByClassName("url","div",_b)[0];
if(_c){
this.itemType="Url";
}else{
_c=YAHOO.util.Dom.getElementsByClassName("discussion","div",_b)[0];
this.itemType="Discussion";
}
this.itemID=_b.attributes["id"].value.substr(4);
if(_b.attributes["communityID"]!=null){
this.communityID=_b.attributes["communityID"].value;
this.communityUrl=_b.attributes["curl"].value;
}else{
this.communityID=-1;
this.communityUrl="";
}
this.votingOption=_b.attributes["vo"].value;
this.url=YAHOO.util.Dom.getElementsByClassName("title","a",_c)[0].attributes["href"].value;
this.title=getNodeInnerText(YAHOO.util.Dom.getElementsByClassName("title","a",_c)[0]);
var _d=YAHOO.util.Dom.getElementsByClassName("itemDescription","span",_c);
if(_d.length>0){
this.description=HtmlDecode(_d[0].innerHTML);
}else{
this.description="";
}
var _e=YAHOO.util.Dom.getElementsByClassName("itemDetails","div",_b)[0];
this.userName=YAHOO.util.Dom.getElementsByClassName("user","a",_e)[0].innerHTML;
var _f=YAHOO.util.Dom.getElementsByClassName("points","span",_e)[0];
if(_f!=null){
this.points=parseInt(_f.innerHTML.split(" ")[0]);
}else{
this.points="-1";
}
this.postDate=YAHOO.util.Dom.getElementsByClassName("postDate","span",_e)[0].innerHTML.split(" ")[1];
this.userVoted=(_b.attributes["uv"].value==1?true:false);
this.commentCount=YAHOO.util.Dom.getElementsByClassName("comment","a",_e)[0].innerHTML.split(" ")[0];
};
Item.prototype.GetPostParams=function(){
var _10="&type="+encodeURIComponent(this.itemType)+"&user="+encodeURIComponent(this.userName)+(this.itemType=="Url"?"&url="+encodeURIComponent(this.url):"")+"&title="+encodeURIComponent(this.title)+"&description="+encodeURIComponent(this.description);
return _10;
};
Item.prototype.GetItemPageUrl=function(){
if(this.communityID==-1){
return "http://zooov.com/user/"+this.userName+"/item/"+this.itemID;
}else{
return this.communityUrl+"item/"+this.itemID;
}
};
Item.prototype.GetUrl=function(){
if(this.itemType=="Url"){
return this.url;
}else{
return this.GetItemPageUrl();
}
};
var Items={};
Items.connection=null;
Items.start=0;
Items.BeginGetItems=function(_11){
document.getElementById("progressGif").style.visibility="";
if(Items.connection!=null){
YAHOO.util.Connect.abort(Items.connection);
Items.connection=null;
}
var _12={success:Items.EndGetItems,failure:Items.ErrorGetItems,argument:_11};
Items.connection=YAHOO.util.Connect.asyncRequest("POST","/ws/Items.asmx/GetItemsXml",_12,"blogName="+encodeURIComponent(Page.blogName)+"&start="+encodeURIComponent(_11));
return;
};
Items.EndGetItems=function(o){
document.getElementById("progressGif").style.visibility="hidden";
Items.itemsXml=o.responseXML;
Items.itemsXml.setProperty("SelectionLanguage","XPath");
Items.sart=o.argument;
Items.connection=null;
Page.RefreshView();
};
Items.ErrorGetItems=function(o){
document.getElementById("progressGif").style.visibility="hidden";
alert("failure: "+o.statusText);
Items.itemsXml=null;
Items.connection=null;
};
Items.IncrementHitCount=function(_15,_16){
try{
var _17=document.getElementById("item"+_16);
var _18=new Item();
_18.LoadFromHtml(_17);
urchinTracker("/out/"+_18.communityName+"/"+_18.itemType+"/"+_18.url);
}
catch(ex){
}
};
var Editing={};
Editing.ItemAdd_Begin=function(_19,_1a,_1b){
var _1c=document.getElementById(_1a);
if(!_19){
_19=new Item();
}
Page.itemStore[_1a]=_19;
var sb=new StringBuilder();
_19.WriteEditHtml(sb);
var _1e="";
if(!_1b){
_1e="disabled='true'";
}
sb.write("<input type=\"button\" class=\"SubmitButton\" value=\"&nbsp;&nbsp;Save&nbsp;&nbsp;\" onclick=\"Editing.ItemAdd_Save('"+_1a+"');\""+_1e+" />");
sb.write("&nbsp;&nbsp;<input type=\"button\" class=\"CancelButton\" value=\"Cancel\" onclick=\"Editing.ItemAdd_Cancel('');\""+_1e+"/>");
if(!_1b){
sb.write("Please sign in to post");
}
_1c.innerHTML=sb.toString();
};
Editing.ItemAdd_Save=function(_1f){
var _20=document.getElementById(_1f);
var _21=Page.itemStore[_1f];
_21.UpdateFromEditHtml(_21,_20);
Page.itemStore[_1f]=_21;
_20.innerHTML="Saving... Please wait.";
Editing.ServerItemAdd_Begin(_21,_1f);
};
Editing.ItemAdd_Cancel=function(_22){
location.href="/home";
};
Editing.ItemAdd_Complete=function(_23){
var _24=document.getElementById(_23);
var sb=new StringBuilder();
sb.write("<div style='margin-top:2em;color:#080;font-weight:bold;font-size:1.2em;'>Item saved. Thank you.</div>");
_24.innerHTML=sb.toString();
};
Editing.ItemAdd_Error=function(_26,_27){
var _28=document.getElementById(_26);
var _29=Page.itemStore[_26];
var sb=new StringBuilder();
_29.WriteEditHtml(sb);
sb.write("<input type=\"button\" class=\"SubmitButton\" value=\"Save\" onclick=\"Editing.ItemAdd_Save('"+_26+"');\"/>");
sb.write("&nbsp;&nbsp;<input type=\"button\" class=\"CancelButton\" value=\"Cancel\" onclick=\"Editing.ItemAdd_Cancel('');\"/>");
sb.write("<div style='margin-top:2em;color:#800;font-weight:bold;font-size:1.2em;'>"+_27+"</div>");
_28.innerHTML=sb.toString();
};
Editing.ServerItemAdd_Begin=function(_2b,_2c){
var _2d={success:Editing.ServerItemAdd_Success,failure:Editing.ServerItemAdd_Error,argument:_2c};
if(_2b.communityID>-1){
YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/AddItem",_2d,"communityID="+_2b.communityID+_2b.GetPostParams());
}
};
Editing.ServerItemAdd_Success=function(o){
var _2f=o.responseXML;
if(_2f!=null&&_2f.documentElement!=null&&_2f.documentElement.tagName=="error"){
if(_2f.documentElement.firstChild.data=="DUPLICATE"){
Editing.ItemAdd_Error(o.argument,"Sorry. This item already exists in this community.");
}else{
if(_2f.documentElement.firstChild.data=="INVALID"){
Editing.ItemAdd_Error(o.argument,"Sorry. Something wrong in the data you're submitting. Please make sure you're filling the required fields.");
}
}
}else{
Editing.ItemAdd_Complete(o.argument);
}
};
Editing.ServerItemAdd_Error=function(o){
Editing.ItemAdd_Error(o.argument,"Oops. Something wrong on our side. Please try again. If the error persists, please let us know through the Feedback link at the top.");
};
Editing.ItemEdit_Begin=function(_31){
var _32=document.getElementById("item"+_31);
var _33=new Item();
_33.LoadFromHtml(_32);
Page.itemStore[_31]=_33;
var sb=new StringBuilder();
_33.WriteEditHtml(sb);
sb.write("<input type=\"button\" class=\"SubmitButton\" value=\"&nbsp;&nbsp;Save&nbsp;&nbsp;\" onclick=\"Editing.ItemEdit_Save('"+_31+"');\"/>");
sb.write("&nbsp;&nbsp;<input type=\"button\" class=\"CancelButton\" value=\"Cancel\" onclick=\"Editing.ItemEdit_Cancel('"+_31+"');\"/>");
_32.innerHTML=sb.toString();
};
Editing.ItemEdit_Cancel=function(_35){
var _36=document.getElementById("item"+_35);
var _37=Page.itemStore[_35];
var sb=new StringBuilder();
_37.WriteBoxInnerHtml(sb,true);
_36.innerHTML=sb.toString();
};
Editing.ItemEdit_Save=function(_39){
var _3a=document.getElementById("item"+_39);
var _3b=Page.itemStore[_39];
_3b.UpdateFromEditHtml(_3b,_3a);
var sb=new StringBuilder();
_3b.WriteBoxInnerHtml(sb,true);
_3a.innerHTML=sb.toString();
if(_3b.communityID>-1){
Editing.ServerCommunityItemUpdate_Begin(_3b.communityID,_39,_3b.GetPostParams());
}else{
Editing.ServerItemUpdate_Begin(_39,_3b.GetPostParams());
}
};
Editing.ServerItemUpdate_Begin=function(_3d,_3e){
var _3f={success:Editing.ServerItemUpdate_Success,failure:function(o){
Editing.ServerItemUpdate_Error(o.status,o.responseText,o.responseXML,_3d);
},argument:_3d};
var _41=YAHOO.util.Connect.asyncRequest("POST","/ws/Items.asmx/UpdateItem",_3f,"itemID="+_3d+_3e);
};
Editing.ServerItemUpdate_Success=function(o){
};
Editing.ServerItemUpdate_Error=function(_43,_44,_45,_46){
alert("Error updating server. Your changes are NOT saved. \r\nPlease try again, and if the error persists, copy your latest edits elsewhere and then try again later.");
};
Editing.ServerCommunityItemUpdate_Begin=function(_47,_48,_49){
var _4a={success:Editing.ServerCommunityItemUpdate_Success,failure:function(o){
Editing.ServerCommunityItemUpdate_Error(o.status,o.responseText,o.responseXML,_47,_48);
},argument:_48};
var _4c=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/UpdateItem",_4a,"communityID="+_47+"&itemID="+_48+_49);
};
Editing.ServerCommunityItemUpdate_Success=function(o){
};
Editing.ServerCommunityItemUpdate_Error=function(_4e,_4f,_50,_51,_52){
alert("Error updating server. Your changes are NOT saved. \r\nPlease try again, and if the error persists, copy your latest edits elsewhere and then try again later.");
};
Editing.ValidateProperty=function(_53,_54,_55,_56){
if(_53=="tags"||_53=="tag"){
var _57=new RegExp("[;'\"]","ig");
if(_55.search(_57)!=-1){
throw {message:"These characters are not allowed\r\n ; ' \""};
}
_57=new RegExp("\\s{2,}");
var _58=_55.replace(_57," ");
var _59=_58.split(",");
if(_53=="tag"){
if(_59.length>1){
throw {message:"A tag name cannot contain a comma."};
}
_5a=_58.trim();
}else{
var _5a=",";
for(var i=0;i<_59.length;i++){
var tag=_59[i].toString().trim();
if(tag!=""){
if(_5a.indexOf(tag)<0){
_5a+=_59[i]+",";
}
}
}
if(_5a==",,"||_5a==","){
_5a="";
}
}
if(_56==true){
if(_5a==""){
throw {message:"A value must be entered."};
}
}
return _5a;
}
throw {message:"not implemented for properties other than 'tags'"};
};
Editing.ItemDelete_Begin=function(_5d){
var _5e=document.getElementById("item"+_5d);
var _5f=new Item();
_5f.LoadFromHtml(_5e);
if(_5f.communityID>-1){
ret=window.confirm("If other users have already voted or commented on this item, all will be lost. Sure you want to delete it?");
if(ret!=true){
return;
}
Editing.ServerCommunityItemDelete_Begin(_5f.communityID,_5d);
_5e.style.display="none";
}else{
ret=window.confirm("Sure?");
if(ret!=true){
return;
}
Editing.ServerItemDelete_Begin(_5d);
_5e.style.display="none";
}
};
Editing.ServerItemDelete_Begin=function(_60){
var _61={success:Editing.ServerItemDelete_Success,failure:Editing.ServerItemDelete_Error,argument:_60};
var _62=YAHOO.util.Connect.asyncRequest("POST","/ws/Items.asmx/DeleteItem",_61,"&itemID="+encodeURIComponent(_60));
};
Editing.ServerItemDelete_Success=function(o){
};
Editing.ServerItemDelete_Error=function(o){
alert("Error updating server. Item was NOT deleted. \r\nPlease refresh the page and try again. If the error persists, please drop us a line.");
};
Editing.ServerCommunityItemDelete_Begin=function(_65,_66){
var _67={success:Editing.ServerCommunityItemDelete_Success,failure:Editing.ServerCommunityItemDelete_Error,argument:_66};
var _68=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/DeleteItem",_67,"&communityID="+encodeURIComponent(_65)+"&itemID="+encodeURIComponent(_66));
};
Editing.ServerCommunityItemDelete_Success=function(o){
};
Editing.ServerCommunityItemDelete_Error=function(o){
alert("Error updating server. Item was NOT deleted. \r\nPlease refresh the page and try again. If the error persists, please contact us.");
};
Editing.ItemFlag_Begin=function(_6b){
ret=window.confirm("Flag this item as junk?");
if(ret!=true){
return;
}
var _6c=document.getElementById("item"+_6b);
var _6d=new Item();
_6d.LoadFromHtml(_6c);
if(_6d.communityID>-1){
Editing.ServerCommunityItemFlag_Begin(_6d.communityID,_6b);
_6c.style.display="none";
}else{
alert("not implemented yet.");
}
};
Editing.ServerItemFlag_Begin=function(_6e){
var _6f={success:Editing.ServerItemFlag_Success,failure:Editing.ServerItemFlag_Error,argument:_6e};
var _70=YAHOO.util.Connect.asyncRequest("POST","/ws/Items.asmx/FlagItem",_6f,"&itemID="+encodeURIComponent(_6e));
};
Editing.ServerItemFlag_Success=function(o){
};
Editing.ServerItemFlag_Error=function(o){
alert("Error updating server. Item was NOT flagged as junk. \r\nPlease refresh the page and try again. If the error persists, please drop us a line.");
};
Editing.ServerCommunityItemFlag_Begin=function(_73,_74){
var _75={success:Editing.ServerCommunityItemFlag_Success,failure:Editing.ServerCommunityItemFlag_Error,argument:_74};
var _76=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/FlagItem",_75,"&communityID="+encodeURIComponent(_73)+"&itemID="+encodeURIComponent(_74));
};
Editing.ServerCommunityItemFlag_Success=function(o){
};
Editing.ServerCommunityItemFlag_Error=function(o){
alert("Error updating server. Item was NOT flagged as junk. \r\nPlease refresh the page and try again. If the error persists, please contact us.");
};
Editing.ItemMove_AddCommunityButtons=function(_79){
var _7a={success:Editing.ItemMove_AddCommunityButtons_Success,failure:function(o){
Editing.ItemMove_AddCommunityButtons_Error(o.status,o.responseText,o.responseXML,_79.itemID);
},argument:_79};
var _7c=YAHOO.util.Connect.asyncRequest("GET","/ws/User.asmx/GetUserCommunities",_7a,"userName="+_79.userName);
};
Editing.ItemMove_AddCommunityButtons_Success=function(o){
var _7e=o.responseXML.documentElement;
var _7f=_7e.getElementsByTagName("string");
var i;
var _81="";
for(i=0;i<_7f.length;i+=2){
var id,_83;
if(_7f[i].textContent){
id=_7f[i].textContent;
_83=_7f[i+1].textContent;
}else{
id=_7f[i].text;
_83=_7f[i+1].text;
}
if(_7f[i].text==o.argument.communityID){
_81+="<input type='radio' checked='checked' name='"+o.argument.itemID+"_community_radio' value='"+id+"'>"+_83+"</input> <br/>";
}else{
_81+="<input type='radio' name='"+o.argument.itemID+"_community_radio' value='"+id+"'>"+_83+"</input> <br/>";
}
}
var div=document.getElementById(o.argument.itemID+"_community_radios_div");
div.innerHTML=_81;
};
Editing.ItemMove_AddCommunityButtons_Error=function(_85,_86,_87,_88){
};
Editing.ItemMove_Begin=function(_89){
var _8a=document.getElementById("item"+_89);
var _8b=new Item();
_8b.LoadFromHtml(_8a);
Page.itemStore[_89]=_8b;
var _8c="";
_8c+="<div id='"+_89+"_community_radios_div'>";
_8c+="</div>";
_8c+="<input type=\"button\" class=\"SubmitButton\" value=\"&nbsp;&nbsp;Move&nbsp;&nbsp;\" onclick=\"Editing.ItemMove_Move('"+_89+"');\" />";
_8c+="&nbsp;&nbsp;<input type=\"button\" class=\"CancelButton\" value=\"Cancel\" onclick=\"Editing.ItemMove_Cancel('"+_89+"');\" />";
_8a.innerHTML=_8c;
Editing.ItemMove_AddCommunityButtons(_8b);
};
Editing.ItemMove_Cancel=function(_8d){
var _8e=document.getElementById("item"+_8d);
var _8f=Page.itemStore[_8d];
var sb=new StringBuilder();
_8f.WriteBoxInnerHtml(sb,true);
_8e.innerHTML=sb.toString();
};
Editing.ItemMove_Move=function(_91){
var _92=Page.itemStore[_91];
var _93=document.getElementsByName(_91+"_community_radio");
var i,_95=-1;
for(i=0;i<_93.length;i++){
if(_93[i].checked==true){
_95=_93[i].value;
break;
}
}
if(_95==-1){
alert("You have selected an invalid community.");
Editing.ItemMove_Cancel(_91);
return;
}
Editing.ServerItemMove_Begin(_91,"&communityID="+_92.communityID+"&newCommunityID="+_95);
};
Editing.ServerItemMove_Begin=function(_96,_97){
var _98={success:Editing.ServerItemMove_Success,failure:function(o){
Editing.ServerItemMove_Error(o.status,o.responseText,o.responseXML,_96);
},argument:_96};
var _9a=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/MoveItem",_98,"itemID="+_96+_97);
};
Editing.ServerItemMove_Success=function(o){
window.location.href=window.location.href;
};
Editing.ServerItemMove_Error=function(_9c,_9d,_9e,_9f){
alert("Error updating server. Your changes are NOT saved. \r\nPlease try again, and if the error persists, copy your latest edits elsewhere and then try again later.");
};
Editing.CastVote_Begin=function(_a0,_a1,_a2){
if(Page.loggedInUserName==""){
alert("Please sign up for a zooov.com account to vote.");
return;
}
var _a3=document.getElementById("item"+_a0);
var _a4=new Item();
_a4.LoadFromHtml(_a3);
_a4.points+=1;
_a4.userVoted=true;
var _a5=false;
if(Page.loggedInUserName==_a4.userName||Page.isModerator==true){
_a5=true;
}
var sb=new StringBuilder();
_a4.WriteBoxInnerHtml(sb,_a5);
_a3.innerHTML=sb.toString();
if(_a4.communityID>-1){
Editing.ServerCastVote_Begin(_a4.communityID,_a0,_a1);
}else{
}
};
Editing.ServerCastVote_Begin=function(_a7,_a8,_a9){
var _aa={success:Editing.ServerCastVote_Success,failure:Editing.ServerCastVote_Error,argument:_a8};
var _ab=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityItems.asmx/CastVote",_aa,"&communityID="+encodeURIComponent(_a7)+"&itemID="+encodeURIComponent(_a8)+"&voteCode="+encodeURIComponent(_a9));
};
Editing.ServerCastVote_Success=function(o){
};
Editing.ServerCastVote_Error=function(o){
alert("Error updating server.");
};
var StringBuilder=function(){
this.buffer=new Array();
};
StringBuilder.prototype.write=function(s){
this.buffer.push(s);
};
StringBuilder.prototype.toString=function(){
return this.buffer.join("");
};
var CommentUI={};
CommentUI.onDeleteClicked=function(_af){
if(confirm("Are you sure?")){
document.getElementById("comment_"+_af+"_action").value="delete";
document.getElementById("comment_"+_af+"_form").submit();
}
return false;
};
CommentUI.onEditClicked=function(_b0,_b1){
document.getElementById("comment_"+_b0+"_text_area_div").style.display="";
document.getElementById("comment_"+_b0+"_text_area").value=_b1;
document.getElementById("comment_"+_b0+"_action").value="edit";
return false;
};
CommentUI.onReplyClicked=function(_b2){
document.getElementById("comment_"+_b2+"_text_area_div").style.display="";
document.getElementById("comment_"+_b2+"_text_area").value="";
document.getElementById("comment_"+_b2+"_action").value="reply";
return false;
};
CommentUI.onCancelClicked=function(_b3){
document.getElementById("comment_"+_b3+"_text_area_div").style.display="none";
return false;
};
CommentUI.CastVote_Begin=function(_b4,_b5,_b6,_b7){
if(Page.loggedInUserName==""){
alert("Please sign up for a zooov.com account to vote.");
return;
}
var _b8=document.getElementById("c"+_b6);
var _b9=YAHOO.util.Dom.getElementsByClassName("voteDiv","div",_b8)[0];
var _ba=YAHOO.util.Dom.getElementsByClassName("points","span",_b8)[0];
if(!_b9||!_ba){
alert("Error with the HTML document. Please refresh the page.");
return;
}
_b9.innerHTML="<a href=\"#\" class=\"voted\" onclick=\"alert('Oops. You already voted for this comment.');return false;\"></a>";
var _bb=parseInt(_ba.innerHTML.split(" ")[0])+1;
_ba.innerHTML=_bb+" votes";
CommentUI.ServerCastVote_Begin(_b4,_b5,_b6,_b7);
return false;
};
CommentUI.ServerCastVote_Begin=function(_bc,_bd,_be,_bf){
var _c0={success:CommentUI.ServerCastVote_Success,failure:CommentUI.ServerCastVote_Error,argument:_be};
var _c1=YAHOO.util.Connect.asyncRequest("POST","/ws/CommunityComments.asmx/CastVote",_c0,"&communityID="+encodeURIComponent(_bc)+"&itemID="+encodeURIComponent(_bd)+"&commentID="+encodeURIComponent(_be)+"&voteCode="+encodeURIComponent(_bf));
};
CommentUI.ServerCastVote_Success=function(o){
};
CommentUI.ServerCastVote_Error=function(o){
alert("Error updating server.");
};
var SettingsUI={};
SettingsUI.EmailNotificationChange_Begin=function(_c4,_c5){
var _c6=document.getElementById("StatusDiv");
_c6.innerHTML="Updating preference..";
_c6.style.backgroundColor="red";
_c6.style.color="white";
_c6.style.display="";
SettingsUI.ServerEmailNotification_Begin(_c4,_c5);
return true;
};
SettingsUI.EmailNotificationChange_Success=function(_c7,_c8){
var _c9=document.getElementById("StatusDiv");
_c9.innerHTML="Preference updated";
_c9.style.backgroundColor="green";
_c9.style.display="";
setTimeout(SettingsUI.EmailNotificationChange_End,3000);
};
SettingsUI.EmailNotificationChange_Error=function(_ca,_cb){
SettingsUI.EmailNotificationChange_End();
alert("Error updating server.");
};
SettingsUI.EmailNotificationChange_End=function(_cc,_cd){
var _ce=document.getElementById("StatusDiv");
_ce.style.display="none";
};
SettingsUI.ServerEmailNotification_Begin=function(_cf,_d0){
var _d1={success:SettingsUI.EmailNotificationChange_Success,failure:SettingsUI.EmailNotificationChange_Error,argument:_cf};
var _d2=YAHOO.util.Connect.asyncRequest("POST","/ws/Settings.asmx/UpdateEmailNotification",_d1,"&communityID="+encodeURIComponent(_cf)+"&preference="+encodeURIComponent(_d0));
};
var Page={};
Page.Init=function(){
Page.itemStore=new Array();
YAHOO.util.Event.onDOMReady(Page.OnDomReady);
};
Page.OnDomReady=function(e){
Page.itemStore=new Array();
};
Page.Init();

