
function showFull(id) { 
		var block = document.getElementById(id);
		if(block.style.display == 'none' || block.style.display == '')
			block.style.display = 'block';
		else
			block.style.display = 'none';
			
		//alert(block.style.display);
}
function hideID(id) { 
		var block = document.getElementById(id);
		block.style.display = 'none';
}

function showID(id) { 
		var block = document.getElementById(id);
		block.style.display = 'block';
}
		
function ltrim(s) { 
    return s.replace(/^\s+/, ""); 
} 
 
function rtrim(s) { 
    return s.replace(/\s+$/, ""); 
} 
 
function trim(s) { 
    return rtrim(ltrim(s)); 
}
		
function IsEmailAddress(theElement)
{
	var s = theElement.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
	return true;
	else
	return false;
}





var STD_ERROR_PREFIX = 'Por favor completa los datos requeridos:\n\n'

function ValidarForm(Formulario) 
{
	//var f = document.recomendacion;
	var f = Formulario
	var errors = [];

	switch (f.name) {
		case 'consultas':
			if (f.Nombre.value == '')	
				errors.push('- Ingresa tu Nombre.');
			if (f.EMail.value == '')	
				errors.push('- Ingresa tu Email.');
			else if (IsEmailAddress(f.EMail)==false) 
				errors.push('- Ingresa tu cuenta de Email válida.');
			if (f.Condicion.options[f.Condicion.selectedIndex].value=='')
				errors.push('- Selecciona la condicion.');
			if (f.Consulta.value.length<5)	
				errors.push('- Ingresa tu Consulta.');
			if (f.Captcha.value.length<6)	
				errors.push('- Ingresa el Codigo de Validacion.');
				
			break;
			
			
			
		case 'PAMCU':
			if (f.Nombre.value == '')	
				errors.push('- Ingresa tu Nombre.');
			if (f.Apellido.value == '')	
					errors.push('- Ingresa tu Apellido.');
			if (f.DomPart.value == '')	
					errors.push('- Ingresa tu Domicilio.');
			if (f.CodPostal.value == '')	
				errors.push('- Ingresa tu Codigo Postal.');
			if (f.EMail.value == '')	
				errors.push('- Ingresa tu Email.');
			else if (IsEmailAddress(f.EMail)==false) 
				errors.push('- Ingresa tu cuenta de Email válida.');
			if (f.Ciudad.value== '')	
				errors.push('- Ingresa tu Ciudad.');
			if (f.Telefono.value== '')	
				errors.push('- Ingresa tu Telefono.');
			if (f.Captcha.value.length<6)	
				errors.push('- Ingresa el Codigo de Validacion.');
			break;
			
			
		case 'curso_mbe':
			
		
			if (f.Nombre.value == '')	
				errors.push('- Ingresa tu Nombre.');
			
			if (f.Apellido.value == '')	
				errors.push('- Ingresa tu Apellido.');
			
			if (f.EMail.value == '')	
				errors.push('- Ingresa tu Email.');
			else if (IsEmailAddress(f.EMail)==false) 
				errors.push('- Ingresa tu cuenta de Email válida.');
			
			if (f.Telefono.value== '')	
				errors.push('- Ingresa tu Telefono.');

			if (f.Ciudad.value== '')	
				errors.push('- Ingresa tu Ciudad.');
				
			if (f.Provincia.options[f.Provincia.selectedIndex].value=='')	
				errors.push('- Ingresa tu Provincia.');
			
			if (f.Captcha.value.length<6)	
				errors.push('- Ingresa el Codigo de Validacion.');
				

			break;
			
		case 'rosario':
			if (f.Nombre.value == '')	
				errors.push('- Ingresa tu Nombre.');
			
			if (f.Domicilio.value == '')	
				errors.push('- Ingresa tu Domicilio.');
			
			if (f.CodPostal.value == '')	
				errors.push('- Ingresa tu Codigo Postal.');
		
			if (f.Localidad.value == '')	
				errors.push('- Ingresa tu Localidad.');
				
			if (f.Provincia.value == '')	
				errors.push('- Ingresa tu Provincia.');
			
			if (f.EMail.value == '')	
				errors.push('- Ingresa tu Email.');
			else if (IsEmailAddress(f.EMail)==false) 
				errors.push('- Ingresa tu cuenta de Email válida.');
			
		
			if (f.Codigo.value== '')	
				errors.push('- Ingresa tu Codigo de telefono.');

			if (f.Telefono.value== '')	
				errors.push('- Ingresa tu Telefono.');
				
				
			if (f.Captcha.value.length<6)	
				errors.push('- Ingresa el Codigo de Validacion.');
				

			break;
			
		
	}
		
	if (errors.length > 0) 
	{
		alert(STD_ERROR_PREFIX + errors.join('\n'));
		return false;
	}
}


