//<![CDATA[
    /*  
    	author: Suchitra Pattanaik
    	© 2008 AOL LLC
    	modified by: Suchitra Pattanaik
    	
    	dependencies : Mootools 1.2
    	Custom Classes: MostCommentedArticlesAjax, HorizontalTweenSlider
    	
    	Added on DOM Ready
    */

	var celestrellasMooEffects = {};

	celestrellasMooEffects.searchEvents = function() {
		var aObjArr = $$('#searches ul li a');
		var txt = $$('#searches form input#asylum-search').get('value');
		aObjArr.each(function(el) {
			el.addEvent('click', function(event) {
				var li = el.getParent('li'), liClass = li.get('class'), inpValCur = txt;
				li.getParent('ul').getChildren('li').each(function(elm) {
					elm.removeClass('current');				
				});
				li.addClass('current');
				$$('#searches form input[type=text]').each(function(elm) {
					var inpVal = elm.get('value');
					if(inpVal != txt && inpVal != '') {
						inpValCur = inpVal;
					}
					elm.set('value', txt);
				});
				$$('#searches form').each(function(elm) {
					var formId = elm.get('id');
					if(liClass.contains(formId)) {
						elm.removeClass('hide');
						$(elm).getElement('input[type=text]').set('value', inpValCur);
					}else {
						elm.addClass('hide');
					}
				});
				return false;
			});
		});				
	   	var formObjArr = $$('#searches form');
	   	formObjArr.each(function(el) {
	   		var inpObj = $(el).getElement('input[type=text]');
	   		if(el.get('id') == 'search-video') {
	   			el.addEvent('submit', function(e) {
					el.set('action', el.get('action') + '/query/' + inpObj.get('value'));
				});
			}

	    		inpObj.addEvents({
				focus: function(event) {
					if(this.value == txt){
						this.value = '';
					}else{
						this.value = this.value
						this.className = 'searchTxt';
					}				
				},
				blur: function(event) {
					if(this.value == '') {
						this.value = txt;
					}
				}		
	    		});
	   	});
	}



	celestrellasMooEffects.searchEventsFt = function() {
		var aObjArr = $$('#searchesFt ul li a');
		var txt = $$('#searchesFt form input#news-search').get('value');

		aObjArr.each(function(el) {
			el.addEvent('click', function(event) {
				var li = el.getParent('li'), liClass = li.get('class'), inpValCur = txt;
				li.getParent('ul').getChildren('li').each(function(elm) {
					elm.removeClass('current');				
				});
				li.addClass('current');
				$$('#searchesFt form input[type=text]').each(function(elm) {			
					var inpVal = elm.get('value');
					if(inpVal != txt && inpVal != '') {
						inpValCur = inpVal;
					}
					elm.set('value', txt);
				});
				$$('#searchesFt form').each(function(elm) {
					var formId = elm.get('id');
					if(liClass.contains(formId)) {
						elm.removeClass('hide');
						$(elm).getElement('input[type=text]').set('value', inpValCur);
					}else {
						elm.addClass('hide');
					}
				});
				return false;
			});
		});				
	   	var formObjArr = $$('#searchesFt form');
	   	formObjArr.each(function(el) {
	   		var inpObj = $(el).getElement('input[type=text]');
	   		if(el.get('id') == 'search-video') {
	   			el.addEvent('submit', function(e) {
					el.set('action', el.get('action') + '/query/' + inpObj.get('value'));
				});
			}

	    		inpObj.addEvents({
				focus: function(event) {
					if(this.value == txt){
						this.value = '';
					}else{
						this.value = this.value
						this.className = 'searchTxt';
					}				
				},
				blur: function(event) {
					if(this.value == '') {
						this.value = txt;
					}
				}		
	    		});
	   	});
	}


	
	celestrellasMooEffects.highlightCategory = function() {		
		if(typeof currentCatSel === 'undefined' || !currentCatSel) {
		      if($("cat-main")){
			$("cat-main").addClass("highlightCat");
		      }
		} else {
			$(currentCatSel).addClass("highlightCat");
		}
	}
	/*
	celestrellasMooEffects.webPromoSlider = function() {
		if(!$('slider')) return;
		var slider = new HorizontalTweenSlider( { 
			slides : $$( $('slider').getElementsByTagName('li') ), 
			prevBttn : $$( '#slider a.prev' )[0],
			nextBttn : $$( '#slider a.next' )[0],									
			wrapperElement : $('slider'),
			innerElement : $('slides'),
			shownSlideCount : 1,
			duration : 1000,
			timerLength : 11000,
			autoPlay : false,
			shuffle : true
		} );

		// slider li/a/img hovers
		$$('#slides li').each(function(el){
			el.addEvent('mouseover', function(event) { el.addClass('hover'); });
			el.addEvent('mouseout', function(event) { el.removeClass('hover'); });
		});
		$$('#slides li img').each(function(el){
			el.addEvent('mouseover', function(event) { el.addClass('hover'); });
			el.addEvent('mouseout', function(event) { el.removeClass('hover'); });
		});
		$$('#slides li a').each(function(el){
			el.addEvent('mouseover', function(event) { el.addClass('hover'); });
			el.addEvent('mouseout', function(event) { el.removeClass('hover'); });
		});		
	}
	*/
	
	
// window add event hijacked - attach to the document	
	document.addEvent('domready', function() {
		celestrellasMooEffects.searchEvents();
		celestrellasMooEffects.searchEventsFt();
		celestrellasMooEffects.highlightCategory();
		//celestrellasMooEffects.webPromoSlider();
	});
	
	
	//addLoadEvent(celestrellasMooEffects.searchEvents());
	//addLoadEvent(celestrellasMooEffects.searchEventsFt());
	//addLoadEvent(celestrellasMooEffects.highlightCategory());
	


