(function(a){function e(i){return typeof i=="object"?i:{top:i,left:i}}var h=a.scrollTo=function(i,d,b){a(window).scrollTo(i,d,b)};h.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1};h.window=function(){return a(window)._scrollable()};a.fn._scrollable=function(){return this.map(function(){var i=this;if(!(!i.nodeName||a.inArray(i.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1))return i;i=(i.contentWindow||i).document||i.ownerDocument||i;return a.browser.safari||i.compatMode==
"BackCompat"?i.body:i.documentElement})};a.fn.scrollTo=function(i,d,b){if(typeof d=="object"){b=d;d=0}if(typeof b=="function")b={onAfter:b};if(i=="max")i=9E9;b=a.extend({},h.defaults,b);d=d||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)d/=2;b.offset=e(b.offset);b.over=e(b.over);return this._scrollable().each(function(){function c(o){j.animate(l,d,b.easing,o&&function(){o.call(this,i,b)})}var g=this,j=a(g),f=i,k,l={},q=j.is("html,body");switch(typeof f){case "number":case "string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=
e(f);break}f=a(f,this);case "object":if(f.is||f.style)k=(f=a(f)).offset()}a.each(b.axis.split(""),function(o,n){var r=n=="x"?"Left":"Top",p=r.toLowerCase(),m="scroll"+r,s=g[m],t=h.max(g,n);if(k){l[m]=k[p]+(q?0:s-j.offset()[p]);if(b.margin){l[m]-=parseInt(f.css("margin"+r))||0;l[m]-=parseInt(f.css("border"+r+"Width"))||0}l[m]+=b.offset[p]||0;if(b.over[p])l[m]+=f[n=="x"?"width":"height"]()*b.over[p]}else{n=f[p];l[m]=n.slice&&n.slice(-1)=="%"?parseFloat(n)/100*t:n}if(/^\d+$/.test(l[m]))l[m]=l[m]<=0?
0:Math.min(l[m],t);if(!o&&b.queue){s!=l[m]&&c(b.onAfterFirst);delete l[m]}});c(b.onAfter)}).end()};h.max=function(i,d){var b=d=="x"?"Width":"Height";d="scroll"+b;if(!a(i).is("html,body"))return i[d]-a(i)[b.toLowerCase()]();b="client"+b;var c=i.ownerDocument.documentElement;i=i.ownerDocument.body;return Math.max(c[d],i[d])-Math.min(c[b],i[b])}})(jQuery);function swfOnSuccess(a){var e=document.getElementsByTagName("body")[0];if(a.success===false)e.className+=" noPlayer"}
function onBegin(a){var e=$("#playlist-items");e.find(".news_selected").removeClass("news_selected");e.find('[rel="'+a+'"]').length==0?e.find(".newslist").eq(a).addClass("news_selected"):e.find('[rel="'+a+'"]').parents(".newslist").addClass("news_selected")}
function getWidth(){var a=$(window).width();if($.browser.mozilla)return a;var e;e=window.innerHeight&&window.scrollMaxY?window.innerWidth+window.scrollMaxX:document.body.scrollHeight>document.body.offsetHeight?document.body.scrollWidth:document.body.offsetWidth;return e<a?e+20:a}
function getPageScroll(){var a;if(self.pageYOffset)a=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)a=document.documentElement.scrollTop;else if(document.body)a=document.body.scrollTop;return arrayPageScroll=["",a]}
function getPageSize(){var a,e;if(window.innerHeight&&window.scrollMaxY){a=document.body.scrollWidth;e=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){a=document.body.scrollWidth;e=document.body.scrollHeight}else{a=document.body.offsetWidth;e=document.body.offsetHeight}var h,i;if(self.innerHeight){h=self.innerWidth;i=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){h=document.documentElement.clientWidth;i=
document.documentElement.clientHeight}else if(document.body){h=document.body.clientWidth;i=document.body.clientHeight}pageHeight=e<i?i:e;pageWidth=a<h?h:a;return arrayPageSize=[pageWidth,pageHeight,h,i]}function template(a,e){var h;if(typeof e==="object")h=e.join("");else if(typeof e==="string")h=e;if(typeof a==="object")for(var i in a){e=RegExp("{"+i+"}","gi");h=h.replace(e,a[i])}return h}
function buildPlaylist(a){var e=[];a.each(function(){e.push($(this).find('[name="video"]').val()+","+$(this).find(".newslist-item > a").attr("href"));$(this).find(".playlist_btn_play").attr("rel",e.length-1)});return e}
var mask=function(a){function e(){$.browser.msie===true&&b.hide();d.fadeIn(a.speed,function(){typeof a.onShow=="function"&&a.onShow()})}function h(){typeof a.beforeClose=="function"&&a.beforeClose();$.browser.msie===true&&b.show();d.fadeOut("fast",function(){d.css({zIndex:a.orginalZIndex});typeof a.onClose=="function"&&a.onClose()})}function i(c){var g=document.createElement("div"),j=$(g);g.id="mask_"+(new Date).getTime();j.css({position:"absolute",top:0,left:0,width:getWidth(),height:$(document).height(),
display:"none",opacity:c.opacity||0.8,zIndex:c.zIndex,backgroundColor:"#000000"});document.getElementsByTagName("body")[0].appendChild(g);return g}a=$.extend({zIndex:8999,originalZIndex:1,id:"mask_",speed:"fast",closable:true},a);var d,b=$("select,embed,object");this.el=document.getElementById(a.id)?document.getElementById(a.id):i(a);d=$(this.el);this.show=function(c){e();typeof c=="function"&&c()};this.hide=function(c){h();typeof c=="function"&&c();typeof a.onHide=="function"&&a.onHide()};this.setZindex=
function(c){a.zIndex=c};d.bind("click",function(){a.closable&&h()});$(document).bind("keyup",function(c){c.keyCode==27&&a.closable&&h()});$(window).resize(function(){d.css({width:getWidth(),height:$(document).height()})});return this},box=function(a){function e(f){getPageSize();var k=getPageScroll();f.css({position:"absolute"});f.animate({top:k[1]+(arrayPageSize[3]-35-f.height())/2+"px",left:(arrayPageSize[0]-20-f.width())/2+"px"});return f}function h(){var f="msg_"+(new Date).getTime(),k=c.main.join("").replace(/%id/g,
f).replace(/%cls/g,c.cls).replace(/%success/g,c.success).replace(/%message/g,c.message);$("body").append(k);k=$("#"+f);var l=$("body").find("."+c.cls).css("zIndex")=="auto"||parseInt(c.zIndex,10);c.zIndex=l!==0&&l!==NaN?parseInt(l+2,10):c.zIndex;k.css(c.css).css("zIndex",c.zIndex);j=new mask({closable:false,zIndex:parseInt(c.zIndex,10)-1});switch(c.success){case "confirm":k.find(".quest").after(b(f,[{cls:c.cancelLiCls,tpl:c.btn.join("").replace(/%cls/g,c.cancelCls).replace(/%text/g,c.cancelText)},
{cls:c.okLiCls,tpl:c.btn.join("").replace(/%cls/g,c.okCls).replace(/%text/g,c.okText)}]));k.find(".ok").click(function(){typeof c.handled=="function"&&c.handled(this);return false});break;case "error":k.find(".quest").after(b(f,[{cls:c.cancelLiCls,tpl:c.btn.join("").replace(/%cls/g,c.cancelCls).replace(/%text/g,"Aceptar")}]));break;case "accept":k.find(".quest").after(b(f,[{cls:c.cancelLiCls,tpl:c.btn.join("").replace(/%cls/g,c.cancelCls).replace(/%text/g,c.acceptText||"Aceptar")}]))}return k}function i(f){j.hide();
f.fadeOut("fast",function(){f.css({zIndex:c.originalZIndex});typeof c.onClose=="function"&&c.onClose();c.id||f.remove()})}function d(){j.show();e(g);g.fadeIn(c.speed,function(){typeof c.onShow=="function"&&c.onShow(g)})}function b(f,k){f=['<ul class="clearfix nav actions">'];for(var l=0;l<k.length;l++)f.push('<li class="btn '+k[l].cls+'">'+k[l].tpl+"</li>");f.push("</ul>");return f.join("")}var c=$.extend({success:"warning",message:":)",cls:"overlay",zIndex:9E3,originalZIndex:1,speed:"fast",css:{width:400},
main:['<div id="%id" class="%cls overlay module module-alter" style="display:none">','<div class="inner clearfix %success">','<a href="#" class="olclose overlay-close close">Cerrar</a>','<a href="#" class="overlay-loading loading" style="display:none">Cargando</a>','<div class="quest">%message</div>','<div class="msg" style="display:none"></div>',"</div>","</div>"],okCls:"ok",okLiCls:"green",okText:"Aceptar",cancelCls:"overlay-close",cancelLiCls:"orange",cancelText:"Cancelar",btn:['<a href="#" class="button %cls"><span class="button-left"><span class="button-right">',
"%text","</span></span></a>"]},a);if(c.id){this.el=$(c.id);this.id=c.id}else this.el=h();var g=this.el,j;this.show=function(f){c.onShow=f||c.onShow;d()};this.close=function(f){c.onClose=f||c.onClose;i(g)};this.center=function(){e(g)};g.find(".overlay-close").live("click",function(){i(g);return false});$(document).bind("keyup",function(f){f.keyCode==27&&i(g)});$(window).resize(function(){e(g)});return this};
(function(a){a.fn.inputDefaultText=function(e){e=a.extend({id:null},e);return this.each(function(){var h=a(this),i=h.val(),d=false,b=false;h.attr("title",i);if(h.attr("type")==="password"){d=document.createElement("input");b=a(d);d.type="text";d.value=h.attr("title");b.addClass(h.attr("class"));h.hide().val("");h.after(d)}if(d!==false){b.bind("focus",function(){a(this).hide();h.show().focus()});h.bind("blur",function(){if(this.value===""){a(this).hide();b.show()}})}else{h.bind("focus",function(){if(this.value===
this.title)this.value=""});h.bind("blur",function(){if(this.value==="")this.value=this.title})}})};a.fn.tabs=function(e){function h(d,b,c){d.addClass("tab-main-content-loading");var g=b.attr("rel").indexOf("?")===-1?"?":"&",j=c===undefined?b.attr("rel"):b.attr("rel")+g+c.split("?")[1],f=d.find(".inner");g="";g=typeof e.filterCombo==="function"?e.filterCombo():b.attr("id");b=c===undefined?"#/"+g:"#/"+g+"/"+c.split("?page=")[1];f.fadeOut("fast",function(){d.css({overlfow:"hidden",height:f.height()});
a.ajax({type:"get",dataType:"html",url:j,success:function(k){d.removeClass("tab-main-content-loading");f.html(k);f.fadeIn();typeof e.afterInsertData==="function"&&e.afterInsertData(f)},error:function(){d.removeClass("tab-main-content-loading");f.fadeIn()}})});return b}function i(d){d=d.replace("#/","");d=d.split("/");return{page:d[1]||"",tab:d[0]}}e=a.extend({id:null,selected:"selected",hashActive:true,filterCombo:null,tabDefault:"#noticias"},e);return this.each(function(){var d=a(this),b=d.find("a"),
c=[];a(this).find(".pagination").find("a").live("click",function(){var g=a(this),j=d.find(".selected").attr("id"),f="";f=b.filter(".selected");var k=f.attr("href").split("#")[1];k=a("#"+k);if(!g.is(".selected"))if(a.browser.msie&&a.browser.version==="6.0")h(k,f,g.attr("href"));else if(e.hashActive===true){f=typeof e.filterCombo==="function"?e.filterCombo():j;location.hash="#/"+f+"/"+g.attr("href").split("?page=")[1]}else h(k,f,g.attr("href"));return false});b.each(function(){var g=a(this),j=a(this).attr("href").split("#")[1];
g.is("."+e.selected)||a("#"+j).hide();c.push("#"+j)});SWFAddress.addEventListener(SWFAddressEvent.CHANGE,function(g){var j=b.filter(".selected"),f=j.attr("href").split("#")[1],k=a("#"+f),l="";l=location.hash;typeof e.onChangeAddress==="function"&&e.onChangeAddress(g,j,f,k,l);try{if(g.pathNames.length>0&&e.hashActive===true){i(l);var q=g.pathNames[0],o=g.pathNames[1]!=undefined?g.pathNames[1]:"";g=null;g=d.find("#"+q).length>0?d.find("#"+q):a(e.tabDefault);if(g.length>0){f=g.attr("href").split("#")[1];
k=a("#"+f);b.filter("."+e.selected).removeClass(e.selected).parent().removeClass("selected_tab");g.addClass(e.selected).parent().addClass("selected_tab");a(c.join(",")).filter(":visible").hide();k.show();if(o!=""){if(k.find(".selected_center").text()!==o){h(k,g,"?page="+o);d.data("getData",function(){h(k,j)})}}else{k.find(".news_boxes");h(k,g);d.data("getData",function(){h(k,j)})}}else{h(k,j);d.data("getData",function(){h(k,j)})}}else{k=a("#latest");if(k.find(".inner").children().length>0){b.filter("."+
e.selected).removeClass(e.selected).parent().removeClass("selected_tab");a("#lo_ultimo").addClass(e.selected).parent().addClass("selected_tab");a(c.join(",")).filter(":visible").hide();a("#latest").show()}else{h(k,j);d.data("getData",function(){h(k,j)})}}}catch(n){}return false});b.bind("click",function(){var g=a(this),j=g.attr("href").split("#")[1];j=a("#"+j);b.filter("."+e.selected).removeClass(e.selected).parent().removeClass("selected_tab");g.addClass(e.selected).parent().addClass("selected_tab");
a(c.join(",")).hide();j.show();if(a.browser.msie&&a.browser.version=="6.0")j.find(".inner").children().length===0&&h(j,g);else location.hash=j.find(".inner").children().length===0?"#/"+g.attr("id"):"#/"+g.attr("id")+"/"+j.find(".selected_center").text();return false})})};a.fn.playlist=function(e){e=a.extend({id:null,descriptionId:"-description",itemsId:"-items",clsShowDescription:"read_detail",clsHideDescription:"slide-close"},e);var h=function(d){var b=d.find("#"+d.attr("id")+"-description");b.hide();
d.css({right:-d.width(),width:d.width()}).show().animate({right:0},"normal",function(){setTimeout(function(){b.fadeIn()},100)})},i=function(d){d.find("#"+d.attr("id")+"-description");d.fadeOut("fast",function(){d.css({right:-d.width()})})};return this.each(function(){var d=a(this),b=a("#"+d.attr("id")+e.descriptionId);a("#"+d.attr("id")+e.itemsId);d.find("."+e.clsShowDescription).bind("click",function(){var c=a(this);c=c.parents(".newslist-item").clone(true);var g=c.find(".addNotice"),j=b.attr("id"),
f=b.find("#"+j+"-addNotice");c.find(".list_video").css({width:108,height:62});f.attr("rel",g.attr("rel")).attr("href",g.attr("href"));g.is(".addNotice-hover")?f.addClass("addNotice-hover"):f.removeClass("addNotice-hover");c.find(".details").remove();b.find("#"+j+"-detail").html(c);b.find("#"+j+"-description").html(c.find(".desc").html());h(b);return false});d.find("."+e.clsHideDescription).bind("click",function(){i(b);return false})})};a.fn.marquee=function(e){e=a.extend({time:6E4,window_width:922},
e);var h=a(this),i,d=function(){h.animate({left:"-=10"},150,"linear",function(){a(this).position().left<=-i&&h.css("left",-5);d()})};h.data("marqueeStop",function(){h.stop()});h.data("marqueePlay",function(){d()});(function(b){anim=false;var c=h.html();if(c.length>0){i=0;h.html('<div class="m1">'+c+'</div>    <div class="m2">'+c+'</div>    <div class="m3">'+c+"</div>");c=h.find(".m1:first").text();var g=0;temporal=document.createElement("div");temporal.style.position="absolute";temporal.style.top=
"-9999em";temporal.style.left="-9999em";letras=Array(c.length);for(var j=0,f=letras.length;j<f;j++){letras[j]=document.createElement("span");letras[j].appendChild(document.createTextNode(c.charAt(j)));temporal.appendChild(letras[j])}document.body.appendChild(temporal);j=0;for(f=temporal.childNodes.length;j<f;j++)g+=temporal.childNodes[j].offsetWidth;document.body.removeChild(temporal);i=g+130;h.find("div").css("width",i);h.addClass("marqueeCont").css({left:0,width:i*3});typeof b=="function"&&b()}})(d)};
a(document).ready(function(){var e=a("#marquee"),h=a("#marquee-data");h.length>0&&h.marquee();e.bind("mouseenter",function(){h.data("marqueeStop")()});e.bind("mouseleave",function(){h.data("marqueePlay")()});a("#menu").find("ul").children().hover(function(){a("#subnav",this).stop(true,true).fadeIn("fast")},function(){a("#subnav",this).fadeOut("fast")});a(".selected").parents("#subnav").prev("a").addClass("selected");a("#login-form, #search-form").find(":input").inputDefaultText();var i=a("#id_q");
i.focus(function(){a("#search_ext").fadeIn()});i.blur(function(){a("#search_ext").fadeOut()});a("#search-form").bind("submit",function(){i.val()==="Buscar"&&i.val("")});a(".add-news").live("click",function(){var b=a(this),c={},g=a(".add-news");if(b.is(".icon-heart-blood")===true){c.url="/mi-noticiero/eliminar/";c.success=function(j){if(j.success===true){b.removeClass("icon-loading");b.text("Agregar a mi noticiero");g.filter('[rel="'+b.attr("rel")+'"]').removeClass("icon-heart-blood").text("Agregar a mi noticiero")}}}else{c.url=
"/mi-noticiero/agregar/";c.success=function(j){if(j.success===true){b.removeClass("icon-loading");b.text("Quitar de mi noticiero");g.filter('[rel="'+b.attr("rel")+'"]').addClass("icon-heart-blood").text("Quitar de mi noticiero")}else{b.removeClass("icon-loading");b.text("Agregar a mi noticiero");g.filter('[rel="'+b.attr("rel")+'"]').removeClass("icon-heart-blood").text("Agregar a mi noticiero")}}}b.addClass("icon-loading");a.ajax({type:"post",dataType:"json",url:c.url,data:{id:b.attr("rel")},success:c.success,
error:function(){b.removeClass("icon-loading")}});return false});var d=function(b,c,g,j){g=g===undefined?"error":g;var f=b.find(".msg");if(f.length>0)f.fadeOut("fast",function(){a(this).remove();b.append('<div class="msg '+g+'" style="display:none"><div class="inner">'+c+"</div></div>");b.find("."+g).fadeIn();typeof j==="function"&&j()});else{b.append('<div class="msg '+g+'" style="display:none"><div  class="inner">'+c+"</div></div>");b.find("."+g).fadeIn();typeof j==="function"&&j()}};a("#login-form").submit(function(){var b=
a(this),c=b.find('[name="username"]'),g=b.find('[name="password"]'),j="";b.find(".msg").fadeOut();if(c.val()==="Usuario"||c.val()===""&&g.val()==="")j="Por favor ingrese su nombre de usuario y contrase\u00f1a.";else if(c.val()==="Usuario"||c.val()==="")j="Por favor ingrese su nombre de usuario.";else if(g.val()==="")j="Por favor ingrese su contrase\u00f1a";j!==""?d(b,j):d(b,"Espere un momento...","loading",function(){a.ajax({type:"post",dataType:"json",url:b.attr("action"),data:{username:c.val(),
password:g.val()},success:function(f){if(f.success===true)location.href="/";else d(b,f.message+"")},error:function(){d(b,"Ocurri\u00f3 un error, por favor intente otra vez.")}})});return false});a("#login").hide();a("#showLogin").click(function(){a("#login").show();return false});a("#hideLogin").click(function(){a("#login").hide();return false})})})(jQuery);


