// JavaScript Document
function cambia(obj) {
v = obj.options[obj.selectedIndex].value;
f = obj.form;

if (v == '') {
	f.marca_m.disabled = true;
	f.marca_b.disabled = true;
	f.tipo.disabled = true;
	f.nome.disabled = true;
	f.upfile.disabled = true;
	f.anteprima.disabled = true;
	f.testo.disabled = true;
	document.getElementById("marca_m").style.display = 'none';
  	document.getElementById("marca_b").style.display = 'none';
}
if (v == 'bici') {
	f.marca_m.disabled = true;
	f.marca_b.disabled = false;
	f.tipo.disabled = false;
	f.nome.disabled = false;
	f.upfile.disabled = false;
	f.anteprima.disabled = false;
	f.testo.disabled = false;
	document.getElementById("marca_m").style.display = 'none';
  	document.getElementById("marca_b").style.display = 'block';
}
if ((v == 'moto') || (v =='scooter')) {
	f.marca_m.disabled = false;
	f.marca_b.disabled = true;
	f.tipo.disabled = false;
	f.nome.disabled = false;
	f.upfile.disabled = false;
	f.anteprima.disabled = false;
	f.testo.disabled = false;
	document.getElementById("marca_m").style.display = 'block';
  	document.getElementById("marca_b").style.display = 'none';
}
}

function caratteriRestantiAnteprima(theField, numChars) {
	   strLen = theField.value.length;
	   if (strLen > numChars ) {
	      theField.value = theField.value.substring(0, numChars);
		  charsLeft = 0;
	   }
 else {
	      charsLeft = numChars - strLen;
	   }
	   document.inserimento.LunghezzaCaratteriAnteprima.value = charsLeft;

	}
function resetForm() {
		document.inserimento.anteprima.value="";
		document.inserimento.LunghezzaCaratteriAnteprima.value="255";
	}	
function openwin (theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}