
var NS4, IE4, ver4, gotlayers;
var BaseDir;

//Con IIS o su produzione mappo cosė 
BaseDir ='http://' + location.host + '/nuovoIspesl/Accessibile';

//Col patacchino mappo cosė
//BaseDir ='http://' + location.host + '/SitoWebAccessibile/Accessibile';

Prodotto = '130';

NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

function BrwType()
{
var tmp = window.navigator.userAgent;
return tmp;
}

function showType()
{
   alert(BrwType());
}

function nulla() {}

function ShowNota(nome) 
{   
   var h = (window.screen.height / 2) - 75;
   var w = (window.screen.width / 2) - 150;

   window.open(BaseDir + '/ShowNota.aspx?url=' + nome + "&idProdotto=" + Prodotto,'NOTA','top=' + h + ',left=' + w + ',width=400,height=200,status=no,resizable=yes,scrollbars=yes');
}

/*
function ShowToc(nome) 
{   
  // var windowobject = window.parent.framesx
  // windowobject.location = BaseDir + '/ShowTree.asp?caption=Sommario&tabella=' + nome;

  var windowobject = window.parent.tree
  windowobject.location = BaseDir + '/sommario.asp?caption=Sommario&tabella=' + nome;
}
*/
//caricamento nel frame di sinistra del sommario: OK
function ShowToc(nome) 
{   
  var windowobject = window.parent.framesx  
  //xsl co scritto Estremi:
  ids = new String(nome);
  idsReplace = ids.replace("Estremi:","");
  
  // windowobject.location = BaseDir + '/ShowTree.asp?caption=Sommario&tabella=' + nome;
  windowobject.location = BaseDir + '/ShowToc.aspx?caption=Sommario&IDS=' + idsReplace + "&cartella=" + Cartella + "&idProdotto=" + Prodotto;
}

function ShowURL(nome)
{
document.location = nome;
}

function ShowDoc(nome) //: OK
{   
//////    if (window.opener!=null)
//////    {
//////        //sta chiamando dal popUP --> apri nella pagina chiamante
//////        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
//////        window.opener.document.location = BaseDir + "/main.aspx?view=showdoc" + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')&ClickLink=true&exp_coll=" + VerificaAncora (nome) + "&iddoc=" + VerificaAncora (nome) + "&selnode=" + VerificaAncora (nome);
//////    }
//////    else
//////    {
//////        //entra quando clicchi su un link a un documento a un comma oppure a un'ancora dentro al documento
//////        windowobject = window.parent.principale;
//////        //devi ripassare sempre l'idprodotto
//////        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
//////		//windowobject.location = BaseDir + "/GestioneLink.aspx?idProdotto=" + Prodotto + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')";

//////		window.location = BaseDir + "/main.aspx?view=showdoc&ClickLink=true&exp_coll=" + VerificaAncora (nome) + "&iddoc=" + VerificaAncora (nome) + "&selnode=" + VerificaAncora (nome) + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')";		
//////		//window.location = BaseDir + "/main.aspx?view=showdoc&ClickLink=true&exp_coll=" + nome + "&iddoc=" + nome + "&selnode=" + nome + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')";
//////		{}
//////    }

    if (window.opener!=null)
    {
        //sta chiamando dal popUP --> apri nella pagina chiamante
        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
        window.opener.document.location = BaseDir + "/main.aspx?view=showdoc" + "&url=ShowDoc('" + VerificaAncora (nome) + "')&ClickLink=true&exp_coll=" + VerificaAncora (nome) + "&iddoc=" + VerificaAncora (nome) + "&selnode=" + VerificaAncora (nome);
    }
    else
    {
        //entra quando clicchi su un link a un documento a un comma oppure a un'ancora dentro al documento
        windowobject = window.parent.principale;
        //devi ripassare sempre l'idprodotto
        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
		//windowobject.location = BaseDir + "/GestioneLink.aspx?idProdotto=" + Prodotto + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')";

		window.location = BaseDir + "/main.aspx?view=showdoc&ClickLink=true&exp_coll=" + VerificaAncora (nome) + "&iddoc=" + VerificaAncora (nome) + "&selnode=" + VerificaAncora (nome) + "&url=ShowDoc('" + VerificaAncora (nome) + "')";		
	   }

}

