function randomSearchStrings() {

  var strings = new Array ("Pájaro + Comala", "Cursos", "Fotografía", "Cine + Debate", "Lenguaje cinematográfico", "Editorial", "Juventud", "Cine + Foro", "Mujer", "Utopía");

  var ri = Math.floor(Math.random() * strings.length);
  var rs = strings[ri];

  document.getElementById("s").value = rs;
  document.getElementById("s").style.color = "#999999";

  document.getElementById("s").onfocus = function () { 
    if (document.getElementById("s").value == rs ) {
      document.getElementById("s").value = "";
      document.getElementById("s").style.color = "#000000";
    } else {
      document.getElementById("s").style.color = "#000000";
    }
  }

  document.getElementById("s").onblur = function () {
    if (document.getElementById("s").value == "") {
      document.getElementById("s").value = rs;
    }
    document.getElementById("s").style.color = "#999999";
  }
}

window.onload = randomSearchStrings;


jQuery(function($) {

var Header = {
  // Logo
  addFade : function(selector){
    $("<span class=\"title-hover\"></span>").css("display", "none").prependTo($(selector));
      $(selector+" a").bind("mouseenter",function(){
      $(selector+" .title-hover").fadeIn("fast");
    });
    
    $(selector+" a").bind("mouseleave",function(){
      $(selector+" .title-hover").fadeOut("fast");
    });
  }
};

$(function(){
  Header.addFade("h1#title");
});

var Header = {
  // Logo escuela
  addFade : function(selector){
    $("<span class=\"escuela-hover\"></span>").css("display", "none").prependTo($(selector));
      $(selector+" a").bind("mouseenter",function(){
      $(selector+" .escuela-hover").fadeIn("fast");
    });
    
    $(selector+" a").bind("mouseleave",function(){
      $(selector+" .escuela-hover").fadeOut("fast");
    });
  }
};

$(function(){
  Header.addFade("#escuela-title");
});


$(function () {
    var tabContainers = $('div.tabs > div');
    	$('div.tabs > div').hide(); 
    
    $('div.tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).fadeIn('slow');
        
        $('div.tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();
});
	
$(document).ready(function() {
	$('body.page #feature, body.single #feature, body.archive #feature, body.category #feature, body.tag #feature, body.search #feature').flash({
		src: 'http://dodeca.org/media/swf/grid.swf',
	    width: 600,
	    height: 150,
	    wmode: 'transparent'
	});
	
	$(".entry-content a.box, .threadpost .post a.box").fancybox({
		'overlayShow':	true
	});
	
	$('div.nav-previous a').addClass('feature-tip').attr("title","Ver artículos anteriores");
	$('div.nav-next a').addClass('feature-tip').attr("title","Ver artículos posteriores");
	
	$('.tip').Tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " :: ",
		fixPNG: true
	});
	
	$("ul.cortos").tabs({ selected: null });
	
	$('.showbox a, a.showbox').toggle(function() {
		$('div#showbox').show('fast');
		return false;
	}, function() {
		$('div#showbox').hide('fast');
		return false;
	});
	

 // Oculta cuando el DOM está listo
 	$('div#cine-sociedad').hide();
	$('div#polemicas').hide();
	$('div#destacadas').hide(); 
	
	$('#showbox').hide();
	
 // Muestra cuando el DOM está listo
 	$('#bcine-sociedad').show();
	$('#bpolemicas').show();
	$('#bdestacadas').show();

	$('#bcine-sociedad').toggle(function() {
		$(this).css("background-position","bottom left");
		$('div#cine-sociedad').show();
		return false;
	}, function() {
		$(this).css("background-position","top left");
		$('div#cine-sociedad').hide();
		return false;
	});

	$('#bpolemicas').toggle(function() {
		$(this).css("background-position","bottom left");
		$('div#polemicas').show();
		return false;
	}, function() {
		$(this).css("background-position","top left");
		$('div#polemicas').hide();
		return false;
	});

	$('#bdestacadas').toggle(function() {
		$(this).css("background-position","bottom left");
		$('div#destacadas').show();
		return false;
	}, function() {
		$(this).css("background-position","top left");
		$('div#destacadas').hide();
		return false;
	});
	
	$('#featured').jcarousel({
        scroll: 1,
        easing: "swing"
    });
    
    $('ul.superior').jcarousel({
        scroll: 2
    });
    $('#cintaescuela').jcarousel({
        scroll: 1,
        auto: 3,
        animation: 2000,
        easing: "swing",
        wrap: "last"
    });
	
});
});