<!--
/*
	============================================================
	Registration fce
	============================================================
	Copyright: www.eastburger.cz (c) 2009 All rights reserved.
	============================================================
 	Spoluprace:
 		./js/lang-"idLang".js
	------------------------------------------------------------
*/

function RegistrationValidate(type){
	var sMsgAlert = '';

	tmp = CheckEmptyElement('name');
	if(tmp != true) sMsgAlert += tmp + '\n';

	tmp = CheckEmptyElement('nickname');
	if(tmp != true) sMsgAlert += tmp + '\n';

	tmp = CheckEmptyElement('email');
	if(tmp != true) sMsgAlert += tmp + '\n';

	tmp = CheckEmptyElement('login');
	if(tmp != true) sMsgAlert += tmp + '\n';

	if(type == 'add'){
		tmp = CheckEmptyElement('password');
		if(tmp != true) sMsgAlert += tmp + '\n';

		tmp = CheckEmptyElement('password2');
		if(tmp != true) sMsgAlert += tmp + '\n';
	}
	else if(type == 'detail'){
		if(Trim(document.getElementById('password').value) != '' || Trim(document.getElementById('password2').value) != ''){
			tmp = CheckEmptyElement('password');
			if(tmp != true) sMsgAlert += tmp + '\n';

			tmp = CheckEmptyElement('password2');
			if(tmp != true) sMsgAlert += tmp + '\n';
		}
	}

	tmp = CheckEmptyElement('id_region');
	if(tmp != true) sMsgAlert += tmp + '\n';

	if(Trim(document.getElementById('id_town').value) == '' && Trim(document.getElementById('town_new').value) == ''){
		var oLabel1 = document.getElementById('lb_id_town');
		var oLabel2 = document.getElementById('lb_town_new');
		sMsgAlert += lgValidateEmptyElement + ': ' + GetLabelDesc(oLabel1) + ' ' + lgValidateOr + ' ' + GetLabelDesc(oLabel2) + '.\n';
		SetLabel(oLabel1, 'err');
		SetLabel(oLabel2, 'err');
	}
	else{
		SetLabel(document.getElementById('lb_id_town'));
		SetLabel(document.getElementById('lb_town_new'));
	}

	tmp = CheckEmptyRadio('form_registration', 'gender_1');
	if(tmp != true) sMsgAlert += tmp + '\n';

	if(type == 'add' && document.getElementById('enabled_profile').checked == true){
		tmp = CheckEmptyElement('photo');
		if(tmp != true) sMsgAlert += tmp + '\n';
	}

	if(type == 'add'){
		tmp = CheckEmptyCheckbox('terms');
		if(tmp != true) sMsgAlert += tmp + '\n';
	}

	if(sMsgAlert == '') return true;
	else{
		alert(lgValidate + '\n\n' + sMsgAlert);
		return false;
	}
}

//-->
