// First Level Items MouseOver Style
function chgPageStl(OverStyle,divID) {
	if (OverStyle==1){
		document.all["ID_elpage" + divID].style.backgroundColor = mainOverCol;
		document.all["ID_elpage" + divID].style.color = mainFntOverCol;
	}
	else {
		document.all["ID_elpage" + divID].style.backgroundColor = mainBackCol;
		document.all["ID_elpage" + divID].style.color = mainFntCol;
	}
}

var er_nombre = 	/^([a-z]|[A-Z]|[0-9]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/	
var er_empre = 		/^([a-z]|[A-Z]|[0-9]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/	
var er_localidad = 	/^([a-z]|[A-Z]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/
var er_consulta = 	/^([a-z]|[A-Z]|[0-9]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/		
var er_direccion = 	/^([a-z]|[A-Z]|[0-9]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/			
var er_telefono = 	/^([0-9\s\+\-])+$/	
var er_cp = 		/^([0-9\s\+\-])+$/						
var er_email = 		/^(.+\@.+\..+)$/
var er_dni = 		/^([0-9\s\+\-])+$/

// idioma:    0= español;  1= ingles
// pantalla:  5=consulta;  4= repuestos, 3=oferta
function validar(idioma, pantalla)
{
	//solo  pantalla de consultas
	if (pantalla==5)	
	{
		if(!er_consulta.test(cons.commentaries.value)) { 
			if (idioma==0)
				alert('Contenido del campo CONSULTA no válido.')
			else
				alert('Field COMMENTARIES not valid.')
			return false
		}
	}
	// nombre
	if(!er_nombre.test(cons.name.value)) {
		if (idioma==0)
			alert('Contenido del campo NOMBRE no válido.')
		else
			alert('Field NAME not valid.')
		return false
	}
	// empresa
   	if(!er_empre.test(cons.company.value)) { 
		if (idioma==0)
			alert('Contenido del campo EMPRESA no válido.')
		else
			alert('Field COMPANY not valid.')
		return false
	}
	
	// direccion y localidad
	if(!er_direccion.test(cons.address.value)) {
		if (!er_localidad.test(cons.city.value) ) {
			if (idioma==0)
				alert('Contenido del campo DIRECCION o LOCALIDAD no válido.')
			else
				alert('Field ADDRESS or CITY not valids.')
			return false
		}
	}
	// telefono
	if( !er_telefono.test(cons.phone.value) ) {
		if (idioma==0)
			alert('Contenido del campo TELEFONO no válido.')
		else
			alert('Field TELEPHONE not valid.')
		return false	
	}
	// direccion de correo	
	if(!er_email.test(cons.email.value)) { 
		if(idioma==0)
			alert('Contenido del campo CORREO ELECTRONICO no válido.')
		else
			alert('Field EMAIL not valid.')
		return false
	}
	document.cons.submit();
}
function email()
{
    var add = document.cons.To.value
    var subject = document.cons.Subject.value
    document.cons.action="mailto:"+add+"?subject="+subject;
}	

function SwapImage(ImageName,ImageFile)
{
	Image1=new Image(23,23);
	Image1.src = ImageFile;
	document[ImageName].src = Image1.src; 
	return true;
}


