var Abilitato =true;
function getLink() {
var value = document.forms["link"].elements["sitigruppo"].value;
if (value>0) {
var link = "";
if (value==1) link="http://www.italgas.it";
if (value==2) link="http://www.assistenzaitalgaspiu.it";
if (value==3) link="http://www.fiorentinagasclienti.it";
if (value==4) link="http://www.napoletanagasclienti.it";
if (value==5) link="http://www.sicilianagasvendite.it";
if (value==6) link="http://www.eni.it";
if (value==7) link="http://www.gasandpower.eni.it/gasp/eni/init.do";
window.open(link);
}
}


function popupSiebel(){
  newwindow=window.open('../nuovoSistInf.html', '', 'width=775,height=500,scrollbars=no');
  window.opener=self;
}


function CercaComuneItalgasProbPort(Campo){     
	
/* Apro la finestra per la ricerca del comune */
	if (Campo=='ARF' || Campo=='ANA' ||  Campo=='STRA') winComune=window.open("/Weblogic/ingresso?classe=NLCercaComuniItalgas&action=franchisising&probport=1","navigWindow","top="+(screen.availHeight-400)/2+","+"Left="+(screen.availWidth-650)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=650,height=400");	
	if (Campo=='SERVIZI3') winComune=window.open("/Weblogic/ingresso?classe=NLCercaComuniItalgas&probport=1","navigWindow","top="+(screen.availHeight-400)/2+","+"Left="+(screen.availWidth-650)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=650,height=400");
	else winComune=window.open("/Weblogic/ingresso?classe=NLCercaComuniItalgas&action=all&probport=1","navigWindow","top="+(screen.availHeight-400)/2+","+"Left="+(screen.availWidth-620)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=620,height=400");
	area=Campo;
}  

function Siebel(){     
	larghezza=700;
	altezza=550;
	winRegistrazione=window.open("/ecustomer/",
					"regWin","top="+(screen.availHeight-altezza)/2+
					",screenY="+(screen.availHeight-altezza)/2+","+
					"Left="+(screen.availWidth-larghezza)/2+
					",screenX="+(screen.availWidth-larghezza)/2+","+
					"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,"+
					"width="+larghezza+",height="+altezza);	
} 


function InserisciComuneItalgasProbPort(comune,provincia,cap){
	window.opener.InviaComuneItalgasProbPort(comune,provincia,cap);
	window.close();
}

function InviaComuneItalgasProbPort(comune,provincia,cap){
	document.forms['frmMailReclami'].DESCOM.value=comune;
	document.forms['frmMailReclami'].SGLPRV.value=provincia;
	document.forms['frmMailReclami'].CODCAP.value=cap;
}

function submitVolture(nomeForm,valore){
	eval("document."+nomeForm+".Action.value='"+valore+"';");
	submitNomeForm(nomeForm);
}

function submitFormMailReclami(){
 if (document.forms['frmMailReclami'].Messaggio.value.length>2000) alert("Campo testo troppo lungo"); 
 else document.forms['frmMailReclami'].submit();;
}

function submitNumUtente(){  
/* Funzione Che gestisce la combo dei numeri utente */
	if (Abilitato){     
	      Abilitato=false;
   	      submitFormNU();
   	      document.forms['frmNumUtente'].CODUTENTE.disabled=-1;
	}         	
}        
var Abilitato2 =true;
function submitFormNU() {
/* Procedura che spedisce il primo form della pagina */
	if (document.forms[1].classe!=null) Classe = document.forms[1].classe.value;
	else Classe="";
	document.forms[1].submit();
} 

function submitForm(n) { 
	if (n!=null) document.forms[n+1].submit();
	else submitFormVuoto();
}

function submitNomeForm(nome) {
  document.forms[nome].submit();
	
}


function submitFormVuoto() {
/* Procedura che spedisce il primo form della pagina */
  if (document.forms[1].classe!=null) Classe = document.forms[1].classe.value;
  else Classe="";
  if (Classe=="NLRegistrazione" || Classe=="Registrazione"){
     if (document.forms[1].txtUserId!=null) document.forms[1].txtUserId.value=trim(document.forms[1].txtUserId.value);
  }
  document.forms[1].submit(); 

}


function GetLinkSSL(URL,SSL) {      

var Protocollo;
var PreUrl;
var Porta;

if (SSL) {
	if  (document.location.hostname=='192.168.1.152' || document.location.hostname=='172.19.249.5') {
	   Protocollo="http://";
           Porta=":"+document.location.port;
	}
	else {
	   Protocollo="https://";
 	   Porta="";
	}
	PreUrl=document.location.hostname;    // Indirizzo Server
}
else {
	Protocollo="http://";
	PreUrl=document.location.hostname;    // Indirizzo Server
	if  (document.location.hostname=='192.168.1.152' || document.location.hostname=='172.19.249.5') {
	    Porta=":"+document.location.port;
	}
	else {
 	   Porta="";
	}
}
var Indirizzo=Protocollo+PreUrl+Porta+URL;

return Indirizzo
}

function LinkSSL(URL,SSL,TARGET) {      
	
var Indirizzo=GetLinkSSL(URL,SSL);
if  (TARGET=="_SELF" || TARGET=="" || TARGET=="_self") window.location.href=Indirizzo;
else {
	if  (TARGET=="_TOP" || TARGET=="_top" ) window.top.location.href=Indirizzo;
	else {
		if (parent.frames[TARGET] == null )  window.open(Indirizzo,TARGET);	
		else  parent.frames[TARGET].location.href=Indirizzo;
		}
	}
}   

function apriFinPagFat(op,codfat,codute,dtasca,impeur,chiave,numbol){     
/* Apro la finestra carello fatture*/ 		
	larghezza=638;
	altezza=500;
	posx=(screen.availHeight-altezza)/2;
	posy=(screen.availWidth-larghezza)/2;
	document.forms[2].elements["COD-UTE"].value=codute;
	document.forms[2].elements["COD-FAT"].value=codfat;
	document.forms[2].elements["DTA-SCA"].value=dtasca;
	document.forms[2].elements["IMP-FAT-EUR"].value=impeur;
	document.forms[2].elements["CHIAVE"].value=chiave;
	document.forms[2].elements["NUM-BOL"].value=numbol;
	var sURL="";
  winPagaFatt=window.open(sURL,"pagaWindow","menubar=no,scrollbars=yes,resizable=yes,location=no"+
	",directories=no,status=no,menubar=no,width="+larghezza+",height="+altezza);	
	Time=setTimeout('CentraFinestra(winPagaFatt)',100);
	document.forms[2].submit();
	
}

function CentraFinestra(winPagaFatt) {
	winPagaFatt.focus();
	winPagaFatt.screenX=posx;
	winPagaFatt.screenY=posy;
	winPagaFatt.moveTo(posy,posx);	
}

function eliminaFattura(chiave){
	document.forms[0].chiave.value = chiave;
	document.forms[0].submit();
}

function CercaDove(){
  var Comune = document.forms[1].txtCOMUNE.value;
  var Indirizzo = document.forms[1].txtINDIRIZZO.value;
  var Civico = document.forms[1].txtCIVICO.value;
	
	if((Comune=="") && (Indirizzo=="") && (Civico=="")){
		alert("Inserire un criterio di ricerca.");
	}
	else{
		if((Comune!="") && (Indirizzo!="") && (Civico!="")){
			document.forms[1].action="localizza.asp";
			var URL="http://italgaspiu.informadove.it/ita/localizza.asp?txtCOMUNE="+escape(document.forms[1].txtCOMUNE.value)+"&txtINDIRIZZO="+escape(document.forms[1].txtINDIRIZZO.value)+"&txtCIVICO="+escape(document.forms[1].txtCIVICO.value)+"&cmdRicerca=ricerca"
			window.open(URL,"UrlLocator","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");
		}
		else {
			if (Comune!=""){
				document.forms[1].action="ingresso";
				document.forms[1].submit();
			}
			else{
				alert("Criterio di ricerca incompleto. Inserire almento il Comune.");
			}
		}
	}
}

/* LM20030904 Script per la nuova versione del sito (ottobre 2003) del DoveSiamo*/
function CercaDove2(){
  var Comune = document.forms[1].txtCOMUNE.value;
  var Indirizzo = document.forms[1].txtINDIRIZZO.value;
  var Civico = document.forms[1].txtCIVICO.value;

	if (Comune!="") {	
		document.forms[1].action="localizza.asp";
		var URL="http://italgaspiu.informadove.it/ita/localizza.asp?txtCOMUNE="+escape(document.forms[1].txtCOMUNE.value)+"&txtINDIRIZZO="+escape(document.forms[1].txtINDIRIZZO.value)+"&txtCIVICO="+escape(document.forms[1].txtCIVICO.value)+"&cmdRicerca=ricerca"
		window.open(URL,"UrlLocator","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");
	}
	else{
	 alert("E' obbligatorio valorizzare il comune");
	}
}

function submitFormComune(n) { 
	indice=document.forms[n+1].codcomune.selectedIndex;
	comune=document.forms[n+1].codcomune.options[indice].value;
	if (comune!="" && comune!="0") submitForm(n);	
	}

function Locator(par){     
	/* Apro finestra per ricerca comune indicato*/ 		
	larghezza=700;
	altezza=550;
	winRegistrazione=window.open("http://italgaspiu.informadove.it/ita/locator.asp?ID="+par+"&searchresource=ok",
					"regWin","top="+(screen.availHeight-altezza)/2+
					",screenY="+(screen.availHeight-altezza)/2+","+
					"Left="+(screen.availWidth-larghezza)/2+
					",screenX="+(screen.availWidth-larghezza)/2+","+
					"menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no,"+
					"width="+larghezza+",height="+altezza);	
	} 				

function ricaricaCodUte()  {
location.href="ingresso?classe=comVolture&COD-UTE2=" + document.Voltura.elements['COD-UTE'].options[document.Voltura.elements['COD-UTE'].selectedIndex].value;
}

function setParamSub(direzione){
  if (direzione==0) document.forms[1].sottoazione.value=0;
  else document.forms[1].sottoazione.value=3;
  document.forms[1].submit();
 }

function setParamSubPrv(direzione){
  if (direzione==1) {
    document.forms[1].azione.value='cancella';
    document.forms[1].sottoazione.value=0;
    }
  else document.forms[1].sottoazione.value=6;
  document.forms[1].submit();
 }

function setParamSubLight(){

  document.forms[1].sottoazione.value=2;
   document.forms[1].submit();
 }
 

function setParamSubUsr(direzione){  
  if (direzione==0) {
   if ((document.forms[1].tipoute.value=='I')||(document.forms[1].tipoute.value=='P')) {
       document.forms[1].sottoazione.value=10;
   }
   else {document.forms[1].sottoazione.value=11;}
  }
  else {document.forms[1].sottoazione.value=5;}
  document.forms[1].submit();
 }

function setParamSubAz(direzione,classe){
  if (direzione==1) {
    document.forms[1].azione.value='cancella';
    document.forms[1].sottoazione.value=0;
    }
  else document.forms[1].sottoazione.value=4;
  document.forms[1].submit();
 }

function setParamSubCanc(direzione){
  if (direzione==0) {
     document.forms[1].azione.value='modifica';
     document.forms[1].sottoazione.value=0;
    }
  else document.forms[1].sottoazione.value=1;
  document.forms[1].submit();
 }

function CaricaBolletta(){     
/* Apre l'help della bolletta del numero utente */
	window.open("/pop_up/registrazionenumeroutente.html","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=490,height=400");	
}    

function CaricaIntestazioneUtente(){     
/* Apre l'help delintestatario del numero utente */
	window.open("/pop_up/ragsociale.html","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=490,height=350");	
}    

function CaricaIntestazioneRagSoc(){     
/* Apre l'help delintestatario del numero utente */
	window.open("/pop_up/ragsociale.html","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=490,height=350");	
}    

function CaricaComuniItalgas(){     
/* Apre l'help delintestatario del numero utente */
	window.open("/Weblogic/ingresso?classe=NLCercaComuniFiscali&action=nascitareg)","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");	
}   

function CaricaComuniFiscali(){     
/* Apre l'help delintestatario del numero utente */
	window.open("/Weblogic/ingresso?classe=NLCercaComuniItalgas&action=nascitareg)","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");	
}    

function InserisciComuneItalgas(comune,provincia,cap){
	window.opener.InviaComuneItalgas(comune,provincia,cap);
	window.close();
}

function InviaComuneItalgas(comune,provincia,cap){
	document.forms['frmRegistrazione'].txtLuogoNascita.value=comune;
	document.forms['frmRegistrazione'].txtCodProvincia.value=provincia;
}

function CaricaNazioni(){     
/* Apre l'help delintestatario del numero utente */
	window.open("/Weblogic/ingresso?classe=NLCercaNazione","boleNumUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");	
}    

function InserisciNazione(nazione){
	window.opener.InviaNazione(nazione);
	window.close();
}

function InviaNazione(nazione){
	document.forms['frmRegistrazione'].txtDesNazioni.value=nazione;
}

function CaricaBolIntestaz(){     
/* Apre l'help della bolletta del nome utente */
	window.open("/Help/hlpBolNomUtente.html","BolNomUtente","top="+(screen.availHeight-500)/2+","+"Left="+(screen.availWidth-700)/2+","+"menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=700,height=500");	
}    

function Art13(){     
/* Apre l'help della bolletta dell'articolo 13 */	
	win=window.open("/Help/hlpArt13.htm","navigWindow","menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no,width=650,height=400");
}    

function Avanti(){
 document.forms[1].sottoazione.value=12;
 document.forms[1].submit();
 }

function redirect(){
	document.forms['frmCentro'].submit();
}

var SalvaNomeCampo;
function openWindow(NomeCampo) {
	SalvaNomeCampo=NomeCampo;
	larghezza=650;
	altezza=500;
	var sURL="/Weblogic/ingresso?classe=SelFatture";
	winCP=window.open(sURL,"_blanc","top="+(screen.availHeight-altezza)/2+
				  ",screenY="+(screen.availHeight-altezza)/2+","+
				  "Left="+(screen.availWidth-larghezza)/2+
				  ",screenX="+(screen.availWidth-larghezza)/2+
				  ","+"menubar=no,scrollbars=yes,resizable=yes,location=no"+
				  ",directories=no,status=no,menubar=no,width="+larghezza+",height="+altezza);	
}       
	
function mettiCod(codFatt)  {
   document.forms[2].elements[SalvaNomeCampo].value=codFatt;
}       
				
function fprevious()  {     
/* Funzione richiamata dalle fatture per la gestione delle fatture precedenti  */
//  parent.apriAttesa();
  document.forms['frmFatture'].action.value="next";	
  document.forms['frmFatture'].submit();
}     
function fnext() {      
/* Funzione richiamata dalle fatture per la gestione delle fatture successive */
//  parent.apriAttesa();
  document.forms['frmFatture'].action.value="prev";	
  document.forms['frmFatture'].submit();
}     

function apriPopUp(nomePagina, maxX, maxY) {
  openWindow(nomePagina,'','width='+maxX+',height='+maxY+',resizable=yes');
}

function submitLogin() {
 document.forms[1].submit();
}
		
function DetectKeyNav(vKey) {
 if (vKey.which==13)  {
  submitLogin();
  return false;
 }
}
		
function DetectKeyIE() {
 if (event.keyCode==13) {
   submitLogin();

   event.returnValue=false;
  }
}

