var globalTimer=Array();var allCheckboxes=false;var STATUS_ERROR=0;var STATUS_SUCCESS=1;var EFFECT_NONE=0;var EFFECT_FADE=1;var EFFECT_SLIDE=2;var POST_TYPE_MESSAGE=0;var POST_TYPE_VIDEO=1;var BOARD_TAB_ALL=0;var BOARD_TAB_MESSAGES=1;var BOARD_TAB_VIDEOS=2;var BOARD_TAB_VIDEOS_SHARE_YT=3;var BOARD_TAB_VIDEOS_SHARE_YT2=4;var BOARD_TAB_VIDEOS_SHARE_OWN=5;var BOARD_TAB_GIFTS=6;var EVENT_ONBLUR=1;var EVENT_ONFOCUS=2;var JCAROUSEL_TYPE_BOARD_VIDEO=0;var BOARD_VIDEOS_TITLE=0;var BOARD_VIDEOS_DESCRIPTION=1;var BOARD_VIDEOS_MODE_NORMAL=0;var BOARD_VIDEOS_MODE_EDITION=1;var EDIT_BASIC_NICKNAME=0;var VIDEOS_AJAX_SUCCESS=1;function collapseText(collapse,expand,effect){switch(effect){case"none":default:$("#"+collapse).hide();$("#"+expand).show();break;case"fade":$("#"+collapse).hide();$("#"+expand).fadeIn();break;case"slide":$("#"+collapse).slideToggle("fast",function(){$("#"+expand).slideToggle("slow")});break}return false}function changeTab(tabsCommonClass,contentCommonClass,currentTabId,currentContentId,effect,switchingClassAdd,switchingClassRm,callback){$.each($("."+contentCommonClass),function(){if($(this).css("opacity")<"0.999"){return false}});if(typeof(switchingClassAdd)=="undefined"||!switchingClassAdd){switchingClassAdd="current-tab"}if(typeof(switchingClassRm)=="undefined"||!switchingClassRm){switchingClassRm="current-tab"}if(typeof(effect)=="undefined"||!effect){effect="none"}$("."+tabsCommonClass).removeClass(switchingClassRm);$("#"+currentTabId).addClass(switchingClassAdd);try{eval(callback)}catch(error){}switch(effect){case"none":default:$("."+contentCommonClass).hide();$("#"+currentContentId).show();break;case"fade":$("."+contentCommonClass).hide();$("#"+currentContentId).fadeIn();break}return false}function magicTxtHelp(event,controlId,text,customClass,forceAction){if(typeof(customClass)=="undefined"||!customClass){customClass="grey-text"}if(typeof(forceAction)=="undefined"){forceAction=false}if(typeof(window.magicTxtHelp_activated)=="undefined"||!window.magicTxtHelp_activated){magicTxtHelp_activated=true}if(magicTxtHelp_activated){switch(event){case EVENT_ONBLUR:if($("#"+controlId).val()===""||forceAction){$("#"+controlId).val(text).addClass(customClass)}break;case EVENT_ONFOCUS:if($("#"+controlId).val()===text||forceAction){$("#"+controlId).val("").removeClass(customClass)}break}}return false}function array_clean(inputArray){var res=new Array;$.each(inputArray,function(key,value){if(typeof(value)!=="undefined"&&value!==""&&value!==null){res.push(value)}});return res}function timeoutMessages(containerId,message,time,effect,timerPointer){containerId="#"+containerId;if(typeof(message)=="undefined"){message=null}if(typeof(time)=="undefined"||!time){time=5000}if(typeof(effect)=="undefined"){effect=EFFECT_NONE}if(typeof(timerPointer)=="undefined"){timerPointer="default"}clearTimeout(globalTimer[timerPointer]);if(message){$(containerId).html(message)}switch(effect){case EFFECT_NONE:default:$(containerId).show("normal",function(){globalTimer[timerPointer]=setTimeout("$('"+containerId+"').hide();",time)});break;case EFFECT_FADE:$(containerId).fadeIn("normal",function(){globalTimer[timerPointer]=setTimeout("$('"+containerId+"').fadeOut();",time)});break;case EFFECT_SLIDE:$(containerId).slideDown("normal",function(){globalTimer[timerPointer]=setTimeout("$('"+containerId+"').slideUp();",time)});break}return false}function captureEvent(elementId,callback,keycode){if(typeof(keycode)==="undefined"){keycode=13}$("#"+elementId).keydown(function(event){if(event.keyCode===keycode){eval(callback);event.preventDefault()}});return false}function textareaMaxLength(textareaId,maxSize,callback){if(typeof(maxSize)==="undefined"){maxSize=1024}if(typeof(callback)==="undefined"){callback=null}var $textarea=$("#"+textareaId);$textarea.bind("keyup blur",function(){var text=$textarea.val();if(text.length>maxSize){$textarea.val(text.substring(0,maxSize))}if(callback){eval(callback)}});return false}function goTo(url){location.assign(url);return false}function addToMyVideos(url,elementClass,callback,silent){if(typeof(callback)=="undefined"){callback=false}if(typeof(silent)=="undefined"){silent=false}$("."+elementClass).animate({opacity:0.01});$.getJSON("/ajax_videos.php",{action:"addToMyVideos",data:[url]},function(res){switch(res[0]){case VIDEOS_AJAX_SUCCESS:if(callback){eval(callback)}else{$("."+elementClass).replaceWith(res[1])}break;default:if(!silent){alert(res[1])}}$("."+elementClass).animate({opacity:1})});return false}function daysInFebruary(year){return(((year%4===0)&&((!(year%100===0))||(year%400===0)))?29:28)}function DaysArray(n){for(var i=1;i<=n;i++){this[i]=31;if(i==4||i==6||i==9||i==11){this[i]=30}if(i==2){this[i]=29}}return this}function month_day(day,month,year){var daysInMonth=DaysArray(12);day=parseInt(day,10);month=parseInt(month,10);if(day===0||month===0||year===0){return false}if((month===2&&day>daysInFebruary(year))||day>daysInMonth[month]){return false}else{return true}}function im_apply_profile_settings(css){if(!window.pc_profile_dynamic_style){pc_profile_dynamic_style=document.createElement("style");pc_profile_dynamic_style.setAttribute("type","text/css");document.getElementsByTagName("head")[0].appendChild(pc_profile_dynamic_style)}if(pc_profile_dynamic_style.styleSheet){pc_profile_dynamic_style.styleSheet.cssText=css}else{$(pc_profile_dynamic_style).text(css)}}function page(number,page_id,form_id){if(number<1){return}document.getElementById(page_id).value=number;document.getElementById(form_id).submit()}function show_help_tip(event,element){$help_tip_div=$('<div class="help-ball" id="help_tip" style="display:none;position:absolute;top:0;left:0"><div class="body-balloon"></div><h5></h5></div>');$("body").append($help_tip_div);$(".tipped").focus(function(e){show_help_tip(e,this)}).blur(function(e){$help_tip_div.hide()});var $e=$(element);var pos=$e.offset();var pos2=$e.width();if($e.attr("position")){pos2=parseInt($e.attr("position"),10)}$(".body-balloon",$help_tip_div).html($("<p></p>").html(element.getAttribute("title")));$help_tip_div.css({position:"absolute",top:pos.top-10,left:pos.left+pos2}).show()}function selectAllCheckboxes(name){var inputs=document.getElementsByName(name);allCheckboxes=!allCheckboxes;for(i=0;i<inputs.length;i++){inputs[i].checked=allCheckboxes}}function strSearch(q,s){$q=$("#"+q);q=$.trim($q.val());if(q==s){q=""}$q.val(q.toLowerCase());return true}if(typeof(sonico)=="undefined"){var sonico=function(){}}sonico.translate={resources:{}};sonico.translate._=function(message){return typeof(sonico.translate.resources[message])=="string"?sonico.translate.resources[message]:message};_=sonico.translate._;sonico.translate.addResources=function(dict){for(var k in dict){sonico.translate.resources[k]=dict[k]}};sonico.String={ltrim:function(s){return s.replace(/^\s+/,"")},rtrim:function(s){return s.replace(/\s+$/,"")},trim:function(s){return s.replace(/^\s+|\s+$/g,"")},extendString:function(){String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}};sonico.resourceLoader={loaded:{},loading:{},loadResources:function(resources,callback){var pending=new Array();var h=this.getHeadpoint();for(var ii=0;ii<resources.length;++ii){if(resources[ii].src&&this.loaded[resources[ii].src]===undefined&&this.loading[resources[ii].src]===undefined){this.loading[resources[ii].src]=true;pending.push(resources[ii].src);this.requestResource(resources[ii].type,resources[ii].src,h)}}if(typeof callback=="function"){var timerId=setInterval(function(){if(pending.length){for(var ii=0;ii<pending.length;++ii){if(sonico.resourceLoader.loaded[pending[ii]]!==undefined){pending.splice(ii--,1)}}}else{callback();clearInterval(timerId)}},10)}},requestResource:function(type,source,h){if(type=="js"){var script=document.createElement("script");script.src=source;script.type="text/javascript";h.appendChild(script);script.onload=function(){sonico.resourceLoader._scriptLoaded(this.src)};script.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){sonico.resourceLoader._scriptLoaded(this.src)}}}},getHeadpoint:function(){var n,heads=document.getElementsByTagName("head");if(heads.length){n=heads[0]}else{n=document.body}return n},_scriptLoaded:function(scriptSrc){this.loaded[scriptSrc]=true;delete this.loading[scriptSrc]}};var magicTxtHelp_activated=true;function fillText_(opt){var text_find_=$("#quick").val();if(typeof(text_)=="undefined"){text_=_("Buscar...")}switch(opt){case 1:if(text_find_===""){$("#quick").val(text_);$("#quick").addClass("quiet")}break;case 2:magicTxtHelp_activated=false;if(text_find_==text_){$("#quick").val("");$("#quick").removeClass("quiet")}break}return true}function sidebarformatItem(row,i,prevQ){if(typeof(prevQ)==="undefined"){prevQ=""}var new_html=row;var words=prevQ.split(" ");var torep={a:"á",e:"é",i:"í",o:"ó",u:"ú",n:"ñ",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",N:"Ñ"};var toign=["#",",","\\.","'","_","-"];var regexes=new Array();var out="";for(var j in words){var w=words[j].replace(/\s+/,"");if(!w){continue}var w2=w.replace(/\(/g,"\\(").replace(/\)/g,"\\)");for(var k in torep){w2=w2.replace(new RegExp("("+torep[k]+")","g"),k);w2=w2.replace(new RegExp("("+k+")","g"),"[$1"+torep[k]+"]")}for(var k in toign){w2=w2.replace(new RegExp("("+toign[k]+")","g"),"$1?")}regexes.push("("+w2+")")}if(regexes.length){new_html=new_html.replace(new RegExp("("+regexes.join("|")+")","ig"),'<span class="added">$1</span>')}if(typeof(sonico_friends_photos)=="undefined"){out='<a href="javascript:void();" class="f-wrap dark-link">'+new_html+"</a>"}else{if(i>=900000000){out='<a href="javascript:void();" class="f-wrap dark-link"><span class="thumb"><b class="icon i-group"></b></span>'+new_html+"</a>"}else{if(i<1000){var domain_img={1:"i-games",2:"i-cards",3:"i-cumplealerta",4:"i-photo",5:"i-group",6:"i-bands",7:"i-pages"};out='<a href="javascript:void();" class="f-wrap dark-link"><span class="thumb"><b class="icon '+domain_img[i]+'"></b></span>'+new_html+"</a>"}else{out='<a href="javascript:void();" class="f-wrap dark-link"><span class="thumb">'+sonico_friends_photos[i]+"</span>"+new_html+"</a>"}}}return out}function launch_autocomplete(){if(typeof(sonico_groups)==="undefined"){sonico_groups={}}var sonico_friends_and_groups={};if(typeof(sonico_friends)==="undefined"){sonico_friends={}}for(var k in sonico_friends){sonico_friends_and_groups[k]=sonico_friends[k]}for(var k in sonico_groups){sonico_friends_and_groups[k]=sonico_groups[k]}if(typeof(sonico_site_language_id)!=="undefined"){var domains={1:{Games:"http://games.sonico.com/","E-card":"http://greetingcards.sonico.com/",Alerts:"http://birthdaytime.sonico.com/",Photos:"http://www.sonico.com/photos.php","Find Friend":"http://www.sonico.com/invite_friends.php",Bands:"http://bandas.sonico.com/bands_index.php","Public Pages":"http://www.sonico.com/publico/pages_list.php"},2:{Juegos:"http://juegos.sonico.com/",Postales:"http://greetingcards.sonico.com/","Alertas de Cumpleaños":"http://birthdaytime.sonico.com/",Fotos:"http://www.sonico.com/photos.php","Buscador de Amigos":"http://www.sonico.com/invite_friends.php",Bandas:"http://bandas.sonico.com/bands_index.php","Paginas Publicas":"http://www.sonico.com/publico/pages_list.php"},3:{Jogos:"http://jogos.sonico.com/","Cartões":"http://seucartao.sonico.com/",Alertas:"http://alertas.sonico.com/",Fotos:"http://www.sonico.com/photos.php","Buscador de Amigos":"http://www.sonico.com/invite_friends.php",Bandas:"http://bandas.sonico.com/bands_index.php","Paginas Publicas":"http://www.sonico.com/publico/pages_list.php"}};var id=1;for(var k in domains[sonico_site_language_id]){sonico_friends_and_groups[id]=k;id+=1}}if(typeof(text_)=="undefined"){text_=_("Buscar...")}$("#quick").autocomplete(sonico_friends_and_groups,{onItemSelect:function(li){if(li.selectValue<1000){window.location=domains[sonico_site_language_id][li.selectOption];return false}window.location=sonico_url+(li.selectValue>=900000000?"groups_index.php?gid=":"profile.php?u=")+li.selectValue},maxItemsToShow:10,width:163,extraResultsCSS:{top:$("#quick").offset().top,left:$("#quick").offset().left},resultsID:"quicksearch-autocomplete",delay:10,formatItem:sidebarformatItem,defaultText:text_})}function closeUserPreferenceBox(preference,divid){var errorF=function(){alert(_("Hubo un error, por favor vuelva a intentar."));$("#"+divid).show()};$("#"+divid).fadeOut(100);sajax({action:"CloseUserPreferenceBox",data:{preference:preference},error:errorF,response:function(res){if(res.error){errorF();return false}}})}(function($){sonico.ajax=function(options){var defaults={data:{},url:"/ajax_action.php",param:"action",error:function(){alert(_("Ops! Internet no es perfecto, intenta de nuevo."))},response:function(){},method:"POST",type:"json"};var op=$.extend(defaults,options);var url=op.url+"?"+op.param+"="+op.action+"&sST="+__sST__;if(op.actionMethod){url+="&actionMethod="+op.actionMethod}if(op.type=="html"){url+="&callType=html"}$.ajax({timeout:10000,type:op.method,dataType:op.type,url:url,data:op.data,error:op.error,success:op.response});return false}})(jQuery);sajax=sonico.ajax;var faviconUtils={change:function(iconUrl){this.addLink(iconUrl)},addLink:function(iconUrl){var link=document.createElement("link");link.type="image/vnd.microsoft.icon";link.rel="shortcut icon";link.href=iconUrl;this.removeLinkIfExists();this.docHead.appendChild(link)},removeLinkIfExists:function(){var links=this.docHead.getElementsByTagName("link");for(var i=0;i<links.length;i++){if(links[i].rel=="shortcut icon"){this.docHead.removeChild(links[i])}}},docHead:document.getElementsByTagName("head")[0]};var _errorLog=[];function myOnError(m,u,lno){if(typeof(_errorLog[m+lno])==="undefined"){_errorLog[m+lno]=1;var url="http://jslog.sonico.com/error_js.php";var data="emsg="+m+"&eurl="+u+"&elno="+lno+"&enav="+navigator.userAgent+"&pname="+_sonico_ref_page;var ss=document.createElement("SCRIPT");ss.src=url+"?"+data;document.body.appendChild(ss)}return false};