var copies = {
				contacto_nombre: 'Debes escribir tu nombre',
				contacto_empresa: 'Debes escribir tu empresa',
				contacto_pais: 'Debes escojer tu pais',
				contacto_correo: 'Debes escribir un correo valido',
				contacto_asunto: 'Debes escribir un asunto',
				contacto_comentario: 'Debes escribir tu comentario',
				contacto_name: 'Fill in your full name',
				contacto_company: 'Fill in the company name',
				contacto_country: 'Select your country',
				contacto_mail: 'Enter a valid email address',
				contacto_asunt: 'Enter a subject',
				contacto_commentary: 'Please write your comment'
				};

function mostrarAlerta(msj)
{
	/*$('alerta').innerHTML = msj;
	$("alertas").tween("top", "-231px", "150px");*/
		
	//$("alertas").tween("opacity", "0", "100"); 
	//new Effect.Tween($('alertas'), -231, 0, function(p){ $('alertas').setStyle('top:'+p+'px');});
	//new Effect.Opacity('alertas', { from: 0, to: 1, duration: 1 });
	alert (msj);
}

function cerrarAlerta()
{
	
	//$("alertas").tween("top", "150px", "-231px");
}

function cambiarProducto(folder,id,alt)
{
	var producto = (folder=="en")? 'en/producto':'es/producto';
	var src = (Browser.Engine.trident)? 'js/clear.gif': "imagenes/"+producto+id+".png" ;
	var myFx = new Fx.Tween('productoimg', {property: 'opacity',duration:1000});
	myFx.start(1,0).chain(function(){
		$('productoimg').getFirst().dispose();															  
		var imagen = new Element('img', {'src':src,
								 'alt':alt,
								 'events': {
									/*'click': function(){
										window.location.href=  'productos/producto'+id+'.html';
									},*/
									'load': function(){ 
										if(Browser.Engine.trident){
											this.setStyle('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='imagenes/"+producto+id+".png"); 
														this.setStyle('height', '180px');
														this.setStyle('width', '373px');
										}
									}
								}
							}
							).inject($('productoimg')); this.start(0,1);
	});
}
/////////////..REGISTRO../////////////////////////

function validarContacto(idioma) 
{
	
	var Regcorreo = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/;
	var texto = /(^\S([\D]+)$)/;
	var numeros = /^([0-9]{3,20})+/;

	var nombre = $('nombre').value;
	var empresa = $('empresa').value;
	var pais = $('pais').value;
	var correo = $('correo').value;
	var asunto = $('asunto').value;
	var comentario = $('comentario').value;
	
	if (!(nombre.match(texto)) || nombre == ''){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_name);
		else 
			mostrarAlerta(copies.contacto_nombre);
		$('nombre').focus();
		return;
	}else if (!(empresa.match(texto)) || empresa == ''){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_company);
		else 
			mostrarAlerta(copies.contacto_empresa);
		$('empresa').focus();
		return;
	}else if (!(pais.match(texto)) || pais == 0){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_country);
		else 
			mostrarAlerta(copies.contacto_pais);
		$('pais').focus();
		return;
	}else if (!(correo.match(Regcorreo)) || correo == 0){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_mail);
		else 
			mostrarAlerta(copies.contacto_correo);
		$('correo').focus();
		return;
	}else if (!(asunto.match(texto)) || asunto == 0){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_asunt);
		else 
			mostrarAlerta(copies.contacto_asunto);
		$('asunto').focus();
		return;
	}else if (!(comentario.match(texto)) || comentario == 0){
		if (idioma =="en")
			mostrarAlerta(copies.contacto_commentary);
		else 
			mostrarAlerta(copies.contacto_comentario);
		$('comentario').focus();
		return;
	}else{
		$('contactenos').submit();
	} 
}