function accendi() {
 
if (document.getElementById("info").style.display == "block"){
	document.getElementById("info").style.display = "none"
 
}else{
 
	document.getElementById("formOn").style.display = 'block';
	document.getElementById("formOff").style.display = "none"
	document.getElementById("info1").style.height = "246px"
	document.getElementById("info").style.display = 'block';
	
	var objname= document.getElementById("nome")
	objname.setAttribute("value", objname.getAttribute("placeHolder"));
	
	var objcognome= document.getElementById("cognome")
	objcognome.setAttribute("value", objcognome.getAttribute("placeHolder"));
	
	var objemail= document.getElementById("email")
	objemail.setAttribute("value", objemail.getAttribute("placeHolder"));
	
	var objtelefono= document.getElementById("telefono")
	objtelefono.setAttribute("value", objtelefono.getAttribute("placeHolder"));
	}
 
}	

function spegni() {
	document.getElementById("info").style.display = 'none';
}

function accendiStella(valore){

var i=1;
	for (i=1; i <= 5; i++){
		var stella = document.getElementById("stella_" + i);
		if (valore == "1"){
			document.getElementById("stella_1").src="/SpotTrading2008/jsp/img/stella_on.gif";
			//document.getElementById("DescVoto").innerHTML="Molto poco";	
		}
		if (valore == "2"){
			document.getElementById("stella_1").src="/SpotTrading2008/jsp/img/stella_on.gif";
			document.getElementById("stella_2").src="/SpotTrading2008/jsp/img/stella_on.gif";
			//document.getElementById("DescVoto").innerHTML="Poco";		
		}
		if (valore == "3"){
			document.getElementById("stella_1").src="/SpotTrading2008/jsp/img/stella_on.gif";
			document.getElementById("stella_2").src="/SpotTrading2008/jsp/img/stella_on.gif";
			document.getElementById("stella_3").src="/SpotTrading2008/jsp/img/stella_on.gif";
			//document.getElementById("DescVoto").innerHTML="Abbastanza";			
		}
		if (valore == "4"){
			document.getElementById("stella_1").src="/SpotTrading2008/jsp/img/stella_on.gif";
			document.getElementById("stella_2").src="/SpotTrading2008/jsp/img/stella_on.gif";
			document.getElementById("stella_3").src="/SpotTrading2008/jsp/img/stella_on.gif";	
			document.getElementById("stella_4").src="/SpotTrading2008/jsp/img/stella_on.gif";
			//document.getElementById("DescVoto").innerHTML="Molto";			
		}
		if (valore == "5"){
			document.getElementById("stella_" + i).src="/SpotTrading2008/jsp/img/stella_on.gif";
			//document.getElementById("DescVoto").innerHTML="Moltissimo";		
				
		}
			
	}
}
function spegniStella(valore){
var i=1;
	for (i=1; i <= 5; i++){
		var stella = document.getElementById("stella_" + i);
		stella.src="/SpotTrading2008/jsp/img/stella_off.gif"	
		
	}
	/*if (document.getElementById("DescVoto").innerHTML != "Grazie!"){
		document.getElementById("DescVoto").innerHTML="";
	}*/
}


function assegnaVoto(valore){

	if ((document.getElementById("asciugamanicheck").innerHTML == "asciugamani") && (document.inviaVoto.idSpot.value == "asciugamani")){
		alert("Grazie, hai già effettuato il voto per lo spot \"Asciugamani\"");
		return false;
	}else if ((document.getElementById("citofonocheck").innerHTML == "citofono") && (document.inviaVoto.idSpot.value == "citofono")){
		alert("Grazie, hai già effettuato il voto per lo spot \"Citofono\"")
		return false;
	}else{
		document.inviaVoto.voto.value=valore;
		document.inviaVoto.action="https://ib.fineco.it/SpotTrading2008/InsertVoto";
		document.inviaVoto.submit();
	}
	
	
	if (document.inviaVoto.idSpot.value == "asciugamani"){
		document.getElementById("asciugamanicheck").innerHTML="asciugamani";
		document.getElementById("grazieVotoparz").style.display='inline';
		document.getElementById("grazieVotoparz").innerHTML="<br><table cellpadding='0' cellspacing='0' width='320' style='margin-bottom:10px;'><tr><td bgcolor='#f2f2f2' style='padding:5px;font-family:Verdana;font-size:10px;'>Grazie per aver votato lo spot <b>Asciugamani</b>.<br>Dai un voto anche allo spot <a href='#' onclick=\"showVideo('citofono')\">Citofono</a>.</td></tr></table>";
	
	}
	
	if (document.inviaVoto.idSpot.value == "citofono"){
	
		document.getElementById("citofonocheck").innerHTML="citofono";
		document.getElementById("grazieVotoparz").style.display='inline';
		document.getElementById("grazieVotoparz").innerHTML="<br><table cellpadding='0' cellspacing='0' width='320' style='margin-bottom:10px;'><tr><td bgcolor='#f2f2f2' style='padding:5px;font-family:Verdana;font-size:10px;'>Grazie per aver votato lo spot <b>Citofono</b>.<br>Dai un voto anche allo spot <a href='#' onclick=\"showVideo('asciugamani')\">Asciugamani</a>.</td></tr></table>";

	}
	
	if ((document.getElementById("citofonocheck").innerHTML == "citofono") && (document.getElementById("asciugamanicheck").innerHTML=="asciugamani")){
		document.getElementById("votazioni").style.display = 'none';
		document.getElementById("grazieVoto").style.display = 'inline';
		document.getElementById("grazieVotoparz").style.display='none';
		//document.getElementById("DescVoto").style.display = 'none';
	}
	
}		
	
	
CARATTERI = "0123456789òàùèéìÒÀÙÈÉÌABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-'?! ";