/*  
    	author: William J Ortiz
    	© 2009 AOL LLC
    	
    	PESP Module functions for Celestrellas
    */



function rssProperties(){
  this.image = "";
  this.title = "";
  this.href = "";
  this.date = "";
}

var itemArray = new Array();
var rss = new rssProperties();

function loadPESPItems(){
    var module = document.getElementById("pespContent");
    if(!module) return;
    // 3 children, 1 image item, 2 text
    var divs = module.getElementsByTagName("div");
    var isSecondFilled = false;
    for(i = 0; i < divs.length; i++){
        var divClass = divs[i].className;
        if(divClass == "imageItem"){
            fillImageItem(divs[i]);
        }
        if(divClass == "textItem"){
            if(!isSecondFilled){
                fillTextItem(divs[i], itemArray[1]);
                isSecondFilled = true;
            }
            else{
                fillTextItem(divs[i], itemArray[2]);
            }
        }
    }
}

function fillImageItem(element){
    //var imageItemElements = element.childNodes;
    var imageDivs = element.childNodes;
    // all subchildren of image item that are DIVS
    for(ii = 0; ii < imageDivs.length; ii++){
        if(imageDivs[ii].nodeType == 1){
            if(imageDivs[ii].className == "image"){
                var imgAnchor = element.getElementsByTagName("a")[0];
                imgAnchor.setAttribute("href", itemArray[0].href);
                var img = imgAnchor.getElementsByTagName("img")[0];
                img.setAttribute("alt", itemArray[0].title);
                img.setAttribute("src", itemArray[0].image);
            }
            if(imageDivs[ii].className == "text"){
                var txt = imageDivs[ii].childNodes;
                for(jj = 0; jj < txt.length; jj++){
                    if(txt[jj].nodeType == 1){
                        if(txt[jj].className == "date"){
                            txt[jj].firstChild.nodeValue = itemArray[0].date;
                        }
                        if(txt[jj].className == "title"){
                            var titleA = txt[jj].getElementsByTagName("a")[0];
                            titleA.setAttribute("href", itemArray[0].href);
                            titleA.firstChild.nodeValue = itemArray[0].title;
                        }
                        if(txt[jj].className == "leer"){
                            var leerA = txt[jj].getElementsByTagName("a")[0];
                            leerA.setAttribute("href", itemArray[0].href);
                        }
                    }
                }
            }
        }
    }
}

function fillTextItem(element, arrayItem){
    var textA = element.getElementsByTagName("a")[0];
    textA.setAttribute("href", arrayItem.href);
    textA.firstChild.nodeValue = arrayItem.title;
}

function loadAwardInfo(){
  var module = document.getElementById("countdown");
  // 3 children
  var divs = module.getElementsByTagName("div");
  for(i = 0; i < divs.length; i++){
    //alert(i);
	if(divs[i].className == "timeLeft"){
		fillTimeLeft(divs[i]);
	}
  }
}


function fillTimeLeft(element){
	var today  = new Date();
	var todayEpoch  = today.getTime();
	var dateVal = document.getElementById("awardDate").value;
	var target = new Date(dateVal); 
	var targetEpoch = target.getTime();

	var timeLeft = (targetEpoch - todayEpoch) / (60*60*24*1000);
	var timeStr = "Días";
	var showStr = "Para el Show";
	var dateStr = "Domingo 20 Sept";
	if(Math.floor(timeLeft) == 1){
	  timeStr = "Dia";
	}
        else if(timeLeft < 1 && timeLeft > 0){
          timeLeft = (targetEpoch - todayEpoch) / (60*60*1000);
          timeStr = "Horas";
          if(Math.floor(timeLeft) == 1){
            timeStr = "Hora";
          }
          if(timeLeft < 1){
            timeLeft = (targetEpoch - todayEpoch) / (60*1000);
            timeStr = "min";
          }
          if(timeLeft <= 0){
            timeLeft = "0";
          }
        }
	if(timeLeft <= 0){
	 timeLeft = 0;
	}
	// fill out the info
	var childDivs = element.getElementsByTagName("div");
	for(j = 0; j < childDivs.length; j++){
	    if(childDivs[j].className == "daysLeft"){
		  childDivs[j].firstChild.nodeValue = Math.floor(timeLeft);
		}
		if(childDivs[j].className == "daysLeftTxt"){
		  childDivs[j].firstChild.nodeValue = timeStr;
		}
	}
}

// executes functions on the onLoad event
function addLoadEvent(func){
    var oldonload = window.onload;
    if(typeof window.onload != 'function'){
        window.onload = func;
    }
    else{
        window.onload = function(){
            oldonload();
            func();
        }
    }
}

