function retornoMadridOrg(){if(window.opener && !window.opener.closed){window.opener.focus();window.close()}}
function popup(url) {window.open(url,"ventana_popup","width=568,height=440,scrollbars=yes")}
function wOpen(url,w,h){
	//window.focus();
	nombre='ventana_imagenes';
	x=((screen.width-w)/2)-5;
	y=((screen.height-h)/2)-8;
	var miv=window.open(url,nombre,"toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,fullscreen=0,width="+w+",height="+h+",left="+x+",top="+y);
	miv.focus();
}
function wOpen_sede(url){
	//window.focus();
	nombre='VVirtual';
	w = window.screen.width-10;
	h = window.screen.height-100;
	x = 0;
	y = 0;
	var miv=window.open(url,nombre,"toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,fullscreen=0,width="+w+",height="+h+",left="+x+",top="+y);
	miv.focus();
}
function valLoginComentario(){
	email = document.formLogin.alias.value;
	if (email == ""){
		emailVacio = 'Introduzca su email';
		alert(emailVacio);
		document.formLogin.alias.focus()
	}else{
		pos1=email.indexOf("@");
		pos2=email.lastIndexOf(".");
		if (!((pos1>=1) && (pos2!=-1) && (pos2>pos1+1) && (email.indexOf("@",pos1+1)== -1) && (email.indexOf(".",pos2+1)==-1))){
			emailIncorrecto = 'Por favor, introduzca un email VALIDO';
			alert(emailIncorrecto);
			document.formLogin.alias.focus()
		}else{
			comentario = trim(document.formLogin.comentario.value);
			if (comentario==""){
			    comentarioVacio = 'Introduzca un comentario';
				alert(comentarioVacio);
				document.formLogin.alias.focus()
			}else{
				document.formLogin.comentario.value = escape(comentario);
				document.formLogin.action = 'http://www.madrid.org/cs/Satellite';
				document.formLogin.submit();
			}
		}
	}
}
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}


// funcvion para cambiar la foto en historia !!! se le pasa el numero de foto y el titulo para el alt 
function cambiar_foto(foto, titulo, texto)
{
	var mifoto = document.getElementById("mimagen");
	 if (document.getElementById) {
		  mifoto.src = foto;
		  mifoto.title = titulo
		  if (arguments.length > 2 && mis_textos && document.getElementById('mitexto')) document.getElementById('mitexto').getElementsByTagName('p')[0].innerHTML = mis_textos[texto];
		  return false;
	 } else {
		  return true;
	 }
	 
}