function setActiveStyleSheet(title, keyStroke) {
  var i, a, main;
  if (keyStroke) {if (keyStroke.keyCode==9) return;} //Tab pressed in Netscape
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function toggle( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
  			if (target.style.display == "none"){
  				target.style.display = "block";
  			} else {
  				target.style.display = "none";
  			}
  	}
}

function popup01(url) {
link=window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=620,height=500")
link.focus()
}

function submitSupportForm() {
if (!checkInfoSupportForm()) return;
if (document.info.subject[1].checked){
	// Informazioni commerciali settare i parametri
	document.info.to_address.value="infocomm@rigel.li.it"
	document.info.subject[0].value="Informazioni Commerciali"
   	}
if (document.info.subject[2].checked){
	// Informazioni tecniche settare i parametri
	document.info.to_address.value="infotech@rigel.li.it"
	document.info.subject[0].value="Informazioni Tecniche"
	}				
document.info.submit();
}
				
function checkInfoSupportForm(){
var form = document.info;
errorMessage="";
if (!form.subject[1].checked && !form.subject[2].checked){
	errorMessage="- 'tipo' di richiesta (Informazioni commerciali o tecniche) non specificato;\n"
	}
if (!isChecked(form,'tipo_az',5)) {
	 errorMessage+="- 'tipo di azienda' di appartenenza non specificato;\n" ;
	}
if (form.elements['email'].value==" "){
	errorMessage+="- indirizzo 'e-mail' non specificato;\n";
	}
if (!isChecked(form,'sped',5)) {
	 errorMessage+="- 'prodotto' oggetto della richiesta non indicato;\n" ;
	}	
if (errorMessage!="") 
   {
   errorMessage="Non è possibile inviare la richiesta a causa dei seguenti errori: \n\n"+errorMessage;
   errorMessage+="\n Si prega di indicare le informazioni mancanti e riprovare a inviare la richiesta";
   alert(errorMessage);
   }
return errorMessage=="";
}

function isChecked(form, varName, length){
for (var i=0;i<length;i++) {if (form.elements[varName][i].checked) return true;}
return false;
}