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.starfill=function(a,b){this.children(".star").slice(0,b).addClass(a).end();return this};jQuery.fn.stardrain=function(){this.children(".star").removeClass("star_yellow").removeClass("star_red").end();return this};jQuery.fn.rating=function(f,h,d,c,g,e){var b=jQuery(this);jQuery.extend(b,{ratings_canrate:h,ratings_curvalue:c,ratings_avg:g,ratings_url:"/ratings/rate/"+f+"/",ratings_hasrated:d,ratings_totalratings:e,ratings_rateeventname:"rate_"+f,ratings_canceleventname:"ratecancel_"+f,ratings_changeeventname:"rating_change_"+f,ratings_yellow_class:"star_yellow",ratings_red_class:"star_red",ratings_gray_class:"star_gray",ratings_rated_text:"rated",ratings_cancel_text:"cancel",ratings_rate_text:"rate"});b.view_stars=jQuery(b).children("#ratings_view");b.rate_stars=jQuery(b).children("#ratings_rate");b.rate_count=jQuery(b).children("#ratings_info").children("#ratings_count");b.rate_link=jQuery(b).children("#ratings_info").children("#ratings_link");if(!b.ratings_canrate){b.rate_link.hide()}else{var a=(b.ratings_hasrated)?b.ratings_rated_text:b.ratings_rate_text;b.rate_link.html(a);b.rate_link.click(function(j){j.preventDefault();if(b.rate_link.html()==b.ratings_cancel_text){var i=(b.ratings_hasrated)?b.ratings_rated_text:b.ratings_rate_text;b.rate_link.html(i);b.view_stars.show();b.rate_stars.hide()}else{b.rate_link.html(b.ratings_cancel_text);b.view_stars.hide();b.rate_stars.show()}})}if(b.ratings_totalratings>0){b.rate_count.html("("+b.ratings_totalratings+")")}b.view_stars.stardrain().starfill(b.ratings_yellow_class,b.ratings_avg);b.rate_stars.stardrain().starfill(b.ratings_red_class,b.ratings_curvalue);$(document).bind(b.ratings_changeeventname,function(i,j){if(b.ratings_hasrated){if(b.ratings_totalratings==1){b.ratings_avg=j}else{tmp=((b.ratings_avg*b.ratings_totalratings)-b.ratings_curvalue)/(b.ratings_totalratings-1);b.ratings_avg=(((tmp*(b.ratings_totalratings-1))+j)/b.ratings_totalratings)}}else{if(!b.ratings_totalratings){b.ratings_avg=j;b.ratings_totalratings=1}else{b.ratings_avg=((b.ratings_avg*b.ratings_totalratings)+j)/(b.ratings_totalratings+1);b.ratings_totalratings=b.ratings_totalratings+1}}b.ratings_hasrated=true;b.ratings_curvalue=j;b.rate_stars.stardrain().starfill(b.ratings_red_class,b.ratings_curvalue);b.view_stars.stardrain().starfill(b.ratings_yellow_class,b.ratings_avg);if(b.ratings_totalratings>0){b.rate_count.html("("+b.ratings_totalratings+")")}});if(b.ratings_canrate){b.rate_stars.children(".star").mouseover(function(){b.rate_stars.stardrain().starfill(b.ratings_red_class,b.rate_stars.children(".star").index(this)+1)}).mouseout(function(){b.rate_stars.stardrain().starfill(b.ratings_red_class,b.ratings_curvalue)}).click(function(j){j.preventDefault();if(b.ratings_curvalue==(b.rate_stars.children(".star").index(this)+1)){return false}var i=b.rate_stars.children(".star").index(this)+1;b.rate_link.html(b.ratings_rated_text);b.view_stars.show();b.rate_stars.hide();$(document).trigger(b.ratings_changeeventname,i);jQuery.get(b.ratings_url+i+"/");return false})}return this};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};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()}}}})}};
