<!--

function cambiaestilo(id, nuevaClase) {
	objeto=document.getElementById(id);
	if(objeto) {
		objeto.className=nuevaClase;
	}
}
	
function mm_showhidelayers() { //v6.0
  var i,p,v,obj,args=mm_showhidelayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { 
  	v=args[i+2];
    if (obj.style) { 
    	obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
    }
    obj.visibility=v; 
   }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function toggleRelevantesDetails() {
	var spans = document.getElementsByTagName('span');
	for(i=0; i < spans.length; i++) {
		if(spans[i].id.substring(0, 16) == 'toggle_relevante') {
			var span_style = document.getElementById(spans[i].id).style;
			span_style.display == 'block' ? span_style.display = 'none' : span_style.display = 'block';
		}
	}	
	var divs = document.getElementsByTagName('div');
	for(i=0; i < divs.length; i++) {
		if(divs[i].id.substring(0, 19) == 'fundacion_relevante') {
			var div_style = document.getElementById(divs[i].id).style;
			div_style.display == 'block' ? div_style.display = 'none' : div_style.display = 'block';
		}
	}
}

function toggleRelevantesDetails() {
	var spans = document.getElementsByTagName('span');
	for(i=0; i < spans.length; i++) {
		if(spans[i].id.substring(0, 16) == 'toggle_relevante') {
			var span_style = document.getElementById(spans[i].id).style;
			span_style.display == 'block' ? span_style.display = 'none' : span_style.display = 'block';
		}
	}	
	var divs = document.getElementsByTagName('div');
	for(i=0; i < divs.length; i++) {
		if(divs[i].id.substring(0, 19) == 'fundacion_relevante') {
			var div_style = document.getElementById(divs[i].id).style;
			div_style.display == 'block' ? div_style.display = 'none' : div_style.display = 'block';
		}
	}
}

function trim(str) {
	return str.replace(/^\s+|\s+$/g, ''); 
}

function updateImage(link, url) {
	var links = document.getElementsByTagName('a');
	for(i=0; i < links.length; i++) {
		if(links[i].id.substring(0, 19) == 'galeria_small_link_') {
			document.getElementById(links[i].id).className = '';
		}
	}		
	link.className = 'seleccionado';
	var ajax = new Ajax.Updater(
						'galeriaarriba',
						url,
						{method: 'get'});
}

function updateLinea(url) {
	if(url != '') {
		var ajax = new Ajax.Updater(
			'lineas_investigacion',
			url,
			{method: 'get'});
	}
}

function updatePaises(select_pais, url) {
	var ajax = new Ajax.Request(
	url,
	{method:'get', synchronous:true, onSuccess:function(t, select){ populateSelect(t.responseText, select_pais) } });
}

function populateSelect(str, select) {
	emptySelect(select);
	var hash = str.split('|');
	for(i = 0, j = 0; j < hash.length; i++, j = j + 2) {
		select.options[i] = new Option(hash[j], hash[j + 1]);
	}
}

function emptySelect(select) {
	select.options.length = 0;
}

function updateSelect(select_cont, select_pais) {
	var url = select_cont.options[select_cont.selectedIndex].value;
	updatePaises(select_pais, url);
}

function updateContinenteFlash(continente_id) {
	select_cont = document.getElementById('continente');
	select_pais = document.getElementById('pais');
	continente_url = URLContinentes[continente_id];
	for(i = 0; i < select_cont.options.length; i++) {
		if(select_cont.options[i].value == URLContinentes[continente_id])
			select_cont.options[i].selected = true;
	}
	updateSelect(select_cont, select_pais);
}

function FullscreenLoad(url){
	if (window.screen){
		var hori=screen.availWidth;
		var verti=screen.availHeight;
		window.open(url,'Papelaweb', 'width='+hori+',height='+verti+',fullscreen=1, scrollbars=0,left='+(0)+',top='+(0));
	}
}

function Pag(num){
	document.getElementById('pagina').value=num;
	document.getElementById('formulariobusca').submit();
}
//-->
