function wpopen (win) {
    window.open(win, '_blank', 'width=430,height=500,scrollbars=yes,status=yes,resizable=yes');
}

function buttonDown(bottone) {
	bottone.style.borderStyle = "inset"
}

function buttonUp(bottone) {
	bottone.style.borderStyle = "outset"
}

function compactHeader(height) {
	parent.document.getElementById("resizable").rows = height + ", *";
}

/* DEMOCRACY */

function addQuestion() {
	ol = document.getElementById('inputList');
	li = document.createElement('li');
	
	input = document.createElement('input');
	input.setAttribute('name', 'answer[]');
	input.setAttribute('type', 'text');
	
	li.appendChild(input);
	ol.appendChild(li);
}

function eatQuestion() {
	ol = document.getElementById('inputList');
	
	if (ol.getElementsByTagName('li').length < 3) 
		alert("Devi avere almeno due risposte!");
	else 
		ol.removeChild(ol.lastChild);
}

function jal_validate() {
	ol = document.getElementById('inputList');
	inputs = ol.getElementsByTagName('input');
	
	answers = 0;
	
	for (i=0; i < inputs.length; i++)
		if (inputs[i].value)
			answers++;

	if (answers < 2) {
		alert("Non ci sono almeno due risposte!");
		return false;
	}

	if (document.getElementById('question').value == "") {
		alert ("Non c'è una domanda!");
		return false;
	}
}