$(document).ready(function(){ 
	//$.ifixpng('_img/pixel.gif'); 
	//$('div').ifixpng();
	
	$('#submn01').click(function () { 
      		submenus();
			$(this).addClass('activo');
			$('#bloque_01').fadeIn('slow');
    });
	$('#submn02').click(function () { 
      		submenus();
			$(this).addClass('activo');
			$('#bloque_02').fadeIn('slow');
    });
	$('#submn03').click(function () { 
      		submenus();
			$(this).addClass('activo');
			$('#bloque_03').fadeIn('slow');
    });	
	$('#submn04').click(function () { 
      		submenus();
			$(this).addClass('activo');
			$('#bloque_04').fadeIn('slow');
    });		
	$('#submn05').click(function () { 
      		submenus();
			$(this).addClass('activo');
			$('#bloque_05').fadeIn('slow');
    });
	//$('#sub_areas').mouseover(function () { 
	//		$('#sub_02').fadeIn('slow');
    //});
	//$('#sub_02').mouseout(function () { 
	//		$(this).fadeOut('slow');
    //});

	$('#subaut01').click(function () { 
      		MenuAutores();
			$(this).addClass('activo');
			$('#autor_blq01').fadeIn('slow');
    });
	$('#subaut02').click(function () { 
      		MenuAutores();
			$(this).addClass('activo');
			$('#autor_blq02').fadeIn('slow');
    });
	$('#subaut03').click(function () { 
      		MenuAutores();
			$(this).addClass('activo');
			$('#autor_blq03').fadeIn('slow');
    });
	$('#subaut04').click(function () { 
      		MenuAutores();
			$(this).addClass('activo');
			$('#autor_blq04').fadeIn('slow');
    });
	$('#subaut05').click(function () { 
      		MenuAutores();
			$(this).addClass('activo');
			$('#autor_blq05').fadeIn('slow');
    });




}); 
   
// desactivar submenus   
function submenus (){
	$('#submn01').removeClass('activo');
	$('#bloque_01').hide();
	$('#submn02').removeClass('activo');
	$('#bloque_02').hide();
	$('#submn03').removeClass('activo');
	$('#bloque_03').hide();
	$('#submn04').removeClass('activo');
	$('#bloque_04').hide();
	$('#submn05').removeClass('activo');
	$('#bloque_05').hide();	
}

// desactivar submenus   
function MenuAutores (){
	$('#subaut01').removeClass('activo');
	$('#autor_blq01').hide();
	$('#subaut02').removeClass('activo');
	$('#autor_blq02').hide();
	$('#subaut03').removeClass('activo');
	$('#autor_blq03').hide();
	$('#subaut04').removeClass('activo');
	$('#autor_blq04').hide();
	$('#subaut05').removeClass('activo');
	$('#autor_blq05').hide();	
}


// para el submenu submenus   
sfHover = function() {
	var sfEls = document.getElementById("menuprincipal").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*Funcion para plegar y desplegar los formularios*/
function plegar_desplegar(bloque){
   if(document.getElementById(bloque).style.display=="none"){
	  document.getElementById(bloque).style.display="block";
   }
   else{
	  document.getElementById(bloque).style.display="none"; 
   }  
}

function new_captcha(){
	if(document.getElementById){
		// extract image name from image source (i.e. cut off ?randomness)
		thesrc = document.getElementById("captcha").src;

		// add ?(random) to prevent browser/isp caching
		document.getElementById("captcha").src = thesrc+"&"+Math.round(Math.random()*100000);
	}//fin if
}//fin function

function limpiar(){
	document.formulario.email.value= "";
}

// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/
//
// nifty StyleSwitcher scripts modified by Aaron Jones 10/10/2002
// ----------------------------------------------

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
  //MM_preloadImages('/imagenes/tamtext/a1.gif','/imagenes/tamtext/a2.gif','/imagenes/tamtext/a3.gif')
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


