window.addEvent('domready', function(){
	$('contactform').addEvent('submit', function(e) {
		new Event(e).stop();
		
		if (this.name.value == "") {  
			//$("labelname_error").show();  
			alert(Alt.Lang.contact_form_name);
			this.name.focus();  
			return false;  
		}
		var email = this.email.value; 
		var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		if (email == "" || !email_reg_exp.test(email)) {  
			alert(Alt.Lang.contact_form_mail+'.');
			this.email.focus();  
			return false;  
		} 
		if (this.tel.value == "") {  
			alert(Alt.Lang.contact_form_tel);
			this.tel.focus();  
			return false;  
		}
		if ((this.private.checked === false && this.reseller.checked === false) || (this.private.checked === true && this.reseller.checked === true)) {  
			alert(Alt.Lang.contact_form_reseller);
			this.private.focus();  
			return false;  
		}		
		
		if (this.message.value == "") {  
			alert(Alt.Lang.contact_form_msg);
			this.message.focus();  
			return false;  
		}
		if (this.checker.value == "" || this.checker.value != "5") {  
			alert(Alt.Lang.contact_form_check);
			this.checker.focus();  
			return false;  
		}	
		
		
		var req = new Request({
			method: 'post',
			url: "/send.php",
			data: { 'name' : this.name.value,  'email' : this.email.value, 'tel' : this.tel.value, 'website' : this.website.value, 'message' : this.message.value, 'checker' : this.checker.value, 'private': this.private.checked ? "SI" : "NO", 'reseller': this.reseller.checked ? "SI" : "NO", 'lang': Alt.Lang.lang },
			onRequest: function() { /*alert('Request made. Please wait...'); */},
			onComplete: function(response) { 
				if(response=="ok"){
					alert(Alt.Lang.contact_form_ok);
				}else{
					alert(Alt.Lang.contact_form_err); 
				}
				
			}
		}).send();
	});		
});