function inviaCommento(){

var testo = document.formcommento.commento.value;

	if (testo == ""){
		alert("Inserisci il tuo commento");
		return false;
	}


	if (!(isLegal(testo, CARATTERI))) {
		alert("Il commento che hai inserito contiene caratteri non ammessi.");
		document.formcommento.commento.focus();
		return false;
	}else{
		document.getElementById("grazieCommento").style.display = 'inline';
		document.getElementById("insertCommento").style.display = 'none';
	}
}



function isLegal(input, legalchars) {
	var ok = true;
	var chr = null;
	var i = 0;
	for (i=0; (i<input.length) && (ok); i++) {
		chr = input.charAt(i);
		ok = (legalchars.indexOf(chr,0) != -1);
	}
	return ok;
}


function limit_note(ctrl, max) {
	if (ctrl.value.length > max) {
		ctrl.value = ctrl.value.substring(0, max);
		//alert('Il commento può essere al massimo di 100 caratteri.');
		return false;
	}
}


function isDivisionVisible(divName) {
   var obj = document.layers ? document.layers[divName] : (document.getElementById ? document.getElementById(divName).style : document.all[divName].style);
   return ((obj.visibility == "visible") || (obj.visibility == "show"));
}

function isDivisionHidden(divName) {
   var obj = document.layers ? document.layers[divName] : (document.getElementById ? document.getElementById(divName).style : document.all[divName].style);
   return ((obj.visibility == "hidden") || (obj.visibility == "hide"));
}

function setDivisionVisibility(divName, visibility) {
   var obj = document.layers ? document.layers[divName] : (document.getElementById ? document.getElementById(divName).style : document.all[divName].style);
   obj.visibility = (visibility) ? (document.layers ? "show" : "visible") : (document.layers ? "hide" : "hidden");
}


function showVideo(obj) {

if (obj=="asciugamani") {
		document.getElementById("spot1").style.backgroundColor="#F2F2F2";
		document.getElementById("spot2").style.backgroundColor="#FFFFFF";	
		//document.getElementById("scaricaspot").href="/SpotTrading2008/jsp/img/asciugamani.zip";
		document.inviaVoto.idSpot.value="asciugamani";
	}
	if (obj=="citofono") {
		document.getElementById("spot2").style.backgroundColor="#F2F2F2";
		document.getElementById("spot1").style.backgroundColor="#FFFFFF";	
		//document.getElementById("scaricaspot").href="/SpotTrading2008/jsp/img/citofono.zip";
		document.inviaVoto.idSpot.value="citofono";
	}	
//document.getElementById("appo").focus();


	var player = document.getElementById("foto");
	
	var pathImg = "/SpotTrading2008/jsp/" + obj+".swf";
	
	if (document.all) {
	player.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="320" height="269" id="asciugamani" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param id="nomeMovie" name="movie" value="'+pathImg+'" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="'+pathImg+'" quality="high" bgcolor="#ffffff" width="320" height="269" name="asciugamani" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'
	
	} else {
		player.innerHTML = "<embed src='"+pathImg+"' width='320' height='269' allowScriptAccess='always' wmode='transparent'></embed>";
	}
document.getElementById("scaricaspot").href = "http://spot.fineco.it/video08/"+obj+".zip";
		document.getElementById("grazieVotoparz").style.display='none';

}

function showDivision(divName) {
   setDivisionVisibility(divName, true);
}

function hideDivision(divName) {
   setDivisionVisibility(divName, false);
}


	
