var array_empty = new Array();

function cityList(obj) {
		var arr, mail;
		if (obj.value == 'Moscow') {
			arr = array_m;
			mail = 'pulford@edunet.ru';
		}
		else if (obj.value == 'Petersburg') {
			arr = array_p;
			mail = 'pulford@mail.wplus.net';
		}
		else if (obj.value == '#') {
			arr = array_empty;
			mail='';
		}

		var l = obj.form['apartment'].options.length;
		obj.form['mailto'].value = mail;

		for(t=0; t<l; t++) {
				obj.form['apartment'].options[t] = null;
				obj.form['apartment'].options[t] = null;
				obj.form['apartment'].options[0] = null;
				// alert(j);
		}

		if (obj.value == '#') { obj.form['apartment'].options = []; return; }
		for(i=0; i<arr.length; i++) {
			obj.form['apartment'].options[i] = new Option(arr[i], arr[i]);
		}
}


function noEmptyFields() {
	var i, obj;
	for(i=0; i< arguments.length; i++) {
		obj = arguments[i];
		
		if(obj.value == '#' || obj.value == '') {
			alert('All fields must be filled to send request');
			return false;
		}
	}
}