// JavaScript Document

function getHttpRequestObject(){

    var xmlhttp=false;

    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    // JScript gives us Conditional compilation, we can cope with old IE versions.
    // and security blocked creation of the objects.
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
    
        xmlhttp = false;
      }
    }
    @end @*/
    
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        xmlhttp = new XMLHttpRequest();
    }

    return xmlhttp;
}
//////////// GET 
function updateContentToId(url, destId){

  xmlhttp = getHttpRequestObject();

  xmlhttp.open("http://www.calme.it/GET", url, true);
  xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {

          document.getElementById(destId).innerHTML = xmlhttp.responseText;
      }
  }

  xmlhttp.send(null);
}
///////////// POST
function updateContentToIdPost(url, destId, paramString){

  xmlhttp = getHttpRequestObject();

  xmlhttp.open("http://www.calme.it/POST", url, true);
  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
  xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {

          document.getElementById(destId).innerHTML = xmlhttp.responseText;
         
            
    }
  }

  xmlhttp.send(paramString);
}
function openRegione(regione){
  url=regione+ ".asp"; 
  document.getElementById('agenti').innerHTML = "";
    updateContentToId(url, 'regione');
 }
function agenti(idProvincia){
  url="http://www.calme.it/agenti.asp?idProvincia=" + idProvincia; 
  document.getElementById('fotoR').src = "img/" +idProvincia+".gif";
   updateContentToId(url, 'agenti');
 }
////
function Stampa() {
 window.print();
}

function initProduct(){
 document.getElementById('sottomenu').style.display = "None";
}

function openSottoMenu(){
 document.getElementById('sottomenu').style.display = "block";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function Menu(links) {
	 //alert(links[links.selectedIndex].value);
	 loadTo = links[links.selectedIndex].value;
	 //getHTML('/common/include/' + loadTo , 'dinamicStabilimento' , 'null' , 'nullImg' );
     location.href = links[links.selectedIndex].value;
  }
  
function Cementi(links) {
	 //alert(links[links.selectedIndex].value);
	 loadTo = links[links.selectedIndex].value;
	 //getHTML('/common/include/' + loadTo , 'contenutoDinamicSx' , 'null' , 'nullImg' );
     location.href = links[links.selectedIndex].value;
  } 