function ShowDocRich(nome) 
{   
    if (window.opener!=null)
    {
        //sta chiamando dal popUP --> apri nella pagina chiamante
        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
        window.opener.document.location = BaseDir + "/main.aspx?view=showdocrich&iddoc=" + VerificaAncora (nome);
    }
    else
    {
        //entra quando clicchi su un link a un documento a un comma oppure a un'ancora dentro al documento
        windowobject = window.parent.principale;
        //devi ripassare sempre l'idprodotto
        //Ho rinviato javascript:ShowDoc() per riutilizzare il codice di Xnorme che riceve appunto questo tipo di valore
		//windowobject.location = BaseDir + "/GestioneLink.aspx?idProdotto=" + Prodotto + "&url=javascript:ShowDoc('" + VerificaAncora (nome) + "')";

		window.location = BaseDir + "/main.aspx?view=showdocrich&iddoc=" + VerificaAncora (nome);		
	}
}


//trasforma l'ancora presente nel link in un valore passabile tramite url --> %23
function VerificaAncora(nome)
{
    var id = nome;
    var indice = nome.indexOf("#");
    if (indice != -1)
    {

        id = id.replace("#", "%23");
        //alert (id);
    }
    return id;

}

function ShowRisposte(numid) 
{
   if (numid.style.display == "none") numid.style.display = "";
   else numid.style.display = "none";
}

//funzioni di apertura sui div
//click sull'immagine NOTA
function ShowNoteTesto()
{
   
   if (divnote.style.display == "none") divnote.style.display = "";
   else divnote.style.display = "none";
}
function ShowTesNoteTesto()
{
	try
	{
   		if (divtesnote.style.display == "none") divtesnote.style.display = "";
   		else divtesnote.style.display = "none";
	}
	catch (e)
	{
		//alert('errore');
	}
}

function ShowTestata() 
{   
   if (headbox.style.display == "none") headbox.style.display = "";
   else headbox.style.display = "none";
}



