function seeMoreOnComment(a){a=$(a).parent("span");a.hide();a.next("span").css("display","inline")}function seeLessOnComment(a){a=$(a).parent("span").parent("span");a.prev().css("display","inline");a.hide()}(function(a){a.fn.focusNextField=function(){return this.each(function(){var b=a(this).parents("form:eq(0),body").find("a,button,input,textarea,select"),f=b.index(this);f>-1&&f+1<b.length&&b.eq(f+1).focus();return false})}})(jQuery);
(function(a){a.fn.extend({TextTip:function(b){b=a.extend({idle_class:"formfield-quiet",focus_class:"formfield-current",data_class:"formfield-filled",cleanEvents:false},b);return this.each(function(){function f(){var h="";if(a.trim(c.val())==""||c.val()==e){c.val(e);h=d.idle_class}else h=d.data_class!=""?d.data_class:d.idle_class;c.removeClass(d.focus_class).addClass(h)}var d=b,c=a(this),e=c.attr("title")?c.attr("title"):"";if(typeof this.placeholder!="undefined"){this.placeholder=e;c.val()==e&&c.val("");
c.removeClass("formfield-quiet");return c}d.cleanEvents&&c.unbind();c.focus(function(){c.removeClass(d.idle_class).removeClass(d.data_class).addClass(d.focus_class);this.value==e?c.val(""):this.select()});c.blur(function(){f()});c.keyup(function(h){h.keyCode==27&&c.focus()});if(c.val()==""||c.val()==e)c.blur()})},cleanTextTip:function(){return this.each(function(){a(this).submit(function(){a("input:text, textarea",this).each(function(){a(this).val()==a(this).attr("title")&&a(this).val("")});return true})})},
TextTipForm:function(){return this.each(function(){a("input:text, textarea",this).each(function(){a(this).TextTip()});a(this).submit(function(){a("input:text, textarea",this).each(function(){var b=a(this);b.val()==b.attr("title")&&b.val("")});return true})})}})})(jQuery);
(function(a){a.fn.extend({cleanTxt:function(){return this.each(function(){if(this.type!="textarea")return false;var b=a(this);a("#elastic_"+b.attr("id")).html("");b.val("");b.css({height:"",overflow:"hidden"}).blur()})},elastic:function(b){b=a.extend({updateOnFocus:false},b);var f=["paddingTop","paddingRight","paddingBottom","paddingLeft","fontSize","lineHeight","fontFamily","width","fontWeight"];return this.each(function(){function d(k,m){curratedHeight=Math.floor(parseInt(k,10));e.height()!=curratedHeight&&
e.css({height:curratedHeight+"px",overflow:m})}function c(){var k=e.val().replace(/<|>/g," ").replace(/\n/g,"<br />").replace(/&/g,"&amp;"),m=h.html();if(k+"&nbsp;"!=m){h.html(k+"&nbsp;");if(Math.abs(h.height()+g-e.height())>3){k=h.height()+g;if(k>=i)d(i,"auto");else k<=j?d(j,"hidden"):d(k,"hidden")}}}if(this.type!="textarea")return false;var e=a(this);e.attr("id")||e.attr("id","elastic_"+Math.floor(Math.random()*9999+1));var h=a('<div id="elastic_'+e.attr("id")+'" />').css({position:"absolute",display:"none"}),
g=parseInt(e.css("lineHeight"),10)||parseInt(e.css("fontSize"),"10"),j=parseInt(e.css("height"),10)||g*3,i=parseInt(e.css("max-height"),10)||g*25,l=0;h.appendTo(e.parent());for(l=f.length;l--;)h.css(f[l].toString(),e.css(f[l].toString()));var n=false,o=0;e.bind("blur",function(){n=false;clearTimeout(e.timer);if(!e.val().length){h.html("");e.val("")}if(!e.val().length||e.val()===e.attr("title")){e.css({height:"",overflow:"hidden"});return false}else c()});e.bind("change",function(){n||c()});e.bind("focus",
function(){n=true;o=(new Date).getTime();b.updateOnFocus&&c()});e.css({overflow:"hidden"});e.keyup(function(k){e.e=k.keyCode;if(k.keyCode!=13){k=(new Date).getTime();if(k-o>200){o=k;c()}}else c()});e.scroll(function(){e.timer=setTimeout(c,250)})})}})})(jQuery);
(function(a){a.fn.extend({sonicoTabs:function(b){var f={type:"html",error:function(){i.removeClass("st-loading").removeClass("st-loaded").html('<div class="box-msg box-error"><div class="error" >'+sonico.translate._("Ops! Internet no es perfecto, intenta de nuevo.")+"</div></div>")},response:function(l){i.html(l).addClass("st-loaded")}},d=a.extend({tabs:"ul.nav-filter a",selected:"current",tabcontainer:"li",containerSelector:" > div",loadContents:{}},b),c=a(this),e=a(d.containerSelector,this),h=a(d.tabs,
this).filter(":first"),g=String(window.location).split("#")[1],j,i;if(g){g="#"+g;a(d.tabs,this).each(function(){if(this.hash==g)h=this})}h&&setTimeout(function(){a(h).click()},120);return a(this).each(function(){a(d.tabs,c).click(function(){j=this.hash.substr(1);i=e.filter(this.hash);if(!i.hasClass("st-loading")&&!i.hasClass("st-loaded")&&d.loadContents[j]){i.addClass("st-loading");var l=a.extend(f,d.loadContents[j]);sajax(l)}e.hide();i.show();a(d.tabs,c).removeClass(d.selected).parent(d.tabcontainer).removeClass(d.selected);
a(this).addClass(d.selected).parent(d.tabcontainer).addClass(d.selected);return false})})}})})(jQuery);function tpl_replace(a,b,f,d){a=$(a).html();for(var c in b)a=a.replace(new RegExp("##"+c+"##","g"),b[c]);if(f&&($target=$(f))&&" append prepend html replace ".indexOf(d)&&typeof $target[d]=="function")$target[d](a);else return a}
function activateSuggestionSidebar(a){$(window).load(function(){$("#sb_sug_wdd").click(function(b){SWSuggestion.ignore(document.getElementById("sb_sug_ws"))});$("#sb_sug_ws").click(function(b){SWSuggestion.accept(b.target)})})}
var _isT_=Math.random()*1E4%100<10,SWSuggestion={accept:function(a){var b={u:a.getAttribute("su"),sb:true};if(a.getAttribute("st")==1){_isT_&&analyticsTrackEvent("Invites","Accept","Sidebar",1);b.af=true}else if(a.getAttribute("st")==2){_isT_&&analyticsTrackEvent("Suggestions","Accept","Sidebar",1);b["if"]=true}return this.run(b)},ignore:function(a){var b={u:a.getAttribute("su"),sb:true};if(a.getAttribute("st")==1){_isT_&&analyticsTrackEvent("Invites","Ignore","Sidebar",1);b.af=false}else if(a.getAttribute("st")==
2){_isT_&&analyticsTrackEvent("Suggestions","Ignore","Sidebar",1);b["if"]=false}return this.run(b)},run:function(a){a={action:"CrudContacts",response:function(b){if(b.res.p){var f=b.res.t==1?"profile.php":"prof_notallow.php";$("#sb_sug_wp").attr("href",sonico_url+f+"?ref=sidesugg&u="+b.res.u);$("img","#sb_sug_wp").attr("src",b.res.p);$("#sb_sug_ws").attr("su",b.res.u);$("#sb_sug_ws").attr("st",b.res.t);$("span","#sb_sug_wp").html(b.res.n);$("#sb_sug_w").fadeIn()}else $("#sb_sug_w").remove()},error:function(){},
data:a};$("#sb_sug_w").fadeOut();sajax(a);return false}},SWPoke={accept:function(a){return this.run("Accept",a)},ignore:function(a){return this.run("Ignore",a)},run:function(a,b){_isT_&&analyticsTrackEvent(b.ac,a,b.as);$(".PokeContent, .PokeLoader","#sw_poke").toggleClass("collapse");sajax({action:"PokeAction",actionMethod:a,type:"html",data:b,error:function(){},response:function(f){$("#sw_poke").replaceWith(f)}});return false}},SWNotification={confirm:function(a){_isT_&&analyticsTrackEvent(a.nc,
"Accept",a.ns);return this.run("Confirm",a)},ignore:function(a){_isT_&&analyticsTrackEvent(a.nc,"Ignore",a.ns);return this.run("Ignore",a)},run:function(a,b){$("#sw_pn").fadeOut();sajax({action:"NotificationAction",actionMethod:a,type:"html",data:b,error:function(){},response:function(f){$("#sw_pn").replaceWith(f)}});return false}},FollowUpBox={init:function(){var a=$(".s-followUp");typeof a.attr("id")!="undefined"&&$(".fub-prev a, .fub-next a",a).unbind("click").click(this.getNext)},getNext:function(a){var b=
$(a).closest(".s-followUp");a=false;if(b.length==0)b=$(this).closest(".s-followUp");else a=true;var f=b.attr("id"),d=b.attr("position"),c=$(this).parent().hasClass("link-prev")?"prev":"next";$(".s-FollowUpContent, .s-FollowUpLoading",b).toggleClass("collapse");sajax({action:"FollowUpAction",actionMethod:"LoadNextBox",type:"html",data:{currFollowUp:f,direction:c,position:d},error:function(){},response:function(e){b.replaceWith(e);FollowUpBox.init()}});a&&_isT_&&analyticsTrackEvent("FollowUpBox","NotNow",
f);return false},processBoxData:function(a,b){var f=$(a).closest(".s-followUp"),d=f.attr("id");$(this).hasClass("link-prev");b.currFollowUp=d;sajax({action:"FollowUpAction",actionMethod:"ProcessBoxData",data:b,error:function(){},response:function(c){if(c.error){$(".box-error",f).html(c.msg).removeClass("collapse");setTimeout(function(){$(".box-error",f).addClass("collapse").html("")},3E3)}else{$(".s-FollowUpToggle",f).toggleClass("collapse");_isT_&&analyticsTrackEvent("FollowUpBox","Accept",d)}}});
return false}};typeof __initializeFollowUpBox!="undefined"&&FollowUpBox.init();var sonico=sonico||{},_mustache=_mustache||[];
sonico.notifications={_container_tpl:'<div id=dropAlerts style=display:none;><div class=notiItemsWrap>{{#events}}{{>event}}{{/events}}</div><div id=notiEmpty class="block space1t spaceb spacel">'+_("No tienes ninguna alerta en este momento")+'</div><a class="boxLnk lnkWhite block txt-center bold" href="/alerts_viewer.php" id=m1-all url="/alerts_viewer.php">[[ALERT]]...</a></div>',_row_tpl:'<div class="notiItem itemThumb30px underline{{#unread}} notiItemNew{{/unread}}" data-type={{type}} url="{{link}}" ><a class=thumbWrap ><img height=30 width=30 src="{{owner_pic}}"></a><div class=txtWrap>{{{msg}}}<div class="spacet note"><b class="icon {{icon}}"></b> {{when}}</div></div></div>',
binded:false,init:function(){if(!(typeof _notifications_enabled==="undefined"||!_notifications_enabled)){var a=sonico.notifications;a.$m=$("#toggleAlerts");a.name="Alert Tab";a.title=a.$d.attr("title");if(a.title.indexOf("Sonico (")==0)a.title="Sonico";a.getPersistedData();a.timer=setInterval(a.getData,24E4)}},$d:$(document),title:"",upTitle:function(a){var b=sonico.notifications;a=a?b.title:"Sonico ("+b.data.total+")"+b.title.replace("Sonico","");b.$d.attr("title",a)},render:function(a){var b=sonico.notifications;
if(!$("#dropAlerts:visible").length){$("#dropAlerts").remove();b.$m.append(a);b.$layer=$("#dropAlerts");if(b.data.total>0){$("#nov-total").html(b.data.total).show().parent().addClass("lnkTabCta");b.upTitle(0)}else $("#nov-total").html("").hide().parent().removeClass("lnkTabCta");$("div.notiItem",b.$layer).length>0?$("#notiEmpty").hide():$("#notiEmpty").show();b.$m.show();if(!b.binded){b.binded=1;b.$m.click(b.toggleMenu)}$("#m1-all").click(function(){b.isTrackable&&analyticsTrackEvent(b.name,"Ver Todas");
self.location=$(this).attr("url");return true});$("div.notiItem",b.$layer).click(function(){b.isTrackable&&analyticsTrackEvent(b.name,"Click",$(this).attr("data-type"));self.location=$(this).attr("url")})}},setPosition:function(){},toggleMenu:function(){var a=sonico.notifications;a.$m.toggleClass("open-arrowtab");if(a.$layer.toggle().is(":visible")){a.$m.removeClass("open-tab");$("body").bind("click",a.toggleMenu);a.data.total&&sonico.notifications.mark();a.isTrackable&&analyticsTrackEvent(a.name,
"Open");$("#ddMyAcc").length&&$("#ddMyAcc").css("display")=="block"&&_toggleHeadMenu();$(".s-Ads").css("visibility","hidden")}else{$("div.notiItemNew",a.$layer).removeClass("notiItemNew");$("#nov-total").html("").hide().parent().removeClass("lnkTabCta");a.upTitle(1);a.$m.prev("li.open-tab").length&&a.$m.addClass("open-tab");$("body").unbind("click",a.toggleMenu);$(".s-Ads").css("visibility","visible")}return false},getPersistedData:function(){var a=sonico.notifications;a.data=notificationPreFetch;
_mustache.push([a._container_tpl.replace("[[ALERT]]",_("Ver todas las alertas")),a.data,{event:a._row_tpl},a.render])},getData:function(){sajax({error:function(){},action:"Notifications",actionMethod:"Get",response:function(a){if(a.error){clearInterval(b.timer);return false}var b=sonico.notifications;b.data=a.res;_mustache.push([b._container_tpl.replace("[[ALERT]]",_("Ver todas las alertas")),b.data,{event:b._row_tpl},b.render])}})},isTrackable:Math.random()*1E4%100<20,mark:function(){sajax({response:function(){},
error:function(){},action:"Notifications",actionMethod:"Mark"})}};$(document).ready(function(){setTimeout(sonico.notifications.init,1E3)});
var _toggleHeadMenu=function(a){$("#lnkDdMyAcc").toggleClass("current");$("#ddMyAcc").toggle();if($("#ddMyAcc").is(":visible")){$("body").bind("click",_toggleHeadMenu);$("#toggleAlerts").length&&$("#dropAlerts").is(":visible")&&sonico.notifications.toggleMenu();$(".s-Ads").css("visibility","hidden")}else{$("body").unbind("click",_toggleHeadMenu);$(".s-Ads").css("visibility","visible")}if(typeof a!="undefined"){a=$(a.target);if(a.attr("url")){var b=window;if(a.attr("target"))b=window.open("",a.attr("target"));
b.location=a.attr("url")}}return false};$(function(){$("#lnkDdMyAcc").click(_toggleHeadMenu)});
(function(a){a.fn.extend({sonicoCountry:function(b){function f(g){return h.optionTPL.replace("{val}",g.val).replace("{selected}",g.selected).replace("{desc}",g.desc)}function d(g,j){var i="";if(!j){g[h.initialOption.val]=h.initialOption.desc;j=h.initialOption.val}for(var l in g){var n=[l,g[l]];i+=f({val:n[0],desc:n[1],selected:n[0]==j?"selected":""})}return i}function c(g,j,i,l,n,o,k){var m=h,p=m[o];g.attr("disabled","disabled").html(f({val:-1,desc:m.loadingMsg}));if(m.initialData[j]){g.html(d(m.initialData[j],
p)).removeAttr("disabled").change(k);m.initialData[j]=false;if(p){g.change();m[o]=false}}else sajax({action:m.ajaxView,actionMethod:l,data:i,response:function(q){g.html(d(q.res[n],p)).removeAttr("disabled").change(k);if(p){g.change();m[o]=false}}})}var e={loadingMsg:_("cargando..."),states:false,city:false,ajaxView:"Country",countriesAjaxMethod:"GetCountries",statesAjaxMethod:"GetStates",citiesAjaxMethod:"GetCities",countriesCB:function(){},statesCB:function(){},citiesCB:function(){},countrySelected:false,
stateSelected:false,citySelected:false,optionTPL:'<option value="{val}" {selected}>{desc}</option>',initialData:{},initialOption:{val:-1,selected:true,desc:_("Selecciona")}},h=a.extend(e,b);return this.each(function(){var g=h,j=a(this);c(j,"countries",{},g.countriesAjaxMethod,"countries","countrySelected",function(){g.countriesCB();if(g.states){var i=a(g.states);a(g.city).attr("disabled","disabled").html("");c(i,"states",{country:j.val()},g.statesAjaxMethod,"states","stateSelected",function(){g.statesCB();
if(g.city){a(g.city).attr("disabled","disabled").html("");c(a(g.city),"cities",{country:j.val(),state:i.val()},g.citiesAjaxMethod,"cities","citySelected",g.citiesCB)}})}})})}})})(jQuery);var fnbox=fnbox||{};fnbox.setCookie=function(a,b,f){var d=new Date;d.setDate(d.getDate()+b);b=escape(f)+(b==null?"":";expires="+d.toUTCString());document.cookie=a+"="+b};
fnbox.getCookie=function(a){var b,f,d,c=document.cookie.split(";");for(b=0;b<c.length;b++){f=c[b].substr(0,c[b].indexOf("="));d=c[b].substr(c[b].indexOf("=")+1);f=f.replace(/^\s+|\s+$/g,"");if(f==a)return unescape(d)}};

