
MAX_output=Array();WSLadloader=function(){function getQueryString(){var result={},queryString=location.search.substring(1),re=/([^&=]+)=([^&]*)/g,m;while(m=re.exec(queryString)){result[decodeURIComponent(m[1])]=decodeURIComponent(m[2]);}
return result;}
var sb=getQueryString()["sb"];if(typeof(sb)!='undefined'){MAX_sb=sb;console.log('small business set');console.log(sb);}
var MAX_p=location.protocol=='https:'?'https:':'http:';var MAX_r=ord=Math.random()*10000000000000000;var adheader='',adfooter='',cats='',tags='',index='',origin='',MAX_zoneids='',ua='',zonename;var loadads=function(){return 0;};var MAX_spc="<"+"script type='text/javascript' ";if(typeof(MAX_zones)!='undefined'){for(zonename in MAX_zones){MAX_zoneids+=escape(zonename+'='+MAX_zones[zonename]+"|");}
MAX_zoneids+='&nz=1';}else{MAX_zoneids='';}
if(typeof(MAX_source)=='undefined'){MAX_source='';}
if(typeof(MAX_country)!='undefined'&&MAX_country=='ES'&&MAX_mnemonic!='MOB'&&MAX_mnemonic!='XTB'&&MAX_mnemonic!='XMX'&&MAX_mnemonic!='TRB'){if(MAX_mnemonic==='XTO'){MAX_mnemonic='XatakaOn';}
tags='';if(typeof(MAX_tags)!='undefined'){tags=MAX_tags;}
cats='';if(typeof(MAX_cats)!='undefined'){cats=MAX_cats;}
index='';if(typeof(MAX_index)!='undefined'){index=MAX_index;}
origin='';if(typeof(MAX_Origin)!='undefined'){origin=MAX_Origin;}
adheader="<"+"script type='text/javascript' ";if(MAX_dfp==1){adheader+="src='"+"http://ad.es.doubleclick.net/N4712/adj/"+MAX_mnemonic+"/";}else if(MAX_mnemonic=='XatakaOn'){adheader+="src='"+"http://ad.es.doubleclick.net/N4712/adj/XatakaOn/"+MAX_source;}else{adheader+="src='"+"http://ad.es.doubleclick.net/adj/"+MAX_mnemonic+"/"+MAX_source;}
if(navigator.userAgent.match(/iPad/i)!=null){ua='ipad';}else if(navigator.userAgent.match(/iPhone/i)!=null){ua='iphone';}
adheader2=";dcopt=ist;kw=;"+cats+tags+index+"origin="+origin+";"+"screen="+screen.width+";"+"ua="+ua+";";adfooter="ord="+ord+"?"+"'><"+"/script>";if(MAX_dfp==1){MAX_output['CAB']=adheader+MAX_source+'_cabecera'+adheader2+"tile=1;sz=300x250;"+adfooter;MAX_output['LAT']=adheader+MAX_source+'_lateral'+adheader2+"tile=2;sz=160x600;"+adfooter;MAX_output['CP']=adheader+MAX_source+'_central'+adheader2+"tile=3;sz=300x250;version=1;"+adfooter;MAX_output['CP2']=adheader+MAX_source+'_central'+adheader2+"tile=3;sz=300x250;version=2;"+adfooter;MAX_output['CP3']=adheader+MAX_source+'_central'+adheader2+"tile=4;sz=300x250;"+adfooter;}else{MAX_output['CAB']=adheader+adheader2+"tile=1;sz=300x250;"+adfooter;MAX_output['LAT']=adheader+adheader2+"tile=2;sz=200x600;"+adfooter;MAX_output['CP']=adheader+adheader2+"tile=3;sz=790x250;version=1;"+adfooter;MAX_output['CP2']=adheader+adheader2+"tile=3;sz=790x250;version=2;"+adfooter;MAX_output['CP3']=adheader+adheader2+"tile=4;sz=790x250;"+adfooter;}}else if(typeof(MAX_sb)!='undefined'&&MAX_sb===0){MAX_spc+="src='"+MAX_p+"//ads2.weblogssl.com/www/delivery/spc.php?zones="+MAX_zoneids;MAX_spc+="&source="+MAX_source+"&r="+MAX_r;if(window.location){MAX_spc+="&loc="+escape(window.location);}
if(document.referrer){MAX_spc+="&referer="+escape(document.referrer);}
MAX_spc+="'><"+"/script>";loadads=function(){document.write(MAX_spc);return 1;};}
return{getad:function(name){var adcode;if(MAX_tags.indexOf("censuragoogle")!=-1){return''}
if(typeof(MAX_country)=='undefined'||MAX_country!=='ES'){if(name==='CLB'){return'';}
if(MAX_sb===0){if(name=='CP2'){name='CP';}
if(name=='CP3'){name='CP';}}else{if(name==='CP'||name=='CP2'){name='CEN';}
adcode="<"+"script type='text/javascript'>"+"GA_googleFillSlot('"+MAX_mnemonic+'-'+name+"')"+"<"+"/script>";return adcode;}}
if(typeof(MAX_output[name])=='undefined'){if(name==='BOT'||name==='CLB'){adcode="<"+"script type='text/javascript'>"+"GA_googleFillSlot('"+MAX_mnemonic+'-'+name+"')"+"<"+"/script>";return adcode;}
if(name=='CP2'){return Max_output['CP'];}else{return'';}}else{return MAX_output[name];}},loadAds:function(){return loadads();},MAX_show:function(name){document.write(this.getad(name));}};};MMM=WSLadloader();MMM.loadAds();if(typeof net=="undefined"){var net=new Object();}if(typeof net.m3=="undefined"){net.m3=new Object();}if(typeof net.m3.util=="undefined"){net.m3.util=new Object();}if(typeof net.m3.FlashObjectUtil=="undefined"){net.m3.FlashObjectUtil=new Object();}net.m3.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.createElement||!document.getElementById){return;}this.DETECT_KEY=_b?_b:"detectflash";this.skipDetect=net.m3.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();this.useExpressInstall=_7;if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new net.m3.PlayerVersion(_5.toString().split(".")));}this.installedVer=net.m3.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);if(c){this.addParam("bgcolor",c);}var q=_8?_8:"high";this.addParam("quality",q);var _d=(_9)?_9:window.location;this.setAttribute("xiRedirectUrl",_d);this.setAttribute("redirectUrl","");if(_a){this.setAttribute("redirectUrl",_a);}};net.m3.FlashObject.prototype={setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},createParamTag:function(n,v){var p=document.createElement("param");p.setAttribute("name",n);p.setAttribute("value",v);return p;},getVariablePairs:function(){var _19=new Array();var key;var _1b=this.getVariables();for(key in _1b){_19.push(key+"="+_1b[key]);}return _19;},getFlashHTML:function(){var _1c="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}_1c="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1d=this.getParams();for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}_1c+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}_1c="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";_1c+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _20=this.getParams();for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}var _22=this.getVariablePairs().join("&");if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";}_1c+="</object>";}return _1c;},write:function(_23){if(this.useExpressInstall){var _24=new net.m3.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}else{this.setAttribute("doExpressInstall",false);}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _23=="string")?document.getElementById(_23):_23;n.innerHTML=this.getFlashHTML();}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};net.m3.FlashObjectUtil.getPlayerVersion=function(_26,_27){var _28=new net.m3.PlayerVersion(0,0,0);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_28=new net.m3.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");for(var i=3;axo!=null;i++){axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);_28=new net.m3.PlayerVersion([i,0,0]);}}catch(e){}if(_26&&_28.major>_26.major){return _28;}if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){try{_28=new net.m3.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}catch(e){}}}return _28;};net.m3.PlayerVersion=function(_2c){this.major=parseInt(_2c[0])||0;this.minor=parseInt(_2c[1])||0;this.rev=parseInt(_2c[2])||0;};net.m3.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};net.m3.util={getRequestParameter:function(_2e){var q=document.location.search||document.location.href.hash;if(q){var _30=q.indexOf(_2e+"=");var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;if(q.length>1&&_30>-1){return q.substring(q.indexOf("=",_30)+1,_31);}}return"";},removeChildren:function(n){while(n.hasChildNodes()){n.removeChild(n.firstChild);}}};if(Array.prototype.push==null){Array.prototype.push=function(_33){this[this.length]=_33;return this.length;};}var getQueryParamValue=net.m3.util.getRequestParameter;var FlashObject=net.m3.FlashObject;document.mmm_fo=1;function SC_Easyroll(){if(SC_Easyroll.singleton==null){SC_Easyroll.singleton=new SC_EasyrollClass;}return SC_Easyroll.singleton;}function SC_EasyrollClass(){this.debugLayer=null;this.playerId="";this.browser="UNKNOWN";this.playerType="UNKNOWN";this.opacity=0.01;this.mediaPlayerClassId="6BF52A52-394A-11D3-B153-00C04F79FAA6";this.flashClassId="D27CDB6E-AE6D-11CF-96B8-444553540000";this.baseUrl="http://cdn.smartclip.net/easyroll";this.silverlightElementName="";this.videoAdUrl="";this.backgroundColor="000000";this.layerLeftOffset=0;this.layerTopOffset=0;this.layerWidth=0;this.layerHeight=0;this.audioVolume=100;this.layer=null;this.clickLayer=null;this.autostart=false;this.countDown=null;this.loaded=false;this.startCall=null;this.startCallParams=null;this.stopCall=null;this.stopCallParams=null;this.skipBtn=null;this.skipBtnLayer=null;this.skipBtnOptions=new Object();this.playingContenVideo=false;this.init=function(){this.debug(2,"init()");if(typeof this.playerId=="undefined"||this.playerId==null||this.playerId==""){this.debug(1,"Player identification not set!");return;}else if(typeof this.videoAdUrl=="undefined"||this.videoAdUrl==null||this.videoAdUrl==""||!this.videoAdUrl.match(/^https?:\/\//)){this.debug(1,"Preroll url not set!");return;}
var onLoad=this.addEvent(window,"load",SC_onLoad);var onResize=this.addEvent(window,"resize",SC_onResize);var onScroll=this.addEvent(window,"scroll",SC_onResize);var flashVer=this.getFlashVersion();if(!onLoad||!onResize||!onScroll||flashVer<9||!this.detectBrowser()){this.removeEvent(window,"load",SC_onLoad);this.removeEvent(window,"resize",SC_onResize);this.removeEvent(window,"scroll",SC_onResize);this.endAd();}else{this.findPlayer();}};this.setStartCall=function(_call,_params){this.startCall=_call;this.startCallParams=_params;return this;};this.setStopCall=function(_call,_params){this.stopCall=_call;this.stopCallParams=_params;return this;};this.setSkipButton=function(btn,time,w,h,top,left){if((typeof(btn)!="undefined")){this.skipBtn=btn;}
if((typeof(time)!="undefined")&&(Number(time)>7)){this.skipBtnOptions.timeDisplaySkip=time;}else{this.skipBtnOptions.timeDisplaySkip=7;}
if((typeof(w)!="undefined")&&(Number(w)>0)){this.skipBtnOptions.w=w+"px";}else{this.skipBtnOptions.w="100px";}
if((typeof(h)!="undefined")&&(Number(h)>0)){this.skipBtnOptions.h=h+"px";}else{this.skipBtnOptions.h="20px";}
if(typeof(top)!="undefined"){this.skipBtnOptions.top=top+"px";}else{this.skipBtnOptions.top="10px";}
if(typeof(left)!="undefined"){this.skipBtnOptions.left=left+"px";}else{this.skipBtnOptions.left="10px";}}
this.setBaseUrl=function(_url){this.baseUrl=_url;return this;};this.setVideoAdUrl=function(_url){this.videoAdUrl=_url;return this;};this.setPlayerId=function(_id){this.playerId=_id;return this;};this.setSilverlightElementName=function(_name){this.silverlightElementName=_name;return this;};this.getSilverlightElementName=function(){return this.silverlightElementName;};this.setLayerLeftOffset=function(_left){this.layerLeftOffset=parseInt(_left);if(isNaN(this.layerLeftOffset)){this.layerLeftOffset=0;this.debug(1,"Redefining invalid left offset "+_left+" with "+this.layerLeftOffset+".");}return this;};this.setLayerTopOffset=function(_top){this.layerTopOffset=parseInt(_top);if(isNaN(this.layerTopOffset)){this.layerTopOffset=0;this.debug(1,"Redefining invalid top offset "+_top+" with "+this.layerTopOffset+".");}return this;};this.setLayerWidth=function(_width){this.layerWidth=parseInt(_width);if(isNaN(this.layerWidth)){this.layerWidth=320;this.debug(2,"Redefining invalid width "+_width+" with "+this.layerWidth+".");}return this;};this.setLayerHeight=function(_height){this.layerHeight=parseInt(_height);if(isNaN(this.layerHeight)){this.layerHeight=250;this.debug(2,"Redefining invalid height "+_height+" with "+this.layerHeight+".");}return this;};this.setBackgroundColor=function(_color){this.backgroundColor=_color;if(this.backgroundColor==null||typeof this.backgroundColor.match=="undefined"||!this.backgroundColor.match(/^[A-Fa-f0-9]{6}$/)){this.backgroundColor="000000";this.debug(2,"Redefining invalid color "+_color+" with "+this.backgroundColor+".");}return this;};this.setAudioVolume=function(_volume){this.audioVolume=_volume;if(isNaN(this.audioVolume)){this.audioVolume=100;this.debug(2,"Redefining invalid volume "+_volume+" with "+this.audioVolume);}return this;};this.setAutostart=function(_autostart){this.autostart=_autostart;return this;};this.addCountDown=function(_position,_text,_textColor,_color,_opacity){this.countDown=[_position,_text,_textColor,_color,_opacity];return this;};this.setCountDown=function(_position,_text,_textColor,_color,_opacity){return this.addCountDown(_position,_text,_textColor,_color,_opacity);};this.findPlayer=function(){this.debug(2,"findPlayer()");this.debugLayer=document.getElementById("SC_DEBUGLAYER");this.player=this.find(this.playerId,document);if(this.player==null&&!this.loaded){window.setTimeout(function(){SC_Easyroll().findPlayer();},100);}else if(this.loaded!=null){this.player=this.find(this.playerId,document);}
if(this.player!=null){this.prepare();}};this.onLoad=function(){this.debug(2,"onLoad()");};this.prepare=function(){this.debug(2,"prepare()");if(this.player!=null){this.checkPlayer(0);}else{this.debug(1,"Player object not found!");}};this.getPlayer=function(){return this.player;};this.detectBrowser=function(){var agent=navigator.userAgent;if(agent.match(/Firefox.(\d.\d)/i)!=null){this.browser="FIREFOX";return true;}else if(agent.match(/MSIE.(\d.\d)/i)!=null){this.browser="IE";return true;}else if(agent.match(/Opera.(\d.\d)/i)!=null){this.browser="OPERA";return true;}else if(agent.match(/Safari.(\d)/i)!=null){this.browser="SAFARI";return true;}return false;};this.addEvent=function(_obj,_event,_func){if(_obj.addEventListener){_obj.addEventListener(_event,_func,false);return true;}else if(_obj.attachEvent){return _obj.attachEvent("on"+_event,_func);}return false;};this.removeEvent=function(_obj,_event,_func){if(typeof _obj.removeEventListener!="undefined"){_obj.removeEventListener(_event,_func,false);return true;}else if(typeof _obj.detachEvent!="undefined"){return _obj.detachEvent("on"+_event,_func);}return false;};this.getLeft=function(_obj){var left=0;if(_obj){if(_obj.offsetParent){left=_obj.offsetLeft+this.getLeft(_obj.offsetParent);}else if(_obj.x){left=_obj.x;}}return left;};this.setLeft=function(_obj,_left){_obj.style.left=_left+"px";};this.getTop=function(_obj){var top=0;if(_obj){if(_obj.offsetParent){top=_obj.offsetTop+this.getTop(_obj.offsetParent);}else if(_obj.y){top=_obj.y;}}return top;};this.setTop=function(_obj,_top){_obj.style.top=_top+"px";};this.getWidth=function(_obj){var width=0;var attr=null;if(_obj){width=parseInt(_obj.width);if(isNaN(width)){width=parseInt(_obj.offsetWidth);if(isNaN(width)){width=parseInt(_obj.style.width);}}}return width;};this.getHeight=function(_obj){var height=0;var attr=null;if(_obj){height=parseInt(_obj.height);if(isNaN(height)){height=parseInt(_obj.offsetHeight);if(isNaN(height)){height=parseInt(_obj.style.height);}}}return height;};this.hideOrShow=function(_obj,_show){if(_show){_obj.style.visibility="visible";}else{_obj.style.visibility="hidden";}};this.setOpacity=function(_obj,_value){if(this.browser=="IE"){_obj.style.filter="alpha(opacity="+_value*100+")";}else{_obj.style.opacity=_value;}};this.getDocument=function(_frame){if(_frame.contentDocument!=null){return _frame.contentDocument;}else if(_frame.contentWindow){return _frame.contentWindow.document;}else if(_frame.document){return _frame.document;}return null;};this.find=function(_id,_document){var object=_document.getElementById(_id);if(object==null){var iframes=_document.getElementsByTagName("iframe");for(var i=0;object==null&&i<iframes.length;i++){var doc=this.getDocument(iframes[i]);if(false){object=this.find(_id,doc);}}}return object;};this.getPositionAndDimension=function(){var left,top,width,height;if(this.player!=null){left=this.getLeft(this.player)+this.layerLeftOffset;top=this.getTop(this.player)+this.layerTopOffset;width=this.layerWidth>0?this.layerWidth:this.getWidth(this.player);height=this.layerHeight>0?this.layerHeight:this.getHeight(this.player);return[left,top,width,height];}return null;};this.addLayerToPage=function(){var data=this.getPositionAndDimension(this.player);if(this.browser=="IE"){this.layer=document.createElement("<div id='smartclip' style=\"filter:alpha(opacity="+this.opacity*100+"); z-index:100; background-color:#"+this.backgroundColor+"; left:"+data[0]+"px; top:"+data[1]+"px; width:"+data[2]+"px; height:"+data[3]+"px; position:absolute; visibility:hidden;\">");}else{this.layer=document.createElement("div");this.layer.setAttribute("id","smartclip");this.layer.setAttribute("style","opacity:"+this.opacity+"; z-index:100; background-color:#"+this.backgroundColor+"; left:"+data[0]+"px; top:"+data[1]+"px; width:"+data[2]+"px; height:"+data[3]+"px; position:absolute; visibility:hidden;");}if(this.browser=="IE"){this.internalPlayer=document.createElement("<object id=\"SC_INTERNAL_PLAYER\" classid=\"clsid:"+this.flashClassId+"\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"100%\" height=\"100%\" type=\"application/x-shockwave-flash\">");}else{this.internalPlayer=document.createElement("object");this.internalPlayer.setAttribute("id","SC_INTERNAL_PLAYER");this.internalPlayer.setAttribute("width","100%");this.internalPlayer.setAttribute("height","100%");this.internalPlayer.setAttribute("type","application/x-shockwave-flash");this.internalPlayer.setAttribute("data",this.getMiniPlayerUrl());}this.internalPlayer.appendChild(this.createParam("movie",this.getMiniPlayerUrl()));this.internalPlayer.appendChild(this.createParam("menu","false"));this.internalPlayer.appendChild(this.createParam("scale","noscale"));this.internalPlayer.appendChild(this.createParam("wmode","transparent"));this.internalPlayer.appendChild(this.createParam("bgcolor","#"+this.backgroundColor));this.internalPlayer.appendChild(this.createParam("allowScriptAccess","always"));if(this.countDown!=null){this.internalPlayer.appendChild(this.createParam("flashvars","ad_countdown=true&ad_countdown_position="+this.countDown[0]+"&ad_countdown_text="+escape(this.countDown[1])+"&ad_countdown_text_color="+this.countDown[2]+"&ad_countdown_color="+this.countDown[3]+"&ad_countdown_opacity="+this.countDown[4]));}
if(this.browser=="IE"){this.clickLayer=document.createElement("<div style=\"filter:alpha(opacity=0.0); z-index:101; background-color:#"+this.backgroundColor+"; left:0px; top:0px; width:"+data[2]+"px; height:"+data[3]+"px; position:absolute;\" onclick=\"SC_run()\">");if(this.skipBtn!=null){var posLeft=this.layerWidth-100;var posTop=this.layerHeight-30;this.skipBtnLayer=document.createElement("<div style=\"visibility:hidden; z-index:111; background-image:url(http://img.weblogssl.com/saltarpubli-tv.gif); background-repeat:no-repeat; left:"+this.skipBtnOptions.left+"; top:"+this.skipBtnOptions.top+"; width:"+this.skipBtnOptions.w+"; height:"+this.skipBtnOptions.h+";position:absolute;\" onclick=\"SC_endVideoAd()\">");this.skipBtnLayer.setAttribute("id","skipBtn");}}else{this.clickLayer=document.createElement("div");this.clickLayer.setAttribute("style","opacity:0.0; z-index:101; background-color:#"+this.backgroundColor+"; left:0px; top:0px; width:"+data[2]+"px; height:"+data[3]+"px; position:absolute;");this.clickLayer.addEventListener("click",SC_run,false);if(this.skipBtn!=null){var posLeft=this.layerWidth-100;var posTop=this.layerHeight-30;this.skipBtnLayer=document.createElement("div");this.skipBtnLayer.setAttribute("style","visibility:hidden; background-image:url(http://img.weblogssl.com/saltarpubli-tv.gif); background-repeat:no-repeat;left:"+this.skipBtnOptions.left+"; top:"+this.skipBtnOptions.top+"; width:"+this.skipBtnOptions.w+"; height:"+this.skipBtnOptions.h+"; position:absolute;");this.skipBtnLayer.setAttribute("id","skipBtn");this.skipBtnLayer.addEventListener("click",SC_endVideoAd,false);}}
this.layer.appendChild(this.internalPlayer);this.layer.appendChild(this.clickLayer);if(this.skipBtnLayer)this.layer.appendChild(this.skipBtnLayer);document.body.appendChild(this.layer);};this.getMiniPlayerUrl=function(){return this.baseUrl+"/player.swf";};this.createParam=function(_name,_value){var param=null;if(this.browser=="IE"){param=document.createElement("<param name=\""+_name+"\" value=\""+_value+"\">");}else{param=document.createElement("param");param.setAttribute("name",_name);param.setAttribute("value",_value);}return param;};this.showSkipButton=function(){var skpLayer=document.getElementById("skipBtn");if(skpLayer!=null){skpLayer.style.visibility="visible";}}
this.checkPlayer=function(_try){var type=this.player.getAttribute("type");var data=this.player.getAttribute("data");var classid=this.player.getAttribute("classid");var result=false;var error=false;var name=null;var value=null;var params=null;this.debug(2,"checkPlayer("+_try+")");if(type!=null){type=type.toLowerCase();}
if(data!=null){data=data.toLowerCase();}
if(classid!=null){classid=classid.toUpperCase();}
if(this.browser=="IE"&&classid!=null&&classid.indexOf(this.mediaPlayerClassId)!=-1){this.playerType="WMV";}else if(type!=null&&type.indexOf("x-silverlight")!=-1||data!=null&&data.indexOf("x-silverlight")!=-1){this.playerType="SILVERLIGHT";}else if(type!=null&&type.indexOf("x-shockwave-flash")!=-1||classid!=null&&classid.indexOf(this.flashClassId)!=-1){this.playerType="FLASH";}
this.debug(2,"- player type = "+this.playerType);if(this.playerType=="SILVERLIGHT"){var background=false;var windowless=false;var opera=this.browser=="OPERA";var element=typeof this.player.Content!="undefined"?this.player.Content.FindName(this.silverlightElementName):null;var playing=element!=null&&element.CurrentState=="Playing"&&element.BufferingProgress==1;this.debug(2,"- playing = "+playing+" ("+(element!=null?element.CurrentState:"-")+", "+(element!=null?element.BufferingProgress:"-")+")");params=this.player.getElementsByTagName("param");for(var i=0;params!=null&&i<params.length;i++){name=params[i].name.toLowerCase();value=params[i].value.toLowerCase();if(name=="background"&&value=="transparent"){background=true;}
if(name=="windowless"&&value=="true"){windowless=true;}}
if(!background){this.debug(1,"Silverlight parameter \"background\" is not set or not set to \"transparent\"");}if(!windowless){this.debug(1,"Silverlight parameter \"windowless\" is not set or not set to \"true\"");}if(opera){this.debug(1,"Silverlight is not fully supported in Opera yet as the \"windowless\" parameter does not work.");}error=!background||!windowless||opera;result=!error&&(!this.autostart||playing);}else if(this.playerType=="FLASH"){var wmode=false;var script=false;var node=this.player.nodeName.toLowerCase();var custom=eval("this.player."+this.startCall);var start=typeof custom!="undefined"||typeof this.player.sendEvent!="undefined"||typeof this.player.Pause!="undefined"||typeof this.player.pauseVideo!="undefined";this.debug(2,"- SendEvent()  = "+(typeof this.player.sendEvent!="undefined"));this.debug(2,"- Pause()      = "+(typeof this.player.Pause!="undefined"));this.debug(2,"- PauseVideo() = "+(typeof this.player.pauseVideo!="undefined"));this.debug(2,"- "+this.startCall+"() = "+(typeof custom!="undefined"));if(node=="object"){params=this.player.getElementsByTagName("param");}else{params=this.player.attributes;}for(var j=0;params!=null&&j<params.length;j++){name=params[j].name.toLowerCase();value=params[j].value.toLowerCase();if(name=="wmode"&&value=="transparent"){wmode=true;}if(name=="allowscriptaccess"&&value=="always"){script=true;}}if(!wmode){this.debug(1,"- Flash parameter \"wmode\" is not set or not set to \"transparent\"");}if(!script){this.debug(1,"- Flash parameter \"allowscriptaccess\" is not set or not set to \"always\"");}if(!start){this.debug(1,"- Could not determine start method for the player");}error=!wmode||!script;result=!error&&start;}else if(this.playerType=="WMV"){error=false;result=!error;}this.debug(2,"- result = "+result);if(!error&&!result&&_try<20){window.setTimeout(function(){SC_Easyroll().checkPlayer(++_try);},500);}else if(result){this.show();}};this.onResize=function(){this.debug(2,"onResize()");var data=this.getPositionAndDimension(this.player);if(data!=null&&this.layer!=null){this.setLeft(this.layer,data[0]);this.setTop(this.layer,data[1]);}};this.show=function(){this.debug(2,"show()");this.addLayerToPage();this.hideOrShow(this.layer,true);};this.initDone=function(){this.debug(2,"initDone("+this.autostart+")");if(this.autostart){this.stopExternalPlayer(0);}};this.run=function(){this.debug(2,"run("+this.videoAdUrl+")");try{var data=this.getPositionAndDimension(this.player);if(data!=null){this.internalPlayer.loadVideoAd(this.videoAdUrl,data[2],data[3],this.audioVolume);}else{this.endVideoAd();}}catch(exc){this.debug(1,exc);}};this.startingVideoAd=function(){this.debug(2,"startingVideoAd()");this.setOpacity(this.layer,1);this.hideOrShow(this.clickLayer,false);};this.endVideoAd=function(){this.layer.appendChild(this.skipBtnLayer);this.debug(2,"endVideoAd");this.hideOrShow(this.layer,false);this.startExternalPlayer();};this.buildCustomCall=function(_call,_params){var custom=_call+"(";for(var i=0;_params!=null&&i<_params.length;i++){custom+="'"+_params[i]+"'";if(i<_params.length-1){custom+=",";}}custom+=")";return custom;};this.runCustomCall=function(){var custom="this.player."+this.buildCustomCall(this.startCall,this.startCallParams);this.debug(2,"runCustomCall("+custom+")");eval(custom);};this.getCustomCallFunc=function(){var custom="runFunc = function() { SC_Easyroll().getPlayer()."+this.buildCustomCall(this.stopCall,this.stopCallParams)+"; SC_Easyroll().run(); }";this.debug(2,"getCustomCallFunc("+custom+")");return custom;};this.startExternalPlayer=function(){this.debug(2,"startExternalPlayer");if(this.playerType=="FLASH"){if(!this.playingContenVideo){var custom=eval("this.player."+this.startCall);if(typeof custom!="undefined"){try{this.runCustomCall();}catch(exc){alert(exc);}}else if(typeof this.player.sendEvent!="undefined"){try{this.player.sendEvent("PLAY","true");}catch(exc){}}else if(typeof this.player.DoPlay!="undefined"){try{this.player.DoPlay();}catch(exc){}}else if(typeof this.player.playVideo!="undefined"){try{this.player.playVideo();}catch(exc){}}
this.playingContenVideo=true;}}else if(this.playerType=="SILVERLIGHT"){try{this.player.Content.FindName(this.silverlightElementName).Play();}catch(exc){}}else if(this.playerType=="WMV"){try{player.controls.play();}catch(exc){alert(exc);}}};this.stopExternalPlayer=function(_try){this.debug(2,"stopExternalPlayer("+_try+", "+this.playerType+")");var stopped=false;var runFunc=null;if(this.playerType=="FLASH"){var custom=eval("this.player."+this.stopCall);if(typeof custom!="undefined"){try{custom=this.getCustomCallFunc();eval(custom);stopped=true;}catch(exc){alert(exc);}}else if(typeof this.player.sendEvent!="undefined"){try{runFunc=function(){SC_Easyroll().getPlayer().sendEvent("PLAY","false");SC_Easyroll().run();};stopped=true;}catch(exc){}}else if(typeof this.player.Pause!="undefined"){try{runFunc=function(){SC_Easyroll().getPlayer().Pause();SC_Easyroll().run();};stopped=true;}catch(exc){}}else if(typeof this.player.pauseVideo!="undefined"){try{runFunc=function(){SC_Easyroll().getPlayer().pauseVideo();SC_Easyroll().run();};stopped=true;}catch(exc){}}}else if(this.playerType=="SILVERLIGHT"){try{runFunc=function(){SC_Easyroll().getPlayer().Content.FindName(SC_Easyroll().getSilverlightElementName()).Pause();SC_Easyroll().run();};stopped=true;}catch(exc){}}else if(this.playerType=="WMV"){try{runFunc=function(){SC_Easyroll().getPlayer().controls.pause();SC_Easyroll().run();};stopped=true;}catch(exc){alert(exc);}}if(!stopped&&_try<10){window.setTimeout(function(){SC_Easyroll().stopExternalPlayer(++_try);},500);}else if(stopped){runFunc();}};this.getFlashVersion=function(){var isIE=navigator.appVersion.indexOf("MSIE")!=-1?true:false;var isWin=navigator.appVersion.toLowerCase().indexOf("win")!=-1?true:false;var isOpera=navigator.userAgent.indexOf("Opera")!=-1?true:false;var descr=null;var versions=null;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins['Shockwave Flash 2.0']||navigator.plugins['Shockwave Flash']){descr=navigator.plugins["Shockwave Flash"+(navigator.plugins['Shockwave Flash 2.0']?" 2.0":"")].description.split(" ");versions=descr[2].split(".");return versions[0];}}else if(isIE&&isWin&&!isOpera){try{versions=(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")).GetVariable("$version").split(",");return versions[0].substr(4);}catch(exception){}}
return 7;};this.debug=function(_level,_message){if(this.debugLayer!=null){if(this.debugLayer.innerHTML==""){this.debugLayer.innerHTML=_message;}else{this.debugLayer.innerHTML=this.debugLayer.innerHTML+"<br>"+_message;}}};}function SC_onLoad(){SC_Easyroll().onLoad();}function SC_initDone(){SC_Easyroll().initDone();}function SC_onResize(){SC_Easyroll().onResize();}function SC_run(){var skpLayer=document.getElementById("skipBtn");if(skpLayer!=null){window.setTimeout(function(){SC_Easyroll().showSkipButton();},SC_Easyroll().skipBtnOptions.timeDisplaySkip*1000);}
SC_Easyroll().run();}function SC_startingVideoAd(){SC_Easyroll().startingVideoAd();}function SC_endVideoAd(){SC_Easyroll().endVideoAd();var adLayer=document.getElementById("smartclip");adLayer.innerHTML="";}
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();function random()
{random.seed=(random.seed*random.a+random.c)%random.m;return random.seed/random.m;}
random.m=714025;random.a=4096;random.c=150889;random.seed=(new Date()).getTime()%random.m;function _rsEH(){}
window.onerror=_rsEH;var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';var _rsND=_rsLP+_rsDN;var _rsRD=(new Date()).getTime();if(typeof(_rsCC)=="undefined"){var _rsCC=1;}
if(typeof(_rsDT)=="undefined"){var _rsDT=0;}
if(typeof(_rsSE)=="undefined"){var _rsSE=0;}
if(typeof(_rsSV)=="undefined"){var _rsSV="";}
if(typeof(_rsSM)=="undefined"){var _rsSM=0;}
if(typeof(_rsSS)=="undefined"){var _rsSS=1;}
if(typeof(_rsUT)=="undefined"){var _rsUT=0;}
if(typeof(_rsMP)=="undefined"){var _rsMP=1;}
if(typeof(_rsIP)=="undefined"){var _rsIP=0;}
if(typeof(_rsCG)=="undefined"){var _rsCG=0;}
if(typeof(_rsTC)=="undefined"){var _rsTC=500;}
if(typeof(_rsSI)=="undefined"){var _rsSI=escape(window.location);}
if(typeof(_rsCL)=="undefined"){var _rsCL=0;}
if(typeof(_rsCU)=="undefined"){var _rsCU=window.location;}
if(typeof(_rsPLfl)=="undefined"){var _rsPLfl=1;}
if(typeof(_rsPLqt)=="undefined"){var _rsPLqt=0;}
if(typeof(_rsPLre)=="undefined"){var _rsPLre=0;}
if(typeof(_rsPLwm)=="undefined"){var _rsPLwm=0;}
if(typeof(_rsPLjj)=="undefined"){var _rsPLjj=0;}
if(typeof(_rsPLac)=="undefined"){var _rsPLac=0;}
if(typeof(_rsC0)=="undefined"){var _rsC0;}
if(typeof(_rsC1)=="undefined"){var _rsC1;}
if(typeof(_rsC2)=="undefined"){var _rsC2;}
if(typeof(_rsC3)=="undefined"){var _rsC3;}
if(typeof(_rsC4)=="undefined"){var _rsC4;}
if(typeof(_rsC5)=="undefined"){var _rsC5;}
if(typeof(_rsC6)=="undefined"){var _rsC6;}
if(typeof(_rsC7)=="undefined"){var _rsC7;}
if(typeof(_rsC8)=="undefined"){var _rsC8;}
if(typeof(_rsC9)=="undefined"){var _rsC9;}
function _rsPause(_rsMillis){var _rsDate=new Date();var _rsCurrDate;do{_rsCurrDate=new Date();}while(_rsCurrDate-_rsDate<_rsMillis);}
function _rsRecordFactory(_rsClickUrl,_rsNewCG){var _rsSrc=_rsND+'cgi-bin/m?rnd='+(new Date()).getTime();_rsSrc+='&ci='+_rsCI;_rsSrc+='&cg='+escape(_rsNewCG);_rsSrc+='&cc=0';_rsSrc+='&si='+_rsCI+'-ctgw-'+escape(_rsClickUrl);_rsSrc+='&rp='+escape(window.location);if(_rsSrc.length>2048){_rsSrc=_rsSrc.substring(0,2048);}
return _rsSrc;}
function _rsEvent(_rsClickUrl){var _rsNewCG=_rsEvent.arguments.length>1?_rsEvent.arguments[1]:_rsCG;(new Image(1,1)).src=_rsRecordFactory(_rsClickUrl,_rsNewCG);}
function _rsLinkTrack(_rsClickUrl){var _rsNewCG=_rsLinkTrack.arguments.length>1?_rsLinkTrack.arguments[1]:_rsCG;var _rsClickImg=new Image(1,1);_rsClickImg.src=_rsRecordFactory(_rsClickUrl,_rsNewCG);_rsPause(_rsTC);}
var _rsClickDst;function _rsClick(_rsClickUrl){var _rsNewCG=_rsClick.arguments.length>1?_rsClick.arguments[1]:_rsCG;var _rsClickImg=new Image(1,1);_rsClickImg.src=_rsRecordFactory(_rsClickUrl,_rsNewCG);_rsClickDst=_rsClickUrl;setTimeout("window.location = _rsClickDst",_rsTC);}
function _rsVerInfo(str,ct){var p=0;var sp=0;for(var i=0;i<ct&&p>=0;i++){sp=p+1;p=str.indexOf('.',sp);}
if(p>0){var v=str.substring(sp,p).match(/\d+$/);return v?v:0;}else{return 0;}}
function _rsPluginDetect(){var _rsPlugins=[];var _rsMT=navigator.mimeTypes;if(_rsMT&&_rsMT.length>0){var k;if(_rsPLfl==1){_rsPlugins['FL']=-1;k='application/x-shockwave-flash';if(_rsMT[k]&&_rsMT[k].enabledPlugin){_rsPlugins['FL']=_rsVerInfo(_rsMT[k].enabledPlugin.description,1);}}
if(_rsPLqt==1){_rsPlugins['QT']=-1;k='video/quicktime';if(_rsMT[k]&&_rsMT[k].enabledPlugin){_rsPlugins['QT']=_rsVerInfo(_rsMT[k].enabledPlugin.name,1);}}
if(_rsPLre==1){_rsPlugins['RE']=-1;k='audio/x-pn-realaudio-plugin';if(_rsMT[k]&&_rsMT[k].enabledPlugin){_rsPlugins['RE']=0;}}
if(_rsPLwm==1){_rsPlugins['QT']=-1;var rt=true;if(window.GeckoActiveXObject){try{var p=new GeckoActiveXObject("WMPlayer.OCX.7");_rsPlugins['WM']=_rsVerInfo(p.versionInfo,1);rt=false;}catch(e){}}
if(rt){k='application/x-mplayer2';if(_rsMT[k]&&_rsMT[k].enabledPlugin){_rsPlugins['WM']=0;}}}
if(_rsPLjj==1){_rsPlugins['JJ']=-1;k='application/x-java-applet';if(_rsMT[k]&&_rsMT[k].enabledPlugin){var v=_rsVerInfo(_rsMT[k].enabledPlugin.description,2);_rsPlugins['JJ']=(v==0?v:'1.'+v);}}
if(_rsPLac==1){_rsPlugins['AC']=-1;k='application/pdf';if(_rsMT[k]&&_rsMT[k].enabledPlugin){_rsPlugins['AC']=0;}}}else if(window.ActiveXObject){var _rsP;if(_rsPLfl==1){_rsPlugins['FL']=-1;for(var i=14;i>0;i--){try{_rsP=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+i);if(_rsP!=null){_rsPlugins['FL']=i;break;}}catch(e){}}}
if(_rsPLqt==1){_rsPlugins['QT']=-1;try{_rsP=new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck.1');if(_rsP!=null){_rsPlugins['QT']=parseInt(_rsP.QuickTimeVersion.toString(16).substring(0,1));}}catch(e){}}
if(_rsPLre==1){_rsPlugins['RE']=-1;try{_rsP=new ActiveXObject('rmocx.RealPlayer G2 Control.1');if(_rsP!=null){_rsPlugins['RE']=0;}}catch(e){}}
if(_rsPLwm==1){_rsPlugins['WM']=-1;try{_rsP=new ActiveXObject('WMPlayer.OCX.7');if(_rsP!=null){_rsPlugins['WM']=_rsVerInfo(_rsP.versionInfo,1);}}catch(e){}}
if(_rsPLjj==1){_rsPlugins['JJ']=-1;try{_rsP=new ActiveXObject('JavaPlugin');if(_rsP!=null){_rsPlugins['JJ']=0;}}catch(e){}}
if(_rsPLac==1){_rsPlugins['AC']=-1;var rt=true;try{_rsP=new ActiveXObject('AcroPDF.PDF.1');if(_rsP!=null){_rsPlugins['AC']=_rsVerInfo(_rsP.GetVersions(),1);rt=false;}}catch(e){}
if(rt){for(var i=6;i>2;i--){try{_rsP=new ActiveXObject('PDF.PdfCtrl.'+i);if(_rsP!=null){_rsPlugins['AC']=i;break;}}catch(e){}}}}}
return _rsPlugins;}
function rsCi()
{var _rsUA=navigator.appName+" "+navigator.appVersion;var _rsRUA=navigator.userAgent;var _rsWS=window.screen;var _rsBV=navigator.appVersion.substring(0,1);var _rsNN=(_rsUA.indexOf('Netscape'));var _rsMC=(_rsUA.indexOf('Mac'));var _rsIE=(_rsUA.indexOf('MSIE'));var _rsOP=(_rsRUA.indexOf('Opera'));var _rsIEV=(parseInt(_rsUA.substr(_rsIE+5)));var _rsRP=escape(document.referrer);var _rsSR;var _rsCD;var _rsLG;var _rsJE;var _rsCK;var _rsTZ;var _rsCT;var _rsHP;var _rsTL;var _rsSW;var _rsSH;var _rsFL;var _rsQT;var _rsRE;var _rsWM;var _rsJJ;var _rsAC;if(_rsMP==0){return;}
_rsJE=(navigator.javaEnabled()==true)?"y":"n";if(_rsDT==1){_rsTL=escape(document.title);}
if((_rsIE>0)||((_rsNN!=-1)&&(_rsBV>=5))){_rsCK=(navigator.cookieEnabled==true)?"y":"n";}
if((_rsIE>=0)&&(_rsIEV>=5)&&(_rsMC==-1)&&(_rsOP==-1)){document.body.addBehavior("#default#clientCaps");_rsCT=document.body.connectionType;document.body.addBehavior("#default#homePage");_rsHP=(document.body.isHomePage(location.href))?"y":"n";}
var _rsD=new Date();_rsTZ=_rsD.getTimezoneOffset()/-60;if((typeof(_rsWS)!="undefined")&&(_rsWS!=null)){_rsSW=_rsWS.width;_rsSH=_rsWS.height;_rsCD=_rsWS.colorDepth;_rsSR=_rsSW+'x'+_rsSH;if((_rsNN!=-1)&&(_rsBV>=4)){_rsCD=_rsWS.pixelDepth;}}
if((_rsNN!=-1)&&(_rsBV>=4)||(_rsOP>=0)){_rsLG=navigator.language;}
if((_rsIE!=-1)&&(_rsBV>=4)&&(_rsOP==-1)){_rsLG=navigator.userLanguage;}
var _rsPlugins=_rsPluginDetect();var _rsPR="";_rsPR='<img class="inielsen" src="';_rsPR=_rsPR+_rsND+'cgi-bin/m?rnd='+(new Date()).getTime();_rsPR=_rsPR+'&ci='+_rsCI;_rsPR=_rsPR+'&cg='+escape(_rsCG);_rsPR=_rsPR+'&cc='+_rsCC;if(_rsSR!=null){_rsPR=_rsPR+'&sr='+_rsSR;}
if(_rsCD!=null){_rsPR=_rsPR+'&cd='+_rsCD;}
if(_rsLG!=null){_rsPR=_rsPR+'&lg='+_rsLG;}
if(_rsJE!=null){_rsPR=_rsPR+'&je='+_rsJE;}
if(_rsCK!=null){_rsPR=_rsPR+'&ck='+_rsCK;}
if(_rsTZ!=null){_rsPR=_rsPR+'&tz='+_rsTZ;}
if(_rsCT!=null){_rsPR=_rsPR+'&ct='+_rsCT;}
if(_rsHP!=null){_rsPR=_rsPR+'&hp='+_rsHP;}
if(_rsTL!=null){_rsPR=_rsPR+'&tl='+_rsTL;}
if(_rsUT==1){if(_rsC0!=null){_rsPR=_rsPR+'&c0='+escape(_rsC0);}
if(_rsC1!=null){_rsPR=_rsPR+'&c1='+escape(_rsC1);}
if(_rsC2!=null){_rsPR=_rsPR+'&c2='+escape(_rsC2);}
if(_rsC3!=null){_rsPR=_rsPR+'&c3='+escape(_rsC3);}
if(_rsC4!=null){_rsPR=_rsPR+'&c4='+escape(_rsC4);}
if(_rsC5!=null){_rsPR=_rsPR+'&c5='+escape(_rsC5);}
if(_rsC6!=null){_rsPR=_rsPR+'&c6='+escape(_rsC6);}
if(_rsC7!=null){_rsPR=_rsPR+'&c7='+escape(_rsC7);}
if(_rsC8!=null){_rsPR=_rsPR+'&c8='+escape(_rsC8);}
if(_rsC9!=null){_rsPR=_rsPR+'&c9='+escape(_rsC9);}}
if(_rsPlugins['FL']!=null){_rsPR=_rsPR+'&fl='+_rsPlugins['FL'];}
if(_rsPlugins['QT']!=null){_rsPR=_rsPR+'&qt='+_rsPlugins['QT'];}
if(_rsPlugins['RE']!=null){_rsPR=_rsPR+'&re='+_rsPlugins['RE'];}
if(_rsPlugins['WM']!=null){_rsPR=_rsPR+'&wm='+_rsPlugins['WM'];}
if(_rsPlugins['JJ']!=null){_rsPR=_rsPR+'&jj='+_rsPlugins['JJ'];}
if(_rsPlugins['AC']!=null){_rsPR=_rsPR+'&ac='+_rsPlugins['AC'];}
_rsPR=_rsPR+'&si='+_rsSI;_rsPR=_rsPR+'&rp='+_rsRP;if(_rsIP==1){_rsPR=_rsPR+'" style="visibility:hidden;position:absolute;left:0px;top:0px;z-index:-1';}
_rsPR=_rsPR+'" width="1" height="1" alt=""/>';document.write(_rsPR);}
function _rsCLSendIt(_rsSrc,_rsDest,_rsTargetType,_rsClickName,_rsClickValue){var _rsCLData=_rsND+'cgi-bin/m?rnd='+(new Date()).getTime();_rsCLData=_rsCLData+'&ci='+_rsCI;_rsCLData=_rsCLData+'&cg='+escape(_rsCG);_rsCLData=_rsCLData+'&cc=0';_rsCLData=_rsCLData+'&si='+_rsCI+'-ctpo-'+escape(_rsDest);_rsCLData=_rsCLData+'&rp='+escape(_rsSrc);_rsCLData=_rsCLData+'&tt='+escape(_rsTargetType);_rsCLData=_rsCLData+'&cn='+escape(_rsClickName);_rsCLData=_rsCLData+'&cv='+escape(_rsClickValue);if(_rsCLData.length>2048){_rsCLData=_rsCLData.substring(0,2048);}
var _rsPx=new Image(1,1);_rsPx.src=_rsCLData;_rsPause(_rsTC);}
function _rsCLSendALink(_rsALink){var _rsName=_rsALink.innerHTML.toLowerCase().indexOf('img')>-1?'image':'text';_rsCLSendIt(_rsCU,_rsALink.href,_rsALink.tagName.toLowerCase(),_rsName,_rsALink.innerHTML);}
function _rsCLSendForm(_rsInput){if(_rsInput.form==undefined||_rsInput.form.action==undefined){return;}
if(_rsInput.type=='image'){var _rsValue=_rsInput.src;}
else if(_rsInput.tagName=='BUTTON'){var _rsValue=_rsInput.innerHTML.replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');if(_rsValue=="")_rsValue=_rsInput.value;}
else{var _rsValue=_rsInput.value;}
_rsCLSendIt(_rsCU,_rsInput.form.action,_rsInput.form.tagName.toLowerCase(),_rsInput.type.toLowerCase(),_rsValue);}
function _rsCLCatchIt(e){var _rsCurr=e?e.target:window.event.srcElement;if((_rsCurr.tagName=='INPUT'||_rsCurr.tagName=='BUTTON')&&(_rsCurr.type=='image'||_rsCurr.type=='submit'||_rsCurr.type=='button')){_rsCLSendForm(_rsCurr);}
else
{do{if((_rsCurr.tagName=='A')&&(_rsCurr.href.length>0)){_rsCLSendALink(_rsCurr);break;}
_rsCurr=_rsCurr.parentNode;}while(_rsCurr!=null&&_rsCurr.tagName!='BODY')}}
function _rsCLRegisterIt(){if(!document.getElementById){return;}
var _rsOld=document.body.onclick;if(_rsOld){document.body.onclick=function(e){_rsCLCatchIt(e);_rsOld(e);}}
else{document.body.onclick=_rsCLCatchIt;}}
if((_rsSE)&&(random()<=_rsSM)){var _rsIM='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'cgi-bin/j?ci='+_rsCI+'&ss='+_rsSS+'&cc='+_rsCC+'&rd='+_rsRD+'&se='+_rsSE+'&sv='+_rsSV+'"><\/scr'+'ipt>';document.write(_rsIM);}
else{rsCi();}
if(_rsCL==1){_rsCLRegisterIt();}
var __reference="";var __searchme="";var __utmp="";var __medium="";function getcookie(c_name,special)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;var cookie_to_use=unescape(document.cookie.substring(c_start,c_end));if(special)
{return cookie_to_use.toLowerCase()}
return cookie_to_use;}}
return"";}
String.prototype.trim=function()
{return this.replace(/^\s*/,"").replace(/\s*$/,"");}
function matchregex(regex)
{var patt=new RegExp(regex+"=([^|]+)");if(result=patt.exec(__utmp))
{return result[1];}
return null;}
function setcookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+value+((expiredays==null)?"":";expires="+exdate.toGMTString());}
function configurecwcookie(reference)
{if(__utmc1.length=="0"&&__utmc2.length=="0")
{setcookie("__utmc1",reference,182);setcookie("__utmc2",reference,182);}
else
{var searchme=__utmc2.match(reference);var workwith=__utmc2.split("|")+"<br />";var temp=new Array();temp=__utmc2.split('|');var templength=temp.length;var latest=temp[templength-1];if(latest.trim()!=reference.trim())
{setcookie("__utmc2",__utmc2+" | "+reference,182);}}}
window['PR_SHOULD_USE_CONTINUATION']=true;window['PR_TAB_WIDTH']=8;window['PR']=window['prettyPrintOne']=window['prettyPrint']=void 0;(function(){var FLOW_CONTROL_KEYWORDS="break continue do else for if return while ";var C_KEYWORDS=FLOW_CONTROL_KEYWORDS+"auto case char const default "+"double enum extern float goto int long register short signed sizeof "+"static struct switch typedef union unsigned void volatile ";var COMMON_KEYWORDS=C_KEYWORDS+"catch class delete false import "+"new operator private protected public this throw true try typeof ";var CPP_KEYWORDS=COMMON_KEYWORDS+"alignof align_union asm axiom bool "+"concept concept_map const_cast constexpr decltype "+"dynamic_cast explicit export friend inline late_check "+"mutable namespace nullptr reinterpret_cast static_assert static_cast "+"template typeid typename using virtual wchar_t where ";var JAVA_KEYWORDS=COMMON_KEYWORDS+"abstract boolean byte extends final finally implements import "+"instanceof null native package strictfp super synchronized throws "+"transient ";var CSHARP_KEYWORDS=JAVA_KEYWORDS+"as base by checked decimal delegate descending dynamic event "+"fixed foreach from group implicit in interface internal into is lock "+"object out override orderby params partial readonly ref sbyte sealed "+"stackalloc string select uint ulong unchecked unsafe ushort var ";var COFFEE_KEYWORDS="all and by catch class else extends false finally "+"for if in is isnt loop new no not null of off on or return super then "+"true try unless until when while yes ";var JSCRIPT_KEYWORDS=COMMON_KEYWORDS+"debugger eval export function get null set undefined var with "+"Infinity NaN ";var PERL_KEYWORDS="caller delete die do dump elsif eval exit foreach for "+"goto if import last local my next no our print package redo require "+"sub undef unless until use wantarray while BEGIN END ";var PYTHON_KEYWORDS=FLOW_CONTROL_KEYWORDS+"and as assert class def del "+"elif except exec finally from global import in is lambda "+"nonlocal not or pass print raise try with yield "+"False True None ";var RUBY_KEYWORDS=FLOW_CONTROL_KEYWORDS+"alias and begin case class def"+" defined elsif end ensure false in module next nil not or redo rescue "+"retry self super then true undef unless until when yield BEGIN END ";var SH_KEYWORDS=FLOW_CONTROL_KEYWORDS+"case done elif esac eval fi "+"function in local set then until ";var ALL_KEYWORDS=(CPP_KEYWORDS+CSHARP_KEYWORDS+JSCRIPT_KEYWORDS+PERL_KEYWORDS+
PYTHON_KEYWORDS+RUBY_KEYWORDS+SH_KEYWORDS);var PR_STRING='str';var PR_KEYWORD='kwd';var PR_COMMENT='com';var PR_TYPE='typ';var PR_LITERAL='lit';var PR_PUNCTUATION='pun';var PR_PLAIN='pln';var PR_TAG='tag';var PR_DECLARATION='dec';var PR_SOURCE='src';var PR_ATTRIB_NAME='atn';var PR_ATTRIB_VALUE='atv';var PR_NOCODE='nocode';var REGEXP_PRECEDER_PATTERN=function(){var preceders=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"];var pattern='(?:^^|[+-]';for(var i=0;i<preceders.length;++i){pattern+='|'+preceders[i].replace(/([^=<>:&a-z])/g,'\\$1');}
pattern+=')\\s*';return pattern;}();function combinePrefixPatterns(regexs){var capturedGroupIndex=0;var needToFoldCase=false;var ignoreCase=false;for(var i=0,n=regexs.length;i<n;++i){var regex=regexs[i];if(regex.ignoreCase){ignoreCase=true;}else if(/[a-z]/i.test(regex.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,''))){needToFoldCase=true;ignoreCase=false;break;}}
function decodeEscape(charsetPart){if(charsetPart.charAt(0)!=='\\'){return charsetPart.charCodeAt(0);}
switch(charsetPart.charAt(1)){case'b':return 8;case't':return 9;case'n':return 0xa;case'v':return 0xb;case'f':return 0xc;case'r':return 0xd;case'u':case'x':return parseInt(charsetPart.substring(2),16)||charsetPart.charCodeAt(1);case'0':case'1':case'2':case'3':case'4':case'5':case'6':case'7':return parseInt(charsetPart.substring(1),8);default:return charsetPart.charCodeAt(1);}}
function encodeEscape(charCode){if(charCode<0x20){return(charCode<0x10?'\\x0':'\\x')+charCode.toString(16);}
var ch=String.fromCharCode(charCode);if(ch==='\\'||ch==='-'||ch==='['||ch===']'){ch='\\'+ch;}
return ch;}
function caseFoldCharset(charSet){var charsetParts=charSet.substring(1,charSet.length-1).match(new RegExp('\\\\u[0-9A-Fa-f]{4}'
+'|\\\\x[0-9A-Fa-f]{2}'
+'|\\\\[0-3][0-7]{0,2}'
+'|\\\\[0-7]{1,2}'
+'|\\\\[\\s\\S]'
+'|-'
+'|[^-\\\\]','g'));var groups=[];var ranges=[];var inverse=charsetParts[0]==='^';for(var i=inverse?1:0,n=charsetParts.length;i<n;++i){var p=charsetParts[i];switch(p){case'\\B':case'\\b':case'\\D':case'\\d':case'\\S':case'\\s':case'\\W':case'\\w':groups.push(p);continue;}
var start=decodeEscape(p);var end;if(i+2<n&&'-'===charsetParts[i+1]){end=decodeEscape(charsetParts[i+2]);i+=2;}else{end=start;}
ranges.push([start,end]);if(!(end<65||start>122)){if(!(end<65||start>90)){ranges.push([Math.max(65,start)|32,Math.min(end,90)|32]);}
if(!(end<97||start>122)){ranges.push([Math.max(97,start)&~32,Math.min(end,122)&~32]);}}}
ranges.sort(function(a,b){return(a[0]-b[0])||(b[1]-a[1]);});var consolidatedRanges=[];var lastRange=[NaN,NaN];for(var i=0;i<ranges.length;++i){var range=ranges[i];if(range[0]<=lastRange[1]+1){lastRange[1]=Math.max(lastRange[1],range[1]);}else{consolidatedRanges.push(lastRange=range);}}
var out=['['];if(inverse){out.push('^');}
out.push.apply(out,groups);for(var i=0;i<consolidatedRanges.length;++i){var range=consolidatedRanges[i];out.push(encodeEscape(range[0]));if(range[1]>range[0]){if(range[1]+1>range[0]){out.push('-');}
out.push(encodeEscape(range[1]));}}
out.push(']');return out.join('');}
function allowAnywhereFoldCaseAndRenumberGroups(regex){var parts=regex.source.match(new RegExp('(?:'
+'\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]'
+'|\\\\u[A-Fa-f0-9]{4}'
+'|\\\\x[A-Fa-f0-9]{2}'
+'|\\\\[0-9]+'
+'|\\\\[^ux0-9]'
+'|\\(\\?[:!=]'
+'|[\\(\\)\\^]'
+'|[^\\x5B\\x5C\\(\\)\\^]+'
+')','g'));var n=parts.length;var capturedGroups=[];for(var i=0,groupIndex=0;i<n;++i){var p=parts[i];if(p==='('){++groupIndex;}else if('\\'===p.charAt(0)){var decimalValue=+p.substring(1);if(decimalValue&&decimalValue<=groupIndex){capturedGroups[decimalValue]=-1;}}}
for(var i=1;i<capturedGroups.length;++i){if(-1===capturedGroups[i]){capturedGroups[i]=++capturedGroupIndex;}}
for(var i=0,groupIndex=0;i<n;++i){var p=parts[i];if(p==='('){++groupIndex;if(capturedGroups[groupIndex]===undefined){parts[i]='(?:';}}else if('\\'===p.charAt(0)){var decimalValue=+p.substring(1);if(decimalValue&&decimalValue<=groupIndex){parts[i]='\\'+capturedGroups[groupIndex];}}}
for(var i=0,groupIndex=0;i<n;++i){if('^'===parts[i]&&'^'!==parts[i+1]){parts[i]='';}}
if(regex.ignoreCase&&needToFoldCase){for(var i=0;i<n;++i){var p=parts[i];var ch0=p.charAt(0);if(p.length>=2&&ch0==='['){parts[i]=caseFoldCharset(p);}else if(ch0!=='\\'){parts[i]=p.replace(/[a-zA-Z]/g,function(ch){var cc=ch.charCodeAt(0);return'['+String.fromCharCode(cc&~32,cc|32)+']';});}}}
return parts.join('');}
var rewritten=[];for(var i=0,n=regexs.length;i<n;++i){var regex=regexs[i];if(regex.global||regex.multiline){throw new Error(''+regex);}
rewritten.push('(?:'+allowAnywhereFoldCaseAndRenumberGroups(regex)+')');}
return new RegExp(rewritten.join('|'),ignoreCase?'gi':'g');}
function extractSourceSpans(node){var nocode=/(?:^|\s)nocode(?:\s|$)/;var chunks=[];var length=0;var spans=[];var k=0;var whitespace;if(node.currentStyle){whitespace=node.currentStyle.whiteSpace;}else if(window.getComputedStyle){whitespace=document.defaultView.getComputedStyle(node,null).getPropertyValue('white-space');}
var isPreformatted=whitespace&&'pre'===whitespace.substring(0,3);function walk(node){switch(node.nodeType){case 1:if(nocode.test(node.className)){return;}
for(var child=node.firstChild;child;child=child.nextSibling){walk(child);}
var nodeName=node.nodeName;if('BR'===nodeName||'LI'===nodeName){chunks[k]='\n';spans[k<<1]=length++;spans[(k++<<1)|1]=node;}
break;case 3:case 4:var text=node.nodeValue;if(text.length){if(!isPreformatted){text=text.replace(/[ \t\r\n]+/g,' ');}else{text=text.replace(/\r\n?/g,'\n');}
chunks[k]=text;spans[k<<1]=length;length+=text.length;spans[(k++<<1)|1]=node;}
break;}}
walk(node);return{source:chunks.join('').replace(/\n$/,''),spans:spans};}
function appendDecorations(basePos,sourceCode,langHandler,out){if(!sourceCode){return;}
var job={source:sourceCode,basePos:basePos};langHandler(job);out.push.apply(out,job.decorations);}
function createSimpleLexer(shortcutStylePatterns,fallthroughStylePatterns){var shortcuts={};var tokenizer;(function(){var allPatterns=shortcutStylePatterns.concat(fallthroughStylePatterns);var allRegexs=[];var regexKeys={};for(var i=0,n=allPatterns.length;i<n;++i){var patternParts=allPatterns[i];var shortcutChars=patternParts[3];if(shortcutChars){for(var c=shortcutChars.length;--c>=0;){shortcuts[shortcutChars.charAt(c)]=patternParts;}}
var regex=patternParts[1];var k=''+regex;if(!regexKeys.hasOwnProperty(k)){allRegexs.push(regex);regexKeys[k]=null;}}
allRegexs.push(/[\0-\uffff]/);tokenizer=combinePrefixPatterns(allRegexs);})();var nPatterns=fallthroughStylePatterns.length;var notWs=/\S/;var decorate=function(job){var sourceCode=job.source,basePos=job.basePos;var decorations=[basePos,PR_PLAIN];var pos=0;var tokens=sourceCode.match(tokenizer)||[];var styleCache={};for(var ti=0,nTokens=tokens.length;ti<nTokens;++ti){var token=tokens[ti];var style=styleCache[token];var match=void 0;var isEmbedded;if(typeof style==='string'){isEmbedded=false;}else{var patternParts=shortcuts[token.charAt(0)];if(patternParts){match=token.match(patternParts[1]);style=patternParts[0];}else{for(var i=0;i<nPatterns;++i){patternParts=fallthroughStylePatterns[i];match=token.match(patternParts[1]);if(match){style=patternParts[0];break;}}
if(!match){style=PR_PLAIN;}}
isEmbedded=style.length>=5&&'lang-'===style.substring(0,5);if(isEmbedded&&!(match&&typeof match[1]==='string')){isEmbedded=false;style=PR_SOURCE;}
if(!isEmbedded){styleCache[token]=style;}}
var tokenStart=pos;pos+=token.length;if(!isEmbedded){decorations.push(basePos+tokenStart,style);}else{var embeddedSource=match[1];var embeddedSourceStart=token.indexOf(embeddedSource);var embeddedSourceEnd=embeddedSourceStart+embeddedSource.length;if(match[2]){embeddedSourceEnd=token.length-match[2].length;embeddedSourceStart=embeddedSourceEnd-embeddedSource.length;}
var lang=style.substring(5);appendDecorations(basePos+tokenStart,token.substring(0,embeddedSourceStart),decorate,decorations);appendDecorations(basePos+tokenStart+embeddedSourceStart,embeddedSource,langHandlerForExtension(lang,embeddedSource),decorations);appendDecorations(basePos+tokenStart+embeddedSourceEnd,token.substring(embeddedSourceEnd),decorate,decorations);}}
job.decorations=decorations;};return decorate;}
function sourceDecorator(options){var shortcutStylePatterns=[],fallthroughStylePatterns=[];if(options['tripleQuotedStrings']){shortcutStylePatterns.push([PR_STRING,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,'\'"']);}else if(options['multiLineStrings']){shortcutStylePatterns.push([PR_STRING,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,'\'"`']);}else{shortcutStylePatterns.push([PR_STRING,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,'"\'']);}
if(options['verbatimStrings']){fallthroughStylePatterns.push([PR_STRING,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);}
var hc=options['hashComments'];if(hc){if(options['cStyleComments']){if(hc>1){shortcutStylePatterns.push([PR_COMMENT,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,'#']);}else{shortcutStylePatterns.push([PR_COMMENT,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,'#']);}
fallthroughStylePatterns.push([PR_STRING,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null]);}else{shortcutStylePatterns.push([PR_COMMENT,/^#[^\r\n]*/,null,'#']);}}
if(options['cStyleComments']){fallthroughStylePatterns.push([PR_COMMENT,/^\/\/[^\r\n]*/,null]);fallthroughStylePatterns.push([PR_COMMENT,/^\/\*[\s\S]*?(?:\*\/|$)/,null]);}
if(options['regexLiterals']){var REGEX_LITERAL=('/(?=[^/*])'
+'(?:[^/\\x5B\\x5C]'
+'|\\x5C[\\s\\S]'
+'|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+'
+'/');fallthroughStylePatterns.push(['lang-regex',new RegExp('^'+REGEXP_PRECEDER_PATTERN+'('+REGEX_LITERAL+')')]);}
var keywords=options['keywords'].replace(/^\s+|\s+$/g,'');if(keywords.length){fallthroughStylePatterns.push([PR_KEYWORD,new RegExp('^(?:'+keywords.replace(/\s+/g,'|')+')\\b'),null]);}
shortcutStylePatterns.push([PR_PLAIN,/^\s+/,null,' \r\n\t\xA0']);fallthroughStylePatterns.push([PR_LITERAL,/^@[a-z_$][a-z_$@0-9]*/i,null],[PR_TYPE,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,null],[PR_PLAIN,/^[a-z_$][a-z_$@0-9]*/i,null],[PR_LITERAL,new RegExp('^(?:'
+'0x[a-f0-9]+'
+'|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
+'(?:e[+\\-]?\\d+)?'
+')'
+'[a-z]*','i'),null,'0123456789'],[PR_PLAIN,/^\\[\s\S]?/,null],[PR_PUNCTUATION,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return createSimpleLexer(shortcutStylePatterns,fallthroughStylePatterns);}
var decorateSource=sourceDecorator({'keywords':ALL_KEYWORDS,'hashComments':true,'cStyleComments':true,'multiLineStrings':true,'regexLiterals':true});function numberLines(node,opt_startLineNum){var nocode=/(?:^|\s)nocode(?:\s|$)/;var lineBreak=/\r\n?|\n/;var document=node.ownerDocument;var whitespace;if(node.currentStyle){whitespace=node.currentStyle.whiteSpace;}else if(window.getComputedStyle){whitespace=document.defaultView.getComputedStyle(node,null).getPropertyValue('white-space');}
var isPreformatted=whitespace&&'pre'===whitespace.substring(0,3);var li=document.createElement('LI');while(node.firstChild){li.appendChild(node.firstChild);}
var listItems=[li];function walk(node){switch(node.nodeType){case 1:if(nocode.test(node.className)){break;}
if('BR'===node.nodeName){breakAfter(node);if(node.parentNode){node.parentNode.removeChild(node);}}else{for(var child=node.firstChild;child;child=child.nextSibling){walk(child);}}
break;case 3:case 4:if(isPreformatted){var text=node.nodeValue;var match=text.match(lineBreak);if(match){var firstLine=text.substring(0,match.index);node.nodeValue=firstLine;var tail=text.substring(match.index+match[0].length);if(tail){var parent=node.parentNode;parent.insertBefore(document.createTextNode(tail),node.nextSibling);}
breakAfter(node);if(!firstLine){node.parentNode.removeChild(node);}}}
break;}}
function breakAfter(lineEndNode){while(!lineEndNode.nextSibling){lineEndNode=lineEndNode.parentNode;if(!lineEndNode){return;}}
function breakLeftOf(limit,copy){var rightSide=copy?limit.cloneNode(false):limit;var parent=limit.parentNode;if(parent){var parentClone=breakLeftOf(parent,1);var next=limit.nextSibling;parentClone.appendChild(rightSide);for(var sibling=next;sibling;sibling=next){next=sibling.nextSibling;parentClone.appendChild(sibling);}}
return rightSide;}
var copiedListItem=breakLeftOf(lineEndNode.nextSibling,0);for(var parent;(parent=copiedListItem.parentNode)&&parent.nodeType===1;){copiedListItem=parent;}
listItems.push(copiedListItem);}
for(var i=0;i<listItems.length;++i){walk(listItems[i]);}
if(opt_startLineNum===(opt_startLineNum|0)){listItems[0].setAttribute('value',opt_startLineNum);}
var ol=document.createElement('OL');ol.className='linenums';var offset=Math.max(0,((opt_startLineNum-1))|0)||0;for(var i=0,n=listItems.length;i<n;++i){li=listItems[i];li.className='L'+((i+offset)%10);if(!li.firstChild){li.appendChild(document.createTextNode('\xA0'));}
ol.appendChild(li);}
node.appendChild(ol);}
function recombineTagsAndDecorations(job){var isIE=/\bMSIE\b/.test(navigator.userAgent);var newlineRe=/\n/g;var source=job.source;var sourceLength=source.length;var sourceIndex=0;var spans=job.spans;var nSpans=spans.length;var spanIndex=0;var decorations=job.decorations;var nDecorations=decorations.length;var decorationIndex=0;var decPos=0;for(var i=0;i<nDecorations;){var startPos=decorations[i];var start=i;while(start+2<nDecorations&&decorations[start+2]===startPos){start+=2;}
var startDec=decorations[start+1];var end=start+2;while(end+2<=nDecorations&&(decorations[end+1]===startDec||decorations[end]===decorations[end+2])){end+=2;}
decorations[decPos++]=startPos;decorations[decPos++]=startDec;i=end;}
if(decPos&&decorations[decPos-2]===sourceLength){decPos-=2;}
nDecorations=decorations.length=decPos;var decoration=null;while(spanIndex<nSpans){var spanStart=spans[spanIndex];var spanEnd=spans[spanIndex+2]||sourceLength;var decStart=decorations[decorationIndex];var decEnd=decorations[decorationIndex+2]||sourceLength;var end=Math.min(spanEnd,decEnd);var textNode=spans[spanIndex+1];if(textNode.nodeType!==1){var styledText=source.substring(sourceIndex,end);if(isIE){styledText=styledText.replace(newlineRe,'\r');}
textNode.nodeValue=styledText;var document=textNode.ownerDocument;var span=document.createElement('SPAN');span.className=decorations[decorationIndex+1];var parentNode=textNode.parentNode;parentNode.replaceChild(span,textNode);span.appendChild(textNode);if(sourceIndex<spanEnd){spans[spanIndex+1]=textNode=document.createTextNode(source.substring(end,spanEnd));parentNode.insertBefore(textNode,span.nextSibling);}}
sourceIndex=end;if(sourceIndex>=spanEnd){spanIndex+=2;}
if(sourceIndex>=decEnd){decorationIndex+=2;}}}
var langHandlerRegistry={};function registerLangHandler(handler,fileExtensions){for(var i=fileExtensions.length;--i>=0;){var ext=fileExtensions[i];if(!langHandlerRegistry.hasOwnProperty(ext)){langHandlerRegistry[ext]=handler;}else if('console'in window){console['warn']('cannot override language handler %s',ext);}}}
function langHandlerForExtension(extension,source){if(!(extension&&langHandlerRegistry.hasOwnProperty(extension))){extension=/^\s*</.test(source)?'default-markup':'default-code';}
return langHandlerRegistry[extension];}
registerLangHandler(decorateSource,['default-code']);registerLangHandler(createSimpleLexer([],[[PR_PLAIN,/^[^<?]+/],[PR_DECLARATION,/^<!\w[^>]*(?:>|$)/],[PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],['lang-',/^<\?([\s\S]+?)(?:\?>|$)/],['lang-',/^<%([\s\S]+?)(?:%>|$)/],[PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],['lang-',/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],['lang-js',/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],['lang-css',/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],['lang-in.tag',/^(<\/?[a-z][^<>]*>)/i]]),['default-markup','htm','html','mxml','xhtml','xml','xsl']);registerLangHandler(createSimpleLexer([[PR_PLAIN,/^[\s]+/,null,' \t\r\n'],[PR_ATTRIB_VALUE,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,'\"\'']],[[PR_TAG,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[PR_ATTRIB_NAME,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],['lang-uq.val',/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[PR_PUNCTUATION,/^[=<>\/]+/],['lang-js',/^on\w+\s*=\s*\"([^\"]+)\"/i],['lang-js',/^on\w+\s*=\s*\'([^\']+)\'/i],['lang-js',/^on\w+\s*=\s*([^\"\'>\s]+)/i],['lang-css',/^style\s*=\s*\"([^\"]+)\"/i],['lang-css',/^style\s*=\s*\'([^\']+)\'/i],['lang-css',/^style\s*=\s*([^\"\'>\s]+)/i]]),['in.tag']);registerLangHandler(createSimpleLexer([],[[PR_ATTRIB_VALUE,/^[\s\S]+/]]),['uq.val']);registerLangHandler(sourceDecorator({'keywords':CPP_KEYWORDS,'hashComments':true,'cStyleComments':true}),['c','cc','cpp','cxx','cyc','m']);registerLangHandler(sourceDecorator({'keywords':'null true false'}),['json']);registerLangHandler(sourceDecorator({'keywords':CSHARP_KEYWORDS,'hashComments':true,'cStyleComments':true,'verbatimStrings':true}),['cs']);registerLangHandler(sourceDecorator({'keywords':JAVA_KEYWORDS,'cStyleComments':true}),['java']);registerLangHandler(sourceDecorator({'keywords':SH_KEYWORDS,'hashComments':true,'multiLineStrings':true}),['bsh','csh','sh']);registerLangHandler(sourceDecorator({'keywords':PYTHON_KEYWORDS,'hashComments':true,'multiLineStrings':true,'tripleQuotedStrings':true}),['cv','py']);registerLangHandler(sourceDecorator({'keywords':PERL_KEYWORDS,'hashComments':true,'multiLineStrings':true,'regexLiterals':true}),['perl','pl','pm']);registerLangHandler(sourceDecorator({'keywords':RUBY_KEYWORDS,'hashComments':true,'multiLineStrings':true,'regexLiterals':true}),['rb']);registerLangHandler(sourceDecorator({'keywords':JSCRIPT_KEYWORDS,'cStyleComments':true,'regexLiterals':true}),['js']);registerLangHandler(sourceDecorator({'keywords':COFFEE_KEYWORDS,'hashComments':3,'cStyleComments':true,'multilineStrings':true,'tripleQuotedStrings':true,'regexLiterals':true}),['coffee']);registerLangHandler(createSimpleLexer([],[[PR_STRING,/^[\s\S]+/]]),['regex']);function applyDecorator(job){var opt_langExtension=job.langExtension;try{var sourceAndSpans=extractSourceSpans(job.sourceNode);var source=sourceAndSpans.source;job.source=source;job.spans=sourceAndSpans.spans;job.basePos=0;langHandlerForExtension(opt_langExtension,source)(job);recombineTagsAndDecorations(job);}catch(e){if('console'in window){console['log'](e&&e['stack']?e['stack']:e);}}}
function prettyPrintOne(sourceCodeHtml,opt_langExtension,opt_numberLines){var container=document.createElement('PRE');container.innerHTML=sourceCodeHtml;if(opt_numberLines){numberLines(container,opt_numberLines);}
var job={langExtension:opt_langExtension,numberLines:opt_numberLines,sourceNode:container};applyDecorator(job);return container.innerHTML;}
function prettyPrint(opt_whenDone){function byTagName(tn){return document.getElementsByTagName(tn);}
var codeSegments=[byTagName('pre'),byTagName('code'),byTagName('xmp')];var elements=[];for(var i=0;i<codeSegments.length;++i){for(var j=0,n=codeSegments[i].length;j<n;++j){elements.push(codeSegments[i][j]);}}
codeSegments=null;var clock=Date;if(!clock['now']){clock={'now':function(){return(new Date).getTime();}};}
var k=0;var prettyPrintingJob;function doWork(){var endTime=(window['PR_SHOULD_USE_CONTINUATION']?clock.now()+250:Infinity);for(;k<elements.length&&clock.now()<endTime;k++){var cs=elements[k];if(cs.className&&cs.className.indexOf('prettyprint')>=0){var langExtension=cs.className.match(/\blang-(\w+)\b/);if(langExtension){langExtension=langExtension[1];}
var nested=false;for(var p=cs.parentNode;p;p=p.parentNode){if((p.tagName==='pre'||p.tagName==='code'||p.tagName==='xmp')&&p.className&&p.className.indexOf('prettyprint')>=0){nested=true;break;}}
if(!nested){var lineNums=cs.className.match(/\blinenums\b(?::(\d+))?/);lineNums=lineNums?lineNums[1]&&lineNums[1].length?+lineNums[1]:true:false;if(lineNums){numberLines(cs,lineNums);}
prettyPrintingJob={langExtension:langExtension,sourceNode:cs,numberLines:lineNums};applyDecorator(prettyPrintingJob);}}}
if(k<elements.length){setTimeout(doWork,250);}else if(opt_whenDone){opt_whenDone();}}
doWork();}
window['prettyPrintOne']=prettyPrintOne;window['prettyPrint']=prettyPrint;window['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':registerLangHandler,'sourceDecorator':sourceDecorator,'PR_ATTRIB_NAME':PR_ATTRIB_NAME,'PR_ATTRIB_VALUE':PR_ATTRIB_VALUE,'PR_COMMENT':PR_COMMENT,'PR_DECLARATION':PR_DECLARATION,'PR_KEYWORD':PR_KEYWORD,'PR_LITERAL':PR_LITERAL,'PR_NOCODE':PR_NOCODE,'PR_PLAIN':PR_PLAIN,'PR_PUNCTUATION':PR_PUNCTUATION,'PR_SOURCE':PR_SOURCE,'PR_STRING':PR_STRING,'PR_TAG':PR_TAG,'PR_TYPE':PR_TYPE};})();;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);(function($){$.fn.extend({counter:function(options){var defaults={type:'char',count:'down',goal:140,countercss:'',before:$(this)};var options=$.extend({},defaults,options);var flag=false;return this.each(function(){var msg;var $obj=$(this);function get_msg_equation(objLength){if(typeof options.type!=='string'){}else{switch(options.type){case'char':if(options.count==='down'){msg=" character(s) left";return(options.goal-objLength);}
else if(options.count==='up'){msg=" characters ("+options.goal+" max)";return objLength;}
break;case'word':if(options.count==='down'){msg=" word(s) left";return(options.goal-objLength);}
else if(options.count==='up'){msg=" words ("+options.goal+" max)";return objLength;}
break;default:}}}
$('<div id=\"'+this.id+'_counter\" class=\"'+options.countercss+'\" title=\"Caracteres disponibles\"><span>'+get_msg_equation($($obj).val().length)+'</span></div>').insertBefore(options.before);var $currentCount=$("#"+this.id+"_counter"+" span");$obj.bind('keyup click blur focus change paste',function(new_length){switch(options.type){case'char':new_length=$($obj).val().length;break;case'word':if($obj.val()===''){new_length=0;}
else{new_length=$.trim($obj.val()).replace(/\s+/g," ").split(' ').length;}
break;default:}
switch(options.count){case'up':if(get_msg_equation(new_length)>=options.goal&&options.type==='char'){$(this).val($(this).val().substring(0,options.goal));flag=true;break;}
if(get_msg_equation(new_length)===options.goal&&options.type==='word'){flag=true;break;}else if(get_msg_equation(new_length)>options.goal&&options.type==='word'){$(this).val("");$currentCount.text("0");flag=true;break;}
break;case'down':if(this.id=="campaign_pregunta"){var sbutton="campaign_enviar";var firstSpan='#ask-commercial-step1 span.mhelp:first';var spanAddColor='1.2em';var spanRemoveColor='8pt';}else{var sbutton="enviar";var firstSpan='#ask-step1 span.mhelp:first';var spanAddColor='1.4em';var spanRemoveColor='0.94em';}
if(new_length<=0||get_msg_equation(new_length)<0){$('#'+sbutton).addClass('disabled');$('#'+sbutton).attr("disabled",true);}
if(get_msg_equation(new_length)<0){$("#"+this.id+"_counter").addClass('mchar-overflow');$(firstSpan).addClass("mwarning");$(firstSpan).css("color","#990000");$(firstSpan).css("font-size",spanAddColor);if($('.post-related-qa .mform span.mhelp:first').length!=0){$('.post-related-qa .mform span.mhelp:first').addClass("mwarning");$('.post-related-qa .mform span.mhelp:first').css('display','block');}}
if(new_length>0&&get_msg_equation(new_length)>=0){$('#'+sbutton).removeClass('disabled');$('#'+sbutton).attr("disabled",false);}
if(get_msg_equation(new_length)>=0){$("#"+this.id+"_counter").removeClass('mchar-overflow');$(firstSpan).removeClass("mwarning");$(firstSpan).css("color","#666666");$(firstSpan).css("font-size",spanRemoveColor);if($('.post-related-qa .mform span.mhelp:first').length!=0){$('.post-related-qa .mform span.mhelp:first').removeClass("mwarning");$('.post-related-qa .mform span.mhelp:first').css('display','none');}}
if(get_msg_equation(new_length)===0&&options.type==='word'){flag=true;}else if(get_msg_equation(new_length)<0&&options.type==='word'){$(this).val("");flag=true;break;}
break;default:}
$obj.keydown(function(event){if(flag){this.focus();if((event.keyCode!==46&&event.keyCode!==8)){if($(this).val().length>options.goal&&options.type==='char'){$(this).val($(this).val().substring(0,options.goal));return false;}else if(event.keyCode!==32&&event.keyCode!==8&&options.type==='word'){return true;}else{return false;}}else{flag=false;return true;}}});$currentCount.text(get_msg_equation(new_length));});});}});})
(jQuery);(function($){$.fn.jcarousel=function(o){return this.each(function(){new $jc(this,o);});};var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:'normal',easing:'swing',auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:'<div></div>',buttonPrevHTML:'<div></div>',buttonNextEvent:'click',buttonPrevEvent:'click',buttonNextCallback:null,buttonPrevCallback:null};$.jcarousel=function(e,o){this.options=$.extend({},defaults,o||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?'width':'height';this.lt=!this.options.vertical?'left':'top';var skin='',split=e.className.split(' ');for(var i=0;i<split.length;i++){if(split[i].indexOf('jcarousel-skin')!=-1){$(e).removeClass(split[i]);var skin=split[i];break;}}
if(e.nodeName=='UL'||e.nodeName=='OL'){this.list=$(e);this.container=this.list.parent();if(this.container.hasClass('jcarousel-clip')){if(!this.container.parent().hasClass('jcarousel-container'))
this.container=this.container.wrap('<div></div>');this.container=this.container.parent();}else if(!this.container.hasClass('jcarousel-container'))
this.container=this.list.wrap('<div></div>').parent();}else{this.container=$(e);this.list=$(e).find('>ul,>ol,div>ul,div>ol');}
if(skin!=''&&this.container.parent()[0].className.indexOf('jcarousel-skin')==-1)
this.container.wrap('<div class=" '+skin+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass('jcarousel-clip'))
this.clip=this.list.wrap('<div></div>').parent();this.buttonPrev=$('.jcarousel-prev',this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)
this.buttonPrev=this.clip.before(this.options.buttonPrevHTML).prev();this.buttonPrev.addClass(this.className('jcarousel-prev'));this.buttonNext=$('.jcarousel-next',this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)
this.buttonNext=this.clip.before(this.options.buttonNextHTML).prev();this.buttonNext.addClass(this.className('jcarousel-next'));this.clip.addClass(this.className('jcarousel-clip'));this.list.addClass(this.className('jcarousel-list'));this.container.addClass(this.className('jcarousel-container'));var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var li=this.list.children('li');var self=this;if(li.size()>0){var wh=0,i=this.options.offset;li.each(function(){self.format(this,i++);wh+=self.dimension(this,di);});this.list.css(this.wh,wh+'px');if(!o||o.size===undefined)
this.options.size=li.size();}
this.container.css('display','block');this.buttonNext.css('display','block');this.buttonPrev.css('display','block');this.funcNext=function(){self.next();};this.funcPrev=function(){self.prev();};this.funcResize=function(){self.reload();};if(this.options.initCallback!=null)
this.options.initCallback(this,'init');if($.browser.safari){this.buttons(false,false);$(window).bind('load',function(){self.setup();});}else
this.setup();};var $jc=$.jcarousel;$jc.fn=$jc.prototype={jcarousel:'0.2.3'};$jc.fn.extend=$jc.extend=$.extend;$jc.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked)
return;this.list.css(this.lt,this.pos(this.options.offset)+'px');var p=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(p,false);$(window).unbind('resize',this.funcResize).bind('resize',this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,'0px');this.list.css(this.wh,'10px');if(this.options.initCallback!=null)
this.options.initCallback(this,'reset');this.setup();},reload:function(){if(this.tail!=null&&this.inTail)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null)
this.options.reloadCallback(this);if(this.options.visible!=null){var self=this;var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;$('li',this.list).each(function(i){wh+=self.dimension(this,di);if(i+1<self.first)
lt=wh;});this.list.css(this.wh,wh+'px');this.list.css(this.lt,-lt+'px');}
this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(s){if(s!=undefined){this.options.size=s;if(!this.locked)
this.buttons();}
return this.options.size;},has:function(i,i2){if(i2==undefined||!i2)
i2=i;if(this.options.size!==null&&i2>this.options.size)
i2=this.options.size;for(var j=i;j<=i2;j++){var e=this.get(j);if(!e.length||e.hasClass('jcarousel-item-placeholder'))
return false;}
return true;},get:function(i){return $('.jcarousel-item-'+i,this.list);},add:function(i,s){var e=this.get(i),old=0,add=0;if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);break;}}}else
old=this.dimension(e);e.removeClass(this.className('jcarousel-item-placeholder'));typeof s=='string'?e.html(s):e.empty().append(s);var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var wh=this.dimension(e,di)-old;if(i>0&&i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+'px');this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+'px');return e;},remove:function(i){var e=this.get(i);if(!e.length||(i>=this.first&&i<=this.last))
return;var d=this.dimension(e);if(i<this.first)
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+'px');e.remove();this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+'px');},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail)
this.scrollTail(false);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='last')&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail)
this.scrollTail(true);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='first')&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);},scrollTail:function(b){if(this.locked||this.animating||!this.tail)
return;var pos=$jc.intval(this.list.css(this.lt));!b?pos-=this.tail:pos+=this.tail;this.inTail=!b;this.prevFirst=this.first;this.prevLast=this.last;this.animate(pos);},scroll:function(i,a){if(this.locked||this.animating)
return;this.animate(this.pos(i),a);},pos:function(i){if(this.locked||this.animating)
return;if(this.options.wrap!='circular')
i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i);var back=this.first>i;var pos=$jc.intval(this.list.css(this.lt));var f=this.options.wrap!='circular'&&this.first<=1?1:this.first;var c=back?this.get(f):this.get(this.last);var j=back?f:f-1;var e=null,l=0,p=false,d=0;while(back?--j>=i:++j<i){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c[back?'before':'after'](e);}
c=e;d=this.dimension(e);if(p)
l+=d;if(this.first!=null&&(this.options.wrap=='circular'||(j>=1&&(this.options.size==null||j<=this.options.size))))
pos=back?pos+d:pos-d;}
var clipping=this.clipping();var cache=[];var visible=0,j=i,v=0;var c=this.get(i-1);while(++visible){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c.length==0?this.list.prepend(e):c[back?'before':'after'](e);}
c=e;var d=this.dimension(e);if(d==0){alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');return 0;}
if(this.options.wrap!='circular'&&this.options.size!==null&&j>this.options.size)
cache.push(e);else if(p)
l+=d;v+=d;if(v>=clipping)
break;j++;}
for(var x=0;x<cache.length;x++)
cache[x].remove();if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+'px');if(back){pos-=l;this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+'px');}}
var last=i+visible-1;if(this.options.wrap!='circular'&&this.options.size&&last>this.options.size)
last=this.options.size;if(j>last){visible=0,j=last,v=0;while(++visible){var e=this.get(j--);if(!e.length)
break;v+=this.dimension(e);if(v>=clipping)
break;}}
var first=last-visible+1;if(this.options.wrap!='circular'&&first<1)
first=1;if(this.inTail&&back){pos+=this.tail;this.inTail=false;}
this.tail=null;if(this.options.wrap!='circular'&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?'marginRight':'marginBottom');if((v-m)>clipping)
this.tail=v-clipping-m;}
while(i-->first)
pos+=this.dimension(this.get(i));this.prevFirst=this.first;this.prevLast=this.last;this.first=first;this.last=last;return pos;},animate:function(p,a){if(this.locked||this.animating)
return;this.animating=true;var self=this;var scrolled=function(){self.animating=false;if(p==0)
self.list.css(self.lt,0);if(self.options.wrap=='both'||self.options.wrap=='last'||self.options.size==null||self.last<self.options.size)
self.startAuto();self.buttons();self.notify('onAfterAnimation');};this.notify('onBeforeAnimation');if(!this.options.animation||a==false){this.list.css(this.lt,p+'px');scrolled();}else{var o=!this.options.vertical?{'left':p}:{'top':p};this.list.animate(o,this.options.animation,this.options.easing,scrolled);}},startAuto:function(s){if(s!=undefined)
this.options.auto=s;if(this.options.auto==0)
return this.stopAuto();if(this.timer!=null)
return;var self=this;this.timer=setTimeout(function(){self.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null)
return;clearTimeout(this.timer);this.timer=null;},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='first')||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=='first')&&this.options.size!=null&&this.last>=this.options.size)
n=this.tail!=null&&!this.inTail;}
if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='last')||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=='last')&&this.options.size!=null&&this.first==1)
p=this.tail!=null&&this.inTail;}
var self=this;this.buttonNext[n?'bind':'unbind'](this.options.buttonNextEvent,this.funcNext)[n?'removeClass':'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',n?false:true);this.buttonPrev[p?'bind':'unbind'](this.options.buttonPrevEvent,this.funcPrev)[p?'removeClass':'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',p?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n);});this.buttonNext[0].jcarouselstate=n;}
if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p);});this.buttonPrev[0].jcarouselstate=p;}},notify:function(evt){var state=this.prevFirst==null?'init':(this.prevFirst<this.first?'next':'prev');this.callback('itemLoadCallback',evt,state);if(this.prevFirst!==this.first){this.callback('itemFirstInCallback',evt,state,this.first);this.callback('itemFirstOutCallback',evt,state,this.prevFirst);}
if(this.prevLast!==this.last){this.callback('itemLastInCallback',evt,state,this.last);this.callback('itemLastOutCallback',evt,state,this.prevLast);}
this.callback('itemVisibleInCallback',evt,state,this.first,this.last,this.prevFirst,this.prevLast);this.callback('itemVisibleOutCallback',evt,state,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!='object'&&evt!='onAfterAnimation'))
return;var callback=typeof this.options[cb]=='object'?this.options[cb][evt]:this.options[cb];if(!$.isFunction(callback))
return;var self=this;if(i1===undefined)
callback(self,state,evt);else if(i2===undefined)
this.get(i1).each(function(){callback(self,this,i1,state,evt);});else{for(var i=i1;i<=i2;i++)
if(i!==null&&!(i>=i3&&i<=i4))
this.get(i).each(function(){callback(self,this,i,state,evt);});}},create:function(i){return this.format('<li></li>',i);},format:function(e,i){var $e=$(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'+i));$e.attr('jcarouselindex',i);return $e;},className:function(c){return c+' '+c+(!this.options.vertical?'-horizontal':'-vertical');},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,'marginLeft')+$jc.margin(el,'marginRight'):el.offsetHeight+$jc.margin(el,'marginTop')+$jc.margin(el,'marginBottom');if(d==undefined||old==d)
return old;var w=!this.options.vertical?d-$jc.margin(el,'marginLeft')-$jc.margin(el,'marginRight'):d-$jc.margin(el,'marginTop')-$jc.margin(el,'marginBottom');$(el).css(this.wh,w+'px');return this.dimension(el);},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css('borderLeftWidth'))-$jc.intval(this.clip.css('borderRightWidth')):this.clip[0].offsetHeight-$jc.intval(this.clip.css('borderTopWidth'))-$jc.intval(this.clip.css('borderBottomWidth'));},index:function(i,s){if(s==undefined)
s=this.options.size;return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1;}});$jc.extend({defaults:function(d){return $.extend(defaults,d||{});},margin:function(e,p){if(!e)
return 0;var el=e.jquery!=undefined?e[0]:e;if(p=='marginRight'&&$.browser.safari){var old={'display':'block','float':'none','width':'auto'},oWidth,oWidth2;$.swap(el,old,function(){oWidth=el.offsetWidth;});old['marginRight']=0;$.swap(el,old,function(){oWidth2=el.offsetWidth;});return oWidth2-oWidth;}
return $jc.intval($.css(el,p));},intval:function(v){v=parseInt(v);return isNaN(v)?0:v;}});})(jQuery);(function($){$.timeago=function(timestamp){if(timestamp instanceof Date)return inWords(timestamp);else if(typeof timestamp=="string")return inWords($.timeago.parse(timestamp));else return inWords($.timeago.datetime(timestamp));};var $t=$.timeago;$.extend($.timeago,{settings:{refreshMillis:60000,allowFuture:true,strings:{prefixAgo:"atrás",prefixFromNow:"a partir de agora",suffixAgo:"",suffixFromNow:"",seconds:"menos de um minuto",minute:"cerca de um minuto",minutes:"unos %d minutos",hour:"cerca de uma hora",hours:"cerca de %d horas",day:"um dia",days:"%d dias",week:"una semana",weeks:"%d semanas",month:"cerca de um mês",months:"%d meses",year:"um ano",years:"%d anos",numbers:[]}},inWords:function(distanceMillis){var $l=this.settings.strings;var prefix=$l.prefixAgo;var suffix=$l.suffixAgo;if(this.settings.allowFuture){if(distanceMillis<0){prefix=$l.prefixFromNow;suffix=$l.suffixFromNow;}
distanceMillis=Math.abs(distanceMillis);}
var seconds=distanceMillis/1000;var minutes=seconds/60;var hours=minutes/60;var days=hours/24;var years=days/365;function substitute(stringOrFunction,number){var string=$.isFunction(stringOrFunction)?stringOrFunction(number):stringOrFunction;var value=($l.numbers&&$l.numbers[number])||number;return string.replace(/%d/i,value);}
var words=seconds<45&&substitute($l.seconds,Math.round(seconds))||seconds<90&&substitute($l.minute,1)||minutes<45&&substitute($l.minutes,Math.round(minutes))||minutes<90&&substitute($l.hour,1)||hours<24&&substitute($l.hours,Math.round(hours))||hours<48&&substitute($l.day,1)||days<7&&substitute($l.days,Math.floor(days))||days<14&&substitute($l.week,1)||days<30&&substitute($l.weeks,Math.floor(days/7))||days<60&&substitute($l.month,1)||days<365&&substitute($l.months,Math.floor(days/30))||years<2&&substitute($l.year,1)||substitute($l.years,Math.floor(years));return $.trim([prefix,words,suffix].join(" "));},parse:function(iso8601){var s=$.trim(iso8601);s=s.replace(/-/,"/").replace(/-/,"/");s=s.replace(/T/," ").replace(/Z/," UTC");s=s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2");return new Date(s);},datetime:function(elem){var isTime=$(elem).get(0).tagName.toLowerCase()=="time";var iso8601=isTime?$(elem).attr("datetime"):$(elem).attr("title");return $t.parse(iso8601);}});$.fn.timeago=function(){var self=this;self.each(refresh);var $s=$t.settings;if($s.refreshMillis>0){setInterval(function(){self.each(refresh);},$s.refreshMillis);}
return self;};function refresh(){var data=prepareData(this);if(!isNaN(data.datetime)){$(this).text(inWords(data.datetime));}
return this;}
function prepareData(element){element=$(element);if(!element.data("timeago")){element.data("timeago",{datetime:$t.datetime(element)});var text=$.trim(element.text());if(text.length>0)element.attr("title",text);}
return element.data("timeago");}
function inWords(date){return $t.inWords(distance(date));}
function distance(date){return(new Date().getTime()-date.getTime());}
document.createElement("abbr");document.createElement("time");})(jQuery);(function($){var globalTags=[];window.setGlobalTags=function(tags){globalTags=getTags(tags);};function getTags(tags){var tag,i,goodTags=[];for(i=0;i<tags.length;i++){tag=tags[i];if(typeof tags[i]=='object'){tag=tags[i].tag;}
goodTags.push(tag.toLowerCase());}
return goodTags;}
$.fn.tagSuggest=function(options){var defaults={'matchClass':'tagMatches','tagContainer':'span','tagWrap':'span','sort':true,'tags':null,'url':null,'delay':0,'separator':' '};var i,tag,userTags=[],settings=$.extend({},defaults,options);if(settings.tags){userTags=getTags(settings.tags);}else{userTags=globalTags;}
return this.each(function(){var tagsElm=$(this);var elm=this;var matches,fromTab=false;var suggestionsShow=false;var workingTags=[];var currentTag={"position":0,tag:""};var tagMatches=document.createElement(settings.tagContainer);function showSuggestionsDelayed(el,key){if(settings.delay){if(elm.timer)clearTimeout(elm.timer);elm.timer=setTimeout(function(){showSuggestions(el,key);},settings.delay);}else{showSuggestions(el,key);}}
function showSuggestions(el,key){workingTags=el.value.split(settings.separator);matches=[];var i,html='',chosenTags={},tagSelected=false;currentTag={position:currentTags.length-1,tag:''};for(i=0;i<currentTags.length&&i<workingTags.length;i++){if(!tagSelected&&currentTags[i].toLowerCase()!=workingTags[i].toLowerCase()){currentTag={position:i,tag:workingTags[i].toLowerCase()};tagSelected=true;}
chosenTags[currentTags[i].toLowerCase()]=true;}
if(currentTag.tag){if(settings.url){$.ajax({'url':settings.url,'dataType':'json','data':{'tag':currentTag.tag},'async':false,'success':function(m){matches=m;}});}else{for(i=0;i<userTags.length;i++){if(userTags[i].indexOf(currentTag.tag)===0){matches.push(userTags[i]);}}}
matches=$.grep(matches,function(v,i){return!chosenTags[v.toLowerCase()];});if(settings.sort){matches=matches.sort();}
for(i=0;i<matches.length;i++){html+='<'+settings.tagWrap+' class="_tag_suggestion">'+matches[i]+'</'+settings.tagWrap+'>';}
tagMatches.html(html);suggestionsShow=!!(matches.length);}else{hideSuggestions();}}
function hideSuggestions(){tagMatches.empty();matches=[];suggestionsShow=false;}
function setSelection(){var v=tagsElm.val();if(v==tagsElm.attr('title')&&tagsElm.is('.hint'))v='';currentTags=v.split(settings.separator);hideSuggestions();}
function chooseTag(tag){var i,index;for(i=0;i<currentTags.length;i++){if(currentTags[i].toLowerCase()!=workingTags[i].toLowerCase()){index=i;break;}}
if(index==workingTags.length-1)tag=tag+settings.separator;workingTags[i]=tag;tagsElm.val(workingTags.join(settings.separator));tagsElm.blur().focus();setSelection();}
function handleKeys(ev){fromTab=false;var type=ev.type;var resetSelection=false;switch(ev.keyCode){case 37:case 38:case 39:case 40:{hideSuggestions();return true;}
case 224:case 17:case 16:case 18:{return true;}
case 8:{if(this.value==''){hideSuggestions();setSelection();return true;}else{type='keyup';resetSelection=true;showSuggestionsDelayed(this);}
break;}
case 9:case 13:{if(suggestionsShow){chooseTag(matches[0]);fromTab=true;return false;}else{return true;}}
case 27:{hideSuggestions();setSelection();return true;}
case 32:{setSelection();return true;}}
if(type=='keyup'){switch(ev.charCode){case 9:case 13:{return true;}}
if(resetSelection){setSelection();}
showSuggestionsDelayed(this,ev.charCode);}}
tagsElm.after(tagMatches).keypress(handleKeys).keyup(handleKeys).blur(function(){if(fromTab==true||suggestionsShow){fromTab=false;tagsElm.focus();}});tagMatches=$(tagMatches).click(function(ev){if(ev.target.nodeName==settings.tagWrap.toUpperCase()&&$(ev.target).is('._tag_suggestion')){chooseTag(ev.target.innerHTML);}}).addClass(settings.matchClass);setSelection();});};})(jQuery);(function(c){c.tools=c.tools||{version:{}};c.tools.version.tabs="1.0.1";c.tools.addTabEffect=function(d,e){b[d]=e};var b={"default":function(d){this.getPanes().hide().eq(d).show()},fade:function(d){this.getPanes().hide().eq(d).fadeIn(this.getConf().fadeInSpeed)},slide:function(d){this.getCurrentPane().slideUp("fast");this.getPanes().eq(d).slideDown()},horizontal:function(d){if(!c._hW){c._hW=this.getPanes().eq(0).width()}this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:c._hW},function(){c(this).show()})}};function a(e,f,g){var d=this;var h;function i(j,k){c(d).bind(j,function(m,l){if(k&&k.call(this,l.index)===false&&l){l.proceed=false}});return d}c.each(g,function(j,k){if(c.isFunction(k)){i(j,k)}});c.extend(this,{click:function(k){if(k===h){return d}var m=d.getCurrentPane();var l=e.eq(k);if(typeof k=="string"){l=e.filter("[href="+k+"]");k=e.index(l)}if(!l.length){if(h>=0){return d}k=g.initialIndex;l=e.eq(k)}var j={index:k,proceed:true};c(d).triggerHandler("onBeforeClick",j);if(!j.proceed){return d}l.addClass(g.current);b[g.effect].call(d,k);c(d).triggerHandler("onClick",j);e.removeClass(g.current);l.addClass(g.current);h=k;return d},getConf:function(){return g},getTabs:function(){return e},getPanes:function(){return f},getCurrentPane:function(){return f.eq(h)},getCurrentTab:function(){return e.eq(h)},getIndex:function(){return h},next:function(){return d.click(h+1)},prev:function(){return d.click(h-1)},onBeforeClick:function(j){return i("onBeforeClick",j)},onClick:function(j){return i("onClick",j)}});e.each(function(j){c(this).bind(g.event,function(k){d.click(j);if(!g.history){return k.preventDefault()}})});if(g.history){e.history(function(j,k){d.click(k||0)})}if(location.hash){d.click(location.hash)}else{d.click(g.initialIndex)}f.find("a[href^=#]").click(function(){d.click(c(this).attr("href"))})}c.fn.tabs=function(g,d){var e=this.eq(typeof conf=="number"?conf:0).data("tabs");if(e){return e}var f={tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",history:false,initialIndex:0,event:"click",api:false};if(c.isFunction(d)){d={onBeforeClick:d}}c.extend(f,d);this.each(function(){var h=c(this).find(f.tabs);if(!h.length){h=c(this).children()}var i=g.jquery?g:c(g);e=new a(h,i,f);c(this).data("tabs",e)});return f.api?e:this}})(jQuery);(function(b){var c,a;b.prototype.history=function(e){var d=this;if(b.browser.msie){if(!a){a=b("<iframe />").hide().get(0);b("body").append(a);setInterval(function(){var f=a.contentWindow.document;var g=f.location.hash;if(c!==g){b.event.trigger("hash",g);c=g}},100)}d.bind("click.hash",function(g){var f=a.contentWindow.document;f.open().close();f.location.hash=b(this).attr("href")});d.eq(0).triggerHandler("click.hash")}else{setInterval(function(){var f=location.hash;if(d.filter("[href*="+f+"]").length&&f!==c){c=f;b.event.trigger("hash",f)}},100)}b(window).bind("hash",e);return this}})(jQuery);var WSL_Tools={removeListener:function(obj,msg)
{obj.unbind('click');obj.click(function()
{if(msg!=''){alert(msg);}
return false;});},validateEmail:function(email)
{success=false;pattern='/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/';validEmail=new String(email.match(pattern));if(validEmail.length==email.length&&validEmail.length>1){success=true;}
return success;}};var WSL_Controller_Carousel={initProductPage:function()
{WSL_Controller_Carousel.tagImagesCount();WSL_Controller_Carousel.flickrImagesCount();WSL_Controller_Carousel.blogVideosCount();WSL_Controller_Carousel.youtubeVideosCount();$('#carousel1').jcarousel({itemLoadCallback:WSL_Controller_Carousel.tagCarousel,size:this.tagImagesCount});$('#carousel2').jcarousel({itemLoadCallback:WSL_Controller_Carousel.flickrCarousel,size:this.flickrImagesCount});$('#carousel3').jcarousel({itemLoadCallback:WSL_Controller_Carousel.blogCarousel,size:this.blogVideosCount});$('#carousel4').jcarousel({itemLoadCallback:WSL_Controller_Carousel.youtubeCarousel,size:this.youtubeVideosCount});$('#carousel7').jcarousel({itemLoadCallback:WSL_Controller_Carousel.galleryScrollToIndex,scroll:5});$('#carousel8').jcarousel({itemLoadCallback:WSL_Controller_Carousel.bigGalleryScrollToIndex,scroll:8});WSL_Controller_Carousel.initTagGallery();WSL_Controller_Carousel.initFlickrGallery();WSL_Controller_Carousel.initBlogGallery();WSL_Controller_Carousel.initYoutubeGallery();WSL_Controller_Carousel.initGalleryImages();$("#gallery ul.tabs").tabs("#gallery div.panes > div.gallery");flickrCarouselLoaded=false;videoCarouselLoaded=false;tagCarouselLoaded=false;youtubeCarouselLoaded=false;},tagImagesCount:function()
{if($(".tagImagesCount").attr("id")>$("#tag-gallery > li").size()){this.tagImagesCount=10;}else{this.tagImagesCount=$("#tag-gallery > li").size();}},flickrImagesCount:function()
{if($(".flickrImagesCount").attr("id")>$("#flickr-gallery > li").size()){this.flickrImagesCount=10;}else{this.flickrImagesCount=$("#flickr-gallery > li").size();}},blogVideosCount:function()
{if($(".tagVideosCount").attr("id")>$("#blog-videos > li").size()){this.blogVideosCount=10;}else{this.blogVideosCount=$("#blog-videos > li").size();}},youtubeVideosCount:function()
{if($(".youtubeVideosCount").attr("id")>$("#youtube-videos > li").size()){this.youtubeVideosCount=10;}else{this.youtubeVideosCount=$("#youtube-videos > li").size();}},galleryScrollToIndex:function(carousel,state)
{if(state=='init')
{index=parseInt($('#images-gallery .act').attr('jcarouselindex'));loop=index>5?Math.ceil(index/5):0;if(loop>0){for(i=0;i<loop;i++){carousel.next();}}
WSL_Controller_Carousel.initGalleryImages();}},bigGalleryScrollToIndex:function(carousel,state)
{if(state=='init')
{index=parseInt($('#tag-gallery .act').attr('jcarouselindex'));loop=index>8?Math.ceil(index/8):0;if(loop>0){for(i=0;i<loop;i++){carousel.next();}}
WSL_Controller_Carousel.initGalleryImages();}},tagCarousel:function(carousel,state)
{if(state=='next'&&!tagCarouselLoaded)
{tagid=$(".productid").attr("id");url='/json/tagimagemore/'+tagid;$.getJSON(url,function(data)
{WSL_Controller_Carousel.carouselItems(carousel,carousel.first,carousel.last,data,"tag");$(function()
{WSL_Controller_Carousel.initTagGallery();});});tagCarouselLoaded=true;}},flickrCarousel:function(carousel,state)
{if(state=='next'&&!flickrCarouselLoaded)
{tagid=$(".productid").attr("id");url='/json/flickrmore/'+tagid;$.getJSON(url,function(data)
{WSL_Controller_Carousel.carouselItems(carousel,carousel.first,carousel.last,data,"flickr");$(function()
{WSL_Controller_Carousel.initFlickrGallery();});});flickrCarouselLoaded=true;}},blogCarousel:function(carousel,state)
{if(state=='next'&&!videoCarouselLoaded)
{tagid=$(".productid").attr("id");url='/json/morepostvideos/'+tagid;$.getJSON(url,function(data)
{WSL_Controller_Carousel.carouselItems(carousel,carousel.first,carousel.last,data,"blog");$(function()
{WSL_Controller_Carousel.initBlogGallery();});});videoCarouselLoaded=true;}},youtubeCarousel:function(carousel,state)
{if(state=='next'&&!youtubeCarouselLoaded)
{tagid=$(".productid").attr("id");url='/json/moreyoutubevideos/'+tagid;$.getJSON(url,function(data)
{WSL_Controller_Carousel.carouselItems(carousel,carousel.first,carousel.last,data,"youtube");$(function()
{WSL_Controller_Carousel.initYoutubeGallery();});});youtubeCarouselLoaded=true;}},initTagGallery:function()
{$('#tag-gallery .thumbnail').parent().click(function()
{var taghref=$(this).children().attr('href');var tagimg=$(this).children().attr('rel');var tagtitle=$(this).children().attr('title');$('#tagtitle a').attr('href',taghref);$('#tagtitle a').attr('title',tagtitle);$('#tagtitle q').text(tagtitle);$("#tag-actual").empty();$('#tag-actual').append('<a href="'+taghref+'" title="'+tagtitle+'"><img src="'+tagimg+'" /></a>');$('#tag-gallery .thumbnail').parent().removeClass('act');$(this).addClass('act');return false;});},initFlickrGallery:function()
{$('#flickr-gallery .thumbnail').parent().click(function()
{var flkhref=$(this).children().attr('href');var flkimg=$(this).children().attr('rel');var flkowner=$(this).children().attr('alt');var flktitle=$(this).children().attr('title');$('#flickrtitle a').attr('href',flkhref);$('#flickrtitle a').attr('title',flktitle);$('#flickrtitle q').text(flkowner);$("#flickr-actual").empty();$('#flickr-actual').append('<a href="'+flkhref+'" title="'+flktitle+'"><img src="'+flkimg+'" /></a>');$('#flickr-gallery .thumbnail').parent().removeClass('act');$(this).addClass('act');return false;});},initBlogGallery:function()
{$('#blog-videos .thumbnail').click(function()
{var pvhref=$(this).attr("href");var pvtitle=$(this).attr('title');$('#postvideotitle a').attr('href',pvhref);$('#postvideotitle q').text(pvtitle);$("#blogvideos-actual").empty();$("#blogvideos-actual").append('<object type="application/x-shockwave-flash" width="480" height="385" data="'+pvhref+'"><param name="movie" value="'+pvhref+'" /></object>');$('#blog-videos .thumbnail').parent().removeClass('act');$(this).parent().addClass('act');return false;});},initYoutubeGallery:function()
{$('#youtube-videos .thumbnail').click(function()
{var ythref=$(this).attr('href');var yttitle=$(this).attr('title');$('#youtubevideotitle a').attr('href',ythref);$('#youtubevideotitle a').text(yttitle);$("#youtubevideos-actual").empty();$("#youtubevideos-actual").append('<object type="application/x-shockwave-flash" width="480" height="385" data="'+ythref+'"><param name="movie" value="'+ythref+'" /></object>');$('#youtube-videos .thumbnail').parent().removeClass('act');$(this).parent().addClass('act');return false;});},initGalleryImages:function()
{$('#images-gallery .thumbnail').parent().click(function()
{$('#gallery-actual a').attr('href',$(this).children().attr('href'));$('#gallery-actual a img').attr('src',$(this).children().attr('rel'));$('#gallerytitle a').attr('href',$(this).children().attr('href'));$('#images-gallery .thumbnail').parent().removeClass('act');$(this).addClass('act');return false;});$('#bigimages-gallery .thumbnail').parent().click(function()
{$('#gallery-actual img').attr('src',$(this).children().attr('rel'));$('#bigimages-gallery .thumbnail').parent().removeClass('act');$(this).addClass('act');return false;});},carouselItems:function(carousel,first,last,data,tab)
{if(data.length>0){if(tab=="tag")
{for(i=0;i<data.length;i++){var arel=data[i].original_url;var aref=data[i].postUrl;;var atitle=data[i].post_title;var imgsrc=data[i].thumb_url;carousel.add(i+6,WSL_Controller_Carousel.carousel_ImgHTML(arel,aref,atitle,imgsrc));}}
else if(tab=="flickr")
{for(i=0;i<data.length;i++){var arel="http://farm"+data[i].farm_id+".static.flickr.com/"+data[i].server_id+"/"+data[i].flickr_id+"_"+data[i].secret_id+".jpg";var aref="http://www.flickr.com/photos/"+data[i].owner_id+"/"+data[i].flickr_id;var atitle=data[i].title;var imgsrc="http://farm"+data[i].farm_id+".static.flickr.com/"+data[i].server_id+"/"+data[i].flickr_id+"_"+data[i].secret_id+"_s.jpg";carousel.add(i+6,WSL_Controller_Carousel.carousel_ImgHTML(arel,aref,atitle,imgsrc));}}
else if(tab=="blog")
{for(i=0;i<data.length;i++){var aid=data[i].youtubeid;var atitle=data[i].post_title;var imgsrc="http://i.ytimg.com/vi/"+data[i].youtubeid+"/default.jpg";carousel.add(i+6,WSL_Controller_Carousel.carousel_VideoHTML(aid,atitle,imgsrc));}}
else if(tab=="youtube")
{for(i=0;i<data.length;i++){var aid=data[i].youtube_id;var atitle=data[i].title;var imgsrc="http://i.ytimg.com/vi/"+data[i].youtube_id+"/default.jpg";carousel.add(i+6,WSL_Controller_Carousel.carousel_VideoHTML(aid,atitle,imgsrc));}}
carousel.size(data.length+5);}},carousel_ImgHTML:function(arel,aref,atitle,imgsrc)
{return'<a class="thumbnail" rel="'+arel+'" href="'+aref+'" title="'+atitle+'"><img src="'+imgsrc+'" alt="'+atitle+'" /></a>';},carousel_VideoHTML:function(aid,atitle,imgsrc)
{return'<a class="thumbnail" title="'+atitle+'" href="http://www.youtube.com/v/'+aid+'&amp;hl=es&amp;fs=1&amp;color1=0x234900&amp;color2=0x4e9e00"><img src="'+imgsrc+'" alt="'+atitle+'" width="75" height="75" /><span>"'+atitle+'"</span></a>';},galleryCarouselItems:function(carousel,first,last,data)
{if(data.length>0)
{var path=$('#images-gallery .thumbnail').attr('name');var j=5;for(i=0;i<data.length;i++)
{j++;var arel=path+"/galleries/"+data[i].gallery+"/"+data[i].filename;var aref="/galeria/big/"+data[i].gallery+"/"+j;var atitle=data[i].gallery;var imgsrc=path+"/resize/75/galleries/"+data[i].gallery+"/"+data[i].thumbnail;carousel.add(i+6,WSL_Controller_Carousel.carousel_ImgHTML(arel,aref,atitle,imgsrc));}
carousel.size(data.length+5);}}};var WSL_Controller_Product={init:function()
{if($('#lasttagsmore').is(':hidden')){$("#lastpostlinks").show();}
if($("#lastpost_links ul li").html()!=null){$("#lastpost_links").show();}
if($('#deliciousmore').is(':hidden')){$("#deliciouslinks").show();}
if($("#delicious_links ul li").html()!=null){$("#delicious_links").show();}
if($('#bitacorasmore').is(':hidden')){$("#bitacoraslinks").show();}
if($("#bitacoras_links ul li").html()!=null){$("#bitacoras_links").show();}
if($("#related-products ul li").html()!=null){$("#related-products").show();}
$(":input[id='solo-expertos']").click(function(){WSL_Controller_Product.iwishihavelist(this);});$("#product-comment #comentario").focus(function(){if(!commentFormFocus){$(this).val('');commentFormFocus=true;}});WSL_Controller_Product.initProductJson();WSL_Controller_Product.initProductLess();WSL_Controller_Product.initProductVoteClass();WSL_Controller_Product.initProductVoteSelect();WSL_Controller_Product.initProductVote();WSL_Controller_Product.initProductWishHave();WSL_Controller_Product.initProductComment();WSL_Controller_Product.initProductCommentActions();WSL_Controller_Product.initiwishihavepagination();WSL_Controller_Product.initstreamwallpagination();showniwishihavemore=false;currentiwishihavepage=0;iwishcount=0;ihavecount=0;iwishihavelimit=0;iwishihaveplimit=0;listcount=0;iwishihavepagecount=0;shownmore=false;$wishaviso='';$haveaviso='';commentFormFocus=false;},ProductJson:function(jsonmod,tagid,postid)
{if(jsonmod=="productdesc"){$.getJSON('/json/productdesc/'+tagid+'/'+postid,function(data){return WSL_View_Product.ProductDescJson(data);});}else if(jsonmod=="latestposts"){$.get('/json/recentposts/'+tagid,function(data){return WSL_View_Product.LatestPostsJson(data);});}else if(jsonmod=="delicious"){$.get('/json/moredelicious/'+tagid,function(data){return WSL_View_Product.DeliciousJson(data);});}else if(jsonmod=="bitacoras"){$.get('/json/bitamore/'+tagid,function(data){return WSL_View_Product.BitacorasJson(data);});}else if(jsonmod=="relatedproducts"){$.get('/json/morerelatedproducts/'+postid+'/'+tagid,function(data){return WSL_View_Product.RelatedProductsJson(data);});}},ProductVoteJson:function(url,previousvalue)
{$.getJSON(url,{},function(data){if(data.res==1){return WSL_View_Product.ProductVoteJsonMsg(data);}else if(data.res==0){return WSL_View_Product.ProductVoteJsonEvent(data);}else{return $("#voteselected").val(previousvalue);}});},ProductVoteEventJson:function(url)
{$.get(url,{},function(data){shownmore=false;$("#streamwall").html(data);WSL_Controller_Product.enableListeners();WSL.getTimeAgo();});},ProductWishHave:function(url)
{var url=url;$.getJSON(url,{},function(data){$("#iwishihavemessage").hide();$("#iwishihavesubscribe").hide();if(data.res==1){$("#iwishihavemessage").attr('class','aviso');$("#iwishihavemessage").html(data.messsages.login);$("#iwishihavemessage").show();}else if(data.res==0){if(data.type=='unclick'){$("li.have-disabled,li.have").attr('class','have');$("li.wish-disabled,li.wish").attr('class','wish');}else{if(data.preference==0){$("li.have-disabled,li.have").attr('class','have-disabled');$("li.wish-disabled,li.wish").attr('class','wish');WSL_Controller_GoogleAnalytics.registerAction('modulo-valorar-productos','me-gusta',url);}else{$("li.have-disabled,li.have").attr('class','have');$("li.wish-disabled,li.wish").attr('class','wish-disabled');WSL_Controller_GoogleAnalytics.registerAction('modulo-valorar-productos','lo-tengo',url);}}
if(data.type=='click'){var message=data.messsages.click;$("#iwishihavemessage").attr('class','exito');}
if(data.type=='click'&&data.subscribed=='0'){var subscribemessage='<input type="checkbox" name="subscribe" class="iwishihavesub" onclick="WSL_Controller_Product.iwishihavesubs(this)" value="'+parts[1]+'" name="subscribe" />'+data.messsages.subscribe;$("#iwishihavesubscribe").html(subscribemessage);$("#iwishihavesubscribe").attr('class','mform');$("#iwishihavesubscribe").show();}
if(data.type=='unclick'){var message=data.messsages.unclick;$("#iwishihavemessage").attr('class','aviso');}
if(data.type=='unclick'&&data.subscribed=='1'){var subscribemessage=data.messsages.unsubscribe;$("#iwishihavesubscribe").html(subscribemessage);$("#iwishihavesubscribe").attr('class','mform');$("#iwishihavesubscribe").show();}
$("#iwishihavemessage").html(message);$("#iwishihavemessage").show();if($(".have-wish-count").length>0){WSL_Controller_Product.iwishihavecount();WSL_Controller_Product.enableListeners();}else{$(":input[id='solo-expertos']").attr('checked',false);WSL_Controller_Product.iwishihavelist($(":input[id='solo-expertos']"));var streamurl='/json/productstream/'+parts[1];$.get(streamurl,{},function(data){shownmore=false;$("#streamwall").html(data);WSL_Controller_Product.enableListeners();WSL.getTimeAgo();});}}});},iwishihavecount:function()
{var tagid=$(".productid").attr("id");var url='/json/iwishihavecount/'+tagid;var ihavecount=0;var iwishcount=0;$.getJSON(url,{},function(data){if(data.res==1){$("#iwishihavelistlogin").show();}else{ihavecount=data.ihavecount;iwishcount=data.iwishcount;if(ihavecount==null){ihavecount=0;}
if(iwishcount==null){iwishcount=0;}
$(".have-wish-count").html('<li title="Lo tienen">'+ihavecount+'</li><li title="Lo quieren">'+iwishcount+'</li>');}});},initProductJson:function()
{$('a.moredesc').click(function(){WSL_Controller_Product.ProductJson("productdesc",$(".productid").attr("id"),$(".postid").attr("id"));return false;});$('#lasttagsmore').click(function(){WSL_Controller_Product.ProductJson("latestposts",$(".productid").attr("id"),$(".postid").attr("id"));return false;});$('#deliciousmore').click(function(){WSL_Controller_Product.ProductJson("delicious",$(".productid").attr("id"),$(".postid").attr("id"));return false;});$('#bitamore').click(function(){WSL_Controller_Product.ProductJson("bitacoras",$(".productid").attr("id"),$(".postid").attr("id"));return false;});$('#productsmore').click(function(){var tags=$(".productid").attr("id");for(i=0;i<$("#related-products ul > li a").size();i++){tags=tags+","+$("#related-products ul li a")[i]["id"];}
WSL_Controller_Product.ProductJson("relatedproducts",tags,$(".categoryid").attr("id"));return false;});},initProductLess:function()
{$('a.proddescfirst').click(function(){$(".proddescfirst").hide(0);$(".extraproddesc").html('');$(".moredesc").show(0);return false;});$('#lasttagsless').click(function(){$(".extralastposts").hide(0);$("#lasttagsmore").show();$("#lasttagsless").hide();$.scrollTo('#lastpost_links',300,{axis:'y'});return false;});$('#deliciousless').click(function(){$(".extradelicious").hide(0);$("#deliciousmore").show();$("#deliciousless").hide();$.scrollTo('#delicious_links',300,{axis:'y'});return false;});$('#bitaless').click(function(){$("#bitaless").hide(0);$(".extrabitalinks").html('');$("#bitacorasmore").show(0);$("#bitamore").show(0);$.scrollTo('#bitacoras_links',300,{axis:'y'});return false;});$('#productsless').click(function(){$("#productsless").hide(0);$(".morerelatedproducts").html('');$("#relatedproductsmore").show(0);$("#productsmore").show(0);$.scrollTo('#related-products',300,{axis:'y'});return false;});},initProductVoteClass:function()
{$(".product-votes li").hover(function(){$(this).nextAll().attr('class','off');$(this).prevAll().attr('class','over');$(this).attr('class','over');});},initProductVoteSelect:function()
{$(".product-votes ul").hover(function(){},function()
{parts=$(".product-votes a").attr("id").split("_");$voteselected=$("#voteselected").val();if($voteselected>0)
{selected='#'+parts[0]+'_'+parts[1]+'_'+$voteselected;$(selected).parent().nextAll().attr('class','off');$(selected).parent().prevAll().attr('class','');$(selected).parent().attr('class','');}
else
{$(".product-votes li").attr('class','off');}});},initProductVote:function()
{$(".product-votes li a").click(function()
{currentObject=$(this);parts=$(this).attr("id").split("_");url='/json/productvote/'+parts[1]+'/'+parts[2];$("#voteselected").val(parts[2]);WSL_Controller_Product.ProductVoteJson(url,$("#voteselected").val());return false;});},initIwishIhaveButtons:function()
{var productId=$(".productid").attr("id");if(productId!=undefined){var url='/json/iwishihavebuttons/'+productId;$.getJSON(url,{},function(data){if(data.res==0){if(data.preference==0){$(".have-wish li.have").attr('class','have-disabled');}else if(data.preference==1){$(".have-wish li.wish").attr('class','wish-disabled');}}
return false;});}},initVoteBar:function()
{var productId=$(".productid").attr("id");if(productId!=undefined){var url='/json/votebar/'+productId;$.get(url,{},function(data){if($(".community").length!=0){$('.product-votes .community').after(data);}else{$('.product-votes>p').after(data);}
WSL_Controller_Product.initProductVoteClass();WSL_Controller_Product.initProductVoteSelect();WSL_Controller_Product.initProductVote();return false;});}},initIwishIhaveList:function()
{var productId=$(".productid").attr("id");var wishcnt=$(".wishcnt").attr("id");var havecnt=$(".havecnt").attr("id");var url='/json/product_wishhavelist/'+productId+'/'+wishcnt+'/'+havecnt;$.get(url,{},function(data){$('#community-content .havecnt').after(data);WSL_Controller_Product.iwishihagepaginit();WSL_Controller_Product.initiwishihavepagination();WSL_Controller_Product.initProductWishHaveList();WSL.initFacebook();return false;});},initProductWishHave:function()
{$("li.have-disabled>a,li.have>a,li.wish-disabled>a,li.wish>a").click(function()
{parts=$(this).attr("id").split("_");url='/json/iwishihave/'+parts[1]+'/'+parts[2];WSL_Controller_Product.ProductWishHave(url);return false;});},initProductWishHaveList:function()
{$(":input[id='solo-expertos']").click(function(){WSL_Controller_Product.iwishihavelist(this);});},initiwishihavepagination:function()
{$("#users-activity").prevAll('a.button.prev').click(function(){return WSL_Controller_Product.iwishihaveprev();});$("#users-activity").prevAll('p.nav').children('a.button.next').click(function(){return WSL_Controller_Product.showNextiwishihavelist();});$("#users-activity").prevAll('a.button.next').click(function(){return WSL_Controller_Product.showNextiwishihavelist();});},initstreamwallpagination:function()
{$("#users-activity a.button.prev ").click(function(){return WSL_Controller_Product.showPreviousStream(this);});$("#users-activity a.button.next").click(function(){return WSL_Controller_Product.showNextStream(this);});},initProductCommentActions:function()
{$('.comment-vote-up').click(WSL_Controller_Post.commentVoteUp);$('.comment-vote-down').click(WSL_Controller_Post.commentVoteDown);$('.abuse').click(WSL_Controller_Post.commentAbuse);},initProductComment:function()
{$("#product-comment .button").click(function()
{commentContent=$("#product-comment #comentario").val();commentContent=commentContent.replace(/^\s+|\s+$/g,'');commentContent=commentContent.replace(/<translate>Escribe algo sobre<\/translate> (.)+.../g,'');parts=$(this).attr("id").split("_");url='/json/productcomment';$.post(url,{product_id:parts[1],comment:commentContent},function(data){if(data==1){$("#productcommetnlogin").show();}else if(data==7){alert('introducir comentario');}else{shownmore=false;$("#streamwall").html(data);$("#product-comment #comentario").val('');WSL_Controller_Product.enableListeners();WSL.getTimeAgo();}});return false;});},iwishihavelist:function(link){var tagid=$(".productid").attr("id");if($(link).attr('checked')){var url='/json/iwishihavelist/'+tagid+'/1';}else{var url='/json/iwishihavelist/'+tagid+'/0';}
$.get(url,{},function(data){if(data==1){$("#iwishihavelistlogin").show();}else{showniwishihavemore=false;currentiwishihavepage=0;$("#users-activity").prevAll().remove();$("#users-activity").before(data);}
WSL_Controller_Product.initProductWishHaveList();WSL_Controller_Product.initiwishihavepagination();$("#iwishihavelist_vermas").hide();$("#iwishihavelist_vermenos").hide();$("#iwishihavelist_volver").hide();WSL.initFacebook();});},iwishihavesubs:function(sub){link=sub;prouduct_id=sub.value;url='/json/iwishihave/subscribe/'+prouduct_id;$.getJSON(url,{},function(data){$("#iwishihavemessage").hide();$("#iwishihavesubscribe").hide();});},showNextiwishihavelist:function(){if(showniwishihavemore==true){WSL_Controller_Product.iwishihavenext();}else{tagid=$(".productid").attr("id");if($(":input[id='solo-expertos']").attr('checked')){url='/json/iwishihavemore/'+tagid+'/1';}
else{url='/json/iwishihavemore/'+tagid+'/0';}
$.get(url,{},function(data){showniwishihavemore=true;$("#users-activity").prevAll().remove();$("#users-activity").before(data);WSL_Controller_Product.iwishihagepaginit();WSL_Controller_Product.iwishihavenext();WSL_Controller_Product.initiwishihavepagination();WSL_Controller_Product.initProductWishHaveList();WSL.initFacebook();});}
return false;},iwishihagepaginit:function(){iwishcount=eval($("#iwishcount").val());ihavecount=eval($("#ihavecount").val());iwishihavelimit=eval($("#iwishihavelimit").val());iwishihaveplimit=eval($("#iwishihaveplimit").val());listcount=iwishcount>ihavecount?iwishcount:ihavecount;iwishihavepagecount=parseInt((listcount)/(iwishihaveplimit));iwishihavepagecount+=(iwishihavepagecount*iwishihaveplimit<listcount)?1:0;iwishihavepagecount+=1;},iwishihavenext:function(){currentiwishihavepage++;WSL_Controller_Product.iwishihavepaginate();},iwishihaveprev:function(){currentiwishihavepage--;WSL_Controller_Product.iwishihavepaginate();return false;},iwishihavepaginate:function(){donotshowihave=false;donotshowiwish=false;if($wishaviso==''){$wishaviso=$("#wish .aviso").text();}
if($haveaviso==''){$haveaviso=$("#have .aviso").text();}
iwishitems=$("li","#wish");ihaveitems=$("li","#have");start=(currentiwishihavepage==1)?0:((currentiwishihavepage-1)*iwishihaveplimit);end=(currentiwishihavepage*iwishihaveplimit<listcount)?currentiwishihavepage*iwishihaveplimit-1:listcount-1;if(currentiwishihavepage==0){start=0;end=iwishihavelimit-1;}
$(iwishitems).hide();$(ihaveitems).hide();$("#iwishihavenav").hide();$("#iwishihavelist_vermas").hide();$("#iwishihavelist_vermenos").hide();$("#iwishihavelist_volver").hide();$("#wish .aviso").hide();$("#have .aviso").hide();userlog=WSL_Controller_Product.userLoggedin();if(userlog==false){$("#sub-just-experts").hide();}
if(iwishcount<=start)
{if(iwishcount==0){$("#wish .aviso").show();$("#wish .aviso").text($wishaviso);}
donotshowiwish=true;}
if(ihavecount<=start)
{if(ihavecount==0){$("#have .aviso").show();$("#have .aviso").text($haveaviso);}
donotshowihave=true;}
for(i=start;i<=end;i++){if(!donotshowihave&&ihavecount-1>=i){$(ihaveitems[i]).show();}
if(!donotshowiwish&&iwishcount-1>=i){$(iwishitems[i]).show();}
if(listcount-1>end){$("#iwishihavenav").show();$("#iwishihavelist_vermas").css('display','');}}
if(currentiwishihavepage>1){$("#iwishihavelist_volver").css('display','');}
if(currentiwishihavepage==1){$("#iwishihavelist_vermenos").css('display','');}},userLoggedin:function(){return($(".logged").length!=0);},showNextStream:function(link){if(shownmore==true){if($(link).parent().attr("id")=="productstream1"){$(link).hide();}else{$(link).parent().prev().hide();$(link).parent().hide();}
$(link).parent().next().show();}else{tag_id=$(".productid").attr("id");shownmore=true;url="/json/productstreamall/"+tag_id;$.post(url,{},function(data){$("#streamwall").html(data);WSL_Controller_Product.enableListeners();WSL.getTimeAgo();});}
return false;},enableListeners:function(){WSL_Controller_Product.initProductCommentActions();WSL_Controller_Product.initstreamwallpagination();WSL.initFacebook();},showPreviousStream:function(link){previous=$(link).parent().prev();if($(link).parent().attr("id")=="productstream3"){$(previous).prev().show();}
if($(link).parent().attr("id")=="productstream2"){if($("#productstream1 a.button.next").html()==null){$(link).parent().prev().append('<a href="#" class="button next"><span>ver mas</span></a>');WSL_Controller_Product.initstreamwallpagination();}else{$("#productstream1 a.button.next").show();}}
$(link).parent().prev().show();$(link).parent().hide();return false;},initUserPage:function(){$('#carousel5').jcarousel({itemLoadCallback:WSL_Controller_Product.itemUserIhaveLoadCallbackFunction,size:$('.userihavecount').attr("id")});userihaveCarouselLoaded=false;$('#carousel6').jcarousel({itemLoadCallback:WSL_Controller_Product.itemUserIwishLoadCallbackFunction,size:$('.useriwishcount').attr("id")});useriwishCarouselLoaded=false;if($("#user-have ul li").html()==null&&$("#user-wish ul li").html()==null){$("#user-products").hide(0);}else if($("#user-have ul li").html()==null&&$("#user-wish ul li").html()!=null){$("#user-products ul.tabs").tabs("#user-products div.panes > div.related-products",{initialIndex:1});}else{$("#user-products ul.tabs").tabs("#user-products div.panes > div.related-products");}},itemUserIhaveLoadCallbackFunction:function(carousel,state)
{if(state=='next'&&!userihaveCarouselLoaded){userid=$(".userid").attr("id");url='/json/moreuserihave/'+userid;$.getJSON(url,function(data){WSL_Controller_Product.mycarousel_itemUserIhaveAddCallback(carousel,carousel.first,carousel.last,data);});userihaveCarouselLoaded=true;}},mycarousel_itemUserIhaveAddCallback:function(carousel,first,last,data)
{if(data.length>0){var limage_path=$('#userihave-gallery').find('img:first').attr('src');var nimage_path=limage_path.substring(0,limage_path.lastIndexOf('/'))+'/';for(i=0;i<data.length;i++){var tag_name=data[i].tag_name;var image_name=data[i].product_post_id;var product_url=data[i].product_url;if(image_name==null){image_name=data[i].photo_post_id;}
thumb_url=nimage_path+image_name+'.jpg'
carousel.add(i+5,WSL_Controller_Product.mycarousel_getUserIhaveItemHTML(tag_name,thumb_url,product_url));}
carousel.size(data.length+4);}},mycarousel_getUserIhaveItemHTML:function(tag_name,thumb_url,product_url)
{return'<a href="'+product_url+'"><img src="'+thumb_url+'" alt="'+tag_name+'" /><span>"'+tag_name+'"</span></a>';},itemUserIwishLoadCallbackFunction:function(carousel,state)
{if(state=='next'&&!useriwishCarouselLoaded){userid=$(".userid").attr("id");url='/json/moreuseriwish/'+userid;$.getJSON(url,function(data){WSL_Controller_Product.mycarousel_itemUserIwishAddCallback(carousel,carousel.first,carousel.last,data);});useriwishCarouselLoaded=true;}},mycarousel_itemUserIwishAddCallback:function(carousel,first,last,data)
{if(data.length>0){var limage_path=$('#useriwish-gallery').find('img:first').attr('src');var nimage_path=limage_path.substring(0,limage_path.lastIndexOf('/'))+'/';for(i=0;i<data.length;i++){var tag_name=data[i].tag_name;var image_name=data[i].product_post_id;var product_url=data[i].product_url;if(image_name==null){image_name=data[i].photo_post_id;}
thumb_url=nimage_path+image_name+'.gif'
carousel.add(i+5,WSL_Controller_Product.mycarousel_getUserIwishItemHTML(tag_name,thumb_url,product_url));}
carousel.size(data.length+4);}},mycarousel_getUserIwishItemHTML:function(tag_name,thumb_url,product_url)
{return'<a href="'+product_url+'"><img src="'+thumb_url+'" alt="'+tag_name+'" /><span>"'+tag_name+'"</span></a>';}};function getWidgetfavourites(){username=$('#username_fav').val();url='/igooglewidget/getfavourites/'+username;$.post(url,{},function(data){$('#favoritos').html(data);favConEvents();});url='/igooglewidget/getconversations/'+username;$.post(url,{},function(data){$('#conversations').html(data);favConEvents();});return false;}
$('document').ready(function(){$("#next").click(function(){next=(3+parseInt($("#recent_hd").val()));url='/igooglewidget_recent_posts/'+next;$.post(url,{},function(data){$('#recent_posts').html(data);if($("#size_rec_hd").val()==0){$("#next").hide();}
$('a.showdesc').click(showdesc);});$("#recent_hd").val(next);$("#pre").show();return false;});$("#pre").click(function(){next=(next-3);url='/igooglewidget_recent_posts/'+next;$.post(url,{},function(data){$('#recent_posts').html(data);if($("#size_rec_hd").val()!=0){$("#next").show();}
$('a.showdesc').click(showdesc);});$("#recent_hd").val(next);if(next==0)
{$("#pre").hide();}
return false;});$("#top_next").click(function(){top_offset=(3+parseInt($("#top_hd").val()));url='/igooglewidget_topread_posts/'+top_offset;$.post(url,{},function(data){$('#top_read').html(data);if($("#size_top_hd").val()==0){$("#top_next").hide();}
$('a.showdesc').click(showdesc);});$("#top_hd").val(top_offset);$("#top_pre").show();return false;});$("#top_pre").click(function(){top_offset=(top_offset-3);url='/igooglewidget_topread_posts/'+top_offset;$.post(url,{},function(data){$('#top_read').html(data);if($("#size_top_hd").val()!=0){$("#top_next").show();}
$('a.showdesc').click(showdesc);});$("#top_hd").val(top_offset);if(top_offset==0){$("#top_pre").hide();}
return false;});$("#fav_pre").click(fav_pre);$("#fav_next").click(fav_next);$("#con_pre").click(con_pre);$("#con_next").click(con_next);if($("#size_rec_hd").val()==0){$("#next").hide();}
if($("#size_top_hd").val()==0){$("#top_next").hide();}
if($("#size_con_hd").val()==0){$("#con_next").hide();};if($("#size_fav_hd").val()==0){$("#fav_next").hide();};$("#pre").hide();$("#top_pre").hide();fav_offset=parseInt($("#fav_hd").val());$("#fav_pre").hide();con_offset=parseInt($("#con_hd").val());$("#con_pre").hide();$('a.showdesc').click(showdesc);$('#target_fav').submit(function(){getWidgetfavourites();return false;});$('#target_con').submit(function(){getWidgetconversations();return false;});});function showdesc(){var str=$(this).text();if(str=="+"){$(this).text("-");}else{$(this).text("+");}
$(this).nextAll(".desc").toggle();return false;};function fav_next(){fav_offset=(3+parseInt($("#fav_hd").val()));url='/igooglewidget/'+fav_offset;$.post(url,{},function(data){$('#favorites').html(data);$('a.showdesc').click(showdesc);if($("#size_fav_hd").val()==0){$("#fav_next").hide();};});$("#fav_hd").val(fav_offset);$("#fav_pre").show();return false;}
function fav_pre(){fav_offset=(parseInt($("#fav_hd").val())-3);url='/igooglewidget/'+fav_offset;$.post(url,{},function(data){$('#favorites').html(data);$('a.showdesc').click(showdesc);$("#fav_next").show();});$("#fav_hd").val(fav_offset);if(fav_offset==0){$("#fav_pre").hide();}
return false;}
function con_next(){con_offset=(3+parseInt($("#con_hd").val()));url='/igooglewidgetcon/'+con_offset;$.post(url,{},function(data){$('#conversations1').html(data);$('a.showdesc').click(showdesc);if($("#size_con_hd").val()==0){$("#con_next").hide();};});$("#con_hd").val(con_offset);$("#con_pre").show();return false;}
function con_pre(){con_offset=(parseInt($("#con_hd").val())-3);url='/igooglewidgetcon/'+con_offset;$.post(url,{},function(data){$('#conversations1').html(data);$('a.showdesc').click(showdesc);$("#con_next").show();});$("#con_hd").val(con_offset);if(con_offset==0){$("#con_pre").hide();}
return false;}
function favConEvents(){if($("#size_con_hd").val()==0){$("#con_next").hide();};if($("#size_fav_hd").val()==0){$("#fav_next").hide();};$("#fav_pre").click(fav_pre);$("#fav_next").click(fav_next);$("#con_pre").click(con_pre);$("#con_next").click(con_next);$('a.showdesc').click(showdesc);$("#fav_pre").hide();$("#con_pre").hide();}
function getWidgetconversations(){username=$('#username_con').val();url='/igooglewidget/getconversations/'+username;$.post(url,{},function(data){$('#conversations').html(data);favConEvents();});url='/igooglewidget/getfavourites/'+username;$.post(url,{},function(data){$('#favoritos').html(data);favConEvents();});return false;}
function enterkey(evt){var evt=(evt)?evt:event;var charCode=(evt.which)?evt.which:evt.keyCode;if(charCode==13){return false;}}
function showlogin(){$('#favoritos').html('Por favor, pon aqui tu nombre en Xataka <input type="text" maxlength="15" name="new_username" id="username_fav"/><input type="button" onclick="return getWidgetfavourites();" value="envia"/>');$('#conversations').html('Por favor, pon aqui tu nombre en Xataka <input type="text" maxlength="15" name="new_username" id="username_con"/><input type="button" onclick="return getWidgetconversations();" value="envia"/>');return false;}var WSL_Controller_SocialShare={initSocialShare:function()
{this.recaptchaflag=$('.recaptchaflag').attr("id");if(this.recaptchaflag){$('#recaptcha').hide(0);}
WSL_Controller_SocialShare.initShareList();WSL_Controller_SocialShare.initSendMailToggle();WSL_Controller_SocialShare.initShareMail();},initShareList:function()
{var blog_url=$(".blogurl").attr("id");var itemid=$(".itemid").attr("id");var item=$(".itemname").attr("id");var productlabel=$(".productlabel").attr("id");var prdlabel=productlabel.toLowerCase();var blogtwitter=$(".blogtwitter").attr("id");var section=$(".postsection").attr("id");if(section!=''&&section!=undefined&&section!='undefined'){section='/'+section;}else{section='';}
$('#share-fb').click(function()
{if(item=='post'){var shorturl='http://www.facebook.com/share.php?u='+encodeURIComponent(blog_url+section+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id"))+'&t='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://www.facebook.com/share.php?u='+encodeURIComponent(blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id"))+'&t='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-tt').click(function()
{if(item=='post'){var shorturl='http://www.tuenti.com/share?url='+encodeURIComponent(blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id"));}else if(item=='product'){var shorturl='http://www.tuenti.com/share?url='+encodeURIComponent(blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id"));}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-mn').click(function()
{if(item=='post'){var shorturl='http://meneame.net/submit.php?url='+blog_url+section+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}else if(item=='product'){var shorturl='http://meneame.net/submit.php?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-bt').click(function()
{if(item=='post'){var shorturl='http://bitacoras.com/anotaciones/'+blog_url+section+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}else if(item=='product'){var shorturl='http://bitacoras.com/anotaciones/'+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-tw').click(function()
{if(item=='post'){var shorturl='http://twitter.com/home?status='+$("#post-title").val()+'+'+blog_url+'/p/'+itemid+'+'+blogtwitter;}else if(item=='product'){var shorturl='http://twitter.com/home?status='+$("#post-title").val()+'+'+blog_url+'/t/'+itemid+'+'+blogtwitter;}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-diu').click(function()
{if(item=='post'){var shorturl='http://del.icio.us/post?url='+blog_url+section+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&title='+$("#post-title").val();}else if(item=='product'){var shorturl='http://del.icio.us/post?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&title='+$("#post-title").val();}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-li').click(function()
{if(item=='post'){var shorturl='http://www.linkedin.com/shareArticle?mini=true&url='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}else if(item=='product'){var shorturl='http://www.linkedin.com/shareArticle?mini=true&url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-r6').click(function()
{if(item=='post'){var shorturl='http://rec6.via6.com/link.php?url='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://rec6.via6.com/link.php?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-lk').click(function()
{if(item=='post'){var shorturl='http://www.linkk.com.br/submit.php?url='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://www.linkk.com.br/submit.php?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-ue').click(function()
{if(item=='post'){var shorturl='http://ueba.com.br/NovoLink?url='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://ueba.com.br/NovoLink?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&titulo='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-gh').click(function()
{if(item=='post'){var shorturl='http://www.gafanhoto.com.br/post-blog?address='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&title='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://www.gafanhoto.com.br/post-blog?address='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&title='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-bb').click(function()
{if(item=='post'){var shorturl='http://blogblogs.com.br/my/bookmarks/add?layout=inline&bookmark_url[url]='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&bookmarking[description]='+encodeURIComponent($("#post-title").val());}else if(item=='product'){var shorturl='http://blogblogs.com.br/my/bookmarks/add?layout=inline&bookmark_url[url]='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id")+'&bookmarking[description]='+encodeURIComponent($("#post-title").val());}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});$('#share-act').click(function()
{if(item=='post'){var shorturl='http://www.actibva.com/enlared/add?url='+blog_url+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}else if(item=='product'){var shorturl='http://www.actibva.com/enlared/add?url='+blog_url+'/'+prdlabel+'/'+$('.categoryname').attr("id")+'/'+$(".urlname").attr("id");}
WSL_Controller_SocialShare.ShareList(shorturl);return false;});},initSendMailToggle:function()
{$('#send-toggle').click(function()
{var toggleurl='/json/islogin';WSL_Controller_SocialShare.SendMailToggle(toggleurl);return false;});},initShareMail:function()
{$('#sharemail').click(function()
{var shareurl="/json/sharemail";WSL_Controller_SocialShare.ShareMail(shareurl);return false;});},ShareList:function(shorturl)
{window.open(shorturl,'Share');},SendMailToggle:function(toggleurl)
{var now=new Date();$.getJSON(toggleurl,{ctc:now.getMilliseconds()},function(data)
{return WSL_Controller_SocialShare.SendMailToggleJson(data);});},ShareMail:function(shareurl)
{var title=$('#post-title').val();var desc=$('#post-excerpt').val();var useremail=$('#useremail').val();var destemail=$('#destemail').val();if($('#send-copy').attr("checked")===true){var userchk=1;}else{var userchk=0;}
var usermsg=$('#message').val();var category=$(".categoryname").attr("id");var item=$(".itemname").attr("id");var urltitle=$(".urlname").attr("id");var response=$("input[name='recaptcha_response_field']").val();var challenge=$("input[name='recaptcha_challenge_field']").val();$.post(shareurl,{title:title,desc:desc,useremail:useremail,destemail:destemail,userchk:userchk,usermsg:usermsg,item:item,category:category,urltitle:urltitle,response:response,challenge:challenge},function(data){return WSL_Controller_SocialShare.ShareMailJson(data);},'json');},SendMailToggleJson:function(data)
{if($('#send-form').is(':visible')){$('#send-form').hide(0);}else{if(data!=1&&this.recaptchaflag){$('#recaptcha').show(0);$('#captcha_error').hide(0);}
$('#send-form').show(0);$('#destemail').val('');$('#useremail_error').hide(0);$('#destemail_error').hide(0);$('#send-copy').attr('checked',false);$('#message').val('');$('#send-form-success').hide(0);}},ShareMailJson:function(data)
{if(data.result==0){$('#send-form').hide(0);$('#send-form-success').show(0);}else if(data.result==3){$('#send-form-success').hide(0);$('#useremail_error').show(0);$('#destemail_error').hide(0);$('#captcha_error').hide(0);}else if(data.result==4){$('#send-form-success').hide(0);$('#useremail_error').hide(0);$('#destemail_error').show(0);$('#captcha_error').hide(0);}else if(data.result==5){$('#send-form-success').hide(0);$('#useremail_error').show(0);$('#destemail_error').show(0);$('#captcha_error').hide(0);}else if(data.result==8){$('#send-form-success').hide(0);$('#useremail_error').hide(0);$('#destemail_error').hide(0);$('#captcha_error').show(0);}else if(data.result==9){$('#send-form-success').hide(0);$('#useremail_error').show(0);$('#destemail_error').show(0);$('#captcha_error').show(0);}
if(this.recaptchaflag&&data.user==0&&data.result>0){Recaptcha.reload();}}};var WSL_Controller_ProductIndex={initProductIndex:function()
{WSL_Controller_ProductIndex.initProductIndexWishHave();},initProductIndexWishHave:function()
{$("li.have-disabled>a,li.have>a,li.wish-disabled>a,li.wish>a").click(function()
{var parts=$(this).attr("id").split("_");var url='/json/iwishihave/'+parts[1]+'/'+parts[2];WSL_Controller_ProductIndex.ProductIndexWishHave(url);return false;});},ProductIndexWishHave:function(url)
{$.getJSON(url,{},function(data)
{var explode=url.split("/");var pitem=$("#pwidget_"+explode[3]).prev('p.aviso');pitem.hide();if(data.res==1)
{pitem.attr('class','aviso');pitem.html(data.messsages.login);pitem.show();}
else if(data.res==0)
{WSL_Controller_ProductIndex.ChangeWishHaveStaus(data,explode[3]);WSL_Controller_ProductIndex.UpdateWishHaveCounter(data,explode[3]);}});},initUserProducts:function(havelist,wishlist)
{for(i in havelist){button='#buttonradio_'+havelist[i];$(button+" li.have").attr('class','have-disabled');};for(i in wishlist){button='#buttonradio_'+wishlist[i];$(button+" li.wish").attr('class','wish-disabled');};},ChangeWishHaveStaus:function(data,product_id)
{button='#buttonradio_'+product_id;havebutton=$(button+" li.have-disabled,"+button+" li.have");wishbutton=$(button+" li.wish-disabled,"+button+" li.wish");if(data.type=='unclick'){havebutton.attr('class','have');wishbutton.attr('class','wish');}else{if(data.preference==0){havebutton.attr('class','have-disabled');wishbutton.attr('class','wish');}else{havebutton.attr('class','have');wishbutton.attr('class','wish-disabled');}}},UpdateWishHaveCounter:function(data,product_id)
{counter='#havewish_'+product_id;havecounter=$(counter+" li.have strong");wishcounter=$(counter+" li.wish strong");havecounter.html(data.productIhaveCount);wishcounter.html(data.productIwishCount);$('#popular_'+product_id).html(parseInt(data.productIhaveCount)+parseInt(data.productIwishCount));}};function WSL_Comments(){var Self=this;this.comments=new Array();this.votesIndex=new Array();this.pageNum=1;this.JSONrequest=false;this.perpageComments=40;this.timeOutIds=new Array();this.timedOutIds=new Array();this.hash="to-comments";this.timeOutMins=15;this.skipToComment=0;this.newComment=false;this.listenersEnabled=false;this.initfacebook=true;this.PAGE_SELECTOR=".comment-nav li a";this.COMMENTS_SELECTOR=".comments";this.COMMENT_SELECTOR="li.comment";this.COMMENTPARENT_SELECTOR="li.reply-notify";this.COMMENTPARENTANCHOR_SELECTOR="li.reply-notify a";this.COMMENT_USERNAME=".comment-info a:first-child";this.COMMENT_BODY=".comment-body, .comment-reply, .comment-footer, .commentvote_error";this.COMMENT_CHILDCLASS="reply-1 reply-2 reply-3";this.COMMENT_REPLYCLASS="reply";this.COMMENTFORM="#commentform";this.COMMENTSUBMIT_SELECTOR="#commentform .button";this.COMMENTEDIT_SELECTOR="a.edit-comment";this.COMMENTEDIT_CLASS=".edit-comment";this.COMMENTDELETE_SELECTOR=".deletecomment";this.DELETEURL="/json/delete_comment/";this.DELETETEXT="Se suprime el comentario \n OK para borrar, Cancelar para detener el proceso";this.COMMENTURL="/json/postComment";this.COMMENTEDITURL="/json/postCommentEdit";this.COMMENTFORMTEXT="#commentform #ud_text";this.COMMENTREPLY_SELECTOR=".comment-reply";this.COMMENTREPLYANCHOR_SELECTOR=".comment-reply a";this.COMMENTREPLYFORM=".comment_replyform";this.COMMENTREPLYFORM_CANCEL=".comment_replyform #cancel";this.COMMENTREPLYFORM_RESPONDER=".comment_replyform #responder";this.COMMENTREPLY_URL="/json/commentreply";this.FADEOUTVOTEUP_SELECTOR=".comment-vote-up";this.FADEOUTVOTEUP_CLASS="comment-vote-up";this.FADEOUTVOTEUP_DISABLEDCLASS="comment-vote-up-disabled";this.VOTEUP_SELECTOR=".comment-vote-up, .comment-vote-up-disabled";this.VOTEUP_URL='/json/commentvoteup/';this.FADEOUTVOTEDOWN_SELECTOR=".comment-vote-down";this.FADEOUTVOTEDOWN_CLASS="comment-vote-down";this.FADEOUTVOTEDOWN_DISABLEDCLASS="comment-vote-down-disabled";this.VOTEDOWN_SELECTOR=".comment-vote-down, .comment-vote-down-disabled";this.VOTEDOWN_URL='/json/commentvotedown/';this.ABUSE_SELECTOR=".abuse";this.VOTEABUSE_URL='/json/abuse/';this.IRRELEVANTECOMMENT_SELECTOR="li.irrelevante";this.DISPLAYIRRELEVANTECOMMENT_SELECTOR=".comment-display.aviso a";this.IRRELEVANTECOMMENT_TEXT="Comentário avaliado como irrelevante";this.TAB_SELECTOR="#sub-tabs a";this.CURRENT_TAB_SELECTOR="#sub-tabs .current";this.HIGHLIGHT_TAB_SELECTOR="#sub-tabs ul li a";this.PAGE_COUNT_SELECTOR="#pageCount";this.VOTE_ERROR=".commentvote_error";this.VOTE_LOGIN_ERROR='<p class="aviso">Para votar un comentario es necesario identificarse. Puedes hacerlo <strong><a href="/signup">aquí</a></strong></p>';this.VOTE_ALREADYVOTED='<p class="aviso">Já foi feita uma avaliação a esse comentário</p>';this.VOTE_OWNCOMMENT='<p class="aviso">No puedes votar tus propios comentarios</p>';this.VOTE_NEGATIVEVOTING='<p class="aviso">Excedido o máximo de votos negativos permitidos por dia</p>';this.VOTE_POSITIVEVOTING='<p class="aviso">Excedido o máximo de votos positivos permitidos por dia</p>';this.VOTE_SAMEIP='<p class="aviso">Esse comentário já recebeu votos deste mesmo número IP</p>';this.VOTE_NOT_ENOUGH_KARMA='<p class="aviso">Você não tem karma suficiente para fazer votos negativos ao comentário. Para isso, é necessário ter no mínimo 3 estrelas. Complete seu perfil e participe mais para conseguir subir de nível</p>';this.init=function(){if($('.post-likes').val()===undefined){this.POSTID=$('.wsl-likes').attr('id').substr(1);}else{this.POSTID=$('.post-likes').attr('id').substr(1);}
this.tab=this.getCurrentTab();this.pageCount=this.getPageCount();this.servertime=parseInt($("#lp2currenttime").text());this.showPagination();this.buildComments();this.createIndexes();this.enableCommentTabs();$('#ud_text_edit').keyup(Self.commentEditPreview);this.permalink();this.tabPermalink();Self.hideIrrelevanteComments();Self.disableOtherListeners();this.initfacebook=false;this.enableListeners();this.initfacebook=true;if(this.userLoggedin()){this.user_name=$("#login_user_id").text();}
if(this.isCampaignQuestion()){Self.initCampaignQuestions();}};this.enableListeners=function(){$(this.PAGE_SELECTOR).click(Self.pageClick);$(this.COMMENTSUBMIT_SELECTOR).click(Self.commentSubmit);this.commentDeleteButton();this.setCommentEditTimeouts();$(this.COMMENTEDIT_SELECTOR).unbind('click');$(this.COMMENTEDIT_SELECTOR).click(Self.commentEdit);$(this.VOTEUP_SELECTOR).unbind('click');$(this.VOTEDOWN_SELECTOR).unbind('click');$(this.ABUSE_SELECTOR).unbind('click');$(this.COMMENTDELETE_SELECTOR).unbind('click');$(this.VOTEUP_SELECTOR).click(Self.commentVoteUp);$(this.VOTEDOWN_SELECTOR).click(Self.commentVoteDown);$(this.ABUSE_SELECTOR).click(Self.forumAbuse);$(this.COMMENTDELETE_SELECTOR).click(Self.commentDelete);$(this.COMMENTREPLYANCHOR_SELECTOR).unbind('click');$(this.COMMENTREPLYANCHOR_SELECTOR).click(Self.showCommentReplyForm);$(this.COMMENTPARENTANCHOR_SELECTOR).unbind('click');$(this.COMMENTPARENTANCHOR_SELECTOR).click(Self.skipCommentParent);$(Self.DISPLAYIRRELEVANTECOMMENT_SELECTOR).unbind('click');$(Self.DISPLAYIRRELEVANTECOMMENT_SELECTOR).click(Self.statusIrrelevanteComment);this.enableCommentTabs();if(Self.initfacebook){WSL.initFacebook();}};this.hideIrrelevanteComments=function(){$(this.IRRELEVANTECOMMENT_SELECTOR).each(function(i){Self.hideIrrelevanteComment($(this).attr('id').substr('1'));});};this.statusIrrelevanteComment=function(){var commentId=$(this).parents("li").attr('id').substr('1');Self.hideIrrelevanteComment(commentId);return false;};this.hideIrrelevanteComment=function(commentId){var i=Self.findCommentIndex(commentId);Self.hideIrrelevanteResponses(i);};this.findCommentIndex=function(commentId){for(i=0;i<this.comments.length;i++){if(this.comments[i].id==commentId){return i;}}};this.hideIrrelevanteResponses=function(i){var comment=this.comments[i];Self.statusIrrelevanteBody(this.comments[i].id);if(Self.tab=='cronologico'){Self.irrelevanteResponses(comment);}};this.irrelevanteResponses=function(comment){for(j=i+1;j<this.comments.length;j++){if(comment.level<this.comments[j].level){Self.irrelevanteResponse(this.comments[i].id,this.comments[j].id);}else{break;}}};this.irrelevanteResponse=function(commentId,responseId){if($("#c"+commentId).find(this.COMMENT_BODY).is(':visible')){$("#c"+responseId).prev(Self.COMMENTPARENT_SELECTOR).show();$("#c"+responseId).show();}else{$("#c"+responseId).prev(Self.COMMENTPARENT_SELECTOR).hide();$("#c"+responseId).hide();}};this.statusIrrelevanteBody=function(commentId){if($("#c"+commentId).find(this.COMMENT_BODY).is(':visible')){$("#c"+commentId).find(this.COMMENT_BODY).hide();$("#c"+commentId+" .comment-display").html(this.IRRELEVANTECOMMENT_TEXT+' <a href="#">Clique para ler</a>');$(Self.DISPLAYIRRELEVANTECOMMENT_SELECTOR).click(Self.statusIrrelevanteComment);}else{$("#c"+commentId).find(this.COMMENT_BODY).show();$("#c"+commentId+" .comment-display").html(this.IRRELEVANTECOMMENT_TEXT+' <a href="#">Clique para encerrar a conversa</a>');$(Self.DISPLAYIRRELEVANTECOMMENT_SELECTOR).click(Self.statusIrrelevanteComment);}};this.setCommentEditTimeouts=function(){if(Self.userLoggedin()){$(this.COMMENT_SELECTOR).each(function(i){Self.commentEditTimeOut($(this).attr('id').substr('1'));});}};this.commentDeleteButton=function(){var wpuser=$.wordpressuser();if(wpuser){$(this.COMMENTDELETE_SELECTOR).show();}};this.TimedOut=function(id){for(var i=0,l=Self.timedOutIds.length;i<l;i++){if(Self.timedOutIds[i]==id){return true;}}
return false;};this.hasTimeOut=function(id){for(var i=0,l=Self.timeOutIds.length;i<l;i++){if(Self.timeOutIds[i].id==id){return true;}}
return false;};this.buildComments=function(){$(this.COMMENT_SELECTOR).each(function(i){html=jQuery("<p>").append($(this).clone()).html();level=0;if($(this).attr('class').search(Self.COMMENT_REPLYCLASS)!=-1){level=parseInt($(this).find(".comment-level").text());html=jQuery("<p>").append($(this).prev().clone()).html()+html;}
Self.add(parseInt($(this).attr('id').substr(1)),$(this).find(".comment_karma").text(),level,html,1);});};this.add=function(id,votes,level,html,page){i=this.comments.length;this.comments[i]={};this.comments[i].page=page;this.comments[i].id=id;this.comments[i].votes=votes;this.comments[i].level=level;this.comments[i].html=html;};this.createIndexes=function(){this.votesIndex=new Array();this.idIndex=new Array();for(i=0;i<this.comments.length;i++){this.votesIndex[i]={index:i,value:this.comments[i].votes.replace(',','.')};this.idIndex[i]={index:i,value:this.comments[i].id};}};this.pageClick=function(){Self.pageNum=Self.getPageNumber($(this));Self.fetchRenderComments();Self.hideIrrelevanteComments();return false;};this.cronologicoTab=function(){commentsList='';for(i in this.comments){if(this.comments[i].page==this.pageNum){commentsList+=this.comments[i].html;}}
$(this.COMMENTS_SELECTOR).html(commentsList);};this.mostVotedTab=function(){var commentsList='';var parentid=0;var firstParentid=0;var secondParentid=0;var k=0;var l=0;var m=0;var n=0;answer=new Array();firstLevel=new Array();secondLevel=new Array();thirdLevel=new Array();for(i=0;i<this.comments.length;i++){if(this.comments[i].level==0){answer[k]={index:i,votes:this.comments[i].votes};parentid=i;k++;}else if(this.comments[i].level==1){firstLevel[l]={index:i,parentid:parentid};l++;if(this.comments[i+1]!=undefined&&this.comments[i+1].level==0){parentid=0;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==1){parentid=parentid;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==2){firstParentid=parentid;parentid=i;}}else if(this.comments[i].level==2){secondLevel[m]={index:i,parentid:parentid,firstParentid:firstParentid};m++;if(this.comments[i+1]!=undefined&&this.comments[i+1].level==0){parentid=0;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==1){parentid=firstParentid;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==2){parentid=parentid;firstParentid=firstParentid;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==3){firstParentid=firstParentid;secondParentid=parentid;parentid=i;}}else if(this.comments[i].level==3){thirdLevel[n]={index:i,parentid:parentid,firstParentid:firstParentid,secondParentid:secondParentid};n++;if(this.comments[i+1]!=undefined&&this.comments[i+1].level==0){parentid=0;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==1){parentid=firstParentid;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==2){parentid=secondParentid;firstParentid=firstParentid;}else if(this.comments[i+1]!=undefined&&this.comments[i+1].level==3){parentid=parentid;firstParentid=firstParentid;secondParentid=secondParentid;}}}
answer.sort(function(a,b){return parseFloat(b.votes)-parseFloat(a.votes)});var start=(this.pageNum-1)*this.perpageComments;for(i=start;i-start<this.perpageComments&&i<answer.length;i++){commentsList+=this.comments[answer[i].index].html;for(j=0;j<firstLevel.length;j++){if(answer[i].index==firstLevel[j].parentid){commentsList+=this.comments[firstLevel[j].index].html;for(x=0;x<secondLevel.length;x++){if(firstLevel[j].index==secondLevel[x].parentid){commentsList+=this.comments[secondLevel[x].index].html;for(y=0;y<thirdLevel.length;y++){if(secondLevel[x].index==thirdLevel[y].parentid){commentsList+=this.comments[thirdLevel[y].index].html;}}}}}}}
$(this.COMMENTS_SELECTOR).html(commentsList);};this.LatestTab=function(){commentsList='';this.idIndex.sort(function(a,b){return parseInt(b.value)-parseInt(a.value)});start=(this.pageNum-1)*this.perpageComments;for(i=start;i-start<this.perpageComments&&i<this.idIndex.length;i++){commentsList+=this.comments[this.idIndex[i].index].html;}
$(this.COMMENTS_SELECTOR).html(commentsList);this.removeThreading();Self.removeReplyLink();};this.removeReplyLink=function(){$(this.COMMENTREPLY_SELECTOR).remove();}
this.fetchRenderComments=function(){if(parseInt($(this.PAGE_COUNT_SELECTOR).text())>1&&!this.JSONrequest){this.JSONrequest=true;Self.moreComments();}else{this.renderComments();}};this.moreComments=function(){if($('.post-likes').val()===undefined){postid=$('.wsl-likes').attr('id');}else{postid=$('.post-likes').attr('id');}
$.getJSON('/morepostcomments/'+postid,{},function(data){$.each(data,function(){Self.add(this.id,this.votes,this.level,this.html,this.page);});Self.createIndexes();Self.SkipToComment();Self.renderComments();Self.hash="to-comments";});};this.SkipToComment=function(){if(Self.skipToComment!=0){for(i in Self.comments){if(Self.comments[i].id==Self.skipToComment){Self.pageNum=Self.comments[i].page;this.hash="#c"+Self.skipToComment;break;}}}
Self.skipToComment=0;};this.getPageNumber=function(page){switch(page.attr('class')){case'last':if(!this.JSONrequest){pageNum=parseInt($(".commentpagecount:first").text());}else{pageNum=this.getLastPageNum();}
break;case'next':link=$(".comment-nav li strong");pageNum=parseInt($(link[0]).text())+1;break;case'prev':link=$(".comment-nav li strong");pageNum=parseInt($(link[0]).text())-1;break;case'first':pageNum=1;break;default:pageNum=parseInt(page.text());break;}
return pageNum;};this.renderComments=function(){Self.processNewComment();this.renderTab();this.pageCount=Self.getLastPageNum();Self.showPagination();WSL.initPostPage();WSL.getTimeAgo();Self.hideIrrelevanteComments();Self.disableOtherListeners();if(!Self.listenersEnabled){Self.enableListeners();}
if(Self.hash!="to-comments"){window.location.hash=Self.hash;}};this.processNewComment=function(){if(Self.newComment){Self.pageNum=Self.getLastPageNum();Self.newComment=false;}};this.renderTab=function(){switch(this.tab){case'cronologico':this.cronologicoTab();break;case'valorado':this.mostVotedTab();break;case'ultimos':this.LatestTab();break;}};this.removeThreading=function(){$(this.COMMENT_SELECTOR).removeClass(this.COMMENT_CHILDCLASS);$(this.COMMENTPARENT_SELECTOR).removeClass("reply-notify-1 reply-notify-2 reply-notify-3");};this.prevNextLinks=function(){if(this.pageNum==1){$("li a.first,li a.prev").hide();}else{$("li a.first,li a.prev").show();}
if(this.pageNum==this.pageCount){$("li a.next,li a.last").hide();}else{$("li a.next,li a.last").show();}};this.pageLinks=function(){for(i=-2;i<=2;i++){num=this.pageNum+i;id=".comment-nav .nav"+(i+3)
if((num>0&&i<0)||(num<=this.pageCount&&i>0)){$(id).show();$(id+" a").text(num);}else{$(id).hide();}}};this.showPagination=function(){if(this.pageCount>1){Self.prevNextLinks();Self.pageLinks();$(".comment-nav .commentpagecount").text(this.pageCount);$(".comment-nav strong").text(this.pageNum);$(".comment-nav .nav3").show();$(".comment-nav").show();}else{$(".comment-nav").hide();}};this.getLastPageNum=function(){switch(this.tab){case'cronologico':case'valorado':page=(this.comments.length!=0)?this.comments[this.comments.length-1].page:1;break;case'ultimos':page=Math.ceil(this.comments.length/this.perpageComments);break;}
return page;};this.tabclick=function(){if(Self.tab!=$(this).attr('href').substr(1)){Self.skipToTab(this);}
Self.hideIrrelevanteComments();};this.skipToTab=function(tab){$(this.TAB_SELECTOR).removeClass('current');$(tab).addClass('current');Self.tab=$(tab).attr('href').substr(1);Self.pageNum=1;Self.hash="to-comments";Self.fetchRenderComments();};this.permalink=function(){commentId=window.location.hash;if(/c(\d)+/.test(commentId)){if(commentId.search("#")==-1){commentId="#"+commentId;}
if($(commentId).length==0){this.skipToComment=commentId.replace('#c','');this.fetchRenderComments();}}};this.tabPermalink=function(){tabs=$("#sub-tabs li a");tabOne=$(tabs[0]).attr("href").replace("#",'');tabTwo=$(tabs[1]).attr("href").replace("#",'');tabThree=$(tabs[2]).attr("href").replace("#",'');tabPermalink=window.location.hash.replace("#",'');if(tabPermalink==''||tabPermalink=="to-comments"){this.skipToTab(tabs[0]);}else if(tabPermalink==tabOne||tabPermalink==tabThree){this.skipToTab((tabPermalink==tabOne?tabs[0]:tabs[2]));}else if(tabPermalink==tabTwo){window.location.hash="to-comments";}};this.commentSubmit=function(){$("#duplicatecommentnotice").hide();$("#duplicatecommentreplynotice").hide();params=Self.getCommentSubmitParams();if(params.text.length!=0&&!Self.isEditCommentExpired()){Self.commentSubmitRequest(params);}
return false;};this.isEditCommentExpired=function(){res=false;if(Self.isEditComment()){commentId=$("#commentedit").val();if(!Self.hasTimeOut(commentId)||Self.TimedOut(commentId)){res=true;Self.commentExpired(commentId);}}
return res;};this.commentExpired=function(commentId){Self.showCommentExpiredMessage(commentId);Self.activateCommentAddMode();Self.emptyCommentFormFields();window.location.hash="c"+commentId;};this.showCommentExpiredMessage=function(){$("#c"+commentId).find('.comment-body').after(jQuery("<p>").append($("#commenteditnotice").clone()).html());$("#c"+commentId).find('#commenteditnotice').show();};this.getCommentSubmitParams=function(){var subscription_status=$(this.COMMENTFORM+" input[name=subscription_status]").val();var subscribe=$(this.COMMENTFORM+" input[name=subscribe]:checked").val();var text=$(this.COMMENTFORMTEXT).val().replace(/^\s+|\s+$/g,'');var postId=this.POSTID;var subscription=true;var clubTagName=$('.clubTagName').attr('id');params={subscribe:subscribe,subscription_status:subscription_status,text:text,postId:postId,subscription:subscription,clubTagName:clubTagName};if(Self.isEditComment()){params.commentId=$("#commentedit").val();params.text=WSL.inittextalter($(this.COMMENTFORM+" #ud_text_edit").html()).replace(/^\s+|\s+$/g,'');}
return params;};this.commentSubmitRequest=function(params){Self.disableCommentSubmit();$.post(Self.commentSubmitURL(),params,function(data){Self.listenersEnabled=true;if(data.res==1){window.location.href='/signup?referrer='+window.location.href;}else if(data.res==-2){$("#userantitrollnotice").show();}else if(data.res==0){Self.commentSubmitResponseRender(data,params)
Self.showQAWarningMessage();}else if(data.res==3){$("#duplicatecommentnotice").show();}
Self.listenersEnabled=false;Self.enableCommentSubmit();},"json");};this.commentSubmitURL=function(){if(Self.isEditComment()){postURL=this.COMMENTEDITURL;}else{postURL=this.COMMENTURL;}
return postURL;};this.commentSubmitResponseRender=function(data,params){Self.servertime=parseInt(data.time);if(Self.isEditComment()){Self.editCommentRender(data);window.location.hash='c'+data.id;if(Self.isCampaignQuestion()){Self.removeReplyLink();Self.initCampaignQuestions();$("#reply").hide();}}else{Self.newCommentRender(data);}
Self.emptyCommentFormFields();$(this.COMMENTFORM+" input[name=subscription_status]").val(params.subscribe);};this.commentEdit=function(){commentId=$(this).parent().attr('id').substr(1);if(Self.hasTimeOut(commentId)){$("#ud_text_edit").html($(this).parent().find('span.comment-content').html());if(Self.isCampaignQuestion()){$("#reply").show();}
$("#ud_text_edit").show();$("#ud_text_edit").attr('contentEditable',true);$(Self.COMMENTFORMTEXT).hide();Self.commentEditPreview();Self.storeEditComment(commentId);window.location.hash="#ud_text_edit";$("#comment-write h2").text("Edita tu comentario");}
return false;};this.storeEditComment=function(commentId){if($("#commentedit").length==0){$(this.COMMENTFORM).append($("<input />").attr({type:"hidden",name:"commentedit",id:"commentedit"}));}
$("#commentedit").val(commentId);};this.commentVoteUp=function(){Self.disableOtherListeners();$(this.VOTE_ERROR).hide();var commentID=$(this).parents("li").attr('id');var obj=this;$.post(Self.VOTEUP_URL+commentID,{},function(data)
{return Self.commentVote(obj,data);},'json');return false;};this.commentVoteDown=function(){Self.disableOtherListeners();$(this.VOTE_ERROR).hide();var commentID=$(this).parents("li").attr('id');var obj=this;$.post(Self.VOTEDOWN_URL+commentID,{},function(data)
{return Self.commentVote(obj,data);},'json');return false;};this.commentAbuse=function(th){Self.disableOtherListeners();$(th.VOTE_ERROR).hide();var commentID=$(th).parents("li").attr('id');var obj=this;$.post(Self.VOTEABUSE_URL+commentID,{},function(data)
{return Self.commentVote(obj,data);},'json');return false;};this.forumAbuse=function(){this.PARENT_ABUSE_SELECTOR=$(this).parent().attr('class');if(this.PARENT_ABUSE_SELECTOR=='forum-item')
{var forusId=$(this).attr('id');var obj=$(this);$.post('/json/question-abuse/'+forusId,{},function(data)
{$('#e'+data.cid+'.commentvote_error').html('');$('#e'+data.cid+' .commentvote_error').show();if(data.res==1){$('#e'+data.cid).html(Self.VOTE_LOGIN_ERROR);}
if(data.res==4){$('#e'+data.cid).html(Self.VOTE_OWNCOMMENT);}
if(data.res==2){$('#e'+data.cid).html(Self.VOTE_ALREADYVOTED);}
if(data.res==0){var abuse=$('#q'+data.cid+'.abuse');Self.abuse_fadeOut(abuse);}
return false;},'json');}else{Self.commentAbuse(this);}
return false;};this.commentDelete=function(){$(this.VOTE_ERROR).hide();var commentID=$(this).parents("li").attr('id');var answer=confirm(Self.DELETETEXT);if(answer){$.post(Self.DELETEURL+commentID,{},function(data)
{return Self.commentRemove(data);},'json');}
return false;};this.commentRemove=function(data){if(data.res==1){alert('Por favor ingrese en wp-admin');}else{Self.updateDeletedCommentInPage(data);Self.updateCommentInCommentsArray(data.id);}};this.updateDeletedCommentInPage=function(data){commentId="#c"+data.id;var replyClass=Self.getCommentReplyClass(data.id);$(commentId).after(data.html);nextId=$(commentId).next();$(nextId).find('strong').text("#"+$(commentId).find("span.number").text());$(nextId).attr('class',"comment "+replyClass);$(commentId).remove();};this.getCommentReplyClass=function(id){var replyClass=parseInt(Self.getCommentNestingLevel("c"+id))-1;if(replyClass>0){replyClass="reply-"+replyClass;}else{replyClass='';}
return replyClass;};this.deleteCommentFromArray=function(commentID){for(i=0;i<Self.comments.length;i++){if(Self.comments[i].id==commentID){Self.comments.splice(i,1);}}
Self.createIndexes();};this.commentVote=function(obj,data)
{$(this.VOTE_ERROR).html('');$('#c'+data.cid+this.VOTE_ERROR).show();if(data.res==1){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_LOGIN_ERROR);}else if(data.res==2){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_ALREADYVOTED);}else if(data.res==4){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_OWNCOMMENT);}else if(data.res==5){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_NEGATIVEVOTING);}else if(data.res==6){var conveted_msg=WSL.inittextalter(this.VOTE_NOT_ENOUGH_KARMA);$('#c'+data.cid+' '+this.VOTE_ERROR).html(conveted_msg);}else if(data.res==7){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_POSITIVEVOTING);}else if(data.res==8){$('#c'+data.cid+' '+this.VOTE_ERROR).html(this.VOTE_SAMEIP);}else if(data.res==0){Self.updateCommentVotes(data.cid,data.karma,data.votes,data.commentkarma);Self.commentWithNewvotesData(data.cid,data.karma);Self.fadeOut(obj,data.cid);Self.showQAWarningMessage();}
Self.enableListeners();};this.updateCommentVotes=function(commentID,karma,votes,karmaLevel){if(votes==1){$('#karmavotes'+commentID).html('Karma '+karma+' (<span class="votes">'+votes+'</span> voto) | '+karmaLevel);}else{$('#karmavotes'+commentID).html('Karma '+karma+' (<span class="votes">'+votes+'</span> votos) | '+karmaLevel);}
this.statusBadgeUpdate(commentID,karmaLevel);var commentclass=$('#c'+commentID).attr('class').split(' ');var newclass='';for(i=0;i<(commentclass.length)-1;i++){newclass=newclass+commentclass[i]+' ';}
$('#c'+commentID).removeClass($('#c'+commentID).attr('class'));$('#c'+commentID).addClass(newclass+karmaLevel);};this.commentWithNewvotesData=function(commentID,commentKarma){for(i=0;i<Self.comments.length;i++){if(Self.comments[i].id==commentID){Self.comments[i].html=jQuery("<p>").append($("#c"+commentID).clone()).html();Self.comments[i].votes=commentKarma;}}
Self.createIndexes();};this.fadeOut=function(obj,commentID){var voteUp=$(obj).parent().children(this.FADEOUTVOTEUP_SELECTOR);var voteDown=$(obj).parent().children(this.FADEOUTVOTEDOWN_SELECTOR);var abuse=$('#c'+commentID+' '+this.ABUSE_SELECTOR);Self.voteUp_fadeOut(voteUp);Self.voteDown_fadeOut(voteDown);Self.abuse_fadeOut(abuse);}
this.voteUp_fadeOut=function(voteUp){$(voteUp).addClass(this.FADEOUTVOTEUP_DISABLEDCLASS);$(voteUp).removeClass(this.FADEOUTVOTEUP_CLASS);$(voteUp).fadeIn('slow');};this.voteDown_fadeOut=function(voteDown){$(voteDown).addClass(this.FADEOUTVOTEDOWN_DISABLEDCLASS);$(voteDown).removeClass(this.FADEOUTVOTEDOWN_CLASS);$(voteDown).fadeIn('slow');};this.abuse_fadeOut=function(abuse){$(abuse).addClass('abuse-disabled');$(abuse).removeClass('abuse');$(abuse).fadeIn('slow');};this.showQAWarningMessage=function(){return 1;};this.disableOtherListeners=function(){$(this.COMMENTSUBMIT_SELECTOR).unbind("click");$(this.VOTEUP_SELECTOR).unbind("click");$(this.VOTEDOWN_SELECTOR).unbind("click");$(this.ABUSE_SELECTOR).unbind("click");$(this.COMMENTDELETE_SELECTOR).unbind("click");$(this.PAGE_SELECTOR).unbind("click");$(this.COMMENTEDIT_SELECTOR).unbind("click");$(this.COMMENTREPLYANCHOR_SELECTOR).unbind("click");$(this.COMMENTPARENTANCHOR_SELECTOR).unbind("click");$(this.DISPLAYIRRELEVANTECOMMENT_SELECTOR).unbind("click");};this.newCommentRender=function(data){WSL_Controller_GoogleAnalytics.registerClick('modulo-escribir-comentarios','comentario-ok');Self.increasePostCommentCount();Self.addNewCommentToCommentsArray(data);Self.newComment=true;Self.hash="#c"+data.id;Self.fetchRenderComments();};this.addNewCommentToCommentsArray=function(data){if(Self.getPageCount()==1&&Self.firstPageCommentCountWithoutReplies()<Self.perpageComments){Self.addToCommentsAndCreateIndexs(data);}else if(Self.getPageCount()==1&&Self.firstPageCommentCountWithoutReplies()==Self.perpageComments){$(this.PAGE_COUNT_SELECTOR).text(2);}else if(Self.getPageCount()>1&&Self.JSONrequest){lastpage=Self.comments[Self.comments.length-1].page;data.page=Self.lastPageCommentCountWithoutReplies()==Self.perpageComments?lastpage+1:lastpage;Self.addToCommentsAndCreateIndexs(data);}};this.editCommentRender=function(data){Self.updateCommentInPage(data);Self.updateCommentInCommentsArray(data.id);Self.activateCommentAddMode();WSL.getTimeAgo();if(Self.tab!='cronologico'){Self.removeReplyLink();}};this.activateCommentAddMode=function(){$("#comment-write h2").text("Escribir un comentario");$("#commentedit").remove();$(this.COMMENTFORMTEXT).show();$("#ud_text_edit").attr('contentEditable',false);$("#ud_text_edit").hide();}
this.updateCommentInPage=function(data){commentId="#c"+data.id;$(commentId).after(data.html);nextId=$(commentId).next();$(nextId).find("span.number").text($(commentId).find("span.number").text());$(nextId).attr('class',$(commentId).attr('class'));$(commentId).remove();};this.clearCommentTimeOut=function(id){if(Self.hasTimeOut(id)){for(i in Self.timeOutIds){if(Self.timeOutIds[i].id==id){clearTimeout(Self.timeOutIds[i].timeOutId);Self.timeOutIds.splice(i,1);}}}};this.userLoggedin=function(){return($(".logged").length!=0);};this.getCommentTime=function(id){return parseInt($("#c"+id).find('.commentTime').text());};this.removeCommentEditLink=function(){commentId="#c"+Self.timeOutIds[0].id;Self.timedOutIds[Self.timedOutIds.length]=Self.timeOutIds[0].id;Self.timeOutIds.splice(0,1);$(commentId).find(this.COMMENTEDIT_SELECTOR).remove();};this.commentEditTimeOut=function(id){if(Self.user_name==Self.getCommentUserName(id)){Self.hideCommentAbuseLink(id);timeout=Self.getCommentRemainEditTime(id);if(timeout>0&&!Self.hasTimeOut(id)&&!Self.TimedOut(id)){Self.setcommentEditTimeOut(id,timeout);}}
if(Self.hasTimeOut(id)){Self.showCommentEditLink(id);}};this.setcommentEditTimeOut=function(id,timeout){index=Self.timeOutIds.length;Self.timeOutIds[index]={id:id,value:timeout};Self.timeOutIds[index].timeOutId=setTimeout(this.removeCommentEditLink,timeout);Self.timeOutIds.sort(function(a,b){return a.value-b.value});};this.getCommentUserName=function(id){return $("#c"+id).find('.comment-user-id').text();};this.hideCommentAbuseLink=function(id){$("#c"+id).find('a'+this.ABUSE_SELECTOR).hide();};this.showCommentEditLink=function(id){$("#c"+id).find(this.COMMENTEDIT_CLASS).show();};this.getCommentRemainEditTime=function(id){return(Self.timeOutMins*60-(Self.servertime-Self.getCommentTime(id)))*1000;};this.isEditComment=function(){return($("#commentedit").length!=0);};this.enableCommentSubmit=function(){$(this.COMMENTSUBMIT_SELECTOR).attr("disabled",false);Self.enableListeners();};this.disableCommentSubmit=function(){Self.disableOtherListeners();$(this.COMMENTSUBMIT_SELECTOR).attr("disabled",true);};this.emptyCommentFormFields=function(){$(this.COMMENTFORMTEXT).val('');$(this.COMMENTFORM+" #ud_preview").text('');$(this.COMMENTFORM+" #ud_text_edit").text('');};this.increasePostCommentCount=function(){$("#comment-count").text(parseInt($("#comment-count").text())+1);if(("#answer-count").length>0){$("#answer-count").text(parseInt($("#answer-count").text())+1);}};this.decreasePostCommentCount=function(){$("#comment-count").text(parseInt($("#comment-count").text())-1)
if(("#answer-count").length>0){$("#answer-count").text(parseInt($("#answer-count").text())-1);}};this.firstPageCommentCountWithoutReplies=function(){firstPagecount=0;for(i=0;i<Self.comments.length;i++){if(Self.comments[i].page==1&&Self.comments[i].level==0){firstPagecount++;}}
return firstPagecount;};this.lastPageCommentCountWithoutReplies=function(){lastPagecount=0;for(i=0;i<Self.comments.length;i++){if(Self.comments[i].page==Self.comments[Self.comments.length-1].page&&Self.comments[i].level==0){lastPagecount++;}}
return lastPagecount;};this.getPageCount=function(){return parseInt($(this.PAGE_COUNT_SELECTOR).text());};this.addToCommentsAndCreateIndexs=function(data){Self.add(data.id,data.votes,data.level,data.html,data.page);Self.createIndexes();};this.updateCommentInCommentsArray=function(id){var commentId="#c"+id;var html=jQuery("<p>").append($(commentId).clone()).html();if($(commentId).prev().length>0&&$(commentId).prev().attr('class').search('reply-notify')!=-1){html=jQuery("<p>").append($(commentId).prev().clone()).html()+html;}
for(i in Self.comments){if(Self.comments[i].id==id){Self.comments[i].html=html;}}};this.showCommentReplyForm=function(){var commentID=$(this).parents("li").attr('id');if(!Self.userLoggedin()){window.location.href='/signup?referrer='+window.location.href;return false;}
if($('#'+commentID+' '+Self.COMMENTREPLYFORM).is(':visible')){$('#'+commentID+' '+Self.COMMENTREPLYFORM).hide(0);}else{Self.commentReplyForm(commentID);}
return false;};this.commentReplyForm=function(commentID){$(this.COMMENTREPLYFORM).hide(0);$(this.COMMENTREPLYFORM).html('');$('#'+commentID+' '+this.COMMENTREPLYFORM).show(0);$('#'+commentID+' '+this.COMMENTREPLYFORM).html($('#replyform').html());$('#'+commentID+' '+this.COMMENTREPLYFORM+' #comment_reply_author').html($('#'+commentID+' '+this.COMMENT_USERNAME).text());if($(this.COMMENTFORM+" input[name=subscribe]").val()==undefined){$('#'+commentID+' '+this.COMMENTREPLYFORM+' .submit-area p').each(function(){$(this).hide();});}else{var commentformsubscribe=$(this.COMMENTFORM+" input[name=subscribe]:checked").val();$('#'+commentID+' '+this.COMMENTREPLYFORM+' input[name=subscribe]').each(function(){if(commentformsubscribe==$(this).val()){$(this).attr('checked',1);}});}
$('#comment_text').keyup(Self.commentPreview);$(this.COMMENTREPLYFORM_CANCEL).unbind('click');$(this.COMMENTREPLYFORM_CANCEL).click(Self.showCommentReplyForm);$(this.COMMENTREPLYFORM_RESPONDER).click(Self.commentReplySubmit);};this.commentPreview=function(){var currentValue=$(this).val();currentValue=currentValue.replace(/\n/g,'<br />').replace(/\n\n+/g,'<br /><br />').replace(/(&lt;\/?)script/g,'$1noscript');$('#comment_preview').html(currentValue);};this.commentEditPreview=function(e){var currentValue=WSL.inittextalter($("#ud_text_edit").html());currentValue=currentValue.replace(/(&lt;\/?)script/g,'$1noscript');$('#ud_preview').html(currentValue);};this.commentReplySubmit=function(){var url=Self.COMMENTREPLY_URL;var commentID=$(this).parents("li").attr('id');params=Self.getCommentReplyParams(commentID);if(params.text.length!=0){Self.commentReplyRequest(url,params);}
return false;};this.getCommentReplyParams=function(commentID){var subscription_status=$(this.COMMENTFORM+" input[name=subscription_status]").val();var subscribe=$(this.COMMENTREPLYFORM+" input[name=subscribe]:checked").val();var text=$(this.COMMENTREPLYFORM+" #comment_text").val().replace(/^\s+|\s+$/g,'');var commentClass=Self.getCommentNestingLevel(commentID);var parentNum=$("#"+commentID).find("span.number").text();var postId=this.POSTID;var commentID=commentID;var clubTagName=$('.clubTagName').attr('id');params={subscribe:subscribe,subscription_status:subscription_status,text:text,commentClass:commentClass,parentNum:parentNum,postId:postId,commentID:commentID,clubTagName:clubTagName};return params;};this.getCommentNestingLevel=function(commentID){cmtClass=$("#"+commentID).attr('class').split(' ');if(cmtClass[1]=="reply-1"){var commentClass=2;}else if(cmtClass[1]=="reply-2"){var commentClass=3;}else if(cmtClass[1]=="reply-3"){var commentClass=4;}else{var commentClass=1;}
return commentClass;}
this.commentReplyRequest=function(url,params){$(this.COMMENTFORM+" input[name=subscribe]").each(function(){if($('#'+params.commentID+' '+this.COMMENTREPLYFORM+' input[name=subscribe]:checked').val()==$(this).val()){$(this).attr('checked',1);}});Self.showCommentReplyForm();$(Self.COMMENTREPLYANCHOR_SELECTOR).unbind('click');$(Self.COMMENTREPLYANCHOR_SELECTOR).click(Self.showCommentReplyForm);$("#replyform").hide();$(this.COMMENTREPLYFORM).hide();$.post(url,params,function(data){Self.disableOtherListeners();if(data.res==1){window.location.href='/signup?referrer='+window.location.href;}else if(data.res==-2){Self.commentReplyForm(params.commentID);$('#'+params.commentID+' '+this.COMMENTREPLYFORM+' #comment_text').val(params.text);$('#userreplyantitrollnotice').html($("#userantitrollnotice").html());$("#userreplyantitrollnotice").show();Self.enableListeners();}else if(data.res==3){Self.commentReplyForm(params.commentID);$('#'+params.commentID+' '+this.COMMENTREPLYFORM+' #comment_text').val(params.text);$("#duplicatecommentreplynotice").show();Self.enableListeners();}else if(data.res==0){Self.commentReplyResponseRender(data,params);}},'json');};this.commentReplyResponseRender=function(data,params){Self.servertime=parseInt(data.time);var commentID=Self.getLastComment(params.commentID);Self.addAfterComment(commentID.substr(1),{votes:data.votes,id:data.id,level:data.level,html:data.html});$("#"+commentID).after(data.html);if(Self.isCampaignQuestion()){Self.removeReplyLink();Self.initCampaignQuestions();}
WSL.getTimeAgo();Self.increasePostCommentCount();Self.createIndexes();Self.enableListeners();window.location.hash='c'+data.id;};this.getLastComment=function(commentID){var parentNumber=$("#"+commentID+" .number").text();var lastElement=Self.getLastReply(parentNumber);if(lastElement.length>0){var level=lastElement.find(".comment-level").text();commentID="c"+Self.getCommentBeforeReply($(lastElement).attr("id"),level);}
return commentID;};this.getCommentBeforeReply=function(ID,level){var i=0;for(;i<Self.comments.length;i++){if(Self.comments[i].id==ID.substr(1)){break;}}
i=Self.getLastCommentIndex(i,level);i--;return Self.comments[i].id;};this.getLastCommentIndex=function(i,level){for(;i<Self.comments.length;i++){if(Self.comments[i].level<level){break;}}
return i;};this.getLastReply=function(parentNumber){var res=$([]);$.fn.reverse=[].reverse;$("li a:contains('#"+parentNumber+"')").reverse().each(function(){if($(this).html()=='#'+parentNumber&&res.length==0){res=$(this).parent().next();}});return res;};this.addAfterComment=function(commentID,commentReply){for(i=0;i<Self.comments.length;i++){if(Self.comments[i].id==commentID){commentReply.page=Self.comments[i].page;Self.comments.splice(i+1,0,commentReply);}}};this.restrictLevels=function(){$("li.reply-3").find("div"+this.COMMENTREPLY_SELECTOR).remove();};this.skipCommentParent=function(){if(Self.tab!='cronologico'){Self.tab='cronologico';commentId=$(this).attr('href').substr(2);Self.pageNum=Self.getCommentPage(commentId);Self.hash="#c"+commentId;Self.renderComments();Self.highlightChronologicoTab();}
return true;};this.getCommentPage=function(commentId){page=1;for(i in Self.comments){if(Self.comments[i].id==commentId){page=Self.comments[i].page;}}
return page;};this.highlightChronologicoTab=function(){$(this.HIGHLIGHT_TAB_SELECTOR).removeClass();$(this.HIGHLIGHT_TAB_SELECTOR+":first").addClass('current');}
this.statusBadgeUpdate=function(commentID,karmaLevel){if(karmaLevel=='normal'||karmaLevel=='flojo'||karmaLevel=='irrelevante'){$('#status'+commentID).html('');$('#status'+commentID).parent('.status-badge').hide();$('#status'+commentID).parent().removeClass('status-badge');}else{$('#status'+commentID).html(karmaLevel);$('#status'+commentID).parent().addClass('status-badge');$('#status'+commentID).parent('.status-badge').show();}}
this.getCurrentTab=function(){return $(this.CURRENT_TAB_SELECTOR).attr('href').substr(1);}
this.enableCommentTabs=function(){$(this.TAB_SELECTOR).click(Self.tabclick);}
this.isCampaignQuestion=function(){if($(".isCampaign").attr("id")==true){return true;}else{return false;}}};function WSL_QA_Comments(){var that=new WSL_Comments();that.COMMENTS_SELECTOR=".answers";that.COMMENT_SELECTOR="li.answer";that.COMMENT_USERNAME=".answer-author p a";that.COMMENT_BODY=".abuse, .answer-karma, .answer-body, .answer-reply, .answer-vote";that.COMMENT_CHILDCLASS="answer-comment";that.COMMENT_REPLYCLASS="answer-comment";that.COMMENTFORM=".mform";that.COMMENTSUBMIT_SELECTOR=".mform .button";that.COMMENTEDIT_SELECTOR="a.edit-comment";that.COMMENTEDIT_CLASS=".edit-comment";that.COMMENTDELETE_SELECTOR=".deletecomment";that.DELETEURL="/json/delete_forumcomment/";that.DELETETEXT="Se suprime la respuesta \n OK para borrar, Cancelar para detener el proceso";that.COMMENTURL="/json/questionCommentSubmit";that.COMMENTEDITURL="/json/questionCommentEditSubmit";that.POSTID=$('.questionId').attr('id').substr(1);that.COMMENTFORMTEXT=".mform #respuesta";that.COMMENTREPLY_SELECTOR=".answer-reply";that.COMMENTREPLYANCHOR_SELECTOR=".answer-reply a";that.COMMENTREPLYFORM=".answer_replyform";that.COMMENTREPLYFORM_CANCEL=".answer_replyform #cancel";that.COMMENTREPLYFORM_RESPONDER=".answer_replyform #ans_responder";that.COMMENTREPLY_URL="/json/questionCommentReplySubmit";that.FADEOUTVOTEUP_SELECTOR=".util";that.FADEOUTVOTEUP_CLASS="util";that.FADEOUTVOTEUP_DISABLEDCLASS="util-votado";that.VOTEUP_SELECTOR=".util, .util-votado";that.VOTEUP_URL='/json/answervoteup/';that.FADEOUTVOTEDOWN_SELECTOR=".no-util";that.FADEOUTVOTEDOWN_CLASS="no-util";that.FADEOUTVOTEDOWN_DISABLEDCLASS="no-util-votado";that.VOTEDOWN_SELECTOR=".no-util, .no-util-votado";that.VOTEDOWN_URL='/json/answervotedown/';that.VOTEABUSE_URL='/json/answerabuse/';that.IRRELEVANTECOMMENT_TEXT="Respuesta votada como irrelevante.";that.TAB_SELECTOR="#topic-answers .sort-answers a";that.TAB_STRONG_SELECTOR="#topic-answers .sort-answers strong";that.VOTE_ERROR=".answervote_error";that.VOTE_LOGIN_ERROR='<p class="aviso">Para votar em uma resposta é preciso se identificar. Pode fazê-lo <strong><a href="/signup">aqui</a></strong></p>';that.VOTE_ALREADYVOTED='<p class="aviso">Essa resposta já foi avaliada</p>';that.VOTE_OWNCOMMENT='<p class="aviso">Não é possível votar em suas próprias respostas</p>';that.VOTE_NOT_ENOUGH_KARMA='<p class="aviso">Você não tem karma suficiente para fazer votos negativos à resposta. Para isso, é necessário ter no mínimo 3 estrelas. Complete seu perfil e participe mais para conseguir subir de nível</p>';that.WARNING='.status,.message-big';that.getCurrentTab=function(){var getSelectedTabText=$(that.TAB_STRONG_SELECTOR).html();var tabAnchorHref=that.getTabAnchorHref(getSelectedTabText);return tabAnchorHref.substr(1);};that.skipToTab=function(tab){var getSelectedTabText=$(that.TAB_STRONG_SELECTOR).html();var tabAnchorHref=that.getTabAnchorHref(getSelectedTabText);var clickedAnchorText=$(tab).html();if(clickedAnchorText!=null){$(that.TAB_STRONG_SELECTOR).replaceWith('<a href="'+tabAnchorHref+'">'+getSelectedTabText+'</a>');$(tab).replaceWith('<strong>'+clickedAnchorText+'</strong>');}
var clickedAnchorHref=that.getTabAnchorHref(clickedAnchorText);that.tab=clickedAnchorHref.substr(1);that.pageNum=1;that.hash="to-comments";that.fetchRenderComments();};that.tabPermalink=function(){tabs=$(that.TAB_SELECTOR);tabOneHtml=$(tabs[0]).html();tabOne=that.getTabAnchorHref(tabOneHtml).replace("#",'');tabTwoHtml=$(tabs[1]).html();tabTwo=that.getTabAnchorHref(tabTwoHtml).replace("#",'');tabThreeHtml=$(that.TAB_STRONG_SELECTOR).html();tabThree=that.getTabAnchorHref(tabThreeHtml).replace("#",'');tabPermalink=window.location.hash.replace("#",'');if(tabPermalink==''){that.skipToTab(tabs[0]);}else if(tabPermalink==tabOne||tabPermalink==tabThree){that.skipToTab((tabPermalink==tabOne?tabs[0]:tabs[2]));}else if(tabPermalink==tabTwo){window.location.hash="to-comments";}};that.highlightChronologicoTab=function(){var getSelectedTabText=$(that.TAB_STRONG_SELECTOR).html();var tabAnchorHref=that.getTabAnchorHref(getSelectedTabText);$(that.TAB_STRONG_SELECTOR).replaceWith('<a href="'+tabAnchorHref+'">'+getSelectedTabText+'</a>');var clickedAnchorText=$(that.TAB_SELECTOR+":first").html();$(that.TAB_SELECTOR+":first").replaceWith('<strong>'+clickedAnchorText+'</strong>');};that.getLastPageNum=function(){return 1;};that.renderTab=function(){switch(that.tab){case'recientes':that.LatestTab();break;case'cronologico':that.cronologicoTab();break;default:that.mostVotedTab();break;}};that.getTabAnchorHref=function(tabText){var href='';switch(tabText){case'Cronológico':href='#cronologico';break;case'Recientes':href='#recientes';break;default:href='#utiles';break;}
return href;};that.mostVotedTab=function(){var commentsList='';var parentid=0;var k=0;var l=0;answer=new Array();child=new Array();for(i=0;i<that.comments.length;i++){if(that.comments[i].level==0){answer[k]={index:i,karma:that.comments[i].votes};parentid=i;k++;}else{child[l]={index:i,parentid:parentid};if(that.comments[i+1]!=undefined&&that.comments[i+1].level==0){parentid=0;}
l++;}}
answer.sort(function(a,b){return parseInt(b.karma)-parseInt(a.karma)});for(i=0;i<answer.length;i++){commentsList+=that.comments[answer[i].index].html;for(j=0;j<child.length;j++){if(answer[i].index==child[j].parentid){commentsList+=that.comments[child[j].index].html;}}}
$(that.COMMENTS_SELECTOR).html(commentsList);if(that.user_name==null){that.user_name=$("#login_user_id").text();}};that.LatestTab=function(){var commentsList='';var childhtml='';var parenthtml='';that.comments.reverse();$(that.COMMENT_SELECTOR).each(function(i){if(that.comments[i].level==0){parenthtml+=that.comments[i].html;commentsList+=parenthtml+childhtml;parenthtml='';childhtml='';}else{childhtml+=that.comments[i].html;}});$(that.COMMENTS_SELECTOR).html(commentsList);that.comments.reverse();};that.updateDeletedCommentInPage=function(data){var commentId="#c"+data.id;$(commentId).after(data.html);$(commentId).remove();};that.addNewCommentToCommentsArray=function(data){that.addToCommentsAndCreateIndexs(data);};that.updateCommentVotes=function(commentID,karma,votes,karmaLevel){if(votes==1){$('#karmavotes'+commentID).html('Karma: <strong><span class="comment_karma">'+karma+'</span></strong> (<span class="votes">'+votes+'</span> voto)');}else{$('#karmavotes'+commentID).html('Karma: <strong><span class="comment_karma">'+karma+'</span></strong> (<span class="votes">'+votes+'</span> votos)');}
that.statusBadgeUpdate(commentID,karmaLevel);var commentclass=$('#c'+commentID).attr('class')+' ';$('#c'+commentID).removeClass($('#c'+commentID).attr('class'));$('#c'+commentID).addClass(commentclass+karmaLevel);};that.statusBadgeUpdate=function(commentID,karmaLevel){if(karmaLevel=='normal'||karmaLevel=='irrelevante'){$('#status'+commentID).html('');$('#status'+commentID).parent('.status-badge').hide();$('#status'+commentID).parent().removeClass('status-badge');}else{$('#status'+commentID).html(karmaLevel);$('#status'+commentID).parent().addClass('status-badge');$('#status'+commentID).parent('.status-badge').show();}};that.irrelevanteResponse=function(commentId,responseId){if($("#c"+commentId).find(that.COMMENT_BODY).is(':visible')){$("#c"+responseId).show();}else{$("#c"+responseId).hide();}};that.hideIrrelevanteResponses=function(i){var comment=that.comments[i];that.statusIrrelevanteBody(that.comments[i].id);that.irrelevanteResponses(comment);};that.hideIrrelevanteComments=function(){$(that.IRRELEVANTECOMMENT_SELECTOR).each(function(i){var commentId=$(this).attr('id').substr('1');var i=that.findCommentIndex(commentId);var comment=that.comments[i];$("#c"+commentId).find(that.COMMENT_BODY).hide();$("#c"+commentId+" .comment-display").html(that.IRRELEVANTECOMMENT_TEXT+' <a href="#">Clique para ler</a>');$(that.DISPLAYIRRELEVANTECOMMENT_SELECTOR).click(that.statusIrrelevanteComment);that.irrelevanteResponses(comment);});};that.removeReplyLink=function(){$(that.COMMENTREPLY_SELECTOR).remove();};that.editCommentRender=function(data){that.updateCommentInPage(data);that.updateCommentInCommentsArray(data.id);that.activateCommentAddMode();WSL.getTimeAgo();};that.getPageCount=function(){return 1;};that.showQAWarningMessage=function(){WSL.showQuestionPageWarning();};that.initCampaignQuestions=function(){if(parseInt($('#login_user_id').text())!=parseInt($('#qst_user_id').text())&&parseInt($('#login_user_id').text())!=parseInt(that.getCommentUserName(that.comments[0].id))){that.removeReplyLink();}
for(i=0;i<that.comments.length;i++){$('#c'+that.comments[i].id+' '+this.COMMENTREPLY_SELECTOR).hide();$('#c'+that.comments[i].id+' '+this.COMMENTREPLYANCHOR_SELECTOR).hide();if(i>0){if(parseInt(that.getCommentUserName(that.comments[0].id))==parseInt(that.getCommentUserName(that.comments[i].id))){$('#c'+that.comments[i].id).removeClass($('#c'+that.comments[i].id).attr('class'));$('#c'+that.comments[i].id).addClass("answer answer-commercial answer-comment-reply");}}
if(i==(that.comments.length-1)){if(parseInt($('#login_user_id').text())!=parseInt(that.getCommentUserName(that.comments[i].id))){$('#c'+that.comments[i].id+' '+that.COMMENTREPLY_SELECTOR).show();$('#c'+that.comments[i].id+' '+that.COMMENTREPLYANCHOR_SELECTOR).show();}}}};return that;}
var WSL_Controller_GoogleAnalytics={registerClick:function(category,action)
{_gaq.push(['_trackEvent',category,action,location.pathname]);return true;},registerAction:function(category,action,label)
{_gaq.push(['_trackEvent',category,action,label]);return true;},setCustomVar:function(varIndex,varName,varValue,level)
{_gaq.push(['_setCustomVar',varIndex,varName,varValue,level]);},trackPageview:function()
{_gaq.push(['_trackPageview()']);}};var WSL_Controller_Post={postVote:function()
{obj=this;postID=$(this).attr('id');$.post('/json/post-vote/'+postID,{},function(data)
{WSL_Controller_GoogleAnalytics.registerAction('modulo-votar-posts','vota',postID);return WSL_View_Post.postVote($(obj),data,false);},'json');return false;},postFBLikeVote:function(postName)
{$.post('/json/post-fblike-vote/'+postName,{},function(data)
{return WSL_View_Post.postVote($('#'+data.pid),data,true);},'json');return false;},commentVoteUp:function()
{return WSL_Controller_Post.commentVoteUpSpecific(this);},commentVoteUpSpecific:function(obj)
{commentID=$(obj).parents("li").attr('id');WSL_Controller_GoogleAnalytics.registerAction('modulo-moderar-comentarios','positivo',commentID);$.post('/json/commentvoteup/'+commentID,{},function(data)
{return WSL_View_Post.commentVote($(obj),data);});return false;},commentVoteDown:function()
{return WSL_Controller_Post.commentVoteDownSpecific(this);},commentVoteDownSpecific:function(obj)
{commentID=$(obj).parents("li").attr('id');WSL_Controller_GoogleAnalytics.registerAction('modulo-moderar-comentarios','negativo',commentID);$.post('/json/commentvotedown/'+commentID,{},function(data)
{return WSL_View_Post.commentVote($(obj),data);});return false;},commentAbuse:function()
{return WSL_Controller_Post.commentAbuseSpecific(this);},commentAbuseSpecific:function(obj)
{commentID=$(obj).parents("li").attr('id');$.post('/json/abuse/'+commentID,{},function(data)
{return WSL_View_Post.commentVote($(obj),data);},"json");return false;},commentPreview:function(event)
{obj=this;WSL_View_Post.commentPreview(obj);},initPostComment:function(){if($('#comment-write .submit-area').find('p').text()!=''){$('#replyform .submit-area p').show();}else{$('#replyform .submit-area p').hide(0);}
$("#userantitrollnotice").hide();},editPostLink:function()
{$(".post-single h1").append('<a target="_blank" href="'+$('#blogurl').val()+'/wp-admin/post.php?action=edit&post='+$('#hpostid').val()+'" class="edit-link">--Edit this post</a>');},postRelatedListing:function(){if($('.post-related-qa').length==0&&$('.post-related-products').length==0){$('.post-related-posts').addClass('related-full');}else if($('.post-related-qa').length==0&&$('.post-related-posts').length==0){$('.post-related-products').addClass('related-full');}else if($('.post-related-products').length==0&&$('.post-related-posts').length==0){$('.post-related-qa').addClass('related-full');}else if($('.post-related-products').length==0){$('.post-related-posts').addClass('related-double');$('.post-related-qa').addClass('related-double');}else if($('.post-related-posts').length==0){$('.post-related-qa').addClass('related-triple');}else if($('.post-related-qa').length==0){$('.post-related-posts').addClass('related-triple');}},postRelatedQA:function(){var postId=$(".itemid").attr('id');var url='/postrelatedqa/'+postId;$.get(url,{},function(data){$('.post-related-qa>p').after(data);WSL_Controller_Post.postRelatedQAVermas();});return false;},preguntaCounter:function()
{$("#pregunta").counter({count:'down',goal:80,countercss:'mchar-counter',before:$('#mform div:first')});},menealo:function()
{if($('.meneos').length!=0){$('.meneos iframe').attr('src','http://cached.weblogssl.com/meneame2.php?url='+encodeURIComponent(document.URL.replace(/(#.*$)/,'')));}},postRelatedProductsVermas:function()
{var min=0;var href='';if($('.product-list li,.product').length!=0){$('.product-list li,.product').each(function(){if(min>$(this).attr('id')*1&&$(this).attr('id')!='')
{min=$(this).attr('id');}
if(min==0){min=$(this).attr('id');}});}
if($('.post-related-products .post-related-more a').length!=0){href=$('.post-related-products .post-related-content #'+min+' a:first').attr('href');subhref=href.substring(href,href.lastIndexOf('/'));$('.post-related-products .post-related-more a').attr('href',subhref);}},postRelatedListingVermas:function()
{var min=0;var href='';if($('.post-single .post-category').length!=0){$('.post-single .post-category a').each(function(){if(min>$(this).attr('id')*1&&$(this).attr('id')!='')
{min=$(this).attr('id');href=$(this).attr('href');}
if(min==0){min=$(this).attr('id');href=$(this).attr('href');}});}
if($('.post-related-posts .post-related-more a').length!=0){$('.post-related-posts .post-related-more a').attr('href',href);}},postRelatedQAVermas:function()
{var min=0;var href='';var catname='';$('.post-related-qa .post-related-content ul li').each(function(){if(min>$(this).attr('id')*1&&$(this).attr('id')!='')
{min=$(this).attr('id');}
if(min==0){min=$(this).attr('id');}});if($('.post-related-qa .post-related-more a').length!=0){href=$('.post-related-qa .post-related-content ul #'+min+' a:first').attr('href');catname=$('.post-related-qa .post-related-content #'+min+' span').attr('id');subhref=href.substring(href,href.lastIndexOf('/'));$('.post-related-qa .post-related-more a').attr('href',subhref+'/categoria/'+catname);}},PostCommentLogin:function()
{if($(".logged").length!=0){var postId=$(".itemid").attr('id');var postName=$(".urlname").attr('id');var catName=$(".categoryname").attr('id');var url='/postcommentlogin/'+postId+'/'+postName+'/'+catName;$.get(url,{},function(data){return WSL_View_Post.PostCommentLogin(data);});return false;}}};var WSL_Controller_SignUp={checkUserName:function(userName)
{successUserName=false;if(userName.length<3){msg='El username no puede contener menos de 3 caracteres';WSL_View_SignUp.checkUserName(1,msg);}else{validUser=new String(userName.match(/[a-z]{1}[.a-z0-9_-]+/));if(validUser!='null'&&validUser.length==userName.length&&validUser.length>1){$.post('/json/checknewusername/'+userName,{},function(data)
{return WSL_View_SignUp.checkUserName(data);});successUserName=true;}else{msg='El username contiene caracteres no permitidos';WSL_View_SignUp.checkUserName(1,msg);}}
return successUserName;},checkEmail:function(email)
{successEmail=false;if(email.length<3){msg='El correo electrónico no puede contener menos de 3 caracteres';WSL_View_SignUp.checkEmail(1,msg);}else{if(WSL_Tools.validateEmail(email)){successEmail=true;}else{msg='Insira um endereço de email válido';WSL_View_SignUp.checkEmail(1,msg);}}
return successEmail;},checkConditions:function(checked)
{successConditions=true;if(checked!=true){msg='Para poder darte de alta tienes que aceptar las condiciones legales';WSL_View_SignUp.checkConditions(1,msg);successConditions=false;}
return successConditions;},finishSignUp:function()
{success=true;if(this.checkUserName($('#username').val())==false){alert('El nombre de usuario introducido no es correcto');success=false;}
if(this.checkEmail($('#username').val())==false){alert('El correo electrónico introducido no es correcto');success=false;}
if(this.checkConditions($('#condition_agree').attr('checked'))==false){alert('Necesitas aceptar las condiciones legales');success=false;}
if(success==true){this.submit();}
return success;},checkFbUserName:function(userName)
{var msg=null;if(userName.length<3){msg='El username no puede contener menos de 3 caracteres';WSL_View_SignUp.checkUserName(1,msg);}else{var validUser=new String(userName.match(/[a-z]{1}[.a-z0-9_-]+/));if(validUser!='null'&&validUser.length==userName.length&&validUser.length>1){$.post('/json/checknewusername/'+userName,{},function(data)
{if(data==0){$("#register-form").submit();}else{WSL_View_SignUp.checkUserName(1,msg);}});}else{msg='El username contiene caracteres no permitidos';WSL_View_SignUp.checkUserName(1,msg);}}}};function WSL_Login()
{var Self=this;var cookieObj=null;var userId=null;var authorWebpage=null;var author=null;var userName=null;var karmaLevel=null;var globalId=null;var isEditor=null;var facebookUid=null;var authorEmail=null;var avatar=null;var loginType=null;var NOIMG_URL_SELECTOR='#noimg_url';var AVATAR_MINI_URL_SELECTOR='#img_avatar_mini_url';var BLOG_TITLE_SELECTOR='#blogtitle';var FBOOK_CONNECT_SELECTOR='#fbook_connect';var LOGGED_MENU_SELECTOR='.logged p .menu';var LOGGED_AVATAR_SELECTOR='.logged p .avatar';var LOGGED_LAST_LINK_SELECTOR='.logged p a:last';var TAGLINE_SELECTOR='#tagline';var LOGIN_PARA_SELECTOR='.login p';var LOGGED_PARA_SELECTOR='.logged p';var LOGIN_SELECTOR='.login';var LOGGED_SELECTOR='.logged';var LOGIN_USER_ID_SELECTOR='#login_user_id';var init=function()
{setCookieObj();if(cookieObj!=null){setUserId();setAuthorWebpage();setAuthor();setUserName();setKarmaLevel();setGlobalId();setIsEditor();setFacebookUid();setAuthorEmail();setAvatar();setLoginType();}
displayLoginBox();};var setCookieObj=function()
{cookieObj=$.parseJSON(decodeURIComponent($.cookie('weblogssl_d')));};var setUserId=function()
{userId=cookieObj.user.UserId;};var setAuthorWebpage=function()
{authorWebpage=cookieObj.user.AuthorWebpage;};var setAuthor=function()
{author=cookieObj.user.Author;};var setUserName=function()
{userName=cookieObj.user.UserName;};var setKarmaLevel=function()
{karmaLevel=cookieObj.user.KarmaLevel;};var setGlobalId=function()
{globalId=cookieObj.user.GlobalId;};var setIsEditor=function()
{isEditor=cookieObj.user.iseditor;};var setFacebookUid=function()
{facebookUid=cookieObj.user.FacebookUid;};var setAuthorEmail=function()
{authorEmail=cookieObj.user.AuthorEmail;};var setAvatar=function()
{avatar=cookieObj.user.Avatar;};var setLoginType=function()
{loginType=cookieObj.login_type;};var displayLoginBox=function()
{if(!cookieObj){displayLogoffBox();}else if(loginType=='standard'||loginType=='openid'){displayNormalLoggedinBox();}else if(loginType=='facebook'){displayFBLoggedinBox();}};var displayLogoffBox=function()
{$('<div id="user" class="login"><p></p></div>').insertAfter(TAGLINE_SELECTOR);logoff_html='<a href="/signup" title="Faça login ou registre-se em '+$(BLOG_TITLE_SELECTOR).val()+'" rel="nofollow" class="menu">Olá!</a>';logoff_html=logoff_html+'<a href="/signup" rel="nofollow" class="avatar"><img src="'+$(NOIMG_URL_SELECTOR).val()+'/images/avatar.jpg'+'" alt="Avatar de usuario" /></a>';logoff_html=logoff_html+'<a title="Faça login ou registre-se" rel="nofollow" class="button" href="/signup"><span>Entrar</span></a>'
if($(FBOOK_CONNECT_SELECTOR).val()==1){logoff_html=logoff_html+'<a href="#" class="fbc"><img src="'+$(NOIMG_URL_SELECTOR).val()+'/images/fbc-login.png" alt="FB" /></a>';}
$(LOGIN_PARA_SELECTOR).html(logoff_html);$('<div id="fbnotlogged"></div>').insertAfter(LOGIN_SELECTOR);};var displayNormalLoggedinBox=function()
{name=getUserName();url=getUserUrl();avatar_url=getUserAvatarUrl();displayLoggedinBox();$(LOGGED_MENU_SELECTOR).text(name);$(LOGGED_MENU_SELECTOR).attr('href',url);$(LOGGED_AVATAR_SELECTOR).attr('href',url);$(LOGGED_AVATAR_SELECTOR).html('<img src="'+avatar_url+'"/>');$(LOGIN_USER_ID_SELECTOR).val(userId);};var displayLoggedinBox=function()
{display_name_link='<a href="#" class="menu"></a>';display_avatar_link='<a href="#" class="avatar"></a>';display_logout_link='<a href="/logout" title="Encerrar sessão">sair [x]</a>';loggedon_html='<div id="user" class="logged"><p class="f"></p></div>';loggedon_html=loggedon_html+'<span id="login_user_id" style="display:none">'+userId+'</span>';if(loginType=='facebook'){loggedon_html=loggedon_html+'<div id="fblogged"></div>';}else{loggedon_html=loggedon_html+'<div id="normaluserlogged"></div>';}
$(loggedon_html).insertAfter(TAGLINE_SELECTOR);$(LOGGED_PARA_SELECTOR).html(display_name_link+display_avatar_link+display_logout_link);};var displayFBLoggedinBox=function()
{var fbname=null;url=getUserUrl();fbname=getUserName();fbavatar=getUserAvatarUrl();displayLoggedinBox();$(LOGGED_MENU_SELECTOR).html(fbname);$(LOGGED_MENU_SELECTOR).attr('href',url);$(LOGGED_AVATAR_SELECTOR).attr('href',url);$(LOGGED_AVATAR_SELECTOR).html(fbavatar);$(LOGGED_LAST_LINK_SELECTOR).attr('class','fblogout');$(LOGGED_LAST_LINK_SELECTOR).attr('href','#');$(LOGGED_SELECTOR).next('span').next('div').attr('id','fblogged');};var getUserName=function()
{var name=null;if(loginType=='standard'||loginType=='openid'){if(author!=''&&author!=null){name=author;}else if(userName!=''&&userName!=null){name=userName;}else if(userId!=''&&userId!=null){name=userId;}}else if(loginType=='facebook'){name='<fb:name uid="'+facebookUid+'" useyou="false" linked="false"></fb:name>';}
return name;};var getUserUrl=function()
{var name=null;if(userName!=null){name=userName;}else if(userId!=null){name=userId;}
url='/usuario/'+name;return url;};var getUserAvatarUrl=function()
{var avatar_url=null;if(loginType=='standard'||loginType=='openid'){if(avatar!=0){avatar_url=$(AVATAR_MINI_URL_SELECTOR).val()+globalId+'_'+avatar+'.png';}else{avatar_url=$(NOIMG_URL_SELECTOR).val()+'/images/avatar.jpg';}}else if(loginType=='facebook'){avatar_url='<fb:profile-pic uid="'+facebookUid+'" facebook-logo="true" size="square" linked="false"></fb:profile-pic>';}
return avatar_url;};this.getLoginStatus=function()
{if(cookieObj!=null)
return true;return false;}
init();}
var WSL_Controller_User={makePrivate:function(isPublic)
{if(isPublic){url='/json/makeprivate';}else{url='/json/removeprivate';}
$.post(url,{},function(data)
{return WSL_View_User.makePrivate(data);});},descriptionCounter:function()
{return WSL_View_User.descriptionCounter();},subscribe:function(id,subscribe,isSuscribe)
{if(isSuscribe){url='/json/subscribe/'+id+'/'+subscribe;}else{url='/json/unsubscribe/'+id;}
$.post(url,{},function(data)
{if(data==0){if(isSuscribe){$('#'+id+' .email-subscribe').hide();if(subscribe==1){$('#'+id+' .subscribe-post').show();}else if(subscribe==2){$('#'+id+' .subscribe-comment').show();}}else
{$('#'+id+' .email-subscribe').show();if(subscribe==1){$('#'+id+' .subscribe-post').hide();}else if(subscribe==2){$('#'+id+' .subscribe-comment').hide();}}
return WSL_View_User.subscribe(data);}else{alert('Se ha producido un error');return false;}});},addExpert:function(id,isRemoveExperto)
{if(isRemoveExperto){url='/json/removeexpert/'+id;WSL_Controller_GoogleAnalytics.registerAction('modulo-producto-anadirexperto',id,'anadir-experto');}else{url='/json/addexpert/'+id;WSL_Controller_GoogleAnalytics.registerAction('modulo-producto-anadirexperto',id,'quitar-experto');}
$.post(url,{},function(data)
{if(data==0){return WSL_View_User.addExpert(data);}else{alert('Se ha producido un error');return false;}});},removeExpert:function(id)
{$.post('/json/removeexpert/'+id,{},function(data)
{if(data==0){return WSL_View_User.removeExpert(data);}else{alert('Houve um erro');return false;}});},addExpertAll:function(id,isExperto)
{if(isExperto){url='/json/removeexpert/'+id;}else{url='/json/addexpert/'+id;}
$.post(url,{},function(data)
{if(data==0){return WSL_View_User.addExpertAll(data);}else{alert('Houve um erro');return false;}});},userPrivate:function()
{$('#private').click(function()
{currentObject=$(this);isPublic=$(this).children('a').hasClass('public');WSL_Controller_User.makePrivate(isPublic);return false;});},expertAdd:function()
{$('#addexpert').click(function()
{currentObject=$(this);id=$(this).attr('rel');isRemoveExperto=$(this).children('a').hasClass('removeExperto');WSL_Controller_User.addExpert(id,isRemoveExperto);return false;});},subscriptions:function()
{$('.suscribe').children().click(function()
{var css_var=$(this).children('.email-subscribe').css('display');if(css_var=="inline"){isSubscribe=true;}else{isSubscribe=false;}
if(isSubscribe)
{var id=$(this).parents("div").attr('id');$('#'+id+' .exito').hide();$('#'+id+' .subscribe_form').html($('#subscribe_real_form').html());$('#'+id+' .subscribe_form').show("slow");$("#"+id+" .enabled").click(function()
{var subscribe=$("#"+id+" input[@name='subscribe']:checked").val()
var type='';if(subscribe==undefined){alert("Por favor selecione alguma opção");}
else{$('#'+id+' .subscribe_form').hide("slow");WSL_Controller_User.subscribe(id,subscribe,isSubscribe);}});$("#"+id+" .disabled").click(function()
{$('#'+id+' .subscribe_form').hide("slow");});}else
{var id=$(this).parents("div").attr('id');var css_post=$(this).children('.subscribe-post').css('display');var css_comment=$(this).children('.subscribe-comment').css('display');if(css_post=='inline'){subscribe=1;$('#'+id+' .exito').html($('#exit-post').html());$('#'+id+' .exito').show("slow");}else if(css_comment=='inline'){subscribe=2;$('#'+id+' .exito').html($('#exit-comment').html());$('#'+id+' .exito').show("slow");}
WSL_Controller_User.subscribe(id,subscribe,isSubscribe);}});},expertos:function()
{$('.expertos').click(function()
{currentObject=$(this);id=$(this).attr('id');isExperto=$(this).hasClass('quitar');WSL_Controller_User.addExpertAll(id,isExperto);return false;});}};var WSL_Controller_Forum={postVote:function()
{obj=this;questionID=$(this).attr('id');$.post('/json/question-vote/'+questionID,{},function(data)
{WSL_Controller_GoogleAnalytics.registerAction('modulo-votar-posts','vota',questionID);return WSL_View_Forum.postVote($(obj),data,false);},'json');return false;},questionSubmit:function()
{WSL_Controller_Forum.validateQuestion();return false;},validateQuestion:function()
{var title=$(".mform #pregunta").val().replace(/^\s+|\s+$/g,'');var desc=$(".mform #description").val().replace(/^\s+|\s+$/g,'');if($(".mform #tags").length)
var tags=$(".mform #tags").val().replace(/^\s+|\s+$/g,'');if($(".mform #category").length)
var category=$(".mform #category").val().replace(/^\s+|\s+$/g,'');if($('#subscribe-email:checked').val()!=null){var subscribe=1;}else{var subscribe=0;}
if($(".campaign_id").length>0){var campaignId=parseInt($('.campaign_id').attr('id'));}else{var campaignId=0;}
$(".mform #success_msg").hide();$(".mform #duplicate_msg").hide();$(".mform #userantitrollnotice").hide();$(".mform #pregunta_error").hide();var url="/json/validatequestion";var params={subscribe:subscribe,title:title,desc:desc,category:category,tags:tags,campaignId:campaignId};$.post(url,params,function(data){WSL_Controller_Forum.validateQuestionSubmit(data);},'json');},validateQuestionSubmit:function(data)
{$(".mform #pregunta_error").hide();$(".mform #category_error").hide();$(".mform #qa-tagbox .error,.message-big").hide();$(".mform #duplicate_msg").hide();$(".mform #userantitrollnotice").hide();$(".mform #inactiveuser").hide();$(".mform #questionstatus").hide();if(data.res==-1){$(".mform #pregunta_error").show();}else if(data.res==-4){$(".mform #category_error").show();}else if(data.res==2){$(".mform #pregunta").addClass('errorbox');$(".mform #duplicate_msg").show();$(".mform #duplicate_msg a").text(params.title);}else if(data.res==-2){$(".mform #userantitrollnotice").show();}else if(data.res==-5){$(".mform #inactiveuser").show();}else if(data.res==3){$(".mform #pregunta").addClass('errorbox');$(".mform #duplicate_msg").show();}else if(data.res==1){$(".mform #pregunta").addClass('errorbox');$(".mform #questionstatus").show();$(".mform #questionstatus a").text(data.title);$(".mform #questionstatus a").attr('href',data.url);}else if(data.res==0){WSL_Controller_Forum.forumQuickLogin();}else if(data.res==-6){$(".mform #qa-tagbox .error,.message-big").show();$(".mform #qa-tagbox #tags").addClass('errorbox');}},forumQuickLogin:function()
{var userlogin=$(".userlogin,.logged").attr("id");if(userlogin==true||userlogin=='user')
{WSL_Controller_Forum.forumQuestionSubmit(0,null,null);}else{$('.mform #loginerror').hide();$('.mform #regemail_error').hide();$('.mform #regpassword_error').hide();$('.mform #username_error').hide();var registro=$(".mform #registro").attr("checked");var identificacion=$(".mform #identificacion").attr("checked");if(registro==true){var url='/forumregistration';var userEmail=$(".mform #regemail").val();var userPassword=$(".mform #regpassword").val();var userNiceName=$(".mform #username").val();params={user_name:userNiceName,email:userEmail,password:userPassword,action:'register'};$.post(url,params,function(data){if(data.result==true){WSL_Controller_Forum.forumQuestionSubmit(data.globalId,data.userName,data.url);}else if(data.result==false){if(data.errormsg['email']){$('.mform #regemail_error').show();$('.mform #regemail_error').html(data.errormsg['email']);}
if(data.errormsg['password']){$('.mform #regpassword_error').show();$('.mform #regpassword_error').html(data.errormsg['password']);}
if(data.errormsg['user_name']){$('.mform #username_error').show();$('.mform #username_error').html(data.errormsg['user_name']);}}},'json');}else if(identificacion==true){var url='/forumsignup';var userName=$(".mform #logemail").val();var userPassword=$(".mform #logpassword").val();params={ud_username:userName,ud_pswd:userPassword};$.post(url,params,function(data){if(data.result==1){WSL_Controller_Forum.forumQuestionSubmit(0,null,null);}else if(data.result==0){$('.mform #loginerror').show();$('.mform #loginerror').html(data.errormsg);}},'json');}}},forumFbLogin:function()
{$('.mform #facebook').attr("checked","checked");$.post('/signup-facebook',{},function(data){if(data.res==1){$.post('/json/islogin',{},function(result){if(result==1){WSL_Controller_Forum.forumQuestionSubmit(0,null,null);}});}else if(data.res==2){window.location=data.url;}},'json');},forumQuestionSubmit:function(globalId,userName,returnUrl)
{var title=$(".mform #pregunta").val().replace(/^\s+|\s+$/g,'');var desc=$(".mform #description").val().replace(/^\s+|\s+$/g,'');if($(".mform #tags").length)
var tags=$(".mform #tags").val().replace(/^\s+|\s+$/g,'');if($(".mform #category").length)
var category=$(".mform #category").val().replace(/^\s+|\s+$/g,'');if($('#subscribe-email:checked').val()!=null){var subscribe=1;}else{var subscribe=0;}
if($(".campaign_id").length>0){var campaignId=parseInt($('.campaign_id').attr('id'));}else{var campaignId=0;}
$(".mform #success_msg").hide();$(".mform #duplicate_msg").hide();$(".mform #userantitrollnotice").hide();$(".mform #pregunta_error").hide();var url="/json/questionSubmit";var params={subscribe:subscribe,title:title,desc:desc,category:category,tags:tags,campaignId:campaignId,globalId:globalId,userName:userName};$.post(url,params,function(data)
{WSL_View_Forum.questionSubmit(data,returnUrl);},'json');},moreQuestions:function()
{var offset=parseInt($('.index-table tr').length-1);if($('#sub-tabs a:first').hasClass('current')){var url="/forum/record/"+offset;}else if(!$('#sub-tabs a:last').hasClass('current')){var url="/forum/sinresponder/record/"+offset;}
$.get(url,{},function(data){WSL_View_Forum.moreQuestions(data);});return false;},questionCommentSubmit:function()
{$("#duplicatecommentnotice").hide();var text=$("[name=text]").val().replace(/^\s+|\s+$/g,'');var questionId=$('.questionId').attr('id').substr(1);var subscription=false;var url="/json/questionCommentSubmit";var params={postId:questionId,text:text,subscription:subscription};if(params.text.length!=0){$.post(url,params,function(data)
{WSL_View_Forum.questionCommentSubmit(data);},'json');}
return false;},moreQuestionsByTag:function(tagname)
{var offset=parseInt($('.index-table tr').length-1);var url='/forum/tag/'+tagname+'/record/'+offset;$.get(url,{},function(data){WSL_View_Forum.moreQuestions(data);});return false;},moreQuestionsByCategory:function(categoryname)
{var offset=parseInt($('.index-table tr').length-1);var url='/forum/categoria/'+categoryname+'/record/'+offset;$.get(url,{},function(data){WSL_View_Forum.moreQuestions(data);});return false;},moreQuestionsByCampaign:function(campaignid)
{var offset=parseInt($('.index-table tr').length-1);var url='/forum/campaign/'+campaignid+'/record/'+offset;$('.showMore').remove();$.get(url,{},function(data){WSL_View_Forum.moreQuestions(data);});return false;},campaignMessage:function()
{var cookie=$.cookie('weblogssl_d_message');var cookieObj=$.parseJSON(decodeURIComponent(cookie));if(cookieObj=='campaign'){$(".exito").show();}},getTagsByTitle:function()
{var tag=$(".mform #pregunta").val().replace(/^\s+|\s+$/g,'');var url='/json/forumtitle_tags';var params={tag:tag};if(params.tag.length>0){$.get(url,params,function(data)
{WSL_View_Forum.getTagsByTitle(data);},'json');}else{$('.mform #tags').val('');$(".informacion").hide();}
return false;}};jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};jQuery.wordpressuser=function(){var wpuser=false;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,13)=='wordpressuser'){wpuser=true;break;}}}
return wpuser;};var currentObject;var WSL={referer:null,fbLoginStatus:null,initPostPage:function()
{if($('#hpostid').length){WSL.showPostPageWordpressUserLinks();}
$('#ud_text').keyup(WSL_Controller_Post.commentPreview);WSL_Controller_Post.initPostComment();WSL.initSidebar();WSL_Controller_Product.initProductWishHave();$('.post-votes').click(WSL_Controller_Post.postVote);WSL_Controller_Post.postRelatedListing();WSL_Controller_Post.menealo();WSL_Controller_Post.postRelatedProductsVermas();WSL_Controller_Post.postRelatedListingVermas();prettyPrint();},initQAPage:function()
{$('#ud_text').keyup(WSL_Controller_Post.commentPreview);WSL_Controller_Post.initPostComment();$('.wsl-likes,.post-likes').click(WSL_Controller_Forum.postVote);},meneame:function()
{var url_clean=document.URL.replace(/(#.*$)/,'');var url='http://cached.weblogssl.com/meneame.php?url='+encodeURIComponent(url_clean);document.write("<iframe src='"+url+"' width='60' height='78' frameborder='0' scrolling='no' class='meneame'></iframe>");},isWordpressUser:function()
{var wpuser=$.wordpressuser();if(wpuser){$(".deletecomment").show();}},initHomePage:function()
{$('.post-votes').click(WSL_Controller_Post.postVote);WSL.initSidebar();prettyPrint();var num=$('div.mvc').length;var randNum=Math.floor(Math.random()*num);var x=0;while(x<num){if(x==randNum){$('div.mvc').eq(x).show();}
else{$('div.mvc').eq(x).hide();}
x++;};},initAuthorPage:function()
{WSL_Controller_User.expertAdd();},initDeleteComment:function()
{$('.deletecomment').click(function()
{id=$(this).attr('id');WSL_Controller_Post.deleteComment(id);return false;});},initUserMainPage:function()
{WSL_Controller_Product.initUserPage();WSL_Controller_User.userPrivate();WSL_Controller_User.expertAdd();WSL_Controller_User.subscriptions();WSL_Controller_User.expertos();WSL.getTimeAgo();$("#activity ul.tabs").tabs("#activity > div.panes > div.user-activity");},initUserPageConversations:function()
{WSL_Controller_User.userPrivate();WSL_Controller_User.expertAdd();WSL_Controller_User.subscriptions();WSL.getTimeAgo();},initUserPage:function()
{WSL_Controller_User.userPrivate();WSL_Controller_User.expertAdd();WSL.getTimeAgo();},initGalleryPage:function()
{$('#carousel1').jcarousel();$('.thumbnail').click(function(){href=$(this).attr('href');src=$(this).attr('rel');$('#tag-actual a').attr('href',href);$('#tag-actual img').attr('src',src);$('#tagtitle a').attr('href',href);$('.thumbnail').removeClass('act');$(this).addClass('act');return false;});},initLoggedIn:function()
{WSL_View_User.loggedInBox();},initRegisterPage:function()
{$('#checkNewUserName').click(function()
{WSL_Controller_SignUp.checkUserName($('#username').val());return false;});$('#finish').click(function()
{WSL_Controller_SignUp.finishSignUp();return false;});},initPrivatePage:function()
{$('#private-remove-expert').bind('click',function()
{currentObject=$(this);userId=$(this).attr('name');WSL_Controller_User.removeExpert(userId);});},initEditUserPage:function()
{$('#description').keyup(function()
{WSL_Controller_User.descriptionCounter();return false;});$('#checkNewUserName').click(function()
{WSL_Controller_SignUp.checkUserName($('#username').val());return false;});},initSidebar:function()
{$('#lo-mejor ul.tabs').tabs('#lo-mejor div.panes > div');$('#comentarios ul.tabs').tabs('#comentarios div.panes > div');$('.panes h3').hide();},initProductPage:function()
{WSL_Controller_Carousel.initProductPage();WSL_Controller_Product.init();WSL.getTimeAgo();},initProductIndex:function()
{WSL_Controller_ProductIndex.initProductIndex();WSL.getTimeAgo();},inittextalter:function(str)
{var ta=document.createElement("textarea");ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");return ta.value;},initFavicons:function()
{$(function()
{$('#favicons-list').attr('src','http://cached.weblogssl.com/iframe.html');});},initSearchBox:function()
{var active_color='#000';var inactive_color='#ccc';$("input.default-value").css("color",inactive_color);var default_values=new Array();$("input.default-value").focus(function(){if(!default_values[this.id]){default_values[this.id]=this.value;}
if(this.value==default_values[this.id]){this.value='';this.style.color=active_color;}
$(this).blur(function(){if(this.value==''){this.style.color=inactive_color;this.value=default_values[this.id];}});});},initFacebook:function()
{},fbLogin:function()
{FB.login(function(response){if(response.authResponse){WSL.fbRedirect(null);}},{scope:'email'});return false;},fbRedirect:function(referer)
{$.post('/signup-facebook',{},function(data)
{if(referer==null){referer=WSL.referer;}
if(referer==null){referer=window.location.pathname;}
if(referer=='/signup'||referer=='/singup-facebook'){referer='/';}
if(data.res==1){$.post('/json/islogin',{},function(result){if(result==1){window.location=referer;}});}else if(data.res==2){window.location=data.url;}else{WSL.fbLogout();}},'json');},setReferer:function(referer)
{WSL.referer=referer;},fbLogout:function()
{FB.logout(function(response){window.location='/logout';});return false;},fbAutoLogin:function()
{FB.getLoginStatus(function(response){if(response.status==='connected'){WSL.fbRedirect(null);}});},fbAutoLogout:function()
{FB.getLoginStatus(function(response){if(response.status==='not_authorized'){$.get('/fbAutoLogout',{},function(data)
{var ref=WSL.referer;if(ref==null){ref=window.location.pathname;}
window.location=ref;});}});},fbLoginCheck:function(response)
{WSL.fbLoginStatus=response.status;},fbAsyncInit:function(appId)
{FB.init({appId:appId,status:true,cookie:true,xfbml:true});if($("#fbnotlogged").length){WSL.fbAutoLogin();}
if($("#fblogged").length){WSL.fbAutoLogout();}
FB.getLoginStatus(function(response){WSL.fbLoginCheck(response);if((response.status==='connected')||(response.status=='notConnected')){if($('.fblike,fb-like').length!=0){$('.wsl-likes').hide();$('.fblike,fb-like').show();}}else if(response.status=='unknown'){$('.wsl-likes').show();}
if($('#forum-item-likes').length==0){$('.wsl-likes,.post-likes').click(WSL_Controller_Post.postVote);}});FB.Event.subscribe('edge.create',function(href,widget){str=WSL.explode('/',href,0);var ln=str.length;var postname=str[ln-1];var category=str[ln-2];if($('#forum-item-likes').length==0&&$('.wsl-likes,.fb-like-button').length==0){WSL_Controller_Post.postFBLikeVote(postname);}});$("a.fbc").click(WSL.fbLogin);$("a.fblogout").click(WSL.fbLogout);},explode:function(delimiter,string,limit){var emptyArray={0:''};if(delimiter===true){delimiter='1';}
if(!limit){return string.toString().split(delimiter.toString());}else{var splitted=string.toString().split(delimiter.toString());var partA=splitted.splice(0,limit-1);var partB=splitted.join(delimiter.toString());partA.push(partB);return partA;}},getUsersForComunityPage:function(offset)
{var offset=parseInt(offset);$('#link'+offset).html('<a class="button disabled"><span><img src="http://testimg.xataka.com/lp2/v2/images/ajax-loader.gif"/> Cargando más usuarios</span></a>');if(offset==40){$('<div id='+offset+'></div>').insertAfter("#community-index");}else{var beforeDivId=offset-40;$('<div id='+offset+'></div>').insertAfter("#"+beforeDivId);}
$('#'+offset).hide();url="/comunidad/record/"+offset;var tabid=offset+40;$.get(url,{},function(data){$('#'+offset).html(data);$('#link'+offset).remove();$('#'+offset).fadeIn('fast').slideDown('fast');$('#sub-tab'+tabid).remove();FB.XFBML.parse(document.getElementById(offset));});return true;},initComunidadPage:function()
{WSL.getTimeAgo();},getTimeAgo:function()
{$("abbr.timeago").timeago();},initLoMejorPage:function()
{WSL.getTimeAgo();},getPostsForLoMejorPage:function(offset)
{var offset=parseInt(offset);$('#link'+offset).html('<a class="button disabled"><span><img src="http://testimg.xataka.com/lp2/v2/images/ajax-loader.gif"/> Cargando...</span></a>');if(offset==40){$('<div id='+offset+'></div>').insertAfter("#thebest-index");}else{var beforeDivId=offset-40;$('<div id='+offset+'></div>').insertAfter("#"+beforeDivId);}
$('#'+offset).hide();url="/lomejor/record/"+offset;$.get(url,{},function(data){$('#'+offset).html(data);$('#link'+offset).remove();$('#'+offset).fadeIn('fast').slideDown('fast');FB.XFBML.parse(document.getElementById(offset));});return true;},handleSubscription:function(postId)
{var cookie=$.cookie('weblogssl_d');var cookieObj=$.parseJSON(decodeURIComponent(cookie));if(cookieObj.login_type!=''){userId=cookieObj.user.UserId
url="/json/post/"+postId;$.get(url,{},function(data){$("#commentform input[name=subscribe]").each(function(){if($(this).val()==data.res){$(this).attr('checked',1);}})
$("#commentform input[name=subscription_status]").val(data.res);},'json');}},moreQuestions:function()
{$("#forum-index #viewmore").click(WSL_Controller_Forum.moreQuestions);},forwardQuestion:function()
{$("#ask-step1 .button").click(WSL_View_Forum.forwardQuestion);},desableButton:function()
{$("#pregunta").keyup(WSL_View_Forum.desableButton);},getTagsByTitle:function()
{$("#pregunta").change(WSL_Controller_Forum.getTagsByTitle);},questionSubmit:function()
{$(".mform #enviar").click(WSL_Controller_Forum.questionSubmit);},initQuestionPage:function()
{$('#ud_text').keyup(WSL_View_Forum.commentPreview);$(".fb-hide a.button").click(WSL_Controller_Forum.postVote);$('.wsl-likes,.post-likes').click(WSL_Controller_Forum.postVote);},questionCommentSubmit:function()
{$(".submit-area .button").click(WSL_Controller_Forum.questionCommentSubmit);},questionCommentAbuse:function()
{$('.abuse').click(function(){$('.commentvote_error').hide();var commentID=$(this).parents("li").attr('id');var obj=this;$.post('/json/question-comment-abuse/'+commentID,{},function(data)
{$('.commentvote_error').html('');$('#c'+data.cid+' .commentvote_error').show();if(data.res==1){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">Para votar un comentario es necesario identificarse. Puede hacerlo <strong><a href="/signup">aqui</a></strong></p>');}
if(data.res==2){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">Ya has votado este comentario</p>');}
if(data.res==4){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">No puedes votar tus propios comentarios</p>');}
if(data.res==0){$('#f'+data.cid).removeClass('abuse');$('#f'+data.cid).addClass('abuse-disabled');$('#f'+data.cid).fadeIn('slow');}
return false;},'json');})},questionAbuse:function()
{$('.question_abuse').click(function(){$('.commentvote_error').hide();var commentID=$(this).parents("li").attr('id');var obj=this;$.post('/json/question-abuse/'+commentID,{},function(data)
{$('#e'+data.cid+'.commentvote_error').html('');$('#e'+data.cid+' .commentvote_error').show();if(data.res==1){$('#e'+data.cid).html('<p class="aviso">Para votar un comentario es necesario identificarse. Puede hacerlo <strong><a href="/signup">aqui</a></strong></p>');}
if(data.res==4){$('#e'+data.cid).html('<p class="aviso">No puedes votar tus propios comentarios</p>');}
if(data.res==5){$('#e'+data.cid).html('<p class="aviso">Ya has votado este comentario</p>');}
if(data.res==0){var abuse=$('#q'+data.cid+' .report');$(abuse).removeClass('report');$(abuse).addClass('abuse-disabled');$(abuse).fadeIn('slow');}
return false;},'json');})},initForumCommentVote:function()
{$("a.question_comment_vote").bind("click",function actions(){var commentId=$(this).attr("id");url='/json/question-comment-vote/'+commentId;$.post(url,{},function(data)
{var votes;votes=data[1];$('#c'+data.cid+' .commentvote_error').html('');$('#c'+data.cid+' .commentvote_error').show();if(data[0]==1){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">Para votar un comentario es necesario identificarse. Puede hacerlo <strong><a href="/signup">aqui</a></strong></p>');}
else if(data[0]==2){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">Ya has votado este comentario</p>');}
else if(data[0]==4){$('#c'+data.cid+' .commentvote_error').html('<p class="aviso">no se puede recomendar su comentario</p>');}else if(data[0]==0){var id=commentId+'votes';$('#'+id).html(votes);}},'json');return false;});},moreQuestionsByTag:function(tagname)
{$("#forum-index #viewmore").bind('click',{tag:tagname},function(event){WSL_Controller_Forum.moreQuestionsByTag(event.data.tag);return false;});},moreQuestionsByCategory:function(categoryname)
{$("#forum-index #viewmore").bind('click',{category:categoryname},function(event){WSL_Controller_Forum.moreQuestionsByCategory(event.data.category);return false;});},moreCampaignQuestions:function(campaignid)
{$("#forum-index #viewmore").bind('click',{campaignid:campaignid},function(event){WSL_Controller_Forum.moreQuestionsByCampaign(event.data.campaignid)});},showPostPageWordpressUserLinks:function()
{if(WSL.checkWordpressUser()){WSL_Controller_Post.editPostLink();}},checkWordpressUser:function()
{var wpuser=$.wordpressuser();if(wpuser){return true;}
return false;},checkFbUserName:function()
{$('#checkNewUserName').click(function(){var userName=$('#username').val();WSL_Controller_SignUp.checkFbUserName(userName);return false;});},showQuestionPageWarning:function()
{comment_count=$('#comment-count').text()*1;var vote_count=0;$('.answer-karma .votes').each(function(){if($(this).text()*1==0){vote_count++;}});if(comment_count>=3&&vote_count==comment_count){$('.status,.message-big').show();}else{$('.status,.message-big').hide();}},initTwitter:function()
{if(twttr){twttr.events.bind('click',function(intent_event){if(intent_event){var label=intent_event.region;_gaq.push(['_trackEvent','twitter_web_intents',intent_event.type,label]);}});twttr.events.bind('tweet',function(intent_event){if(intent_event){var label=intent_event.data.tweet_id;_gaq.push(['_trackEvent','twitter_web_intents',intent_event.type,label]);}});}}};var WSL_View_Product={ProductDescJson:function(data)
{if(data.status==1)
{$(".extraproddesc").html(data.content);$('.proddescfirst').show(0);$('.moredesc').hide(0);}else{$('.moredesc').hide(0);}},LatestPostsJson:function(data)
{$(".extralastposts").html(data);$("#lasttagsmore").hide();$("#lasttagsless").show();$(".extralastposts").show(0);},DeliciousJson:function(data)
{$(".extradelicious").html(data);$("#deliciousmore").hide();$("#deliciousless").show();$(".extradelicious").show(0);},BitacorasJson:function(data)
{$(".extrabitalinks").html(data);$("#bitaless").show(0);$("#bitacorasmore").hide(0);$(".extrabitalinks").show(0);},RelatedProductsJson:function(data)
{$(".morerelatedproducts").html(data);$("#productsless").show(0);$("#relatedproductsmore").hide(0);},ProductVoteJsonMsg:function(data)
{$("#log_off_vote_message").show();$("#voteselected").val(0);$(".product-votes li").attr('class','off');},ProductVoteJsonEvent:function(data)
{if($(".have-wish-count").length>0){$(".product-votes > p > strong").text(data.avguservoting);}else{$(".editors > strong").text(data.avgeditorvoting);$(".community > strong").text(data.avguservoting);}
currentObject.parent().nextAll().attr('class','off');currentObject.parent().prevAll().attr('class','');currentObject.parent().attr('class','');url='/json/productstream/'+parts[1];WSL_Controller_Product.ProductVoteEventJson(url);return false;}};(function(){var SmartClip;SmartClip=(function(){var adUrl;adUrl="http://ad.es.doubleclick.net/ad/weblogs.smartclip/"+smartClip+";sz=400x320;dcmt=text/xml;ord=[timestamp]?";function SmartClip(videoTag){this.id=$(videoTag).attr('id');this.videoId=this.id.split('-')[1];this.renderBlip();this.renderSmartClip();}
SmartClip.prototype.renderBlip=function(){var params,url;url='http://blip.tv/play/'+this.videoId;params={allowFullScreen:'true',allowscriptaccess:'always',wmode:'transparent'};return swfobject.embedSWF(url,this.id,'655','366','9',null,params);};SmartClip.prototype.renderSmartClip=function(){var sc;sc=SC_Easyroll();sc.setPlayerId(this.id);sc.setVideoAdUrl(this.adUrl);sc.setLayerWidth(655);sc.setLayerHeight(366);sc.setAudioVolume(50);sc.setLayerTopOffset(0);sc.setLayerLeftOffset(0);sc.setBackgroundColor('148ADF');sc.setCountDown('bottom','[time]','0xffffff','0x000000',100);sc.setAutostart(false);sc.setStartCall('sendEvent',['play']);sc.setStopCall('sendEvent',['playpause']);return sc.init();};return SmartClip;})();$(function(){return $('.smartclip-video').each(function(index,el){return new SmartClip(el);});});}).call(this);var WSL_View_Post={postVote:function(obj,data,fb_flag)
{if(data.res==1){if(fb_flag==true)
{$(obj).parent().children('#warn-login-post-vote-facebook.facebook').show();}else{if($('#warn-login-post-single-vote').length==0){$(obj).parent().parent().children('#warn-login-post-vote-normal.normal').show();}else if($('#warn-login-post-single-vote').length>0){$(obj).parent().children('#warn-login-post-single-vote').show();}}}else if(data.res==2){alert('Ya has votado');}else if(data.res==0){numVotes=$(obj).children('span').children('strong');titleVotes=$(obj).children('a').children('span');titleVotes.fadeOut('normal');numVotes.fadeOut('normal',function()
{numVotes.html(parseInt(numVotes.html())+1);titleVotes.html('Me gusta');obj.children('a').bind('click',function()
{alert('Ya has votado');return false;});obj.children('a').addClass('disabled');numVotes.fadeIn('normal');titleVotes.fadeIn('fast');});}},commentVote:function(obj,data)
{if(data==1){alert('É necessário estar logado para votar');}else if(data==2){alert('Já foi avaliado');}else if(data==4){alert('Não é possível votar em seu próprio comentário');}else if(data==5){alert('Esse comentário já tem votos negativos suficientes');}else if(data==6){var msg='Você não tem karma suficiente para fazer votos negativos ao comentário. Para isso, é necessário ter no mínimo 3 estrelas. Complete seu perfil e participe mais para conseguir subir de nível';var conveted_msg=WSL.inittextalter(msg);alert(conveted_msg);}else if(data==0){voteUp=$(obj).parent().children('.comment-vote-up');voteDown=$(obj).parent().children('.comment-vote-down');abuse=$(obj).parent().children('.abuse');$(voteUp).fadeOut('slow',function()
{$(voteUp).addClass('comment-vote-up-disabled');$(voteUp).removeClass('comment-vote-up');$(voteUp).fadeIn('slow');});$(voteDown).fadeOut('slow',function()
{$(voteDown).addClass('comment-vote-down-disabled');$(voteDown).removeClass('comment-vote-down');$(voteDown).fadeIn('slow');});$(abuse).fadeOut('slow',function()
{$(abuse).addClass('abuse-disabled');$(abuse).removeClass('abuse');$(abuse).fadeIn('slow');});}},commentPreview:function(data)
{currentValue=$(data).val();currentValue=currentValue.replace(/\n/g,'<br />').replace(/\n\n+/g,'<br /><br />').replace(/(&lt;\/?)script/g,'$1noscript');$('#ud_preview').html(currentValue);},deleteComment:function(data)
{if(data==1){alert('Por favor ingrese en wp-admin');}else{$('#c'+id).hide();commentCount=parseInt($('a.comments').html());if(commentCount!=1){content=(commentCount-1)+' comentarios';}else{content=(commentCount-1)+' comentario';}
$('a.comments').html(content);}},PostCommentLogin:function(data)
{if($("#comment-write").length!=0){$('#comment-write>div').html('');$('#comment-write>h2').after(data);}
wsl_comments.enableListeners();$('#ud_text').keyup(WSL_Controller_Post.commentPreview);}};var WSL_View_SignUp={checkUserName:function(data,msgError)
{if(data==0){$('#res_username').removeClass('error').addClass('exito');$('#res_username').html('Disponível');}else{$('#res_username').removeClass('exito').addClass('error');if(!msgError){msgError='Indisponível';}
$('#res_username').html(msgError);}},checkEmail:function(data,msgError)
{if(data==1){$('#res_email').addClass('error');if(!msgError){msgError='Indisponível';}
$('#res_email').html(msgError);}},checkConditions:function(data,msgError)
{if(data==1){$('#res_conditions').addClass('error');if(!msgError){msgError='Indisponível';}
$('#res_conditions').html(msgError);}}};var WSL_View_User={loggedInBox:function()
{$('#menu').hide();$('#menuName').click(function()
{$('#menu').toggle('slow');return false;});},makePrivate:function()
{currentObject.fadeOut('slow',function()
{if(currentObject.children('a').hasClass("public")){currentObject.children('a').removeClass("public");currentObject.children('a').addClass("private");currentObject.children('a').html('Fazer meu perfil público');}else{currentObject.children('a').removeClass("private");currentObject.children('a').addClass("public");currentObject.children('a').html('Fazer meu perfil privado');}
currentObject.fadeIn('slow');});},descriptionCounter:function()
{l=$('#description').val().length;if(l>250){$('#description').val($('#description').val().substring(0,250));}else{if($('#remaining')){$('#remaining').html(''+(250-l));}
if(l>250){$('#remaining').css('color','#d40d12');}else if(l>130){$('#remaining').css('color','#aa0000');}else{$('#remaining').css('color','#93A33D');}}},subscribe:function()
{currentObject.fadeOut('slow',function()
{if(currentObject.children('a').hasClass('email-subscribe')){currentObject.children('a').removeClass('email-subscribe');currentObject.children('a').addClass('email-unsubscribe');currentObject.children('a').html('Desuscribir');}else{currentObject.children('a').removeClass('email-unsubscribe');currentObject.children('a').addClass('email-subscribe');currentObject.children('a').html('Suscribir');}
currentObject.fadeIn('slow');});},addExpert:function()
{currentObject.fadeOut('slow',function(){if(currentObject.children('a').hasClass('removeExperto')){delta=-1;currentObject.children('a').html('<strong>+</strong> Adicionar especialista');}else{delta=1;currentObject.children('a').html('<strong>-</strong> Eliminar especialista');}
currentObject.children('a').toggleClass('removeExperto');currentObject.fadeIn('normal');});$('#num_followers').fadeOut('slow',function()
{$('#num_followers').html(parseInt($('#num_followers').html())+delta);$('#num_followers').fadeIn('fast');});},removeExpert:function()
{$('#private-following').fadeOut('slow');},addExpertAll:function()
{currentObject.fadeOut('slow',function(){if(currentObject.hasClass('quitar')){delta=-1;currentObject.removeClass('quitar');currentObject.addClass('anadir');currentObject.html('<strong>+</strong> Adicionar especialista');}else{delta=1;currentObject.removeClass('anadir');currentObject.addClass('quitar');currentObject.html('<strong>-</strong> Eliminar especialista');}
currentObject.fadeIn('normal');});numExperts=$('#numExperts_'+currentObject.attr('id'));numExperts.fadeOut('slow',function()
{numExperts.html(parseInt(numExperts.html())+delta);numExperts.fadeIn('fast');});}};var WSL_View_Forum={postVote:function(obj,data,fb_flag)
{if(data.res==1){if(fb_flag==true)
{$('.facebook').show();}else{$('.normal').show();}}else if(data.res==2){alert('Já foi avaliado');}else if(data.res==4){alert('Não é possível votar em suas próprias perguntas');}else if(data.res==0){numVotes=$('.likes').children('strong');titleVotes=$(obj).children('a').children('span');titleVotes.fadeOut('normal');numVotes.fadeOut('normal',function()
{numVotes.html(parseInt(numVotes.html())+1);titleVotes.html('Me gusta');obj.children('a').bind('click',function()
{alert('Já foi avaliado');return false;});obj.children('a').addClass('disabled');numVotes.fadeIn('normal');titleVotes.fadeIn('fast');});}},commentVote:function(obj,data)
{if(data==1){alert('É necessário estar logado para votar');}else if(data==2){alert('Já foi avaliado');}else if(data==4){alert('Não é possível votar em seu próprio comentário');}else if(data==5){alert('Esse comentário já tem votos negativos suficientes');}else if(data==6){var msg='Você não tem karma suficiente para fazer votos negativos ao comentário. Para isso, é necessário ter no mínimo 3 estrelas. Complete seu perfil e participe mais para conseguir subir de nível';var conveted_msg=WSL.inittextalter(msg);alert(conveted_msg);}else if(data==0){voteUp=$(obj).parent().children('.comment-vote-up');voteDown=$(obj).parent().children('.comment-vote-down');abuse=$(obj).parent().children('.abuse');$(voteUp).fadeOut('slow',function()
{$(voteUp).addClass('comment-vote-up-disabled');$(voteUp).removeClass('comment-vote-up');$(voteUp).fadeIn('slow');});$(voteDown).fadeOut('slow',function()
{$(voteDown).addClass('comment-vote-down-disabled');$(voteDown).removeClass('comment-vote-down');$(voteDown).fadeIn('slow');});$(abuse).fadeOut('slow',function()
{$(abuse).addClass('abuse-disabled');$(abuse).removeClass('abuse');$(abuse).fadeIn('slow');});}},commentPreview:function(data)
{currentValue=$(data).val();currentValue=currentValue.replace(/\n/g,'<br />').replace(/\n\n+/g,'<br /><br />').replace(/(&lt;\/?)script/g,'$1noscript');$('#ud_preview').html(currentValue);},deleteComment:function(data)
{if(data==1){alert('Por favor ingrese en wp-admin');}else{$('#c'+id).hide();commentCount=parseInt($('a.comments').html());if(commentCount!=1){var content=(commentCount-1)+' comentarios';}else{var content=(commentCount-1)+' comentario';}
$('a.comments').html(content);}},questionSubmit:function(data,returnUrl)
{$(".mform #pregunta_error").hide();$(".mform #category_error").hide();$(".mform #qa-tagbox .error,.message-big").hide();$(".mform #duplicate_msg").hide();$(".mform #userantitrollnotice").hide();$(".mform #inactiveuser").hide();$(".mform #questionstatus").hide();if(data.res==-1){$(".mform #pregunta_error").show();}else if(data.res==-4){$(".mform #category_error").show();}else if(data.res==2){$(".mform #pregunta").addClass('errorbox');$(".mform #duplicate_msg").show();$(".mform #duplicate_msg a").text(params.title);}else if(data.res==-2){$("#ask-step2").submit();}else if(data.res==-5){$(".mform #inactiveuser").show();}else if(data.res==3){$(".mform #pregunta").addClass('errorbox');$(".mform #duplicate_msg").show();}else if(data.res==1){$(".mform #pregunta").addClass('errorbox');$(".mform #questionstatus").show();$(".mform #questionstatus a").text(data.title);$(".mform #questionstatus a").attr('href',data.url);}
else if(data.res==0){if(returnUrl!=null){window.location=returnUrl;}else{window.location=data.url;}}else if(data.res==-6){$(".mform #qa-tagbox .error,.message-big").show();$(".mform #qa-tagbox #tags").addClass('errorbox');}},moreQuestions:function(data)
{$('.index-table tr:last').after(data);var morerows=parseInt($('.index-table tr:last').attr('id'));if(morerows==true){$('.nav #viewmore').show();}else{$('.nav #viewmore').hide();}
WSL.getTimeAgo();WSL.initFacebook();},forwardQuestion:function()
{if($.trim($('#ask-step1 #pregunta').val())==''){$("#ask-step1 #pregunta_error").show();}else{$('form#ask-step1').submit();}
return false;},questionCommentSubmit:function(data){if(data.res==0){$(".answer-number #comment-count").text(parseInt($(".answer-number #comment-count").text())+1);commentCount=parseInt($(".post-footer .comment-count").text())+1;if(commentCount==1){$(".post-footer .comment-count").text(commentCount+' comentario');}else{$(".post-footer .comment-count").text(commentCount+' comentarios');}
if($('#answers > li').length>0){$('#answers li:last').after(data.html);}else{$("#answers").prepend(data.html);}
$("[name=text]").val('');$("#ud_preview").text('');WSL.getTimeAgo();WSL.initFacebook();if($('#responder').length>0){$("#topic-answers #comment-count").text(parseInt($("#topic-answers #comment-count").text())+1);}}else if(data.res==2){$("#duplicatecommentnotice").show();}},questionLogin:function(id)
{$('.mform #loginerror').hide();$('.mform #regemail_error').hide();$('.mform #regpassword_error').hide();$('.mform #username_error').hide();$('.mform #email').val('');$('.mform #password').val('');if(id=='registro'){$("#questionLogin").hide();$("#questionReg").show();$("#enviar").show();}else if(id=='identificacion'){$("#questionReg").hide();$("#questionLogin").show();$("#enviar").show();}else if(id=='facebook'){$("#questionReg").hide();$("#questionLogin").hide();$("#enviar").hide();}},getTagsByTitle:function(data)
{$(".informacion").hide();$('.mform #tags').val('');$('.mform #tags').val(data);if(data!=''){$(".informacion").show();}}};var WSL_Analytics_Event_Manager={init:function(){name="weblogssl_analytics";var analyticscookie=$.cookie(name);if(analyticscookie){WSL_Analytics_Event_Manager.analyticsEvents($.parseJSON(analyticscookie));document.cookie=name+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/";}},analyticsEvents:function(analytics){if(analytics.type=='facebook'&&analytics.quick_registration=='YES'){WSL_Analytics_Event_Manager.facebookRegistration(analytics);}else if(analytics.type=='facebook'&&analytics.quick_registration=='NO'){WSL_Analytics_Event_Manager.facebookLogin(analytics);}else if(analytics.type=='openid'&&analytics.quick_registration=='YES'){WSL_Analytics_Event_Manager.openidRegistration(analytics);}else if(analytics.type=='openid'&&analytics.quick_registration=='NO'){WSL_Analytics_Event_Manager.openidLogin(analytics);}else if(analytics.type=='email'&&analytics.quick_registration=='YES'){WSL_Analytics_Event_Manager.wslRegistration(analytics);}else if(analytics.type=='email'&&analytics.quick_registration=='NO'){WSL_Analytics_Event_Manager.wslLogin(analytics);}
WSL_Controller_GoogleAnalytics.trackPageview()},facebookRegistration:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Analytics_Event_Manager.setCustomvar3();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'facebook');},facebookLogin:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'facebook');},openidRegistration:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Analytics_Event_Manager.setCustomvar3();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'openid');},openidLogin:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'openid');},wslRegistration:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Analytics_Event_Manager.setCustomvar3();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'weblogs');},wslLogin:function(analytics){WSL_Analytics_Event_Manager.setCustomvar1();WSL_Analytics_Event_Manager.setCustomvar2();WSL_Controller_GoogleAnalytics.registerAction('ID de Usuario',WSL_Analytics_Event_Manager.getGlobalID(),'weblogs');},setCustomvar1:function(){WSL_Controller_GoogleAnalytics.setCustomVar(1,'status de usuario','hace login',2);},setCustomvar2:function(){WSL_Controller_GoogleAnalytics.setCustomVar(2,'status de usuario','registrado',3);},setCustomvar3:function(){WSL_Controller_GoogleAnalytics.setCustomVar(3,'status de usuario','se registra',2);},getGlobalID:function(){var res=null;var cookie=$.cookie('weblogssl_d');if(cookie){var cookieObj=$.parseJSON(decodeURIComponent(cookie));res=""+cookieObj.user.GlobalId;}
return res;}};