// maschera di ricerca avanzata:
function leggidati()
{
	var esci = false;
	var Text_Mese_Provv="";
	var Text_Giorno_Provv="";
	var Combo_Anno_Provv="";
	var Text_Mese_Fonte="";
	var Text_Giorno_Fonte="";
	var Combo_Anno_Fonte="";
	var query = "";
	var index = "";
	var MyForm = document.Ricerca;

//-----Controllo input date Provvedimento	
	if (MyForm.aaaa2.value != "")
	{
	   if (MyForm.mm2.value == "") MyForm.mm2.value = "12";
	   if (MyForm.gg2.value == "") MyForm.gg2.value = "31";
	}
	else
	{
	   if ((MyForm.mm2.value != "") || (MyForm.gg2.value != "")) 
	   {
	      alert("Inserire l'anno di fine periodo del Provvedimento");
	      esci=true;
	   }
	}
	if ((MyForm.aaaa.value != "") && (MyForm.aaaa2.value != ""))
	{
	   if (MyForm.mm.value == "") MyForm.mm.value = "01";
	   if (MyForm.gg.value == "") MyForm.gg.value = "01";
	}
	else
	{
	   if (((MyForm.mm.value != "") || (MyForm.gg.value != "")) && (MyForm.aaaa2.value != "")) 
	   {
	      alert("Inserire l'anno di inizio periodo del Provvedimento");
	      esci=true;
	   }
	}

//-----Controllo input date Fonte
	if (MyForm.aaaaf2.value != "")
	{
	   if (MyForm.mmf2.value == "") MyForm.mmf2.value = "12";
	   if (MyForm.ggf2.value == "") MyForm.ggf2.value = "31";
	}
	else
	{
	   if ((MyForm.mmf2.value != "") || (MyForm.ggf2.value != "")) 
	   {
	      alert("Inserire l'anno di fine periodo della Fonte");
	      esci=true;
	   }
	}
	if ((MyForm.aaaaf.value != "") && (MyForm.aaaaf2.value != ""))
	{
	   if (MyForm.mmf.value == "") MyForm.mmf.value = "01";
	   if (MyForm.ggf.value == "") MyForm.ggf.value = "01";
	}
	else
	{
	   if (((MyForm.mmf.value != "") || (MyForm.ggf.value != "")) && (MyForm.aaaaf2.value != "")) 
	   {
	      alert("Inserire l'anno di inizio periodo della Fonte");
	      esci=true;
	   }
	}
//------	

       if (esci==false)
	   {
	   
//------Creazione campi data provvedimento per query di ricerca
	   if (MyForm.mm.value != "" && MyForm.aaaa2.value == "")
	   {
	   	switch (MyForm.mm.value)
	   		{
	   		case "01","1": 
	   		    Text_Mese_Provv = "gennaio";
	   		    break;
	   		case "02","2": 
	   		    Text_Mese_Provv = "febbraio";
	   		    break;
	   		case "03","3": 
	   		    Text_Mese_Provv = "marzo";
	   		    break;
	   		case "04","4": 
	   		    Text_Mese_Provv = "aprile";
	   		    break;
	   		case "05","5": 
	   		    Text_Mese_Provv = "maggio";
	   		    break;
	   		case "06","6": 
	   		    Text_Mese_Provv = "giugno";
	   		    break;
	   		case "07","7": 
	   		    Text_Mese_Provv = "luglio";
	   		    break;
	   		case "08","8": 
	   		    Text_Mese_Provv = "agosto";
	   		    break;
	   		case "09","9": 
	   		    Text_Mese_Provv = "settembre";
	   		    break;
	   		case "10": 
	   		    Text_Mese_Provv = "ottobre";
	   		    break;
	   		case "11": 
	   		    Text_Mese_Provv = "novembre";
	   		    break;
			case "12": 
			    Text_Mese_Provv = "dicembre";
			    break;
			}
			Combo_Anno_Provv = MyForm.aaaa.value
			Text_Giorno_Provv = MyForm.gg.value
			
	   }
	   else
	   {
	        if (MyForm.aaaa2.value != "" && MyForm.aaaa.value != "")
	   	{
	   	   Combo_Anno_Provv = MyForm.aaaa.value + MyForm.mm.value + MyForm.gg.value + "~~" + MyForm.aaaa2.value + MyForm.mm2.value + MyForm.gg2.value;
	   	}
	   	else
	   	{
			Combo_Anno_Provv = MyForm.aaaa.value
			Text_Giorno_Provv = MyForm.gg.value
	        }
	   }
	   
//------Creazione campi data fonte per query di ricerca
	   if (MyForm.mmf.value != "" && MyForm.aaaaf2.value == "")
	   {
	   	switch (MyForm.mmf.value)
	   		{
	   		case "01","1": 
	   		    Text_Mese_Fonte = "gennaio";
	   		    break;
	   		case "02","2": 
	   		    Text_Mese_Fonte = "febbraio";
	   		    break;
	   		case "03","3": 
	   		    Text_Mese_Fonte = "marzo";
	   		    break;
	   		case "04","4": 
	   		    Text_Mese_Fonte = "aprile";
	   		    break;
	   		case "05","5": 
	   		    Text_Mese_Fonte = "maggio";
	   		    break;
	   		case "06","6": 
	   		    Text_Mese_Fonte = "giugno";
	   		    break;
	   		case "07","7": 
	   		    Text_Mese_Fonte = "luglio";
	   		    break;
	   		case "08","8": 
	   		    Text_Mese_Fonte = "agosto";
	   		    break;
	   		case "09","9": 
	   		    Text_Mese_Fonte = "settembre";
	   		    break;
	   		case "10": 
	   		    Text_Mese_Fonte = "ottobre";
	   		    break;
	   		case "11": 
	   		    Text_Mese_Fonte = "novembre";
	   		    break;
			case "12": 
			    Text_Mese_Fonte = "dicembre";
			    break;
			}
			Combo_Anno_Fonte = MyForm.aaaaf.value
			Text_Giorno_Fonte = MyForm.ggf.value
			
	   }
	   else
	   {
	        if (MyForm.aaaaf2.value != "" && MyForm.aaaaf.value != "")
	   	{
	   	   Combo_Anno_Fonte = MyForm.aaaaf.value + MyForm.mmf.value + MyForm.ggf.value + "~~" + MyForm.aaaaf2.value + MyForm.mmf2.value + MyForm.ggf2.value;
	   	}
	   	else
	   	{
			Combo_Anno_Fonte = MyForm.aaaaf.value
			Text_Giorno_Fonte = MyForm.ggf.value
	        }
	   }
	

	//alert(MyForm.Combo_Tipo_Parte.value);
	//alert(MyForm.elements.length);
	for (var idx=0; idx < MyForm.elements.length - 1; idx++)
	{
		 //alert("nome: " + MyForm.elements[idx].name + " Tipo=" + MyForm.elements[idx].type + " Testo=" + MyForm.elements[idx].value);
		 if (MyForm.elements[idx].type=="text" || MyForm.elements[idx].type=="select-one" || MyForm.elements[idx].type=="textarea")
		 {
			if (MyForm.elements[idx].value != "") 
			{
			   if (MyForm.elements[idx].name == "Combo_Tipo_Provv") 
			   {
				   if (MyForm.Combo_Tipo_Parte.value == "" && MyForm.Text_Libero.value == "")
				   {
				     query = query + MyForm.Combo_Tipo_Parte.name + "=TS|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
				     //alert("sei dentro!!");
				   }
			   }
			   if (MyForm.elements[idx].name == "Text_Num_Provv") 
			   {
				   if (MyForm.Combo_Tipo_Parte.value == "" && MyForm.Text_Libero.value == "")
				   {
				     query = query + MyForm.Combo_Tipo_Parte.name + "=TS|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
				     //alert("sei dentro!!");
				   }
			   }

			   if (MyForm.elements[idx].name == "Text_Num_Parte") 
			   {
				     query = query + "Text_Num_Parte=NP" + Ins_Char_Before(MyForm.Text_Num_Parte.value,"0",4) + "|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
				     //alert("sei dentro!!");
			   }
			   else
			   {
			   query = query + MyForm.elements[idx].name + "=" + MyForm.elements[idx].value + "|";
			   }

			}
		 }
		 if (MyForm.elements[idx].type=="checkbox")
		 {
		 	if (MyForm.elements[idx].checked == true)
			{
			   index = index + String.fromCharCode(34) + MyForm.elements[idx].value + String.fromCharCode(34) + " ";
			}
		 }
	}
	
	if (Combo_Anno_Provv != "") query = query + "|Combo_Anno_Provv=" + Combo_Anno_Provv;
	if (Text_Mese_Provv != "") query = query + "|Text_Mese_Provv=" + Text_Mese_Provv;
	if (Text_Giorno_Provv != "") query = query + "|Text_Giorno_Provv=" + Text_Giorno_Provv;
	if (Combo_Anno_Fonte != "") query = query + "|Combo_Anno_Fonte=" + Combo_Anno_Fonte;
	if (Text_Mese_Fonte != "") query = query + "|Text_Mese_Fonte=" + Text_Mese_Fonte;
	if (Text_Giorno_Fonte != "") query = query + "|Text_Giorno_Anno_Fonte=" + Text_Giorno_Fonte;

	
	if (query == "")
	{
	   alert("Impostare almeno un valore!!")
	}
	else
	{
	//Debug:
	//alert(query)
	//alert(index)

	//chiamo la pagina di ricerca e visualizzo i risultati nel frame sottostante
	   if (BrwType().indexOf("MSIE") > 0)
	   {
		   var windowobject = window.parent.framedestro;
		   // windowobject.rows = "80%,*";
		   windowobject.rows = "*, 150";
		   windowobject = window.parent.srcresult;
		   windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
		   //alert(BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index);
	   }
	   else
	   {
		   var windowobject = window.parent.principale;
		   windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
	   }
	}
	
	}
	
//	Document.location = query
}


