// user edit 
function checkUserForm(f)
{		
	var msg = 'I seguenti errori sono stati rilevati nella la compilazione del form:\n';
	var error = 0;
	
	var login = f.elements['login'];
	if(login.value == '') {
		error++;
		msg += '* il campo login non puņ essere vuoto\n';
	}

	var password = f.elements['password'];
	if(password.value == '') {
		error++;
		msg += '* il campo password non puņ essere vuoto\n';
	}
	
	if(error>0) {
		alert(msg);		
		return false;
	}else {
		return true;
	}
}
 
function checkPreviewForm(f)
{		
	var msg = 'I seguenti errori sono stati rilevati nella la compilazione del form:\n';
	var error = 0;
	
	var desc = f.elements['descriptionIt'];
	if(desc.value == '') {
		error++;
		msg += '* il campo descrizione (italiano) non puņ essere vuoto\n';
	}

	desc = f.elements['descriptionEn'];
	if(desc.value == '') {
		error++;
		msg += '* il campo descrizione (inglese) non puņ essere vuoto\n';
	}
	
	if(error>0) {
		alert(msg);		
		return false;
	}else {
		return true;
	}
}
 
/* listbox stuff */

function addItem() {
	var f = document.forms['previews'];
	var leftL = f.elements['boundTo'];
	var rightL = f.elements['objects'];
	
	// check if something is selected of the right
	var index = rightL.selectedIndex;
	if (index >= 0) {
//		alert('len: ' + leftL.options.length);
		var opt = new Option('','', false, false);
		opt.text = rightL.options[index].text;
		opt.value = rightL.options[index].value;
		leftL.options[leftL.options.length] = opt;
		rightL.options[index] = null;

	}
}

function removeItem() {
	var f = document.forms['previews'];
	var leftL = f.elements['boundTo'];
	var rightL = f.elements['objects'];

	// check if something is selected of the left
	var index = leftL.selectedIndex;
	if (index >= 0 ) {
		leftL.options[index] = null;
		
	}
	
}
 

function checkContactsForm()
{
  if(document.forms[0].nome.value=="") return false;
  if(document.forms[0].cognome.value=="") return false; 
  if(document.forms[0].e_mail.value=="") return false;
  return true;
}
