var LANGUAGE_CODE="en";var LANGUAGE_BIDI=false;var catalog=new Array();function pluralidx(a){return(a==1)?0:1}function gettext(a){var b=catalog[a];if(typeof(b)=="undefined"){return a}else{return(typeof(b)=="string")?b:b[0]}}function ngettext(b,a,c){value=catalog[b];if(typeof(value)=="undefined"){return(c==1)?b:a}else{return value[pluralidx(c)]}}function gettext_noop(a){return a}function interpolate(b,c,a){if(a){return b.replace(/%\(\w+\)s/g,function(d){return String(c[d.slice(2,-2)])})}else{return b.replace(/%s/g,function(d){return String(c.shift())})}}window.hgettext=function(a){return gettext(a)};window.hngettext=function(b,a,c){return ngettext(b,a,c)};jQuery.fn.vote=function(c,b){var a=jQuery(this);jQuery.extend(a,{comment_id:c,current_vote:b});a.yes_link=jQuery(a).children("a").slice(0,1);a.no_link=jQuery(a).children("a").slice(1);a.yes_link.click(function(d){d.preventDefault();if(a.current_vote!=1){$.ajax({type:"GET",url:"/votes/vote/"+a.comment_id+"/up/",success:function(f){var e=JSON.parse(f);a.current_vote=1;a.yes_link.addClass("active").end();a.no_link.removeClass("active").end();$("#yes_count_"+a.comment_id).html(e.up_votes);$("#no_count_"+a.comment_id).html(e.down_votes)},error:function(e){if(e.status&&e.status>0){alert("having some technical difficulties, try back in a bit.")}}})}});a.no_link.click(function(d){d.preventDefault();if(a.current_vote!==0){$.ajax({type:"GET",url:"/votes/vote/"+a.comment_id+"/down/",success:function(f){var e=JSON.parse(f);a.current_vote=0;a.yes_link.removeClass("active").end();a.no_link.addClass("active").end();$("#yes_count_"+a.comment_id).html(e.up_votes);$("#no_count_"+a.comment_id).html(e.down_votes)},error:function(e){if(e.status&&e.status>0){alert("having some technical difficulties, try back in a bit.")}}})}});return this};function loadVotes(c){c=new String(c);if(isHighLoad()){c=c.split(",");for(var a=0;a<c.length;a++){var b=c[a];$("#votes_"+b).show();$("#votes_"+b).vote(b,false)}}else{$.ajax({type:"POST",url:"/votes/load_votes/",data:{comment_ids:c},success:function(k){c=c.split(",");var j=JSON.parse(k);for(var g=0;g<c.length;g++){var h=c[g];var e=(j[h].can_vote==1)?true:false;var f=(j[h].vote=="false")?false:j.vote;var d=j[h].up_votes;var l=j[h].down_votes;if(e){if(f===1){$("#yes_vote_"+h).addClass("active")}else{if(f===0){$("#no_vote_"+h).addClass("active")}}$("#yes_count_"+h).html(d);$("#no_count_"+h).html(l);$("#votes_"+h).show();$("#votes_"+h).vote(h,f)}}},error:function(d,g){if(d.status&&d.status>0){c=c.split(",");for(var e=0;e<c.length;e++){var f=c[e];$("#votes_"+f).show()}}}})}}function flag(a,b){$.ajax({type:"GET",url:"/flags/flag/"+a+"/"+b+"/",success:function(e){var d=JSON.parse(e);var c=(d.is_flagged=="1")?true:false;if(c){$("#flag_"+b).hide();$("#unflag_"+b).show()}else{$("#flag_"+b).show();$("#unflag_"+b).hide()}},error:function(c){if(c.status&&c.status>0){alert("having some technical difficulties, try back in a bit.")}}})}function loadFlags(b,c){c=new String(c);if(isHighLoad()){c=c.split(",");for(var a=0;a<c.length;a++){var d=c[a];$("#flag_"+d).show()}}else{$.ajax({type:"POST",url:"/flags/load_flags/"+b+"/",data:{object_ids:c},success:function(h){c=c.split(",");var g=JSON.parse(h);for(var e=0;e<c.length;e++){var j=c[e];var f=(g[j].is_flagged=="1")?true:false;if(f){$("#unflag_"+j).show()}else{$("#flag_"+j).show()}}},error:function(e,h){if(e.status&&e.status>0){c=c.split(",");for(var f=0;f<c.length;f++){var g=c[f];$("#flag_"+g).show()}}}})}}jQuery.fn.content_save=function(c,b){var a=jQuery(this);jQuery.extend(a,{content_id:c,is_saved:b,saved_event_name:"content_saved_"+c,unsaved_event_name:"content_unsaved_"+c,saved_text:"unsave",unsaved_text:"save"});var d=(a.is_saved)?a.saved_text:a.unsaved_text;a.html(d);$(document).bind(a.saved_event_name,function(f){a.is_saved=true;a.html(a.saved_text)});$(document).bind(a.unsaved_event_name,function(f){a.is_saved=false;a.html(a.unsaved_text)});a.click(function(g){g.preventDefault();var f=(a.is_saved)?"/saved_content/unsave/"+a.content_id+"/":"/saved_content/save/"+a.content_id+"/";var e=(a.is_saved)?a.unsaved_event_name:a.saved_event_name;$.ajax({type:"GET",url:f,success:function(h){$(document).trigger(e)},error:function(h){if(h.status&&h.status>0){alert("Sorry, we're having some difficulties right now, please try back later")}}});$("#banner-tools-toggle").addClass("emptyElement")});return this};