// maschera di ricerca semplificata:
function simpsearch(modo)
{
	var esci = false;
	var Text_Mese_Provv="";
	var Text_Giorno_Provv="";
	var Combo_Anno_Provv="";
	var Text_Mese_Fonte="";
	var Text_Giorno_Fonte="";
	var Combo_Anno_Fonte="";
	var query = "";
	var index = "";
	var MyForm = document.Ricerca;



       if (esci==false)
	   {
	   
//------Creazione campi data provvedimento per query di ricerca
	   if (MyForm.mm.value != "")
	   {
	   	switch (MyForm.mm.value)
	   		{
	   		case "01","1": 
	   		    Text_Mese_Provv = "gennaio";
	   		    break;
	   		case "02","2": 
	   		    Text_Mese_Provv = "febbraio";
	   		    break;
	   		case "03","3": 
	   		    Text_Mese_Provv = "marzo";
	   		    break;
	   		case "04","4": 
	   		    Text_Mese_Provv = "aprile";
	   		    break;
	   		case "05","5": 
	   		    Text_Mese_Provv = "maggio";
	   		    break;
	   		case "06","6": 
	   		    Text_Mese_Provv = "giugno";
	   		    break;
	   		case "07","7": 
	   		    Text_Mese_Provv = "luglio";
	   		    break;
	   		case "08","8": 
	   		    Text_Mese_Provv = "agosto";
	   		    break;
	   		case "09","9": 
	   		    Text_Mese_Provv = "settembre";
	   		    break;
	   		case "10": 
	   		    Text_Mese_Provv = "ottobre";
	   		    break;
	   		case "11": 
	   		    Text_Mese_Provv = "novembre";
	   		    break;
			case "12": 
			    Text_Mese_Provv = "dicembre";
			    break;
			}
			Combo_Anno_Provv = MyForm.aaaa.value
			Text_Giorno_Provv = MyForm.gg.value			
	   }
	else
	{
		Combo_Anno_Provv = MyForm.aaaa.value
		Text_Giorno_Provv = MyForm.gg.value				   
	}

	for (var idx=0; idx < MyForm.elements.length - 1; idx++)
	{
		 //alert("nome: " + MyForm.elements[idx].name + " Tipo=" + MyForm.elements[idx].type + " Testo=" + MyForm.elements[idx].value);
		 if (MyForm.elements[idx].type=="text" || MyForm.elements[idx].type=="select-one" || MyForm.elements[idx].type=="textarea")
		 {
			if (MyForm.elements[idx].value != "") 
			{

			   if (MyForm.elements[idx].name == "Combo_Tipo_Provv") 
			   {
			   /*
				   if (MyForm.Combo_Tipo_Parte.value == "" && MyForm.Text_Libero.value == "")
				   {
				     query = query + MyForm.Combo_Tipo_Parte.name + "=TS|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
				   }
			   */
				if (MyForm.Text_Libero.value == "") query = query + "Combo_Tipo_Parte" + "=TS|";
			   }

			   if (MyForm.elements[idx].name == "Text_Num_Provv") 
			   {
				/*
				   if (MyForm.Combo_Tipo_Parte.value == "" && MyForm.Text_Libero.value == "")
				   {
				     query = query + MyForm.Combo_Tipo_Parte.name + "=TS|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
				   }
				*/
				if (MyForm.Combo_Tipo_Provv.value == "" && MyForm.Text_Libero.value == "") query = query + "Combo_Tipo_Parte" + "=TS|";
			   }

			   if (MyForm.elements[idx].name == "Text_Num_Parte") 
			   {
				     query = query + "Text_Num_Parte=NP" + Ins_Char_Before(MyForm.Text_Num_Parte.value,"0",4) + "|";
				     //MyForm.Combo_Tipo_Parte.value = "te";
			   }
			   else
			   {
			   query = query + MyForm.elements[idx].name + "=" + MyForm.elements[idx].value + "|";
			   }

			}
		 }

/* selezione sezioni:
		 if (MyForm.elements[idx].type=="checkbox")
		 {
		 	if (MyForm.elements[idx].checked == true)
			{
			   index = index + String.fromCharCode(34) + MyForm.elements[idx].value + String.fromCharCode(34) + " ";
			}
		 }
*/
index = '"@@[BaseDir]@@Indice_~10L" "@@[BaseDir]@@Indice_~20P" "@@[BaseDir]@@Indice_~10E"';

	}

	if (Combo_Anno_Provv != "") query = query + "|Combo_Anno_Provv=" + Combo_Anno_Provv;
	if (Text_Mese_Provv != "") query = query + "|Text_Mese_Provv=" + Text_Mese_Provv;
	if (Text_Giorno_Provv != "") query = query + "|Text_Giorno_Provv=" + Text_Giorno_Provv;
	if (Combo_Anno_Fonte != "") query = query + "|Combo_Anno_Fonte=" + Combo_Anno_Fonte;
	if (Text_Mese_Fonte != "") query = query + "|Text_Mese_Fonte=" + Text_Mese_Fonte;
	if (Text_Giorno_Fonte != "") query = query + "|Text_Giorno_Anno_Fonte=" + Text_Giorno_Fonte;
	
	if (query == "")
	{
	   alert("Impostare almeno un valore!!")
	}

	else
	{
	//Debug:
	//alert(query)
	//alert(index)

//chiamo la pagina di ricerca e visualizzo i risultati nel frame sottostante
/* 
// modifiche per versione ricerca ridotta da homepage ISPESL :

	   if (BrwType().indexOf("MSIE") > 0)
	   {
		   var windowobject = window.parent.framedestro;
		   // windowobject.rows = "80%,*";
		   windowobject.rows = "*,150";
		   windowobject = window.parent.srcresult;
		   windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
		   //alert(BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index);
	   }
	   else
	   {
		   var windowobject = window.parent.principale;
		   windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
	   }
*/
// BaseDir1 = 'http://www.cesimultimedia.it/ISPESL1';
if (modo == 0)
  {

var tvalues;
tvalues = "&testo=" + MyForm.Text_Libero.value + "&tipo=" + MyForm.Combo_Tipo_Provv.value + "&numero=" + MyForm.Text_Num_Provv.value + "&gg=" + MyForm.gg.value + "&mm=" + MyForm.mm.value + "&aaaa=" + MyForm.aaaa.value;

    // window.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
    /// window.location = 'navigr.asp?sx=menu.htm&query=' + query + '&index=' + index;

// alert('navigr.asp?sx=menu.htm' + tvalues + '&query=' + query + '&index=' + index);

    window.location = 'navigr.asp?sx=menu.htm' + tvalues + '&query=' + query + '&index=' + index;
  }

else
  {
    var windowobject = window.parent.framedestro;
    windowobject.rows = "*,150";
    windowobject = window.parent.srcresult;
    windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
  }


	}
	
	}
	
//	Document.location = query
}



