 var now = new Date();
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;
}

function updateContentToId(url, destId){

  xmlhttp = getHttpRequestObject();

  xmlhttp.open("GET", url, true);
  xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {

          document.getElementById(destId).innerHTML = xmlhttp.responseText;
      }
  }

  xmlhttp.send(null);
}
function updateContentToIdPost(url, destId, paramString){

  xmlhttp = getHttpRequestObject();

  xmlhttp.open("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 isblank( s ) {
   for( var i=0; i < s.length; i++ ) {
      var c = s.charAt(i);
      if( (c != ' ') && (c != '\n') && (c != '\t') ) return false;
   }
   return true;
}

function apriSchede(idArticolo,p){
	url="schedaArticolo.asp?idArticolo=" + idArticolo + '&p=' + p + '&Nocache=' + escape(now) ; 
	   updateContentToId(url, 'secondoDiv');
  if (document.getElementById) {
		document.getElementById("secondoDiv").style.visibility="visible";
	} else if (document.all) {
		document.all.secondoDiv.style.visibility="visible";
	}
  	   
  }
   
   function apriSchede_eng(idArticolo){
	url="schedaArticolo_eng.asp?idArticolo=" + idArticolo + '&Nocache=' + escape(now) ; 
	   updateContentToId(url, 'secondoDiv');
  if (document.getElementById) {
		document.getElementById("secondoDiv").style.visibility="visible";
	} else if (document.all) {
		document.all.secondoDiv.style.visibility="visible";
	}
  	   
  }
function blank(){
     url="blank.asp";
     updateContentToId(url, 'destra');
   return false;
}
function apriPagina(url){
window.scrollTo(0,0);
   updateContentToId(url, 'dinamicContent');
 }
 
function CheckCampi() {
   err = "";
   
    if( isblank(document.modulo.Nome.value) ) 
        err = err + "Manca il nome " + "\n\r";
    if( isblank(document.modulo.Cognome.value) ) 
        err = err + "Manca il cognome" + "\n";
    if( isblank(document.modulo.Ind.value) ) 
        err = err + "Manca l'indirizzo" + "\n";
    if( isblank(document.modulo.Loc.value) ) 
        err = err + "Manca la localita'" + "\n";
    if( isblank(document.modulo.Prov.value) ) 
        err = err + "Manca la provincia" + "\n";
     if( isblank(document.modulo.Cap.value) ) 
        err = err + "Manca il cap" + "\n";
    if( isblank(document.modulo.Tel.value) ) 
        err = err + "Manca il telefono " + "\n";
     if( isblank(document.modulo.Mail.value) ) 
        err = err + "Manca l'email" + "\n";
	 if( err.length > 0 ) {
     window.alert( err );
     return false;
   } else {
     return true;
   }
}

function CheckRegistrazione() {
   err = "";
   
    if( isblank(document.modulo.Rag.value) ) 
        err = err + "Manca la Ragione Sociale" + "\n\r";
    if( isblank(document.modulo.Piva.value) ) 
        err = err + "Manca la p.iva" + "\n";
    if( isblank(document.modulo.Ind.value) ) 
        err = err + "Manca l'indirizzo" + "\n";
    if( isblank(document.modulo.Loc.value) ) 
        err = err + "Manca la localita'" + "\n";
    if( isblank(document.modulo.Prov.value) ) 
        err = err + "Manca la provincia" + "\n";
     if( isblank(document.modulo.Cap.value) ) 
        err = err + "Manca il cap" + "\n";
    if( isblank(document.modulo.Tel.value) ) 
        err = err + "Manca il telefono " + "\n";
     if( isblank(document.modulo.Mail.value) ) 
        err = err + "Manca l'email" + "\n";
	if( isblank(document.modulo.CF.value) ) 
        err = err + "Manca il codice fiscale" + "\n";
   if( err.length > 0 ) {
     window.alert( err );
     return false;
   } else {
     return true;
   }
}