// @font-face flicker issue in FireFox - http://joshuamcginnis.com/2010/08/17/how-to-fix-the-font-face-flicker-issue-in-firefox/
(function(){
  // if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUT
  var d = document, e = d.documentElement, s = d.createElement('style');
  if (e.style.MozTransform === ''){ // gecko 1.9.1 inference
    s.textContent = 'body{visibility:hidden}';
    e.firstChild.appendChild(s);
    function f(){ s.parentNode && s.parentNode.removeChild(s); }
    addEventListener('load',f,false);
    setTimeout(f,1000);
  }
})();

jQuery(document).ready(function(){
// Adding css class automatically.
	$(".shadow-left").append("<span class=\"shadow-left\"/>");
	$(".thumb-video").append("<span class=\"mask-video\"/>");

	$("ul li:first-child").addClass("first");
	$("ul li:last-child").addClass("last");

	$("#mn").find("#videos ul.resultados li:odd").addClass("odd");
	$("#mn").find(".ranking table tr:odd").addClass("odd");
	$("#mn").find("#videos ul.resultados li span.thumb").append("<span class='play' />");

	var escolhaCapitulo = $(".escolha-capitulo a");
	escolhaCapitulo.hover(function(){
		$(this).parent().children("ul").show();
		return false;
	},function(){
		$(this).parent().children("ul").hide();
	});
	var escolhaCapituloUl = $(".escolha-capitulo ul");
	escolhaCapituloUl.hover(function(){
		$(this).show();
		return false;
	},function(){
		$(this).hide();
	});

// Replace text on fields
	$(".field").addClass("idleField");
	$(".field").focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue) {
			this.value = '';
		}
		if (this.value != this.defaultValue) {
			this.select();
		}
	});
	$(".field").blur(function() {
		if ($.trim(this.value) == '') {
			$(this).removeClass("focusField").addClass("idleField");
			$(this).removeClass("fillField");
				this.value = (this.defaultValue ? this.defaultValue : '');
		} else {
			$(this).removeClass("focusField").addClass("fillField");
		}
	});

});
