

var hibas_form_szin="#FF4500";
var eredeti_form_szin="#FFFFFF";



function check_jelentkezes_form(){
	var h=[]; // hibák
	if($('form[name=MailSystemSubscription] :checkbox:checked').size()==0) h.push('-legalább egy rendezvényt jelöljön be');
	var ok=true;
	$('form[name=MailSystemSubscription] input:text:not(:last)').each(function(){
		if($(this).val()==""){
			ok=false;
			$(this).css('background-color', hibas_form_szin);
			$(this).keypress(function(){$(this).css('background-color', eredeti_form_szin);});
		}
	});
	if(!ok) h.push('-nem töltötte ki az összes mezőt');
	if(!$('input[name=FormValue_Email]').val().match(/^.*@.*\..*$/)){		h.push('-hibás email cím formátum!');
		$('input[name=FormValue_Email]').css('background-color', hibas_form_szin);
		$('input[name=FormValue_Email]').keypress(function(){$(this).css('background-color', eredeti_form_szin);});
	}
	if(h.length!=0){
		alert("Kérem töltse ki a teljes űrlapot!\n" + h.join("\n") );
		return false;
	}else{
		return true;
	}
}



$(function(){	$('form[name=MailSystemSubscription]').submit(check_jelentkezes_form);
});




