var user_credits=0;function pc_aprox_col(hex){if(hex.substr(0,1)=="#"){hex=hex.substr(1)}var r_f=(17*(Math.ceil(parseInt(hex.substring(0,2),16)/17))).toString(16);r_f=r_f==0?"00":r_f;var g_f=(17*(Math.ceil(parseInt(hex.substring(2,4),16)/17))).toString(16);g_f=g_f==0?"00":g_f;var b_f=(17*(Math.ceil(parseInt(hex.substring(4,6),16)/17))).toString(16);b_f=b_f==0?"00":b_f;return r_f+g_f+b_f}function pc_apply_profile_settings(settings){var sheetToBeRemoved=document.getElementById("pc_profile_premium_css");if(sheetToBeRemoved){var sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_premium_css=null}sheetToBeRemoved=document.getElementById("pc_profile_premium_js");if(sheetToBeRemoved){sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_premium_js=null}var keys=["link","background","text","title"];$.each(keys,function(i,k){if(settings[k].substr(0,1)!="#"){settings[k]="#"+settings[k]}});var tit=settings.title;var txt=settings.text;var lnk=settings.link;var bkg=settings.background;var bkg2=profile_mixcolor(txt,bkg,18,false);var bkg3=profile_mixcolor(bkg,bkg2,48,false);var txt2=profile_mixcolor(txt,bkg,72,false);var tit2=profile_mixcolor(tit,bkg,84,false);var fc=pc_aprox_col(tit)+".png";var on=pc_aprox_col(lnk)+".png";var arrow=pc_aprox_col(bkg)+".png";var arrow1=pc_aprox_col(lnk)+".png";var arrow2=pc_aprox_col(bkg2)+".png";var arrow3=pc_aprox_col(tit)+".png";var arrow4=pc_aprox_col(txt2)+".png";var bkgImg="";if(settings.bgImage!=null){bkgImg=" url("+settings.bgImage+") repeat"}css="/* LOGO */.enchulado #logo { background: url("+static_host_sonico+"/img/logo/fc"+fc+") no-repeat; _display: none; }.enchulado #logo a, .enchulado #logo a:hover { background: url("+static_host_sonico+"/img/logo/on"+on+') no-repeat; }.enchulado #logo img { display: none; }/* Logo IE */.enchulado #logo-ie { height: 53px; overflow: hidden; position: absolute; width: 133px; cursor: pointer; }.enchulado #logo-ie a { display: block; height: 60px; width: 133px; cursor: pointer; }.enchulado #logo-ie { _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (enabled=true,src="'+static_host_sonico+"/img/logo/fc"+fc+'"); }.enchulado #logo-ie a { _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (enabled=true,src="'+static_host_sonico+"/img/logo/on"+on+'"); } /* IMAGENES */body.enchulado { background: '+bkg+bkgImg+"; }.enchulado #menu .toggler {background-image: url("+static_host_sonico+"/img/arrows/"+arrow+");background-position: right -16px;}.enchulado #menu .open .toggler {background-position: right -48px;}.enchulado #page-title .breadcrumbs li {background-image: url("+static_host_sonico+"/img/arrows/"+arrow3+");background-position: left -16px;}.enchulado .link-slide, .enchulado .link-expand {background-image: url("+static_host_sonico+"/img/arrows/"+arrow1+");}.enchulado .link-slide {background-position: right -32px;}.enchulado .link-expand {background-position: right -48px;}.enchulado .jcarousel-container-horizontal .link-prev,.enchulado .jcarousel-container-horizontal .link-next {background-image: url("+static_host_sonico+"/img/arrows/"+arrow2+");}.enchulado .jcarousel-container-horizontal .link-prev {background-position: 0 -96px !important;}.enchulado .jcarousel-container-horizontal .link-next {background-position: 0 -128px !important;}.enchulado .newsfeed-comments .tip-top {background-image: url("+static_host_sonico+"/img/arrows/"+arrow2+");background-position: -5px -37px;}/* X cerrar */.enchulado #bd .i-close { width: auto; height: auto; padding: 0 3px; background: none; color: "+txt2+"; font-size: 9px; }.enchulado #bd a:hover .i-close { background: "+bkg2+"; color: "+txt+"; }/* Newsfeed quotes */.enchulado .quotes .open, .enchulado .quotes .close {color: "+txt2+";}/* REDONDEADO ABAJO AREA CONTENIDO */.enchulado .rbc { display: none; }/* COLORES */.enchulado #hd, .enchulado #hd .dark-link,.enchulado #bd, .enchulado #bd .dark-link, .enchulado #bd a.title, .enchulado #page-title .flag,.enchulado #ft .container, .ftlogged dl dd {color: "+txt+" !important;}.enchulado #bd h2, .enchulado #bd h3, .enchulado #bd h4, .enchulado #bd h5, .enchulado #bd h6 { color: "+tit+"; }.enchulado #hd a, .enchulado #bd a, .enchulado #ft a { color: "+lnk+"; } .enchulado .btn-plus, .enchulado .btn-plus:hover { color: "+lnk+" !important; }.enchulado .ftlogged-cont .note, .enchulado #ft .note { color: "+lnk+" !important; }.enchulado #bd .pager .current { background-color: "+lnk+"; color: "+bkg+"; }.enchulado #dashboard { padding-right: .4em; padding-left: .4em; background: "+bkg+"; }.enchulado #lang-select { border-color: "+bkg2+" !important; background: "+bkg3+" !important; }.enchulado #ft { background: "+bkg3+"; }.enchulado #ft .nav { color: "+txt2+"; }.enchulado #menu, .enchulado #menu-r { background: "+tit+"; } .enchulado #menu-wrap, .enchulado #menu-r-wrap { background: none; }.enchulado #menu { color: "+bkg3+"; }.enchulado #menu a { color: "+bkg+"; }.enchulado #menu .edit-tools a { color: "+bkg2+" !important; }.enchulado #menu .nav, .enchulado #menu .apps, .enchulado #menu .txtinput, .enchulado #menu #quick-btn, .enchulado #menu #invitefriend { border-color: "+tit2+"; }.enchulado #menu .nav .open { background: "+tit2+"; }.enchulado #menu .tag, .enchulado #menu .tag span { background: "+bkg3+"; }.enchulado #menu .tag a { color: "+tit+"; }.enchulado #page-title { background: "+bkg2+"; } .enchulado #page-title .title { background: none; }.enchulado #page-title .nav-tabs li, .enchulado #page-title .nav-tabs a { background: "+bkg3+"; color: "+txt2+"; }.enchulado #page-title .nav-tabs a { padding-bottom: 5px; }.enchulado #page-title .nav-tabs .current-tab, .enchulado #page-title .nav-tabs .current-tab a, .enchulado #page-title .nav-tabs li:hover, .enchulado #page-title .nav-tabs a:hover { background: "+bkg+"; color: "+txt+"; }.enchulado #content-wrap { border-color: "+bkg+" "+bkg2+" "+bkg2+"; background: "+bkg+"; }.enchulado #bd .box-highlight, .enchulado #bd .box-highlight .rt b, .enchulado #bd .box-highlight .rb b { background-color: "+bkg3+";  }.enchulado #bd .box-highlight .rt, .enchulado #bd .box-highlight .rb { background-color: "+bkg+";  }.enchulado .col-w305px .box-highlight, .enchulado .col-w305px .box-highlight .rt b, .enchulado .col-w305px .box-highlight .rb b { background-color: "+bkg+";  }.enchulado .col-w305px .box-highlight .rt, .enchulado .col-w305px .box-highlight .rb, .enchulado .ftlogged { background-color: "+bkg2+"; }.enchulado .jScrollPaneTrack { background-color: "+bkg3+"; }.enchulado .jScrollPaneDrag { background-color: "+lnk+"; }.enchulado #bd .underline, .enchulado #bd .overline, .enchulado .user-info .acts ul { border-color: "+bkg3+"; }.enchulado #bd .datetime, .enchulado #bd .note, .enchulado #bd .info dt, .enchulado .ad300x250 .edit-tools a, .enchulado .ad120x600 .edit-tools a, .enchulado .newsfeed-metadata { color: "+txt2+" !important; }.enchulado #bd .txtinput, .enchulado #bd .txtarea, .enchulado #bd .select, .enchulado #bd .select-inline, .enchulado #bd .select-block, .enchulado #bd .select-friends-list { border-color: "+bkg2+"; }.enchulado .profile-photos .empty a { border-color: "+bkg2+"; color: "+lnk+"; }.enchulado .profile-photos .empty a:hover { background-color: "+bkg3+"; }.enchulado .profile-photos .empty a.nohover { background-color: "+bkg+"; }.enchulado .profile-friends .empty a { border-color: "+bkg+"; color: "+lnk+"; }.enchulado .profile-friends .empty a:hover { background-color: "+bkg3+"; }/* NEWSFEED y CARTELERA */.enchulado .board { margin-left: 0; background: "+tit+"; color: "+bkg+"; } .enchulado .board .ebox-tl, .enchulado .board .ebox-bl, .enchulado .board .ebox-bl .ebox-br { background: none; }.enchulado .board .nav-tabs { margin-left: -8px; }.enchulado .board .nav-tabs .current-tab, .enchulado .board .nav-tabs .current-tab a { border-color: "+tit+"; background: "+tit+"; }.enchulado .board .nav-tabs .current-tab a { color: "+bkg+" !important; }.enchulado .board .nav-tabs a, .enchulado .board .nav-tabs a:hover { color: "+lnk+"; }.enchulado .board .ebox-bl .ebox-br a { color: "+bkg2+"; }.enchulado .board .form dt, .enchulado .board .note { color: "+bkg2+" !important; }.enchulado .jcarousel-container .thumb { border-color: "+bkg2+" !important; }.enchulado .status-comments, .enchulado .status-comments .new-msg { border-color: "+bkg2+"; background: none; }.enchulado .newsfeed dd.user-msg, .enchulado .status-comments .new-msg, .enchulado .new-photo-comments dl.user-comment, .enchulado dd.video-comments dl.user-comment, .enchulado dd.video-comments .new-msg, .enchulado .new-photo-comments .new-msg { background: "+bkg3+"; }.enchulado #bd a.thumb-frame img, .enchulado #bd img.thumb-frame { background: "+bkg3+"; border-color: "+txt+"; }.enchulado #bd a.thumb-frame:hover img { border-color: "+lnk+"; }/* COLUMNA DERECHA */.enchulado .col-w305px { min-height: 715px; _height: 715px; margin-top: -11px; background-color: "+bkg2+"; }.enchulado .profile-event dt span { background: "+txt+"; color: "+bkg+"; }.enchulado .profile-event dt strong { border-color: "+txt+"; color: "+txt+"; }.enchulado .se-hover { background-color: "+bkg3+"; }.enchulado .col-w305px .calendar caption { background-color: "+bkg+"; }.enchulado .col-w305px .calendar caption .prev, .enchulado .col-w305px .calendar caption .next { background-color: "+lnk+"; color: "+bkg+" !important; }.enchulado .col-w305px .calendar thead th, .enchulado .col-w305px .calendar span.quiet { color: "+txt2+"; }.enchulado .col-w305px .calendar .today { border-color: "+bkg+"; background-color: "+bkg3+"; color: "+lnk+"; }/* ESPECIFICO DE PERFIL DE USUARIO */.enchulado #profileUserPhoto .hover {border-color: "+lnk+"; background-color: "+bkg+";}.enchulado #profileUserPhoto .box-msg {background-color: "+lnk+";}.enchulado #profileUserPhoto .box-msg .dark-link {color: "+bkg+" !important;}.enchulado #profileMedia .list-photos-grid .thumb {color: "+bkg+";}.enchulado #profileMedia .list-photos-grid .thumb:hover {color: "+txt2+";}.enchulado #profileMedia .list-photos-grid span.thumb {border-color: "+txt2+";}.enchulado .pager-buttons .arrow, .enchulado .pager-buttons .xbl, .enchulado .pager-buttons .xbr {border-color: "+txt2+";}.enchulado .pager-buttons a:hover .arrow, .enchulado .pager-buttons a:hover .xbl, .enchulado .pager-buttons a:hover .xbr {border-color: "+lnk+";}.enchulado .pager-buttons .current .arrow, .enchulado .pager-buttons .current .xbl, .enchulado .pager-buttons .current .xbr {border-color: "+bkg2+" !important;}.enchulado .pager-buttons .arrow {background-color: "+bkg+";background-image: url("+static_host_sonico+"/img/arrows/"+arrow4+");}.enchulado .pager-buttons a:hover .arrow {background-color: "+lnk+";background-image: url("+static_host_sonico+"/img/arrows/"+arrow+");}.enchulado .pager-buttons .current .arrow {background-color: "+bkg3+" !important;background-image: url("+static_host_sonico+"/img/arrows/"+arrow2+") !important;}.enchulado .pager-buttons .link-prev .arrow {background-position: 0 -64px !important;}.enchulado .pager-buttons .link-next .arrow {background-position: 0 -80px !important;}/* ESPECIFICO DE PERFIL DE FAN PAGE */.enchulado .info-other dt {color: "+txt2+";}/* NUEVO NEWSFEED Y CAJAS */.enchulado #content-wrap .nav-filter .current .t1,.enchulado #content-wrap .nav-filter .current .t2 {border-color: "+bkg+"; background-color: "+tit+";}.enchulado #content-wrap .nav-filter .current strong,.enchulado #content-wrap .nav-filter .current a {background-color: "+tit+"; color: "+bkg+";}.enchulado #content-wrap .nav-filter,.enchulado .content-clipping,.enchulado #content-wrap .nFtLnks .current, .enchulado #content-wrap .nFtBox, .enchulado .newsfeed-comments,.enchulado .newsfeed-comments .rt, .enchulado .newsfeed-comments .rb {border-color: "+bkg2+";}.enchulado .newsfeed .content-clipping .rt,.enchulado .newsfeed .content-clipping .rb {background-color: "+bkg3+";}.enchulado .newsfeed-comments,.enchulado #content-wrap .nFtBox,.enchulado #content-wrap .nFtLnks .current,.enchulado .newsfeed-comments .user-comment,.enchulado .newsfeed-comments .old-msg,.enchulado .newsfeed-comments .new-msg {background-color: "+bkg3+";}.enchulado .newsfeed-comments .old-msg,.enchulado .newsfeed-comments .user-comment {border-color: "+bkg+";}.enchulado .xbx .xbcont,.enchulado .xb2,.enchulado .box-app-content {border-color: "+bkg3+"; background-color: "+bkg+";}.enchulado .xb1  {background-color: "+bkg3+";}.enchulado .xbx.sub .xbot .xb1, .enchulado .xbx.sub .xbot .xb2, .enchulado .xbx.sub .sublnk {border-color: "+bkg3+"; background-color: "+bkg3+";}.enchulado .xbx.sub .sublnk a {color: "+txt+";}.enchulado .xbx.grey .xbcont,.enchulado .xbx.grey .xb2 {border-color: "+bkg3+"; background-color: "+bkg2+";}.enchulado .xbx.grey .xb1 {background-color: "+bkg3+";}.enchulado #shareAttach .nav-tabs .current .xbl, .enchulado #shareAttach .nav-tabs .current .xbr {background: "+bkg+"; border-color: "+bkg2+";}.enchulado #shareAttach .nav-tabs .current {background: "+bkg+";}.enchulado #shareAttach .nav-tabs .current a {border-color: "+bkg+";}.enchulado #shareAttachContent.xbx.white .xb2, .enchulado #shareAttachContent.xbx.white .xbcont { background: "+bkg+"; border-color: "+bkg3+"; } .enchulado #shareAttachContent.xbx.white .xb1 { background: "+bkg3+"; }.enchulado #shareAttachContent.xbx.white #attachGiftFilter,.enchulado .nav-attachtype li {border-color: "+bkg3+";}.enchulado .nav-attachtype a:hover {background: "+bkg3+";}/* Anula enchule en partes especificas */.enchulado #quicksearch-autocomplete .dark-link, .enchulado .box-msg, .enchulado .box-msg h2, .enchulado .xbx.yellow { color: #1E1E1E !important; }.enchulado .thumb .txt { color: #3860A9; }.enchulado .xbx.yellow .xb2, .enchulado .xbx.yellow .xbcont { background-color: #FCFCC6; border-color: #E1CF85; } .enchulado .xbx.yellow .xb1 { background-color: #E1CF85; }.enchulado .box-msg a { color: #0156ee !important; }/* interior caja personalizar perfil */.enchulado #customize .i-close { width: 13px; height: 13px; padding: 0; background: url(http://st2.sonicocnt.com/3/img/sprite.png) -2px -993px; font-size: 0; }.enchulado #customize a:hover .i-close { background: #fff url(http://st2.sonicocnt.com/3/img/sprite.png) -2px -1025px; }.enchulado #customize .i-close { _background-image: url(http://st2.sonicocnt.com/3/img/spriteIE6.png) !important; }.enchulado #customize .content .arrow, .enchulado #customize .content .link-prev, .enchulado #customize .content .link-next { background-image: url(http://st2.sonicocnt.com/3/img/sprite.png) !important; _background-image: url(http://st2.sonicocnt.com/3/img/spriteIE6.png) !important; }.enchulado #customize .content a { color: #3860A9 !important; }.enchulado #customize .content, .enchulado #customize .current-tab a, .enchulado #customize .content .dark-link { color: #1E1E1E !important; }.enchulado #customize .content .note { color: #666 !important; }.enchulado #customize .content .underline, .enchulado #customize .content .overline { border-color: #D8DFEA !important; }";if(!window.pc_profile_dynamic_style){pc_profile_dynamic_style=document.createElement("style");pc_profile_dynamic_style.setAttribute("type","text/css");pc_profile_dynamic_style.setAttribute("id","pc_profile_style");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 pc_apply_profile_premium_settings(settings){var sheetToBeRemoved=document.getElementById("pc_profile_style");if(sheetToBeRemoved){var sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_style=null}if(!window.pc_profile_dynamic_premium_css){pc_profile_dynamic_premium_css=document.createElement("link");pc_profile_dynamic_premium_css.setAttribute("type","text/css");pc_profile_dynamic_premium_css.setAttribute("id","pc_profile_premium_css");pc_profile_dynamic_premium_css.setAttribute("rel","stylesheet");document.getElementsByTagName("head")[0].appendChild(pc_profile_dynamic_premium_css)}if(!window.pc_profile_dynamic_premium_js){pc_profile_dynamic_premium_js=document.createElement("script");pc_profile_dynamic_premium_js.setAttribute("id","pc_profile_premium_js");pc_profile_dynamic_premium_js.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(pc_profile_dynamic_premium_js)}$("#pc_profile_premium_css").attr("href",static_host_sonico+settings.custom_css);$("#pc_profile_premium_js").attr("src",static_host_sonico+settings.custom_js)}function pc_get_colors(){var greys=["000000","111111","333333","444444","555555","777777","999999","AAAAAA","CCCCCC","DDDDDD","EEEEEE","FFFFFF"];var colors=[];var pos=0;var rl={1:"00",2:"33",3:"66"};var rh={1:"99",2:"CC",3:"FF"};var gba={1:"00",2:"33",3:"66",4:"99",5:"CC",6:"FF"};for(n=1;n<=228;n++){if(((n-1)%19)==0){colors.push(greys[((n-1)/19)]);continue}pos=n-Math.ceil(n/19);colors.push((pos<=108?rl[Math.ceil((pos-18*(Math.ceil(pos/18)-1))/6)]:rh[Math.ceil((pos-18*(Math.ceil(pos/18)-1))/6)])+gba[pos-6*(Math.ceil(pos/6)-1)]+gba[Math.ceil((pos-108*(Math.ceil(pos/108)-1))/18)])}return colors}pc_customization_rows={pc_txt_col_box:"pc_txt_cust_row",pc_bg_col_box:"pc_bg_cust_row",pc_lnk_col_box:"pc_lnk_cust_row",pc_ttl_col_box:"pc_ttl_cust_row"};function pc_build_palette(){var colors=pc_get_colors();for(i in colors){$('<li style="background:#'+colors[i]+'" hexColor="#'+colors[i]+'" onclick="pc_preview_color(\'#'+colors[i]+"')\">&nbsp;</li>").appendTo($ccPul)}pc_loaded_palette=true}function pc_has_changes(){var changed=false;for(i in profile_customization){if(profile_customization[i]!=pc_preview_settings[i]){if(i=="link"||i=="background"||i=="text"||i=="title"){if(pc_preview_settings[i].substr(0,1)=="#"&&profile_customization[i].substr(0,1)!="#"&&("#"+profile_customization[i])!=pc_preview_settings[i]){changed=true;break}else{if(pc_preview_settings[i].substr(0,1)=="#"&&profile_customization[i].substr(0,1)=="#"){changed=true;break}}}else{changed=true;break}}}if(changed){$ccSaveButton.addClass("openwin").attr("src","layers/popup_save_skin.php?fpid="+fpid).children().removeClass("quiet");if($ccCancelButton){$ccCancelButton.html(i18n.Cancelar)}$("#ex2").jqmAddTrigger("a.openwin")}else{$ccSaveButton.removeClass("openwin").attr("src","").children().addClass("quiet");if($ccCancelButton){$ccCancelButton.html(i18n.Cerrar)}}return changed}function pc_start_customization(e){if(!$("body").hasClass("enchulado")){$("body").addClass("enchulado");$("#im-iframe iframe").contents().find("body").addClass("enchulado");$("#switch-enchule").text("on");setViewColors("0")}if(!window.pc_profile_dynamic_style&&$("#pc_profile_style").length>0){window.pc_profile_dynamic_style=document.getElementById("pc_profile_style")}if(!window.pc_profile_dynamic_premium_css&&$("#pc_profile_premium_js").length>0){window.pc_profile_dynamic_premium_css=document.getElementById("pc_profile_premium_js")}if(!window.pc_profile_dynamic_premium_js&&$("#pc_profile_premium_js").length>0){window.pc_profile_dynamic_premium_js=document.getElementById("pc_profile_premium_js")}pc_update_container("layers/page_customization.php?fpid="+fpid)}function pc_start_color_chooser(e){$ccSaveButton.addClass("openwin").attr("src","layers/popup_save_skin.php?fpid="+fpid).children().removeClass("quiet");$ccCancelButton.html(i18n.Cancelar);ccCurrentTarget=e.target.id;$curTarget=$("#"+ccCurrentTarget);$("#"+pc_customization_rows[e.target.id]).show();for(k in pc_customization_rows){if(k!=e.target.id){$("#"+pc_customization_rows[k]).hide()}}$ccHexInput.val(e.target.getAttribute("currHexColor"));$("#"+pc_customization_rows[e.target.id]+" td").html();$("#pc_change_color_th").html($("#"+pc_customization_rows[e.target.id]+" th").html());$("#pc_change_color_td").attr({style:$("#"+pc_customization_rows[e.target.id]+" td").attr("style"),currhexcolor:$("#"+pc_customization_rows[e.target.id]+" td").attr("currhexcolor"),hexcolor:$("#"+pc_customization_rows[e.target.id]+" td").attr("hexcolor")});$("#custom-colors,#custom-images,#pc_cust_colors_but").hide();$("#custom-color-picker").show()}function pc_go_to_colors_customization(){$ccDivImages.hide();$ccDivColors.show()}function pc_go_to_images_customization(){if(pc_has_changes()){if(!confirm(i18n["Tienes cambios sin guardar, continuar?"])){return}pc_sync_customization(profile_customization);pc_sync_images_divs()}$ccDivColors.hide();$ccDivImages.show()}function pc_abort_customization(e){if(pc_has_changes()){if(!confirm(i18n["Tienes cambios sin guardar, continuar?"])){return}pc_sync_customization(profile_customization);pc_sync_images_divs()}pc_reset_customization();pc_update_container("")}function pc_stop_color_chooser(apply){if(apply){$curTarget.css("background",$curTarget.attr("currHexColor"));pc_preview_settings[$curTarget.attr("target")]=$curTarget.attr("currHexColor")}else{$curTarget.css("background",pc_preview_settings[$curTarget.attr("target")]).attr("currHexColor",pc_preview_settings[$curTarget.attr("target")]);pc_apply_profile_settings(pc_preview_settings)}for(k in pc_customization_rows){$("#"+pc_customization_rows[k]).show()}pc_has_changes();$("#custom-color-picker").hide();$("#custom-colors,#custom-images,#pc_cust_colors_but").show()}function pc_preview_color(hex){var tmp={text:"pc_txt_col_box",background:"pc_bg_col_box",link:"pc_lnk_col_box",title:"pc_ttl_col_box"};var tmp2={};for(k in pc_preview_settings){tmp2[k]=pc_preview_settings[k]}tmp2[$curTarget.attr("target")]=hex;$curTarget.css("background",hex).attr("currHexColor",hex);$("#pc_change_color_td").css("background",hex).attr("currHexColor",hex);$ccHexInput.val(hex.toUpperCase());pc_apply_profile_settings(tmp2)}function pc_color_input(){var val=$ccHexInput.val();if(val.substr(0,1)!="#"){val="#"+val}if(val.match(new RegExp("^#[0-9a-fA-F]{6}$"))){pc_preview_color(val)}}function pc_sync_customization(settings){if(settings.premium==1){pc_apply_profile_premium_settings(settings)}else{pc_apply_profile_settings(settings);$.each($("td.color_box"),function(i,n){var hex=settings[n.getAttribute("target")];if(hex.substr(0,1)!="#"){hex="#"+hex}n.setAttribute("currHexColor",hex);n.style.background=hex});if(settings.template){var seli=null;for(i in sonico_templates){if(sonico_templates[i].template==settings.template){seli=i;break}}}if(settings.text=="#333333"&&settings.title=="#0099FF"&&settings.link=="#3366CC"&&settings.background=="#FFFFFF"&&!settings.bgImage){pc_set_sonico_enchule()}}for(k in settings){pc_preview_settings[k]=settings[k]}}function pc_sync_images_divs(){if(profile_customization.bgImage){$ccBgImageDelDiv.show();$ccBgImageUpDiv.hide();$ccImgBck.attr("src",profile_customization.bgImage)}else{$ccBgImageDelDiv.hide();$ccBgImageUpDiv.show();$ccImgBck.attr("src","")}if(profile_customization.ttlImage){$ccTtlImageDelDiv.show();$ccTtlImageUpDiv.hide();$ccImgTitle.attr("src",profile_customization.ttlImage)}else{$ccTtlImageDelDiv.hide();$ccTtlImageUpDiv.show();$ccImgTitle.attr("src","")}}function pc_reset_customization(){if(profile_customization.premium==1){pc_apply_profile_premium_settings(profile_customization)}else{pc_apply_profile_settings(profile_customization);$.each($("td.color_box"),function(i,n){var hex=profile_customization[n.getAttribute("target")];if(hex.substr(0,1)!="#"){hex="#"+hex}n.setAttribute("hexColor",hex);n.setAttribute("currHexColor",hex);n.style.background=hex});if(profile_customization.text=="#333333"&&profile_customization.title=="#0099FF"&&profile_customization.link=="#3366CC"&&profile_customization.background=="#FFFFFF"&&!profile_customization.bgImage){pc_set_sonico_enchule()}}for(k in profile_customization){pc_preview_settings[k]=profile_customization[k]}}function pc_save_customization(){if(parseInt(user_credits)<parseInt(pc_preview_settings.price)){window.location="purchase.php?t=skins&pcid="+pc_preview_settings.skinId;return false}if($("#theme-name").val()){pc_preview_settings.new_name=$("#theme-name").val()}if(!pc_preview_settings.sonico_pages_idsonico_pages){pc_preview_settings.sonico_pages_idsonico_pages=fpid}$.ajax({url:"page_save_customization.php",type:"POST",data:pc_preview_settings,dataType:"json",error:function(msg){window.alert(i18n["Ha habido un error, por favor intente nuevamente en unos minutos"])},success:function(resp){if(resp.text||resp.premium){profile_customization=resp;pc_reset_customization();pc_sync_images_divs();pc_has_changes();pc_update_container("")}else{if(resp.err==1){window.alert(sonico.translate._("El nombre del enchule no es válido"))}}}});$("#ex2").jqmHide()}function pc_save_customization_as_new(){if(pc_preview_settings.skinUId&&!trigger_pc){pc_preview_settings.setAsNew=1}pc_preview_settings.isTemp=0;pc_save_customization()}function pc_set_old_customization(){pc_preview_settings.setSavedSkin=1;if(!pc_preview_settings.sonico_pages_idsonico_pages){pc_preview_settings.sonico_pages_idsonico_pages=fpid}$.ajax({url:"page_save_customization.php",type:"POST",data:pc_preview_settings,dataType:"json",error:function(msg){window.alert(i18n["Ha habido un error, por favor intente nuevamente en unos minutos"])},success:function(resp){if(resp.template){profile_customization=resp;pc_reset_customization();pc_sync_images_divs();pc_has_changes();pc_update_container("");pc_preview_settings.setSavedSkin=0}}})}function pc_delete_image(type){if(type=="title"){pc_preview_settings.hasTtl=0;pc_preview_settings.title_image=null;pc_preview_settings.ttlImage=null;$ccTtlImageDelDiv.hide();$ccTtlImageUpDiv.show();$ccImgTitle.attr("src","")}else{pc_preview_settings.hasBg=0;pc_preview_settings.background_image=null;pc_preview_settings.bgImage=null;$ccBgImageDelDiv.hide();$ccBgImageUpDiv.show();$ccImgBck.attr("src","")}pc_sync_customization(pc_preview_settings);pc_has_changes()}function pc_change_template(name){if(name=="custom"){return false}pc_sync_customization(name=="personal"?profile_customization:sonico_templates[name]);if(name!="personal"&&sonico_templates[name].premium==1){$("#op_ch").hide()}else{$("#op_ch").show()}setNewHeight(sonico_templates[name].premium);pc_has_changes()}function pc_delete_template(obj,id){if(!window.confirm(sonico.translate._("¿Estás seguro que deseas eliminar este tema?"))){return}$.ajax({url:"ajax_responser.php",type:"POST",data:{action:"delete_template",v:fpid,t:id},dataType:"json",error:function(msg){window.alert(i18n["Ha habido un error, por favor intente nuevamente en unos minutos"])},success:function(ret){$(obj).parent().hide();if(ret.current){window.location.reload()}}});return false}function profile_mixcolor(fg,bg,opacity,d){var f=new Array();var b=new Array();var add=new Array();var out=new Array();f[0]=parseInt((fg.charAt(1)+fg.charAt(2)),16);f[1]=parseInt((fg.charAt(3)+fg.charAt(4)),16);f[2]=parseInt((fg.charAt(5)+fg.charAt(6)),16);b[0]=parseInt((bg.charAt(1)+bg.charAt(2)),16);b[1]=parseInt((bg.charAt(3)+bg.charAt(4)),16);b[2]=parseInt((bg.charAt(5)+bg.charAt(6)),16);add[0]=(f[0]-b[0])/100;add[1]=(f[1]-b[1])/100;add[2]=(f[2]-b[2])/100;b[0]+=parseInt(add[0]*opacity);b[1]+=parseInt(add[1]*opacity);b[2]+=parseInt(add[2]*opacity);out[0]=b[0].toString(16);out[1]=b[1].toString(16);out[2]=b[2].toString(16);if(out[0].length==1){out[0]="0"+out[0]}if(out[1].length==1){out[1]="0"+out[1]}if(out[2].length==1){out[2]="0"+out[2]}var ret=out[0]+out[1]+out[2];if(d){return ret}return"#"+ret.toUpperCase()}function setViewColors(v){$.ajax({url:"ajax_responser.php",type:"POST",data:{action:"hide_colors",colors:v},dataType:"json"});return true}function setLaboralNoticeOff(v){$.ajax({url:"ajax_responser.php",type:"POST",data:{action:"laboral_notice"},dataType:"json"});return true}function setTTColorsOff(v){$.ajax({url:"ajax_responser.php",type:"POST",data:{action:"hide_tt_colors"},dataType:"json"});return true}function toggleColors(){if($("body").hasClass("enchulado")){$("body").removeClass("enchulado");$("html").removeClass("enchulado");$("#im-iframe iframe").contents().find("body").removeClass("enchulado");$("#switch-enchule").text("on");setViewColors("1")}else{$("body").addClass("enchulado");$("html").addClass("enchulado");$("#im-iframe iframe").contents().find("body").addClass("enchulado");$("#switch-enchule").text("off");setViewColors("0")}}function formatItemSkinContent(skins){var html="";var sk_img="";var li_class="";$.each(skins,function(i,n){if(pc_type=="my"){if(n.premium==1){sk_img='<img alt="'+n.fullname+'" src="'+static_host_sonico+"img/templates/thumbs/premium/"+n.template+'_thumb.jpg" width="70" height="70" />';li_class=""}else{sk_img='<span class="color-bkg" style="background:#'+n.background_color+'"></span><span class="color-tit" style="background:#'+n.title_color+'"></span><span class="color-txt" style="background:#'+n.text_color+'"></span><span class="color-lnk" style="background:#'+n.link_color+'"></span>';li_class=' class="custom-colors"'}if(pc_curr_id==n.idsonico_pages_skins){if(li_class!=""){li_class=' class="selected custom-colors"'}else{li_class=' class="selected"'}html+="<li"+li_class+'><a href="#" class="link-close hide" onclick="pc_delete_template(this, \''+n.idsonico_pages_skins+'\');return false;" title="'+i18n["Eliminar tema"]+'"><span class="icon i-close"></span></a><a class="thumb" href="#" onclick="pc_change_template(\''+n.idsonico_pages_skins+"');return false;\">"+sk_img+'</a><a class="dark-link block" href="#" onclick="pc_change_template(\''+n.idsonico_pages_skins+"');return false;\">"+n.fullname+"</a>"}else{html+="<li"+li_class+'><a href="#" class="link-close hide" onclick="pc_delete_template(this, \''+n.idsonico_pages_skins+'\');return false;" title="'+sonico.translate._("Eliminar tema")+'"><span class="icon i-close"></span></a><a class="thumb" href="#" onclick="pc_change_template(\''+n.idsonico_pages_skins+"');return false;\">"+sk_img+'</a><a class="dark-link block" href="#" onclick="pc_change_template(\''+n.idsonico_pages_skins+"');return false;\">"+n.fullname+'</a><div class="edit-tools hide"><a class="buy-link" href="#" onclick="pc_set_old_customization(); return false;">'+sonico.translate._("Usar Tema")+"</a></div>"}}else{html+="<li>";html+='<a class="thumb" href="#" onclick="pc_change_template(\''+n.template+"');return false;\">"+n.thumb+'</a><a class="dark-link block" href="#" onclick="pc_change_template(\''+n.template+"');return false;\">"+n.fullname+"</a>";if(n.price>0){html+='<span class="note smaller">'+n.price+" "+sonico.translate._("créditos")+'</span><div class="edit-tools hide"><a class="buy-link" href="javascript:void(0);" onclick="showPremiumPopup(\''+n.template+"'); return false;\">"+sonico.translate._("comprar")+"</a></div>"}else{html+='<div class="edit-tools hide"><a class="buy-link" href="#" onclick="pc_save_customization(); return false;">'+msg_save+"</a></div>"}}html+="</li>"});return html}function formatItemSkinsPager(pager){var gpaging='<span class="pager f-right">';if(pager.previous_page<pager.page){gpaging+='<a class="link-prev" href="javascript:skinsPage('+pager.previous_page+');">'+msg_previous+"</a>"}else{gpaging+='<span class="link-prev">'+msg_previous+"</span>"}if(pager.next_page>pager.page){gpaging+='- <a class="link-next" href="javascript:skinsPage('+pager.next_page+');">'+msg_next+"</a>"}else{gpaging+='- <span class="link-next">'+msg_next+"</span>"}gpaging+="</span>";return gpaging}function changeSkinsType(new_pc_type){$("#skinsContent").html('<div style="vertical-align: middle; text-align: center; margin: 20px 20px"><img src="'+img_loading+'" /></div>');if(new_pc_type=="ch"){pc_update_container("layers/page_customization.php?t=ch&fpid="+fpid+"&sui="+pc_preview_settings.skinUId+"&si="+pc_preview_settings.skinId);return false}$.ajax({url:"ajax_responser.php",type:"POST",dataType:"json",data:{action:"pc_change_type",v:fpid,t:new_pc_type},error:function(msg){window.alert(i18n["Ha habido un error, por favor intente nuevamente en unos minutos"])},success:function(alldata){if(alldata.sonico_skins_count>0){$("#op_"+pc_type).removeClass("current-tab");$("#op_"+new_pc_type).addClass("current-tab");pc_type=new_pc_type;sonico_templates=alldata.sonico_templates;var main_content='<div id="skinsPaging" class="underline f-wrap"></div><ul class="theme-grid f-wrap">'+formatItemSkinContent(alldata.sonico_skins)+"</ul>";$("#skinsContent").html(main_content);var gpaging="";if(alldata.paging){gpaging=formatItemSkinsPager(alldata.paging)}$("#skinsPaging").html('<p class="f-left">'+alldata.phrase+"</p>"+gpaging);reBindClickFunction();if(new_pc_type=="pr"){$("#ex2").jqmAddTrigger("a.openwin")}}}});return false}function skinsPage(page){$("#skinsContent").html('<div style="vertical-align: middle; text-align: center; margin: 20px 20px"><img src="'+img_loading+'" /></div>');$.ajax({url:"ajax_responser.php",type:"POST",dataType:"json",data:{action:"pc_change_type",v:fpid,t:pc_type,p:page},error:function(msg){window.alert(i18n["Ha habido un error, por favor intente nuevamente en unos minutos"])},success:function(alldata){if(alldata.sonico_skins_count>0){var main_content='<div id="skinsPaging" class="underline f-wrap"></div><ul class="theme-grid f-wrap">'+formatItemSkinContent(alldata.sonico_skins)+"</ul>";$("#skinsContent").html(main_content);var gpaging="";if(alldata.paging){gpaging=formatItemSkinsPager(alldata.paging)}$("#skinsPaging").html('<p class="f-left">'+alldata.phrase+"</p>"+gpaging);sonico_templates=alldata.sonico_templates;reBindClickFunction();if(pc_type=="pr"){$("#ex2").jqmAddTrigger("a.openwin")}}}})}function reBindClickFunction(){$("#customize ul.theme-grid li").hover(function(){$(this).find(".link-close").removeClass("hide")},function(){$(this).find(".link-close").addClass("hide")});$("#customize ul.theme-grid a.thumb,#customize ul.theme-grid a.dark-link").click(function(){$("#customize ul.theme-grid li.selected").find(".edit-tools").addClass("hide");$("#customize ul.theme-grid li.selected").removeClass("selected");$(this).parent("li").addClass("selected");$(this).parent("li").find(".edit-tools").removeClass("hide")})}function pc_custom_image_upload(id,frm_id){$("#"+id+"_skin_user_id").val(pc_preview_settings.skinUId);if(!pc_preview_settings.skinUId||pc_preview_settings.isTemp){var tmp="";for(x in pc_preview_settings){tmp+="&"+x+"="+pc_preview_settings[x]}$("#"+id+"_skin_temp").val(tmp)}$("#"+id+"_progress_bar").css("display","block");$("#"+frm_id).submit()}function pc_start_temporal_customization(){if(!$("body").hasClass("enchulado")){$("body").addClass("enchulado");$("#im-iframe iframe").contents().find("body").addClass("enchulado");$("#switch-enchule").text("on");setViewColors("0")}pc_update_container("layers/page_customization.php?t=ch&skt=tmp&fpid="+fpid)}function pc_update_container(load_content){if(load_content!=""){$(".pc_container_main").attr("id","customize").show();$(".pc_container").html(ajaxText);$.ajax({url:load_content,cache:false,success:function(html){$(".pc_container").html(html)}})}else{$(".pc_container_main").hide().attr("id","");$(".pc_container").html("")}}function showPremiumPopup(name){if(!sonico_templates[name]||sonico_templates[name].premium!=1){return}var params="?credits="+sonico_templates[name].price+"&skid="+sonico_templates[name].skinId+"&src="+static_host_sonico+"img/templates/thumbs/premium/"+sonico_templates[name].template+"_thumb.jpg";$("#ex2").jqm({ajax:"layers/popup_premium_skin.php"+params,overlay:15,modal:true}).jqmShow();$("#ex2").jqm({ajax:"@src",trigger:"a.openwin",ajaxText:ajaxText});return false}function setNewHeight(premium){if(premium){$("#menu-r").height("auto");$("#menu").height("auto");$("#menu-wrap").height("auto");$("#menu-r-wrap").height("auto")}else{$("#menu").height($("#content").height()-43);$("#menu-r").height($("#menu").height())}}function pc_set_sonico_enchule(){var sheetToBeRemoved=document.getElementById("pc_profile_style");if(sheetToBeRemoved){var sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_style=null}sheetToBeRemoved=document.getElementById("pc_profile_premium_css");if(sheetToBeRemoved){sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_premium_css=null}sheetToBeRemoved=document.getElementById("pc_profile_premium_js");if(sheetToBeRemoved){sheetParent=sheetToBeRemoved.parentNode;sheetParent.removeChild(sheetToBeRemoved);window.pc_profile_dynamic_premium_js=null}}function rzContent(){var $wr=$("#content-wrap");var $col500=$(".col-w500px",$wr);var $col305=$(".col-w305px",$wr);$col305.height("auto");var $col305h=$col305.height();var $wrh=$wr.height();if($col305h<$wrh){$col305.height($wrh+parseInt($col305.css("padding-top"),10)+parseInt($col305.css("padding-bottom"),10))}}$(document).ready(function(){if(hasCustomization){setTimeout("rzContent()",1000)}});