function leggidati_sempl()
// non pių utilizzata?
{
	var query = "";
	var index = "";
	var MyForm = document.Ricerca;
	//alert(MyForm.elements.length);
	for (var idx=0; idx < MyForm.elements.length - 1; idx++)
	{
		 //alert("nome: " + MyForm.elements[idx].name + " Tipo=" + MyForm.elements[idx].type + " Testo=" + MyForm.elements[idx].value);
		 if (MyForm.elements[idx].type=="text" || MyForm.elements[idx].type=="select-one" || MyForm.elements[idx].type=="textarea")
		 {
			if (MyForm.elements[idx].value != "") 
			{
			   query = query + MyForm.elements[idx].name + "=" + MyForm.elements[idx].value + "|";
			}
		 }
		 if (MyForm.elements[idx].type=="checkbox")
		 {
		 	if (MyForm.elements[idx].checked == true)
			{
			   index = index + String.fromCharCode(34) + ReplaceAny(MyForm.elements[idx].value, ",", String.fromCharCode(34)+ " " + String.fromCharCode(34)) + String.fromCharCode(34) + " ";
			}
		 }
	}
	
	if (query == "")
	{
	   alert("Impostare almeno un valore!!")
	}
	else
	{
	//Debug:
	//alert(query)
	//alert(index)

	//chiamo la pagina di ricerca e visualizzo i risultati nel frame sottostante
	   var windowobject = window.parent.framedestro;
	   windowobject.rows = "80%,*";
	   windowobject = window.parent.srcresult;
	   windowobject.location = BaseDir + '/ShowResult.asp?cmd=src&query=' + query + '&index=' + index;
	   //alert(BaseDir + '/ShowResult.asp?query=' + query + '&index=' + index);
	}
	
//	Document.location = query
}

