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