// Twitter module
if (!"console" in window) {
  window.console = {
    log: function () {}
  }
}
TWTR = window.TWTR || {};
if (!Array.forEach) {
  Array.prototype.forEach = function (a, b) {
    var c = b || window;
    for (var i = 0, j = this.length; i < j; ++i) {
      a.call(c, this[i], i, this)
    }
  };
  Array.prototype.indexOf = function (a, b) {
    var b = b || 0;
    for (var i = 0; i < this.length; ++i) {
      if (this[i] === a) {
        return i
      }
    }
    return -1
  }
} (function () {
  function Animate(a, b, c) {
    this.el = a;
    this.prop = b;
    this.from = c.from;
    this.to = c.to;
    this.time = c.time;
    this.callback = c.callback;
    this.animDiff = this.to - this.from
  };
  Animate.canTransition = function () {
    return false
  } ();
  Animate.prototype._setStyle = function (a) {
    switch (this.prop) {
    case 'opacity':
      this.el.style[this.prop] = a;
      this.el.style.filter = 'alpha(opacity=' + a * 100 + ')';
      break;
    default:
      this.el.style[this.prop] = a + 'px';
      break
    }
  };
  Animate.prototype._animate = function () {
    var a = this;
    this.now = new Date();
    this.diff = this.now - this.startTime;
    if (this.diff > this.time) {
      this._setStyle(this.to);
      if (this.callback) {
        this.callback.call(this)
      }
      return
    }
    this.percentage = (Math.floor((this.diff / this.time) * 100) / 100);
    this.val = (this.animDiff * this.percentage) + this.from;
    this._setStyle(this.val);
    this.timer = setTimeout(function () {
      a._animate.call(a)
    },
    20)
  };
  Animate.prototype.start = function () {
    var a = this;
    this.startTime = new Date();
    this.timer = setTimeout(function () {
      a._animate.call(a)
    },
    20)
  };
  TWTR.Widget = function (a) {
    this.init(a)
  };
  (function () {
    var k = {};
    var l = {};
    var p = function (c) {
      var a = l[c];
      if (!a) {
        a = new RegExp('(?:^|\\s+)' + c + '(?:\\s+|$)');
        l[c] = a
      }
      return a
    };
    var q = function (c, a, b, d) {
      var a = a || '*';
      var b = b || document;
      var e = [],
      elements = b.getElementsByTagName(a),
      re = p(c);
      for (var i = 0, len = elements.length; i < len; ++i) {
        if (re.test(elements[i].className)) {
          e[e.length] = elements[i];
          if (d) {
            d.call(elements[i], elements[i])
          }
        }
      }
      return e
    };
    var t = function (a) {
      if (typeof a == 'string') {
        return document.getElementById(a)
      }
      return a
    };
    var u = function (a) {
      return a.replace(/^\s+|\s+$/g, '')
    };
    var v = function () {
      var a = self.innerHeight;
      var b = document.compatMode;
      if ((b || J.ie)) {
        a = (b == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight
      }
      return a
    };
    var w = function (e, a) {
      var b = e.target || e.srcElement;
      return a(b)
    };
    var x = function (a) {
      if (a && 3 == a.nodeType) {
        return a.parentNode
      } else {
        return a
      }
    };
    var y = function (e) {
      var a = e.relatedTarget;
      if (!a) {
        if (e.type == 'mouseout') {
          a = e.toElement
        } else if (e.type == 'mouseover') {
          a = e.fromElement
        }
      }
      return x(a)
    };
    var z = function (a, b) {
      b.parentNode.insertBefore(a, b.nextSibling)
    };
    var A = function (a) {
      try {
        a.parentNode.removeChild(a)
      } catch(ex) {}
    };
    var B = function (a) {
      return a.firstChild
    };
    var C = function (e) {
      var a = y(e);
      while (a && a != this) {
        try {
          a = a.parentNode
        } catch(ex) {
          a = this
        }
      }
      if (a != this) {
        return true
      }
      return false
    };
    var D = {
      has: function (a, c) {
        return new RegExp("(^|\\s)" + c + "(\\s|$)").test(t(a).className)
      },
      add: function (a, c) {
        if (!this.has(a, c)) {
          t(a).className = u(t(a).className) + ' ' + c
        }
      },
      remove: function (a, c) {
        if (this.has(a, c)) {
          t(a).className = t(a).className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)", "g"), "")
        }
      }
    };
    var E = {
      add: function (a, b, c) {
        if (a.addEventListener) {
          a.addEventListener(b, c, false)
        } else {
          a.attachEvent('on' + b, function () {
            c.call(a, window.event)
          })
        }
      }
    };
    var F = {
      bool: function (b) {
        return typeof b === 'boolean'
      },
      def: function (o) {
        return ! (typeof o === 'undefined')
      },
      number: function (n) {
        return typeof n === 'number' && isFinite(n)
      },
      fn: function (f) {
        return typeof f === 'function'
      },
      array: function (a) {
        if (a) {
          return F.number(a.length) && F.fn(a.splice)
        }
        return false
      }
    };
    var G = function (a) {
      var b = new Date();
      var c = new Date(a);
      if (J.ie) {
        c = Date.parse(a.replace(/( \+)/, ' UTC$1'))
      }
      var d = b - c;
      var e = 1000,
      minute = e * 60,
      hour = minute * 60,
      day = hour * 24,
      week = day * 7;
      if (isNaN(d) || d < 0) {
        return ""
      }
      if (d < e * 7) {
        return "right now"
      }
      if (d < minute) {
        return Math.floor(d / e) + " segundos atrás"
      }
      if (d < minute * 2) {
        return "alrededor de 1 minuto"
      }
      if (d < hour) {
        return Math.floor(d / minute) + " minutos atrás"
      }
      if (d < hour * 2) {
        return "alrededor de 1 hora"
      }
      if (d < day) {
        return Math.floor(d / hour) + " horas atrás"
      }
      if (d > day && d < day * 2) {
        return "ayer"
      }
      if (d < day * 365) {
        return Math.floor(d / day) + " días atrás"
      } else {
        return "hace más de un año"
      }
    };
    var H = {
      link: function (d) {
        return d.replace(/\bhttps?\:\/\/\S+/g, function (b) {
          var c = '';
          b = b.replace(/(\.*|\?*|\!*)$/, function (m, a) {
            c = a;
            return ''
          });
          return '<a class="twtr-hyperlink" href="' + b + '">' + ((b.length > 25) ? b.substr(0, 24) + '...' : b) + '</a>' + c
        })
      },
      at: function (b) {
        return b.replace(/\B\@([a-zA-Z0-9_]{1,15})/g, function (m, a) {
          return '@<a class="twtr-atreply" href="http://twitter.com/' + a + '">' + a + '</a>'
        })
      },
      hash: function (b) {
        return b.replace(/\B\#([a-zA-Z0-9_]+)/g, function (m, a) {
          return '<a class="twtr-hashtag" href="http://search.twitter.com/search?q=%23' + a + '">#' + a + '</a>'
        })
      },
      clean: function (a) {
        return this.hash(this.at(this.link(a)))
      }
    };
    function Occasionally(a, b, c) {
      this.job = a;
      this.decayFn = b;
      this.interval = c;
      this.decayRate = 1;
      this.decayMultiplier = 1.25;
      this.maxDecayTime = 3 * 60 * 1000
    }
    Occasionally.prototype = {
      start: function () {
        this.stop().run();
        return this
      },
      stop: function () {
        if (this.worker) {
          window.clearTimeout(this.worker)
        }
        return this
      },
      run: function () {
        var b = this;
        this.job(function () {
          b.decayRate = b.decayFn() ? Math.max(1, b.decayRate / b.decayMultiplier) : b.decayRate * b.decayMultiplier;
          var a = b.interval * b.decayRate;
          a = (a >= b.maxDecayTime) ? b.maxDecayTime : a;
          a = Math.floor(a);
          b.worker = window.setTimeout(function () {
            b.run.call(b)
          },
          a)
        })
      },
      destroy: function () {
        this.stop();
        this.decayRate = 1;
        return this
      }
    };
    function IntervalJob(a, b, c, d) {
      this.time = b || 7000;
      this.loop = c || false;
      this.repeated = 0;
      this.total = a.length;
      this.callback = d;
      this.haystack = a
    };
    IntervalJob.prototype = {
      start: function (a) {
        var b = this;
        if (a) {
          this.repeated = 0
        }
        this.stop().job();
        this.timer = window.setInterval(function () {
          b.job.call(b)
        },
        this.time);
        return this
      },
      stop: function () {
        if (this.timer) {
          window.clearInterval(this.timer)
        }
        return this
      },
      job: function () {
        if (this.repeated === this.total) {
          if (this.loop) {
            this.repeated = 0
          } else {
            this.stop();
            return
          }
        }
        this.callback(this.haystack[this.repeated]);
        this.repeated++;
        return this
      }
    };
    var I = function (a, b, c) {
      b[a] = c
    };
    var J = function () {
      var a = navigator.userAgent;
      return {
        ie: a.match(/MSIE\s([^;]*)/)
      }
    } ();
    function Tweet(a) {
      var b = '<div class="twtr-tweet-wrap">         <div class="twtr-avatar">           <div class="twtr-img"><a href="http://twitter.com/' + a.user + '"><img src="' + a.avatar + '"></a></div>         </div>         <div class="twtr-tweet-text">           <p>             <a href="http://twitter.com/' + a.user + '" class="twtr-user">' + a.user + '</a> ' + a.tweet + '             <i>            <a href="http://twitter.com/' + a.user + '/status/' + a.id + '">' + G(a.created_at) + '</a>             <a target="_blank" class="twtr-reply" href="http://twitter.com/?status=@' + a.user + '%20&in_reply_to_status_id=' + a.id + '&in_reply_to=' + a.user + '">reply</a>             </i>           </p>         </div>       </div>';
      var c = document.createElement('div');
      c.id = 'tweet-id-' + ++Tweet._tweetCount;
      c.className = 'twtr-tweet';
      c.innerHTML = b;
      this.element = c
    };
    Tweet._tweetCount = 0;
    (function () {
      var d = false;
      k.css = function (a) {
        var b = document.createElement('style');
        b.type = 'text/css';
        if (J.ie) {
          b.styleSheet.cssText = a
        } else {
          var c = document.createDocumentFragment();
          c.appendChild(document.createTextNode(a));
          b.appendChild(c)
        }
        function appendHeadStyle() {
          document.getElementsByTagName('head')[0].appendChild(b)
        }
        if (!J.ie || d) {
          appendHeadStyle()
        } else {
          window.attachEvent('onload', function () {
            d = true;
            appendHeadStyle()
          })
        }
      }
    })();
    var K = function () {},
    STATIC_CALLBACK_LOCK = false;
    I('receiveCallback', TWTR.Widget, function (a) {
      K(a)
    });
    TWTR.Widget.isLoaded = false;
    I('jsonP', TWTR.Widget, function (a, b) {
      var c = document.createElement('script');
      c.type = 'text/javascript';
      c.src = a;
      function append() {
        document.getElementsByTagName('body')[0].appendChild(c);
        b(c)
      }
      if (!J.ie || TWTR.Widget.isLoaded) {
        append()
      } else {
        window.attachEvent('onload', function () {
          TWTR.Widget.isLoaded = true;
          append()
        })
      }
      return c
    });
    TWTR.Widget.prototype = function () {
      var f = 'http://search.twitter.com/search.';
      var g = 'http://twitter.com/statuses/user_timeline.';
      var h = 'http://twitter.com/favorites/';
      var i = 25000;
      var j = 'http://widgets.twimg.com/j/1/default.gif';
      return {
        init: function (b) {
          var c = this;
          this.opts = b;
          this.base = f;
          this._isRunning = false;
          this._hasOfficiallyStarted = false;
          this._rendered = false;
          this._isCreator = b.creator || false;
          this._profileImage = false;
          this._isProfileWidget = b.profile || false;
          this._isFavsWidget = b.favs || false;
          this.timesRequested = 0;
          this.runOnce = false;
          this.newResults = false;
          this.results = [];
          this.jsonRequestTime = 0;
          this.jsonMaxRequestTimeOut = 20000;
          this.showedResults = [];
          this.sinceId = 1;
          this.source = 'TWITTERINC_WIDGET';
          this.id = b.id;
          this.loop = F.bool(b.loop) ? b.loop : true;
          this.tweets = 0;
          this.TIMER_ID = {};
          this.wh = (b.width && b.height) ? [b.width, b.height] : [250, 300];
          this.wh[0] = ((this.wh[0] < 150) ? 150 : this.wh[0]) + 'px';
          this.wh[1] = ((this.wh[1] < 100) ? 100 : this.wh[1]) + 'px';
          this.intervalJobTimer = b.interval || 7000;
          this.format = 'json';
          this.rpp = b.rpp || 50;
          this.subject = b.subject || '';
          this.title = b.title || '';
          this.setSearch(b.search);
          this._setUrl();
          this.theme = b.theme ? b.theme : this._getDefaultTheme();
          this.occasionalJob = new Occasionally(function (a) {
            c.decay = a;
            c._job.call(c)
          },
          function () {
            return c._decayDecider.call(c)
          },
          i);
          this._avatars = true;
          this._isFullScreen = false;
          this._isFlat = false;
          this._isFlatNoScroll = false;
          this.setFeatures(b.features)
        },
        _job: function () {
          this._getResults(this._prePlay)
        },
        setFeatures: function (a) {
          if (a) {
            if (F.def(a.fullscreen) && F.bool(a.fullscreen)) {
              if (a.fullscreen) {
                this._isFullScreen = true;
                this.wh[0] = '100%';
                this.wh[1] = (v() - 90) + 'px'
              }
            }
            if (F.def(a.avatars) && F.bool(a.avatars)) {
              if (!a.avatars) {
                k.css('#' + this.id + ' .twtr-avatar, #' + this.id + ' .twtr-user { display: none; } ' + '#' + this.id + ' .twtr-tweet-text { margin-left: 0; }');
                this._avatars = false
              } else {
                var b = (this._isFullScreen) ? '90px' : '40px';
                k.css('#' + this.id + ' .twtr-avatar { display: block; } #' + this.id + ' .twtr-user { display: inline; } ' + '#' + this.id + ' .twtr-tweet-text { margin-left: ' + b + '; }');
                this._avatars = true
              }
            } else { if (this._isProfileWidget) {
                this.setFeatures({
                  avatars: false
                });
                this._avatars = false
              } else {
                this.setFeatures({
                  avatars: true
                });
                this._avatars = true
              }
            }
            if (F.def(a.hashtags) && F.bool(a.hashtags)) {
              (!a.hashtags) ? k.css('#' + this.id + ' a.twtr-hashtag { display: none; }') : ''
            }
            if (F.def(a.timestamp) && F.bool(a.timestamp)) {
              var c = a.timestamp ? 'block' : 'none';
              k.css('#' + this.id + ' i { display: ' + c + '; }')
            }
            if (F.def(a.flat) && F.bool(a.flat)) {
              if (a.flat) {
                this._isFlat = true;
                if (F.def(a.scrollbar) && a.scrollbar === false) {
                  this._isFlatNoScroll = true
                }
              }
            }
          } else { if (this._isProfileWidget) {
              this.setFeatures({
                avatars: false
              });
              this._avatars = false
            }
          }
          return this
        },
        setInterval: function (a) {
          this.interval = a;
          return this
        },
        setBase: function (b) {
          this.base = b;
          return this
        },
        setProfile: function (a, b) {
          this._isProfileWidget = true;
          this.username = a;
          this.realname = b || ' ';
          this.setBase(g + this.format + '?screen_name=' + a);
          this.setSearch(' ');
          return this
        },
        setUser: function (a) {
          this._isFavsWidget = true;
          this.username = a;
          this.setBase(h + a + '.');
          this.setSearch(' ');
          return this
        },
        setProfileImage: function (a) {
          this._profileImage = a;
          this.byClass('twtr-profile-img', 'img').src = a;
          this.byClass('twtr-profile-img-anchor', 'a').href = 'http://twitter.com/' + this.username;
          return this
        },
        setTitle: function (a) {
          this.title = a;
          this.widgetEl.getElementsByTagName('h3')[0].innerHTML = this.title;
          return this
        },
        setCaption: function (a) {
          this.subject = a;
          this.widgetEl.getElementsByTagName('h4')[0].innerHTML = this.subject;
          return this
        },
        setSearch: function (s) {
          s = s || '';
          s = s.replace(' ', '+');
          this.search = escape('-RT -via ' + s);
          this._setUrl();
          if (this._rendered) {
            var a = this.byClass('twtr-join-conv', 'a');
            if (this._isProfileWidget || this._isFavsWidget) {
              a.href = 'http://twitter.com/'
            } else {
              a.href = 'http://twitter.com/#search?q=' + this.search
            }
          }
          return this
        },
        _setUrl: function () {
          var a = this;
          function showSince() {
            return (a.sinceId == 1) ? '' : '&since_id=' + a.sinceId
          }
          if (this._isProfileWidget) {
            this.url = this.base + '&callback=TWTR.Widget.receiveCallback' + '&count=' + this.rpp + showSince() + '&clientsource=' + this.source
          } else if (this._isFavsWidget) {
            this.url = this.base + this.format + '?callback=TWTR.Widget.receiveCallback' + showSince() + '&clientsource=' + this.source
          } else {
            this.url = this.base + this.format + '?q=' + this.search + '&callback=TWTR.Widget.receiveCallback' + '&rpp=' + this.rpp + showSince() + '&clientsource=' + this.source
          }
          return this
        },
        setTheme: function (o, a) {
          var b = this;
          var c = ' !important';
          var d = ((window.location.hostname.match(/twitter\.com/)) && (window.location.pathname.match(/goodies/)));
          if (a || d) {
            c = ''
          }
          this.theme = {
            shell: {
              background: function () {
                return o.shell.background || b._getDefaultTheme().shell.background
              } (),
              color: function () {
                return o.shell.color || b._getDefaultTheme().shell.color
              } ()
            },
            tweets: {
              background: function () {
                return o.tweets.background || b._getDefaultTheme().tweets.background
              } (),
              color: function () {
                return o.tweets.color || b._getDefaultTheme().tweets.color
              } (),
              links: function () {
                return o.tweets.links || b._getDefaultTheme().tweets.links
              } ()
            }
          };
          var e = '#' + this.id + ' .twtr-doc,                      #' + this.id + ' .twtr-hd a {            background: ' + this.theme.shell.background + c + ';            color: ' + this.theme.shell.color + c + ';          }          #' + this.id + ' .twtr-tweet a {            color: ' + this.theme.tweets.links + c + ';          }          #' + this.id + ' .twtr-bd, #' + this.id + ' .twtr-timeline i a {            color: ' + this.theme.tweets.color + c + ';          }          #' + this.id + ' .twtr-timeline {            background: ' + this.theme.tweets.background + c + ';          }';
          if (J.ie) {
            e += '#' + this.id + ' .twtr-tweet { background: ' + this.theme.tweets.background + c + '; }'
          }
          k.css(e);
          return this
        },
        byClass: function (c, a, b) {
          var d = q(c, a, t(this.id));
          return (b) ? d : d[0]
        },
        render: function () {
          var a = this;
          this.setTheme(this.theme, this._isCreator);
          this.widgetEl = t(this.id);
          D.add(this.widgetEl, 'twtr-widget');
          if (this._isProfileWidget) {
            D.add(this.widgetEl, 'twtr-widget-profile')
          }
          if (this._isFlatNoScroll) {
            this.wh[1] = 'auto'
          }
          if (this._isFlat) {
            (!this._isFlatNoScroll) ? D.add(this.widgetEl, 'twtr-flat') : ''
          }
          this.widgetEl.innerHTML = this._getWidgetHtml();
          this.spinner = this.byClass('twtr-spinner', 'div');
          var b = this.byClass('twtr-timeline', 'div');
          if (!this._isFlat) {
            E.add(b, 'mouseover', function (e) {
              if (C.call(this, e)) {
                a.pause.call(a)
              }
            });
            E.add(b, 'mouseout', function (e) {
              if (C.call(this, e)) {
                a.resume.call(a)
              }
            })
          }
          this._rendered = true;
          return this
        },
        _getDefaultTheme: function () {
          return {
            shell: {
              background: '#3082af',
              color: '#ffffff'
            },
            tweets: {
              background: '#ffffff',
              color: '#444444',
              links: '#1985b5'
            }
          }
        },
        _getWidgetHtml: function () {
          var a = this;
          function getQueryString() {
            if (a._isProfileWidget) {
              return ''
            } else {
              return '#search?q=' + a.search
            }
          }
          function getHeader() {
            if (a._isProfileWidget) {
              return '<a href="http://twitter.com/" class="twtr-profile-img-anchor"><img class="twtr-profile-img" src="' + j + '"></a>                      <h3></h3>                      <h4></h4>'
            } else {
              return '<h3>' + a.title + '</h3><h4>' + a.subject + '</h4>'
            }
          }
          function getLogoHeight() {
            if (!a._isFullScreen) {
              return ' height="15"'
            }
            return ''
          }
          function isFull() {
            return a._isFullScreen ? ' twtr-fullscreen' : ''
          }
          var b = '<div class="twtr-doc' + isFull() + '" style="width: ' + this.wh[0] + ';">            <div class="twtr-hd">' + getHeader() + '               <div class="twtr-spinner twtr-inactive"></div>            </div>            <div class="twtr-bd">              <div class="twtr-timeline" style="height: ' + this.wh[1] + ';">                <div class="twtr-tweets">                  <div class="twtr-reference-tweet"></div>                  <!-- tweets show here -->                </div>              </div>            </div>            <div class="twtr-ft">              <div><a href="http://twitter.com"><img src="http://widgets.twimg.com/j/1/twitter_logo_s.' + (J.ie ? 'gif' : 'png') + '"' + getLogoHeight() + '></a>                <span><a class="twtr-join-conv" style="color:' + this.theme.shell.color + '" href="http://twitter.com/celestrellas">Síguenos via Twitter</a></span>              </div>            </div>          </div>';
          return b
        },
        _appendTweet: function (a) {
          z(a, this.byClass('twtr-reference-tweet', 'div'));
          return this
        },
        _slide: function (a) {
          var b = this;
          var c = B(a).offsetHeight;
          new Animate(a, 'height', {
            from: 0,
            to: c,
            time: 500,
            callback: function () {
              b._fade.call(b, a)
            }
          }).start();
          return this
        },
        _fade: function (a) {
          var b = this;
          if (Animate.canTransition) {
            a.style.webkitTransition = 'opacity 0.5s ease-out';
            a.style.opacity = 1;
            return this
          }
          new Animate(a, 'opacity', {
            from: 0,
            to: 1,
            time: 500
          }).start();
          return this
        },
        _chop: function () {
          var a = this.byClass('twtr-tweet', 'div', true);
          if (a.length) {
            var b = a[a.length - 1];
            var c = parseInt(b.offsetTop);
            if (c > parseInt(this.wh[1])) {
              b.parentNode.removeChild(b)
            }
          }
          return this
        },
        _appendSlideFade: function () {
          this._chop()._appendTweet(this.tweet.element)._slide(this.tweet.element);
          return this
        },
        _createTweet: function (o) {
          this.tweet = new Tweet(o);
          if (!this._isFlat) {
            this.tweet.element.style.opacity = 0;
            this.tweet.element.style.filter = 'alpha(opacity:0)';
            this.tweet.element.style.height = '0'
          }
          return this
        },
        _getResults: function (b) {
          var c = this;
          this.timesRequested++;
          this.jsonRequestRunning = true;
          this.jsonRequestTimer = window.setTimeout(function () {
            if (c.jsonRequestRunning) {
              clearTimeout(c.jsonRequestTimer);
              D.add(c.spinner, 'twtr-inactive')
            }
            if (c.TIMER_ID) {
              clearInterval(c.TIMER_ID)
            }
            STATIC_CALLBACK_LOCK = false;
            c.jsonRequestRunning = false;
            A(c.scriptElement);
            c.newResults = false;
            c.decay()
          },
          this.jsonMaxRequestTimeOut);
          D.remove(this.spinner, 'twtr-inactive');
          function waitFn() {
            STATIC_CALLBACK_LOCK = true;
            K = function (a) {
              c.jsonRequestRunning = false;
              b.call(c, a)
            };
            TWTR.Widget.jsonP(c.url, function (a) {
              c.scriptElement = a
            })
          } (STATIC_CALLBACK_LOCK) ? this._wait(waitFn) : waitFn.call(this)
        },
        _wait: function (a) {
          var b = this;
          this.TIMER_ID = window.setInterval(function () {
            if (!STATIC_CALLBACK_LOCK) {
              window.clearInterval(b.TIMER_ID);
              a.call(b)
            }
          },
          100)
        },
        clear: function () {
          var b = q('twtr-tweet', 'div', t(this.id));
          b.forEach(function (a) {
            a.parentNode.removeChild(a)
          });
          return this
        },
        _sortByMagic: function (c) {
          if (!this.loop) {
            this.results = c;
            return
          }
          var d = this;
          var e = function () {
            if (J.ie) {
              return function (a) {
                return Date.parse(a.replace(/( \+)/, ' UTC$1'))
              }
            } else {
              return function (a) {
                return new Date(a)
              }
            }
          } ();
          this.results.unshift.apply(this.results, c);
          this.results.forEach(function (a) {
            if (!a.views) {
              a.views = 0
            }
          });
          this.results.sort(function (a, b) {
            if (e(a.created_at) < e(b.created_at)) {
              return 1
            } else if (e(a.created_at) > e(b.created_at)) {
              return -1
            } else {
              return 0
            }
          });
          this.results = this.results.slice(0, this.rpp);
          if (this._isFlat) {
            this.results.reverse()
          }
          this.results = this.results.sort(function (a, b) {
            if (a.views > b.views) {
              return 1
            } else if (a.views < b.views) {
              return -1
            }
            return 0
          })
        },
        _prePlay: function (a) {
          if (this.jsonRequestTimer) {
            clearTimeout(this.jsonRequestTimer)
          }
          A(this.scriptElement);
          if (a.error) {
            this.newResults = false
          } else if (a.results && a.results.length > 0) {
            if (this.intervalJob) {
              this.intervalJob.stop()
            }
            this.newResults = true;
            this.sinceId = a.max_id;
            this._sortByMagic(a.results);
            if (this.isRunning()) {
              this._play()
            }
          } else if ((this._isProfileWidget || this._isFavsWidget) && F.array(a) && a.length > 0) {
            if (this.intervalJob) {
              this.intervalJob.stop()
            }
            this.newResults = true;
            if (!this._profileImage && this._isProfileWidget) {
              var b = a[0].user.screen_name;
              this.setProfileImage(a[0].user.profile_image_url);
              this.setTitle(a[0].user.name);
              this.setCaption('<a href="http://twitter.com/' + b + '">' + b + '</a>')
            }
            this.sinceId = a[0].id;
            this._sortByMagic(a);
            if (this.isRunning()) {
              this._play()
            }
          } else {
            this.newResults = false
          }
          this._setUrl();
          if (!this._isFlat) {
            this.decay()
          }
          STATIC_CALLBACK_LOCK = false;
          D.add(this.spinner, 'twtr-inactive')
        },
        _play: function () {
          var b = this;
          if (this._avatars) {
            this._preloadImages(this.results)
          }
          if (this._isFlat) {
            this.results.forEach(function (a) {
              if (b._isProfileWidget) {
                a.from_user = b.username;
                a.profile_image_url = a.user.profile_image_url
              }
              if (b._isFavsWidget) {
                a.from_user = a.user.screen_name;
                a.profile_image_url = a.user.profile_image_url
              }
              b._createTweet({
                user: a.from_user,
                tweet: H.clean(a.text),
                avatar: a.profile_image_url,
                created_at: a.created_at,
                id: a.id
              })._appendTweet(b.tweet.element)
            });
            return this
          }
          this.intervalJob = new IntervalJob(this.results, this.intervalJobTimer, this.loop, function (a) {
            a.views++;
            if (b._isProfileWidget) {
              a.from_user = b.username;
              a.profile_image_url = a.user.profile_image_url
            }
            if (b._isFavsWidget) {
              a.from_user = a.user.screen_name;
              a.profile_image_url = a.user.profile_image_url
            }
            if (b._isFullScreen) {
              a.profile_image_url = a.profile_image_url.replace(/_normal\./, '_bigger.')
            }
            b._createTweet({
              user: a.from_user,
              tweet: H.clean(a.text),
              avatar: a.profile_image_url,
              created_at: a.created_at,
              id: a.id
            })._appendSlideFade()
          }).start(true);
          return this
        },
        _preloadImages: function (c) {
          if (this._isProfileWidget || this._isFavsWidget) {
            c.forEach(function (a) {
              var b = new Image();
              b.src = a.user.profile_image_url
            })
          } else {
            c.forEach(function (a) {
              var b = new Image();
              b.src = a.profile_image_url
            })
          }
        },
        mock: function () {
          this._createTweet({
            user: 'ded',
            tweet: H.clean("Walking home during a beautiful San Francisco evening to meet @erin. #sf"),
            avatar: 'http://s3.amazonaws.com/twitter_production/profile_images/56561346/dustin-was-here_normal.gif',
            id: '2574165545',
            created_at: new Date().toString()
          })._appendSlideFade();
          return this
        },
        _decayDecider: function () {
          var r = false;
          if (!this.runOnce) {
            this.runOnce = true;
            r = true
          } else if (this.newResults) {
            r = true
          } else {
            r = false
          }
          return r
        },
        start: function () {
          if (this._isFlat) {
            this._job()
          } else {
            this.occasionalJob.start()
          }
          this._isRunning = true;
          this._hasOfficiallyStarted = true;
          return this
        },
        stop: function () {
          this.occasionalJob.stop();
          if (this.intervalJob) {
            this.intervalJob.stop()
          }
          this._isRunning = false;
          return this
        },
        pause: function () {
          if (this.isRunning() && this.intervalJob) {
            this.intervalJob.stop()
          }
          if (this._resumeTimer) {
            clearTimeout(this._resumeTimer)
          }
          this._isRunning = false;
          return this
        },
        resume: function () {
          var a = this;
          if (!this.isRunning() && this._hasOfficiallyStarted && this.intervalJob) {
            this._resumeTimer = window.setTimeout(function () {
              a.intervalJob.start();
              a._isRunning = true
            },
            2000)
          }
          return this
        },
        isRunning: function () {
          return this._isRunning
        },
        destroy: function () {
          this.stop();
          this.clear();
          this.runOnce = false;
          this._hasOfficiallyStarted = false;
          this._profileImage = false;
          this._isFlat = false;
          this._isFlatNoScroll = false;
          this.newResults = false;
          this._isRunning = false;
          this.sinceId = 1;
          this.results = [];
          this.showedResults = [];
          this.occasionalJob.destroy();
          if (this.jsonRequestRunning) {
            clearTimeout(this.jsonRequestTimer);
            D.add(this.spinner, 'twtr-inactive')
          }
          if (this.TIMER_ID) {
            clearInterval(this.TIMER_ID)
          }
          D.remove(this.widgetEl, 'twtr-flat');
          STATIC_CALLBACK_LOCK = false;
          return this
        }
      }
    } ()
  })()
})();

