	function validar (form)
	{
		if (form.nombre.value.length==0) {
			alert ("Introduzca su Nombre.");
			form.nombre.focus();
			return false; }
		if (form.email.value.length==0) {
			alert ("Introduzca su Email.");
			form.email.focus();
			return false; }
		if (!form.condiciones.checked) {
			alert ("Debe de aceptar las condiciones.");
			form.condiciones.focus();
			return false; }
	
		return true;
	}

	function validarPolitica(form)
	{
		if (!form.politica.checked) {
			alert ("Debe de aceptar la política de privacidad");
			form.politica.focus();
			return false;
		}
	
		return true;
	}


	function validarEmail(form)
	{
		valor = form.email.value;

		if (valor)
		{
			if (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/.test(valor))
			{
				return true;
			}
			else
			{
				alert("La dirección de email es incorrecta");
				form.email.focus();
				return false;
			}
		}
		else
		{
			alert("Rellene el email");
			form.email.focus();
			return false;
		}
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function ampliar_imagen(imagen,ancho,alto) 
	{
		w_amp=window.open('','','width='+ancho+', height='+alto);
		w_amp.document.write('<html><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"><img src="'+imagen+'"></body></html>');
		if (window.focus) 
			w_amp.focus()
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function abrir_ventana (url,nombre,parametros) 
	{
		window.open (url,nombre,parametros);
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function es_numero(campo)
	{
		eval("var numero=document.frm."+campo+".value;");
		if (isNaN(numero))
		{
			alert('Error: debe introducir un numero válido');
			eval("document.frm."+campo+".value='';");
			return false;
		}
		else
			return true;
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function es_entero (campo)
	{	
		eval("var numero=document.frm."+campo+".value;");
	
		if ((isNaN(numero)) || (parseInt(numero)<0))
		{
			alert('Error: debe introducir un numero válido');
			eval("document.frm."+campo+".value='';");
			return false;
		}
		else
			return true;	
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function check_email(valor, salida) 
	{
		if ((valor=='') || (/^\w+([\.-\\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(valor)))
		{
				document.frm.enviar.disabled=false;
				return true;
		}
		else 
			if (salida=='alertar')
			{
				alert('Email no válido');
				document.frm.enviar.disabled=true;
				return false;
			}
			else
				return false;
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function MM_preloadImages() 
	{ 
	  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() 
	{ 
	  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_findObj(n, d) 
	{
	  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 MM_swapImage() 
	{ 
	  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) 
	{ 
	  window.open(theURL,winName,features);
	}

<!-------------------------------------------------------------------------------------------------------------------------------->
	
	function cargaAjax( id , scriptphp )
	{
		var xmlHttp;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("¡Su explorador no soporta AJAX!");
					return false;
				}
			}
		}
	
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById('vistas' + id).innerHTML=xmlHttp.responseText;
			}
		}
		xmlHttp.open('GET', 'ajaxPhp/'+scriptphp+'id=' + id,true);
		xmlHttp.send(null);
	}

<!-------------------------------------------------------------------------------------------------------------------------------->

	function validar_formulario (form1)
	{
	
		if (document.getElementById('nick').value.length==0) {
			alert ("Introduzca su nick.");
			document.getElementById('nick').focus();
			return false; }
	
		if (document.getElementById('clave').value.length==0) {
			alert ("Introduzca una clave.");
			document.getElementById('clave').focus();
			return false; }
			
		if (document.getElementById('clave2').value.length==0) {
			alert ("Debe de repetir la clave.");
			document.getElementById('clave2').focus();
			return false; }
	
		if (document.getElementById('clave').value!=document.getElementById('clave2').value) {
			alert ("Las claves deben de ser iguales.");
			document.getElementById('clave2').focus();
			return false; }
	
		if (document.getElementById('email').value.length==0) {
			alert ("Introduzca un email.");
			document.getElementById('email').focus();
			return false; }

		if (!document.getElementById('condiciones').checked) {
			alert ("Debe de aceptar las condiciones legales.");
			document.getElementById('condiciones').focus();
			return false; }
	
		document.form1.submit();
	
	}

<!-------------------------------------------------------------------------------------------------------------------------------->


/* Función que limita lo que se escribe */
function limitText(campoTexto)
{
	var limite = 450;
	if (campoTexto.value.length > limite)
	{
		campoTexto.value = campoTexto.value.substring(0, limite);
		campoTexto.scrollTop = 999999;
	}
}
