function downloadCity() {
	selectFirstRow = '-- Kérem válasszon --';
	megyeID = $('#selectMegye').attr('value');

	if ( megyeID > 0 ) {
		$.post(document.URL, {ajaxFunction: 'downloadVarosok', ajaxFile: 'regisztracio/ajax.php', megyeID: megyeID},
			function( data ) {
				s = document.getElementById('selectVaros');
				$(s).empty();

				s.options[0] = new Option(selectFirstRow, '0');
				a = data.split('|');
				for ( i=0; i<a.length; i++ ) {
					j = a[i].split('$');
					s.options[i+1] = new Option(j[1], j[0]);
				}
			}
		);
	}
	else
		$('#selectVaros').attr('innerHTML', selectFirstRow);

}

function checkPassword( count ) {
	check1 = $('#Passwd'+count);

	if ( count == 1)
		check2 = $('#Passwd2');
	else
		check2 = $('#Passwd1');

	if ( check2.attr('value') != '' && check1.attr('value')!=check2.attr('value') ) {
		check1.attr('value', '');
		check1.css('background', jQuery.formErrorBg);
		check2.attr('value', '');
		check2.css('background', jQuery.formErrorBg);
		
		bmAlert('A két megadott jelszó nem egyezik!', 'error');
	}
}

function checkUserName( input ) {
	userName = $(input).attr('value');
	
	$.post(document.URL, {ajaxFunction: 'checkUserName', ajaxFile: 'regisztracio/ajax.php', userName: userName},
		function( data ) {
			if ( data == 'false' ) {
				$(input).css('background', jQuery.formErrorBg);
				$(input).attr('value', '');
				bmAlert("A kért felhasználónév ('<b><i>"+ userName +"</i></b>') már foglalt, kérem válasszon újat!", 'error');
			}
		}
	);
}