function generateTopFiveDropDown(){
	var dayOfWeek = new Array();
	var fiveDays = new Array();
	var dayID = new Array();
	var monthOfWeek = new Array();
	var entry = new Array();

	dayOfWeek[0] = "sunday";
	dayOfWeek[1] = "monday";
	dayOfWeek[2] = "tuesday";
	dayOfWeek[3] = "wednesday";
	dayOfWeek[4] = "thursday";
	dayOfWeek[5] = "friday";
	dayOfWeek[6] = "saturday";

	monthOfWeek[1] = 'Enero';
	monthOfWeek[2] = 'Febrero';
	monthOfWeek[3] = 'Marzo';
	monthOfWeek[4] = 'Abril';
	monthOfWeek[5] = 'Mayo';
	monthOfWeek[6] = 'Junio';
	monthOfWeek[7] = 'Julio';
	monthOfWeek[8] = 'Agosto';
	monthOfWeek[9] = 'Septiembre';
	monthOfWeek[10] = 'Octubre';
	monthOfWeek[11] = 'Noviembre';
	monthOfWeek[12] = 'Diciembre';

	var myDate=new Date();
	var count =1;
	var theMonth = myDate.getMonth()+1;
	fiveDays[0] = myDate.getDate()+" "+  monthOfWeek[theMonth] +" "+ myDate.getFullYear();
	dayID[0] = dayOfWeek[myDate.getDay()];

	for(i=0;i<6;i++){
	myDate.setDate(myDate.getDate()-1);
	theMonth = myDate.getMonth()+1;
		if((dayOfWeek[myDate.getDay()]!="sunday") && (dayOfWeek[myDate.getDay()]!="saturday")){
			fiveDays[count] = myDate.getDate()+" "+ monthOfWeek[theMonth] +" "+ myDate.getFullYear();
			dayID[count] = dayOfWeek[myDate.getDay()];
			count++;

		}
	}
	fiveDays.reverse();
	dayID.reverse();
	document.getElementById("tvTop5DropdownDatesES").innerHTML="";
	for(j=0;j<5;j++){
		entry[j] = document.createElement('li');
		entry[j].className = "tt5ESVideo";
		entry[j].innerHTML = '<a id="tt5-es-'+dayID[j]+'" href="javascript:void(0);">'+fiveDays[j]+'</a>';
		document.getElementById("tvTop5DropdownDatesES").appendChild(entry[j]);
	}
	
	document.getElementById("tvTop5DropdownDatesEN").innerHTML="";
	for(k=0;k<5;k++){
		entry[k] = document.createElement('li');
		entry[k].className = "tt5ENVideo";
		entry[k].innerHTML = '<a id="tt5-en-'+dayID[k]+'" href="javascript:void(0);">'+fiveDays[k]+'</a>';
		document.getElementById("tvTop5DropdownDatesEN").appendChild(entry[k]);
	}
	
}

//]]>