desplegable = {
	
	openText : "[+]",
	closeText : "[-]",
	velocity : "fast",
	init : function (id) {
		var d = $( "#" + id );
    	d.find("ul").css("display","none");
    	d.find("ul").prev().append('&nbsp;<a href="#" style="color:#999;" onclick="return desplegable.action(this);">'+this.openText+'</a>');
	},
	action : function (el) {
		if ( $(el).html() == this.openText) {
			$(el).html(this.closeText);
			$(el).parent().next().show(this.velocity);
		} else if ( $(el).html() == this.closeText){
			$(el).html(this.openText);
			$(el).parent().next().hide(this.velocity);	
		}
		return false
	}
}

$(document).ready(function()
 {
  if(($.cookie("fuente"))!= "undefined") $("body").css("fontSize", $.cookie("fuente"));
  desplegable.init("desplega");
    
  $("#aumenta").click(function()
   {
 	$("body").css("fontSize", "0.9em");
    $.cookie("fuente", "0.9em");
   });
   
  $("#normal").click(function()
   {
    $("body").css("fontSize", "0.8em");
    $.cookie("fuente", "0.8em");
   });
   
  $("#busqueda").submit(function()
   {
   	texto1=$("#error_busqueda").attr('value');
	texto2=$("#error_busqueda").attr('name'); /*alert*/
  	if(($.trim($("#cadena").val()).length<3)||($("#cadena").val()==texto1))
     {
      alert(texto2);
      return false;
     }
    else $("#busqueda").submit();
   });
   
  
  $("#cadena").focus(function()
   {
	texto1=$("#error_busqueda").attr('value');	
	$("#cadena").css('color','#000');
	if($("#cadena").val()==texto1) $("#cadena").attr('value','');
     else $("#cadena").select();	
   });
 
  $("#cadena").blur(function()
   {
    texto1=$("#error_busqueda").attr('value');	
    $("#cadena").css('color','#999');
    if($("#cadena").val()=='') $("#cadena").attr('value',texto1);
   });

 });