function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 CompruebaFrmEnviarLink(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txturl.value == "" || obj.txturl.value == "http://" )
		stmp = stmp + "Debes Introducir una Dirección Web Correcta\n";
		
	if ( obj.txtdescripcion.value == "" )
		stmp = stmp + "Debes Introducir una Descripción\n";
	
	var desc;
	desc = obj.txtdescripcion.value;
	if (  desc.length > 100 )
		stmp = stmp + "La descripción no puede tener más de 100 caracteres";
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmComentario(obj) {
	
	if ( obj.txtcomentario.value == "" ) {
		alert ('No puedes introducir un comentario vacío');
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarMarca(obj) {
	
	if ( obj.txtnombre.value == "" ) {
		alert ('No puedes introducir una marca vacía');
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarNoticias(obj) {
	
	if ( obj.txtdescripcion.value == "" ) {
		alert ('No puedes introducir una noticia vacía');
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmTema(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txttitulo.value == "" )
		stmp = stmp + "Debes Introducir un Título\n";
		
	if ( obj.txttexto.value == "" )
		stmp = stmp + "Debes Introducir un Texto";
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
	
}

function CompruebaFrmEnviarViaje(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txtfechainicio.value == "" )
		stmp = stmp + "Debes Introducir una Fecha de Inicio\n";
		
	if ( obj.txtfechafin.value == "" )
		stmp = stmp + "Debes Introducir una Fecha de Fin\n";		
		
	if ( obj.txtdescripcion.value == "" )
		stmp = stmp + "Debes Introducir una Descripción\n";
	
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarExcursion(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txtfechainicio.value == "" )
		stmp = stmp + "Debes Introducir una Fecha de Inicio\n";
		
	if ( obj.txtfechafin.value == "" )
		stmp = stmp + "Debes Introducir una Fecha de Fin\n";		
		
	if ( obj.txtdescripcion.value == "" )
		stmp = stmp + "Debes Introducir una Descripción\n";
	
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarOferta(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txtprecio.value == "" )
		stmp = stmp + "Debes Introducir un Precio\n";
		
	if ( obj.txtfechafin.value == "" )
		stmp = stmp + "Debes Introducir una Fecha de Fin\n";		
		
	if ( obj.txtdescripcion.value == "" )
		stmp = stmp + "Debes Introducir una Descripción\n";
	
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarFoto(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txtdescripcion.value == "" )
		stmp = stmp + "Debes Introducir una Descripción\n";
		
	var desc;
	desc = obj.txtdescripcion.value;
	if (  desc.length > 200 )
		stmp = stmp + "La descripción no puede tener más de 200 caracteres";		
	
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmEnviarArchivo(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir un Nombre\n";
		
	if ( obj.txtarchivo.value == "" )
		stmp = stmp + "Debes Introducir un Archivo\n";
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function CompruebaFrmCambiarPassword(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtpassword1.value != obj.txtpassword2.value ) 
		stmp = stmp + "La Contraseña y su repetición deben ser iguales\n";
		
	if ( obj.txtpasswordantiguo.value == "" ) 
		stmp = stmp + "Introduce tu Antigua Contraseña\n";
		
	if ( obj.txtpasswordantiguo.value.length < 6 ) 
		stmp = stmp + "La Antigua Contraseña debe tener almenos 6 carácteres\n";	
		
	if ( obj.txtpassword1.value == "" ) 
		stmp = stmp + "Introduce tu Nueva Contraseña\n";		
		
	if (  obj.txtpassword1.value.length < 6   )
		stmp = stmp + "La Nueva Contraseña debe tener almenos 6 carácteres\n";				
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}		
		
}

function CompruebaFrmCambiarDatos(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir tu Nombre\n";
		
	if ( obj.txtapellidos.value == "" )
		stmp = stmp + "Debes Introducir tus Apellidos\n";			
		
	if ( obj.txttlf1.value == "" )
		stmp = stmp + "Debes Introducir el Teléfono obligatorio\n";
		
	if ( obj.txtemail.value == "" )
		stmp = stmp + "Debes Introducir tu Cuenta de E-Mail\n";		
		
	if ( obj.lstprovincia.options[obj.lstprovincia.selectedIndex].value == "" )
		stmp = stmp + "Debes Introducir tu Provincia\n";
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}		
	
}

function CompruebaFrmRegistro(obj) {
	
	var stmp;
	stmp = "";
	if ( obj.txtuser.value == "" )
		stmp = stmp + "Debes Introducir un Nombre de Usuario\n";

	if ( obj.txtpassword1.value == "" )
		stmp = stmp + "Debes Introducir una Contraseña\n";
		
	if ( obj.txtpassword2.value == "" )
		stmp = stmp + "Debes Repetir tu Contraseña\n";
		
	if ( obj.txtnombre.value == "" )
		stmp = stmp + "Debes Introducir tu Nombre\n";
		
	if ( obj.txtapellidos.value == "" )
		stmp = stmp + "Debes Introducir tus Apellidos\n";		
		
	if ( obj.txttlf1.value == "" )
		stmp = stmp + "Debes Introducir el Teléfono obligatorio\n";
		
	if ( obj.txtemail.value == "" )
		stmp = stmp + "Debes Introducir tu Cuenta de E-Mail\n";
		
	if ( obj.lstprovincia.options[obj.lstprovincia.selectedIndex].value == "" )
		stmp = stmp + "Debes Introducir tu Provincia\n";
		
	if ( obj.txtpassword1.value != obj.txtpassword2.value ) 
		stmp = stmp + "La Contraseña y su repetición deben ser iguales\n";
		
	var pas1;
	pas1 = obj.txtpassword1.value;
	if (  pas1.length < 6   )
		stmp = stmp + "La Contraseña debe tener almenos 6 carácteres\n";				
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function AbrirVentana (url) {
	
	open(url, "", "location=no,menubar=no,resizable=no,scrollbars=no,  status=no,toolbar=no,width=180,height=200");
	
}

function CompruebaUsuario(user) {
	
	if ( user != "" )
		AbrirVentana('registro_compruebausuario.php?usu=' + user );
	else
		alert ('Introduce un Usuario');
	
}

function CompruebaUsuPass(obj) {
	
	var stmp;
	stmp = ""
	
	if ( obj.txtusuario.value == "" || obj.txtpassword.value == "" )
		stmp = stmp + "Introduce un Usuario y Password Correctos";
		
	if ( stmp.length > 0 ) {
		alert ( stmp );
		return false;
	}
	else {
		return true;
	}
	
}

function MoverURL(url) {
	location.href = url;
}

function HTMLPop(sInputName) {
	form_campo=sInputName;
	window.open('thumbnail.php','Profundo','width=630,scrollbars=yes,menubar=no,resizable=yes,status=yes');
}