/*-----------------------------------------------*/
/*------------ INIZIALIZZO OGGETTO --------------*/
/*-----------------------------------------------*/

var xmlHttp;

function createXMLHttpRequest(){

	if (window.XMLHttpRequest) {
	   xmlHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
	}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*------------ IMMAGINE PRELOAD -----------------*/
/*-----------------------------------------------*/

Immagine_Preload = ""
//Immagine_Preload = Immagine_Preload + "<center><img src='ICONE/loading/5.gif' style='vertical-align:middle;'></center>"
Immagine_Preload = "<div align='center' style='line-height:12px;color:red;FONT-SIZE: 9px;FONT-FAMILY: Trebuchet MS, Verdana;'>ricerca in corso ....</div>"

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*--------- CARICA LISTA NEGOZI -----------------*/
/*-----------------------------------------------*/

function CaricaNegozi(UrlContenuto){
	
		createXMLHttpRequest();			
		
		xmlHttp.onreadystatechange = handleStateChangeNegozi;
		xmlHttp.open("GET", UrlContenuto, true);
		xmlHttp.send(null);

}

function handleStateChangeNegozi(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){

				document.getElementById("ListaNegoziAjax").innerHTML = xmlHttp.responseText;

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("ListaNegoziAjax").innerHTML = Messaggio;
			}
		
		}else{
			
			document.getElementById("ListaNegoziAjax").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*--- GESTIONE E VISUALIZZAZIONE ERRORI ---------*/
/*-----------------------------------------------*/

function handleErrFullPage(strIn) {	

        var errorWin;

        // Create new window and display error
        try {
			errorWin = window.open('', 'errorWin');
			errorWin.document.body.innerHTML = strIn;
        }
        // If pop-up gets blocked, inform user
        catch(e) {
			alert(strIn);
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/