function ReplaceAny(S, F, R)
{
    var RA_pos = -1;
    var RS = S;
    RA_pos = RS.indexOf(F, 1);
    while (RA_pos != -1)
    {
       //RS = Mid(RS, 1, RA_pos - 1) & s2 & Mid(RS, RA_pos + Len(s1), Len(RS))
       RS = RS.substr(0, RA_pos) + R + RS.substr(RA_pos + F.length, RS.length);
       RA_pos = RS.indexOf(F, RA_pos + 1);
    }
    return RS
}

function Ins_Char_Before(S, c, l)
{
    var i = 0;
    var tmp_Char_Before = S;
    for(i = 1; i <= l - S.length; i++)
    {
        tmp_Char_Before = c + tmp_Char_Before;
    }
    return tmp_Char_Before;
}

function chiudiframe()
{
	   if (BrwType().indexOf("MSIE") > 0)
	   {
		//nascondo la pagina di ricerca
		   var windowobject = window.parent.framedestro;
		   windowobject.rows = "100%,*";
		   windowobject = window.parent.srcresult;
		   windowobject.location = BaseDir + '/blank.htm';
		   //windowobject = window.parent.srcresult;
		   //windowobject.location = '/ShowResult.asp?query=' + query + '&index=' + index;
	   }
	   else
	   {
		   var windowobject = window.parent.principale;
		   windowobject.location = BaseDir + '/' + Prodotto + '_search.htm';
	   }
}

