window.addEvent('domready', function(){
	var sexy = new SexyAlertBox();
	var form = $('formulario');
	form.set('send', {
		onSuccess: function(response){
			sexy.info("<b>Información:</b><br /><br />El formulario se ha enviado con éxito.");
			//sexy.info(response);
		},
		onFailure: function(){
			sexy.alert("<b>Error:</b><br /><br />No se ha podido enviar el formulario, inténtelo más tarde por favor.");
		}
	});
	$('enviar').addEvent('click', function(){
		var correcto = true;
		var obl = $$('input.req');
		$each(obl, function(el){
			if(el.get('value') == ""){
				correcto = false;
			}
		})
		if(correcto == false){
			sexy.alert("<b>Error:</b><br /><br />Debe rellenar todos los campos obligatorios.");
		}else{
			form.send();
		}
	});
	
});