// JavaScript Document
function isMail(texto)
	{ 
	var mailres = true;             
	var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-"; 
	 
	var arroba = texto.indexOf("@",0); 
	if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
	 
	var punto = texto.lastIndexOf("."); 
				 
	for (var contador = 0 ; contador < texto.length ; contador++)
		{ 
		if (cadena.indexOf(texto.substr(contador, 1),0) == -1)
			{ 
			mailres = false; 
			break; 
		 	} 
		} 	
	if ((arroba > 1) && (arroba + 1 < punto) && (punto + 2 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)) 
		 mailres = true; 
	else 
		 mailres = false; 
	return mailres; 
	}
function validate_rec() {
	document.getElementById('div_youname').innerHTML='';
	document.getElementById('div_youemail').innerHTML='';
	document.getElementById('div_friendname').innerHTML='';
	document.getElementById('div_friendemail').innerHTML='';
	document.getElementById('div_coment').innerHTML='';
	var sw=true;
	if (document.frmRecommended.youname.value=='')
		{
		document.getElementById('div_youname').innerHTML='required!';
		sw=false;
		}
	if (document.frmRecommended.youemail.value=='')
		{
		document.getElementById('div_youemail').innerHTML='required!';
		sw=false;
		}
	else
		{
		if (!isMail(document.frmRecommended.youemail.value))
			{
			document.getElementById('div_youemail').innerHTML='Incorrecto email!';
			sw=false;
			}
		}
	if (document.frmRecommended.friendname.value=='')
		{
		document.getElementById('div_friendname').innerHTML='required!';
		sw=false;
		}
	if (document.frmRecommended.friendemail.value=='')
		{
		document.getElementById('div_friendemail').innerHTML='required!';
		sw=false;
		}
	else
		{
		if (!isMail(document.frmRecommended.friendemail.value))
			{
			document.getElementById('div_friendemail').innerHTML='Incorrecto email!';
			sw=false;
			}
		}
	if (document.frmRecommended.coment.value=='')
		{
		document.getElementById('div_coment').innerHTML='required!';
		sw=false;
		}
	return sw;
	}
