
$("#form-newsletter").submit(function(evt){
	var sendable = true;
	$("#form-newsletter *").each(function(index, el) {
		if ( el.type == 'text' || el.type == 'checkbox' || el.type == 'radio' || el.type == 'textarea' || el.type == 'select-one' ) {
		if ( !$(el).is('off') ) {
			if ($(el).attr('class') == 'required' && $(el).val() == '') {
				if ($('.error-container').css('display') == 'none');
					$('.error-container').css('display', 'block');
				$('.error').css('display', 'block');
				sendable = false;
				window.location = String(window.location).replace(/\#.*$/, "") + "#errors";
				return false;
			}
			if ($(el).attr('class') == 'required_email') {
				if ( !$(el).val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/) || $(el).val() == '' ) {
					if ($('.error-container').css('display') == 'none');
						$('.error-container').css('display', 'block');
					$('.error-mail').css('display', 'block');
					sendable = false;
					window.location = String(window.location).replace(/\#.*$/, "") + "#errors";
					return false;
				}
			}
			/*if ($(el).attr('class') == 'required_privacy') {
				if ( !el.checked ) {
					if ($('.error-container').css('display') == 'none');
						$('.error-container').css('display', 'block');
					$('.error-privacy').css('display', 'block');
					sendable = false;
					return false;
				}
			}*/
			if ($(el).attr('class') == 'required_radio') {
				radios = $('#form-newsletter').find('input[type="radio"]');
				group = new Array;
				name = $(el).attr('name');
				checked = false;
				counter = 0;
				radios.each(function(index, el){
					if (name == el.name) {
						group[counter] = el;
						counter++;
					}
				});
				$(group).each(function(index, el){
					if (el.checked)
						checked = true;
				});
				if ( !checked || !group[0].checked  ) {
					if ($('.error-container').css('display') == 'none');
						$('.error-container').css('display', 'block');
						$('.error').css('display', 'block');
					sendable = false;
					window.location = String(window.location).replace(/\#.*$/, "") + "#errors";
					return false;
				}
			}
			}
		}
	});
	if (sendable)
		$('.form-button button[type="submit"]').attr('disabled', 'disabled');
	return sendable;
});
