tagged.namespace("modules.pagination");tagged.modules.pagination={linkHtml:' <a href="#" class="%s" page="%2$d">%3$s</a> ',spanText:' <span class="%s">%s</span> ',renderDirectionLinks:function(f,g,a,i,d,h){h=(typeof h==="undefined")?"l":h;var e=Math.floor(a/g)+1;var c=Math.ceil(f/g);if(c<=1){return}var b="";if(h=="l"){b+=this.dirHelper(1,this.msgs.first,e!=1,"outer")}b+=this.dirHelper(e-1,this.msgs.previous,e>1,"inner")+" | "+this.dirHelper(e+1,this.msgs.next,e!=c,"inner");if(h=="l"){b+=this.dirHelper(c,this.msgs.last,e!=c,"outer")}d=D.get(d);if(d){d.innerHTML=b;if(!d.getAttribute("page_action")){d.setAttribute("page_action",true);YAHOO.util.Event.addListener(d,"click",this.getNavigationHandler(i))}}},dirHelper:function(c,d,b,a){if(b){return sprintf(this.linkHtml,a,c,d)}else{return sprintf(this.spanText,a,d)}},getNavigationHandler:function(b){var a=function(c){var e=E.getTarget(c);if(e.tagName.toUpperCase()!="A"){e=e.parentNode}if(e.tagName.toUpperCase()=="A"){var d=e.getAttribute("page");if(d){E.preventDefault(c);if(typeof(b)=="function"){b(d)}else{YAHOO.util.History.navigate("pageNum",d)}}}};return a},renderPageNumbers:function(g,i,c,j,e){var f=Math.floor(c/i)+1;var d=Math.ceil(g/i);var b='<a href="#%1$d" page="%1$d">%1$d</a> ';var h='<a href="#%1$d" page="%1$d">%2$s</a> ';var a=new tagged.util.stringBuffer();a.add(this.numberHelper(f-1,h,1,d,this.msgs.prev),this.numberHelper(f-2,b,1,d,""),this.numberHelper(f-1,b,1,d,""),sprintf(this.spanText,"page_current",f),this.numberHelper(f+1,b,1,d,""),this.numberHelper(f+2,b,1,d,""),this.numberHelper(f+1,h,1,d,this.msgs.next));e=D.get(e);if(e){e.innerHTML=a;if(!e.getAttribute("tag_action")){e.setAttribute("tag_action",true);YAHOO.util.Event.addListener(e,"click",this.getNavigationHandler(j))}}},numberHelper:function(c,d,b,a,e){if(c<b){return""}if(c>a){return""}return sprintf(d,c,e)},boundsCheck:function(b,a){if(b<0){return false}if(a>0&&b>=a){return false}return true},offset:function(b,a){return a*(b-1)},sanePageNum:function(c,b,a){c=parseInt(c);if(isNaN(c)){return 1}if(!this.boundsCheck(this.offset(c,b),a)){return 1}return c}};TAGGED.namespace("util.notification");TAGGED.util.notification={showNotification:function(d,g,c,a,e){if(D.get(g+"_feedback")){this.hideNotification(g+"_feedback")}var f=D.get(g)||D.get("inner_container");var b=document.createElement("div");b.className="feedback "+c;b.id=g+"_feedback";b.innerHTML=d;if(a=="bottom"||f.childNodes.length==0){f.appendChild(b)}else{if(a=="top"){f.insertBefore(b,f.childNodes[0])}}if(e>0){if(e>300){setTimeout(function(){var h=new YAHOO.util.Anim(b,{opacity:{from:1,to:0}},0.3,YAHOO.util.Easing.easeOut);h.onComplete.subscribe(function(){f.removeChild(b)});h.animate()},e-300)}else{setTimeout(function(){f.removeChild(b)},e)}}},hideNotification:function(b){var a=D.get(b);if(a){a.parentNode.removeChild(a)}}};tagged.util.notificationClass=function(d,c){this._initEvents();this.cfg=new YAHOO.util.Config(this);this._initDefaultConfig();if(c){this.cfg.applyConfig(c,true)}if(YAHOO.lang.isString(d)){var b=d;d=D.get(d);if(d==null){d=(this._createTemplate()).cloneNode(false);d.id=b;var a=D.get(this.cfg.config.container.value);if(this.cfg.config.position.value=="bottom"||a.childNodes.length==0){a.appendChild(d)}else{if(this.cfg.config.position.value=="top"){a.insertBefore(d,a.childNodes[0])}}}}this.el=d;this.onInit.fire()};tagged.util.notificationClass.prototype={DEFAULT_CONFIG:{POSITION:{key:"position",value:"top"},CONTAINER:{key:"container",value:document.body}},CSS_NOTIFICATION:"feedback",_template:null,_createTemplate:function(){if(!this._template){this._template=document.createElement("div");D.addClass(this._template,this.CSS_NOTIFICATION+" hide_me")}return this._template},fadeTimeout:300,_initEvents:function(){this.onInit=new YAHOO.util.CustomEvent("init");this.onShow=new YAHOO.util.CustomEvent("show");this.onHide=new YAHOO.util.CustomEvent("hide")},_initDefaultConfig:function(){this.cfg.addProperty(this.DEFAULT_CONFIG.POSITION.key,{value:this.DEFAULT_CONFIG.POSITION.value});this.cfg.addProperty(this.DEFAULT_CONFIG.CONTAINER.key,{value:this.DEFAULT_CONFIG.CONTAINER.value})},show:function(b,a,c){if(isNaN(c)){c=this.fadeTimeout}a=a||this.cfg.config.css.value;this.el.className=this.CSS_NOTIFICATION+" "+a;this.el.innerHTML=b;D.removeClass(this.el,"hide_me");if(c>300){YAHOO.util.Lang.later(c-300,this,function(){var d=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0}},0.3,YAHOO.util.Easing.easeOut);d.onComplete.subscribe(this.hide,null,this);d.animate()})}else{if(c){YAHOO.util.Lang.later(c,this,this.hide)}}this.onShow.fire()},hide:function(){D.addClass(this.el,"hide_me");D.setStyle(this.el,"opacity",1);this.onHide.fire()}};tagged.namespace("comments.report");tagged.comments.report={lastCommentId:"",lastReporUid:"",userCommentIds:[],handleReport:function(d,c){E.preventDefault(d);var b=c.getAttribute("cid");var f=c.getAttribute("from_uid");var a=c.getAttribute("to_uid");if(b&&f&&a){tagged.comments.report.reportComment(f,b,a);tagged.comments.report.lastCommentId=b;tagged.comments.report.lastReporUid=f;tagged.comments.report.addCommentId(f,b)}},reportComment:function(d,c,a){var b={method:"tagged.comments.report",owner_id:a,uid_to_report:d,comment_id:c,callback:"tagged.comments.report.renderFeedback"};TAGGED.api.call(b)},renderFeedback:function(g){if(g.stat=="ok"){tagged.ads.reload();var d=g.result;var c=d.comment_id;var b=d.uid_to_report;var f=d.is_primary;var a=d.name;var h="comment_"+c;var e=new tagged.util.stringBuffer();e.add(sprintf('<img src="%s/im/icons/x_grey.gif" class="icon_close" alt="%s" id="%s_feedback_close"  onclick="tagged.comments.report.handleCloseFeedback(event);"/>',tagged.static_uri,this.msgs.close,h));e.add(this.msgs.reportFeedback);if(f){e.add(sprintf('<a href="#" onclick="return tagged.comments.report.blockUser(%s);">%s</a>',b,sprintf(this.msgs.blockUser,a)))}TAGGED.util.notification.showNotification(e.toString(),h,"success","top")}},handleCloseFeedback:function(a){E.preventDefault(a);var c=E.getTarget(a);if(c){var b=c.id;TAGGED.util.notification.hideNotification(b.substr(0,b.indexOf("_close")))}},bindLinks:function(a){var c=D.getElementsByClassName("report","a",a);for(var b=0;b<c.length;++b){if(!c[b].getAttribute("report_action")){E.addListener(c[b],"click",tagged.comments.report.handleReport,c[b]);c[b].setAttribute("report_action",1)}}},addCommentId:function(b,a){if(!this.userCommentIds[b]){this.userCommentIds[b]=[]}this.userCommentIds[b].push(a)},blockUser:function(a){if(a){var b={method:"tagged.usermgmt.blockUser",uid_to_block:a,callback:"tagged.comments.report.userBlocked"};TAGGED.api.call(b)}return false},userBlocked:function(g){tagged.ads.reload();if(g.stat=="ok"){var d=g.results;if(d.uid&&this.userCommentIds[d.uid]){var f=sprintf(this.msgs.blockConfirmation,d.name);var e=this.userCommentIds[d.uid];for(var c=0;c<e.length;++c){var b=e[c];var h="comment_"+b;var a=D.get(h);if(a){TAGGED.util.notification.showNotification(f,h,"success","top",10000)}}}}}};tagged.namespace("util.dateHandler");tagged.util.dateHandler={dateObjects:[],findAndBind:function(b,c){if(b){var d=D.getElementsByClassName("tag_ts","span",b)}else{var d=D.getElementsByClassName("tag_ts","span")}for(var a in d){var e=d[a];if(e._inited){continue}YAHOO.lang.augmentObject(e,this.dateBinderClass,true);e.init(c);this.dateObjects.push(e)}},updateAll:function(){for(var a in this.dateObjects){this.dateObjects[a].update()}},getRelativeDate:function(b,c,e){var f=new Date();if(isNaN(c)){c=31557600}var a=(f.getTime()-b.getTime())/1000;if(c==0){return this.getLocalDate(b)}if(c<0){return this.computeRelative(a)}if(e&&a>e){a=e}if(c&&(a<c)){return this.computeRelative(a)}else{return this.getLocalDate(b)}},computeRelative:function(c){if(c<5){return this.stringMoments}else{if(c<30){return this.stringHalfMinute}else{if(c<60){return this.stringLessMinute}else{if(c<3600){var f=Math.round(c/60);if(f<=1){return this.stringMinute}else{return sprintf(this.stringMinutes,f)}}else{if(c<86400){var e=Math.round(c/3600);if(e<=1){return this.stringHour}else{return sprintf(this.stringHours,e)}}else{if(c<2629800){var b=Math.round(c/86400);if(b<=1){return this.stringDay}else{return sprintf(this.stringDays,b)}}else{if(c<31557600){var d=Math.round(c/2629800);if(d<=1){return this.stringMonth}else{return sprintf(this.stringMonths,d)}}else{var a=Math.round(c/3155760);if(a<=1){return this.stringYear}else{return sprintf(this.stringYears,a)}}}}}}}}},getLocalDate:function(a){return a.toLocaleString()},dateBinderClass:{init:function(a){if(this._inited){return}if(this.getAttribute("utc")){this._selfDate=new Date;this._selfDate.setTime(this.getAttribute("utc")*1000)}else{this._selfDate=new Date(this.innerHTML)}this.maxRelativeDate=0;if(this.getAttribute("max_relative_date")){this.maxRelativeDate=this.getAttribute("max_relative_date")}if(this.getAttribute("relative")){switch(this.getAttribute("relative")){case"true":case"1":case"on":case"relative":this._isRelative=true;break;default:this._isRelative=false}}else{this._isRelative=true}this._inited=false;if(a){this.update()}},update:function(){if(!this._inited){this.init()}var a=tagged.util.dateHandler.getLocalDate(this._selfDate);if(this._isRelative){this.innerHTML=tagged.util.dateHandler.getRelativeDate(this._selfDate,"relative",this.maxRelativeDate)}else{this.innerHTML=a}if(!this.getAttribute("no_title")){this.setAttribute("title",a)}D.removeClass(this,"hidden")}}};tagged.namespace("comments.page");tagged.comments.page={thumbHtml:'<a href="%s" class="user_photo"><img src="%s"></a>',presenseIconHtml:'<img src="%s/im/im/icon_presence_green_small2.png" height="11" width="11" class="png presence"/>',linkHtml:'<a href="%s" id="%s">%s</a>',userNameLink:'<a href="%s" class="user_name">%s</a>',commentBodyHtml:'<div class="comment_body">%s<div class="comment_widget_content">%s</div>%s</div>',listItemHtml:'<li class="%s"><a href="%s">%s</a></li>',timestampHtml:'<p><span class="timestamp" title="%s">%s</span></p>',delLink:'<li class="%s"><a href="#" cid="%s" class="delete">%s</a></li>',commentOpenDiv:'<div id="comment_%s" class="comment">',bottomMenu:'<ul class="comment_actions"><li class="first"><a href="%s">%s</a></li><li><a href="%s">%s</a></li></ul>',comments:[],numPerPage:20,pageCount:0,viewerId:0,curPage:-1,comments:[],pageHandler:null,init:function(c){this.pageHandler=c;this.data=tagged.data.comments;this.viewerId=this.data.viewerId;this.commentsContent=D.get("comments_content");var d=YAHOO.util.History.getBookmarkedState("pageNum");var b=YAHOO.util.History.getQueryStringParameter("pageNum");var a=d||b||this.data.pageNum||"1";YAHOO.util.History.register("pageNum",a,function(e){tagged.comments.page.loadPage(e)});YAHOO.util.History.onReady(function(){tagged.comments.page.loadPage(a)});YAHOO.util.History.initialize("yui-history-field","yui-history-iframe")},loadPage:function(a){if(a>0){a-=1}else{a=0}if(a==this.curPage){return}this.curPage=a;this.pageHandler.fetchComments(this.curPage)},handleFetchResponse:function(a){tagged.ads.reload();window.scrollTo(0,0);if(!a){alert(this.msgs.fetchError);return}if(a.error){if(this.msgs.errors[a.error.code]){alert(this.msgs.errors[a.error.code])}else{alert(this.msgs.fetchError)}return}if(a.result&&a.result.data){this.pageCount=a.result.data.length;this.total=a.result.total;this.comments=a.result.data;this.pageHandler.renderComments(this.comments);tagged.comments.report.bindLinks("comments_content")}},getComment:function(b){for(var a in this.comments){if(this.comments[a]&&this.comments[a].commentId==b){return this.comments[a]}}return null},handleDeleteComment:function(c,b){YAHOO.util.Event.preventDefault(c);if(confirm(tagged.comments.page.msgs.deleteConfirm)){var a=b.getAttribute("cid");tagged.comments.page.deleteComment(a)}},deleteComment:function(b){var g=D.get("comment_"+b);if(!g){return}var c=this.getComment(b);if(!c){return}var a=c.ownerId;var e=function(){D.get("comments_content").removeChild(g)};var d=new YAHOO.util.Anim(g,{opacity:{to:0}},0.4);d.onComplete.subscribe(e);d.animate();var f={method:"tagged.comments.delete",comment_id:b,user_id:a,callback:"tagged.comments.page.commentDeleted"};TAGGED.api.call(f);if(this.total>0){this.total--}if(this.pageCount>0){this.pageCount--}},commentDeleted:function(a){tagged.ads.reload();if(a.stat!="ok"){alert(this.msgs.deleteError)}else{tagged.comments.page.updateCommentCount()}},updateCommentCount:function(){var c=D.get("navigate_top");var b=D.get("navigate_bottom");var d=this.renderCommentIndex();var a=Math.ceil(this.total/this.numPerPage);if(c){D.get("index_top").innerHTML=d;if(a>1){tagged.modules.pagination.renderDirectionLinks(this.total,this.numPerPage,this.curPage*this.numPerPage,null,"links_top")}}if(this.total==0||this.pageCount==0){D.addClass(b,"hide_me")}else{if(b){D.removeClass(b,"hide_me");D.get("index_bottom").innerHTML=d;if(a>1){tagged.modules.pagination.renderDirectionLinks(this.total,this.numPerPage,this.curPage*this.numPerPage,null,"links_bottom")}}}},bindDelLinks:function(){var c=D.getElementsByClassName("delete","a","comments_content");for(var a=0;a<c.length;a++){var b=c[a];E.addListener(b,"click",tagged.comments.page.handleDeleteComment,b)}},renderCommentIndex:function(c,b,a){if(this.total==0){return this.msgs.noComments}else{if(this.total==1){return this.msgs.oneComment}}return sprintf(this.msgs.commentsIndex,this.curPage*this.numPerPage+1,this.curPage*this.numPerPage+this.pageCount,this.total)},renderComment:function(g,c){var b=new tagged.util.stringBuffer();var e="/profile.html?uid="+g.senderId;b.add(sprintf(this.commentOpenDiv,g.commentId));b.add(sprintf(this.thumbHtml,e,g.thumb));if(g.onlineStatus==3){b.add(sprintf(this.presenseIconHtml,tagged.static_uri))}b.add(sprintf(this.userNameLink,e,g.displayName));var a=new Date();a.setTime(g.datePosted*1000);b.add(sprintf(this.timestampHtml,tagged.util.dateHandler.getLocalDate(a),tagged.util.dateHandler.getRelativeDate(a,"relative")));b.add('<ul class="comment_actions">');var f=false;if(this.viewerId!=g.senderId){b.add(sprintf(this.listItemHtml,"first","messages.html?action=compose&rid="+g.senderId,this.msgs.messageMe));f=true}if(g.ownerId!=g.senderId&&(!c||!c.isOneToOne)){b.add(sprintf(this.listItemHtml,f?"":"first","onetoone.html?uida="+g.ownerId+"&uidb="+g.senderId,this.msgs.viewOneToOne));f=true}if(this.viewerId!=g.senderId){b.add(sprintf('<li><a href="#" class="report" to_uid="%1$s" from_uid="%2$s" cid="%3$s" id="report_%3$s" >%4$s</a></li>',g.ownerId,g.senderId,g.commentId,this.msgs.report))}if(this.viewerId==g.senderId||this.viewerId==g.ownerId){b.add(sprintf(this.delLink,f?"":"first",g.commentId,this.msgs.deleteLabel))}b.add("</ul>");var d=sprintf(this.bottomMenu,"post_comment.html?tarId="+g.senderId,this.msgs.reply,"post_comment.html?parentPropId="+g.commentId+"&ownerId="+g.ownerId,this.msgs.forward);b.add(sprintf(this.commentBodyHtml,g.commentText,g.widgetContent,d));b.add("</div>");return b.toString()}};tagged.namespace("comments.view");tagged.comments.view={init:function(){this.data=tagged.data.comments;this.pageUid=this.data.pageUid;this.commentsContent=D.get("comments_content");this.numPerPage=this.data.numPerPage;tagged.comments.page.init(tagged.comments.view)},fetchComments:function(b){var a={method:"tagged.comments.get",user_id:this.pageUid,offset:b*this.numPerPage,count:this.numPerPage,callback:"tagged.comments.page.handleFetchResponse"};TAGGED.api.call(a)},renderComments:function(d){var b=new tagged.util.stringBuffer();var a={};if(d.length>0){for(var c=0;c<d.length;++c){b.add(tagged.comments.page.renderComment(d[c],a))}}this.commentsContent.innerHTML=b.toString();tagged.comments.page.updateCommentCount();window.setTimeout(tagged.comments.page.bindDelLinks,1)}};E.onDOMReady(function(){tagged.comments.view.init()});tagged.loadStringsDirect({"tagged.modules.pagination.msgs":{first:"&lt;&lt; First",previous:"&lt; Previous",next:"Next &gt;",last:"Last &gt;&gt;",prev:"&lt; Previous"}});tagged.loadStringsDirect({"tagged.strings":{genericError:"Sorry, an error occurred. Please refresh the page and try again :(",locales:{ar_SA:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",az_AZ:"Az\u0259rbaycan",bn_IN:"\u09ac\u09be\u0982\u09b2\u09be",my_MM:"Burmese",zh_CN:"\u4e2d\u6587 - \u7b80\u5355",zh_TW:"\u4e2d\u6587 - \u50b3\u7d71",cs_CZ:"\u010ce\u0161tina",nl_NL:"Nederlands",en_US:"English",fr_FR:"Fran\u00e7ais",de_DE:"Deutsch",el_GR:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",hi_IN:"\u0939\u093f\u0928\u094d\u0926\u0940",he_IL:"\u05e2\u05d1\u05e8\u05d9\u05ea",hu_HU:"Magyar",id_ID:"Indonesia",it_IT:"Italiano",ja_JP:"\u65e5\u672c\u8a9e",jv_ID:"basa Jawa",ko_KR:"\ud55c\uad6d\uc5b4",ms_MY:"Bahasa Melayu",mr_IN:"\u092e\u0930\u093e\u0920\u0940",ne_NP:"\u0928\u0947\u092a\u093e\u0932\u0940",fa_IR:"\u0641\u0627\u0631\u0633\u06cc",pl_PL:"Polska",pt_PT:"Portugu\u00eas",pa_IN:"\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40",ro_RO:"Rom\u00e2n",ru_RU:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",es_ES:"Espa\u00f1ol - Spain",es_MX:"Espa\u00f1ol - Mexico",es_CO:"Espa\u00f1ol - Latin America",su_ID:"Basa Sunda",tl_PH:"Tagalog",ta_IN:"\u0ba4\u0bae\u0bbf\u0bb4\u0bcd",te_IN:"\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41",th_TH:"\u0e44\u0e17\u0e22",tr_TR:"T\u00fcrk\u00e7e",uk_UA:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur_PK:"Urdu",vi_VN:"Vi\u1ec7t",ruf_US:"Fake \u0420\u0443\u0441\u0441\u043a\u0438\u0439",ebo_US:"Ebonics",zxx_XX:"XXX XXXX"}}});tagged.loadStringsDirect({"TAGGED.api.strings":{errorMethodMissing:"An error occurred. Please refresh the page and try again. Method is missing.",errorGeneral:"An error occurred. Please refresh the page and try again."}});tagged.loadStringsDirect({"tagged.comments.report.msgs":{reportFeedback:"Report filed to Tagged Safety. ",close:"Close",blockUser:"Block %s",blockConfirmation:"%s is blocked from contacting you."}});tagged.loadStringsDirect({"tagged.util.dateHandler":{stringMoments:"moments ago",stringHalfMinute:"half a minute ago",stringLessMinute:"less than a minute ago",stringMinute:"a minute ago",stringMinutes:"%d minutes ago",stringHour:"an hour ago",stringHours:"%d hours ago",stringDay:"a day ago",stringDays:"%d days ago",stringMonth:"a month ago",stringMonths:"%d months ago",stringYear:"a year ago",stringYears:"%d years ago"}});tagged.loadStringsDirect({"tagged.comments.page.msgs":{commentMe:"Comment Me",messageMe:"Message Me",repost:"Re-Post",viewOneToOne:"View 1-to-1",report:"Report",deleteLabel:"Delete",commentsIndex:"Comments %d-%d of %d",oneComment:"1 Comment",noComments:"No comments",postComment:"Post a Comment",reply:"Reply",forward:"Forward",fetchError:"An error occurred while getting the comments.  Please refresh the page to try again.",errors:{"503":"You don't have permission to view the comments"},deleteConfirm:"Are you sure you want to delete this comment?",deleteError:"Sorry, there was an error deleting the comment. Please reload the page and try again"}});tagged.loadStringsDirect({"tagged.header.alerts.strings":{newAlerts:"New Alerts"}});