function sommaOPERATORE(operatore)
{
	var MyForm = document.ricerca;
	var stemp = MyForm.Text_Libero.value + operatore;
	//alert(stemp);
	MyForm.Text_Libero.value = stemp;
	MyForm.Text_Libero.focus()
	//MyForm.Testo.select()
}

function ShowResults(waid)
{
//	   var windowobject = window.parent.framedestro;
//	   windowobject.rows = "80%,*";
	   if (BrwType().indexOf("MSIE") > 0)
	   {
	   var windowobject = window.parent.srcresult;
	   windowobject.location = BaseDir + '/ShowResult.asp?cmd=res&waid=' + waid;
	   }
	   else
	   {
	   var windowobject = window.parent.principale;
	   windowobject.location = BaseDir + '/ShowResult.asp?cmd=res&waid=' + waid;
	   }
}
function ShowResult(docid, index)
{
//	   var windowobject = window.parent.framedestro;
//	   windowobject.rows = "80%,*";
	   var windowobject = window.parent.parent.principale;
	   windowobject.location = BaseDir + '/ShowResult.asp?cmd=evd&index=' + index + '&docid=' + docid;
}

//Per rendere visibile o meno il div della ricerca
function AttivaNascondiDivRicerca()
{
	if(document.getElementById('tableRicerca').style.display != 'none')
	{
		document.getElementById('tableRicerca').style.display = 'none';
	}
	else
	{
		document.getElementById('tableRicerca').style.display = 'block';
	}
}

//Tasto submit ricerca
function SubmitRicerca(e)
{
	if(document.forms['Ricerca'] != null)
	{
        if(e.keyCode == 13)
			document.forms['Ricerca'].submit();
	}
}

//Scroll news homepage

var delayb4scroll = 2000; //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed = 1; //Specify marquee scroll speed (larger is faster 1-10)
var pauseit = 1; //Pause marquee onMousever (0=no. 1=yes)?

var copyspeed = marqueespeed;
var pausespeed = (pauseit == 0)? copyspeed: 0;
var actualheight = '';

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
	cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px";
else
	cross_marquee.style.top=parseInt(marqueeheight)+8+"px";
}

function initializemarquee()
{
	if(document.getElementById("vmarquee") == null)
		return;
	cross_marquee=document.getElementById("vmarquee");
	cross_marquee.style.top=0;
	marqueeheight=document.getElementById("marqueecontainer").offsetHeight;
	actualheight=cross_marquee.offsetHeight;
	if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1)
	{ 
		//if Opera or Netscape 7x, add scrollbars to scroll and exit
		cross_marquee.style.height=marqueeheight+"px";
		cross_marquee.style.overflow="scroll";
		return
	}
	setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
	window.addEventListener("load", initializemarquee, false);
else if (window.attachEvent)
		window.attachEvent("onload", initializemarquee);
	else if (document.getElementById)
		window.onload=initializemarquee;

// fine del file.