var xhr = new Array(); // ARRAY OF XML-HTTP REQUESTS
var xi = new Array(0); // ARRAY OF XML-HTTP REQUEST INDEXES
xi[0] = 1; // FIRST INDEX SET TO 1 MAKING IT AVAILABLE
function xhrRequest(type) {
	if (!type) {
		type = 'html';
	}
	// xhrsend IS THE xi POSITION THAT GETS PASSED BACK
	// INITIALIZED TO THE LENGTH OF THE ARRAY(LAST POSITION + 1)
	// IN CASE A FREE RESOURCE ISN'T FOUND IN THE LOOP
	var xhrsend = xi.length; 
	
	// GO THROUGH AVAILABLE xi VALUES
	for (var i=0; i<xi.length; i++)  // ripristina editor >
	{

		// IF IT'S 1 (AVAILABLE), ALLOCATE IT FOR USE AND BREAK
		if (xi[i] == 1) {
			xi[i] = 0;
			xhrsend = i;
			break;
		}
	}
	// SET TO 0 SINCE IT'S NOW ALLOCATED FOR USE
	xi[xhrsend] = 0;
	// SET UP THE REQUEST
	if (window.ActiveXObject) {
		try {
			xhr[xhrsend] = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xhr[xhrsend] = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) {
		xhr[xhrsend] = new XMLHttpRequest();
		if (xhr[xhrsend].overrideMimeType) {
			xhr[xhrsend].overrideMimeType('text/' + type);
		}
	}
	return (xhrsend);
}
function getFileToDiv(url, reqType,indiv) {
	var xhri = xhrRequest('html');
				
	//alert(url);
	xhr[xhri].open('GET', url, true);
	xhr[xhri].onreadystatechange = function() 
	{
		if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200)
		{
			//alert(xhr[xhri].responseText);
		    document.getElementById(indiv).innerHTML=xhr[xhri].responseText;

			xi[xhri] = 1;
			xhr[xhri] = null;
		}
		//else
		//{
		//	alert(url);
        //
		//}
	}
	xhr[xhri].send(null);
}









function setLingua(lang) 
{
          //alert(document.documentMode);
         //alert(lang);
          // alert( document.getElementById("LANG_PS").value);

           if(lang == "-IT")
           {
             
               document.getElementById('LANG_PS').value='-IT';
              // alert('<asp: Application(\"LANG_PS\") \= \"-IT\"   >');
           }    
           else if(lang == "-EN")
           {
                document.getElementById('LANG_PS').value='-EN';
           }
           else if(lang == "-RU")
           {
                document.getElementById('LANG_PS').value='-RU';
           }
           else if(lang == "-AR")
           {
                document.getElementById('LANG_PS').value='-AR';
          
           }
           else  if(lang == "-CI")
           {
                document.getElementById('LANG_PS').value='-CI';
           }
}




function getFile(pURL,pTYPE,pCONTENT,pIMAGE) 
{
	
// Nel caso di http://hpliga/parmasegreteria/  allora usare queste 2 di seguito
   if(document.getElementById('SERVER_PS').value=="")
   {

   		var myURL   ="http://"+ document.getElementById('SITE_PS').value+"/"+pURL+ document.getElementById('LANG_PS').value+"."+pTYPE
   		var myURLIMG="http://"+ document.getElementById('SITE_PS').value+"/"+pURL+ document.getElementById('LANG_PS').value+"_Img."+pTYPE
   }
   else
   {
   // altrimenti le successive 2
       var myURL   ="http://"+ document.getElementById('SERVER_PS').value+"/"+ document.getElementById('SITE_PS').value+"/"+pURL+ document.getElementById('LANG_PS').value+"."+pTYPE
   	   var myURLIMG="http://"+ document.getElementById('SERVER_PS').value+"/"+ document.getElementById('SITE_PS').value+"/"+pURL+ document.getElementById('LANG_PS').value+"_Img."+pTYPE
  	  // alert(myURL)

   }
   
   window.status=myURL;
//    alert(myURL);
   //alert(window.XMLHttpRequest);
   //if (window.XMLHttpRequest ) 
   if(window.XMLHttpRequest && !(window.ActiveXObject)) 
   { 
      // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttpI=new XMLHttpRequest();
      xmlhttp.onreadystatechange=function()
         {
             //alert('entrato1');

             if(xmlhttp.readyState==4)
             {
                 //   alert('entrato2');

                 xhrHandler(xmlhttp,xmlhttpI,0,pCONTENT,pIMAGE)
             }
         };
      xmlhttp.open('GET', myURL, true);
      xmlhttp.send(null);
      xmlhttp.close

            
      xmlhttpI.onreadystatechange=function(){if(xmlhttpI.readyState==4){xhrHandler(xmlhttp,xmlhttpI,1,pCONTENT,pIMAGE)}};
      xmlhttpI.open('GET', myURLIMG, true);
      xmlhttpI.send(null);
      xmlhttpI.close;
      
      
   }
   else if (window.ActiveXObject)
   { //IE 
      //xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      //xmlhttpI=new ActiveXObject('Microsoft.XMLHTTP'); 

        try {   
            xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');   
        } catch (e1) {   
            try {   
                xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');   
            } catch (e2) {   
                try {   
                    xmlhttp=new ActiveXObject('MSXML2.XMLHTTP.3.0');   
                } catch (e3) {   
                    xmlhttp=null;   
                }   
            }   
        }   
       
  

        try {   
            xmlhttpI=new ActiveXObject("Msxml2.XMLHTTP");   
        } catch (e1) {   
            try {   
                xmlhttpI=new ActiveXObject("Microsoft.XMLHTTP");   
            } catch (e2) {   
                try {   
                    xmlhttpI=new ActiveXObject("Msxml2.XMLHTTP.4.0");   
                } catch (e3) {   
                    xmlhttpI=null;   
                }   
            }   
        }   
     
  
    if(!xmlhttpI && window.createRequest)   
        xmlhttpI = window.createRequest();
    
    if (!xmlhttpI) alert("Il browser non supporta AJAX");     
    
    
    
    
    
    
      //alert('entrato IE');

      if (xmlhttp)
       {
         xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){xhrHandler(xmlhttp,xmlhttpI,0,pCONTENT,pIMAGE)}};
         xmlhttp.open('GET', myURL, false);
         xmlhttp.send();
         xmlhttp.close;
         
         xmlhttpI.onreadystatechange=function(){if(xmlhttpI.readyState==4){xhrHandler(xmlhttp,xmlhttpI,1,pCONTENT,pIMAGE)}};
         xmlhttpI.open('GET', myURLIMG, false);
         xmlhttpI.send();
         xmlhttpI.close;
         
      }
   }
}
function xhrHandler(xmlhttp,xmlhttpI,id,pCONTENT,pIMAGE ) 
{
	//alert(xmlhttp);
	//alert(xmlhttpI);
	//alert(id);
	//alert(pCONTENT);
	//alert(pIMAGE);
	
	
   if(id==0)
   {
      if (xmlhttp.readyState==4) 
      {
	     //	   alert(xmlhttp.status);
 
         if (xmlhttp.status==200) 
         { 
           
               //alert(xmlhttp.responseText);
               document.getElementById(pCONTENT).innerHTML=xmlhttp.responseText;
            
      
                    
         }
         else
         if  (xmlhttp.status==404) 
         {
           document.getElementById(pCONTENT).innerHTML="<h3><center> CONTENT AVAILABLE ONLY IN ITALIAN LANGUAGE.</center></h3>";
           //manca la pagina
         }
         else
         if  (xmlhttp.status!=200) 
         {
           alert('id='+id+' readyState='+xmlhttp.readyState+' status='+xmlhttp.status);
         
         }
     }
   }
   if(id==1)
   {
      if (xmlhttpI.readyState==4) 
      { 
         if (xmlhttpI.status==200) 
         { 
               // alert(xmlhttp.responseText);   
               document.getElementById(pIMAGE).innerHTML=xmlhttpI.responseText;
            
         }
      }
   }
 
} 

function getValForm()
{
     var retval;
     var newsbody;
     var check;
     
    ///alert(this.newstitle.value);
    

     newsbody=encodeURI(this.newsbody.value).
     replace(/!/g, '%21').
     replace(/&/g, '%26').
     replace(/'/g, '%27').
     replace(/\(/g, '%28').
     replace(/\)/g, '%29').
     replace(/=/g, '%3D').
     replace(/:/g, '%3A').
     replace(/\"/g, '%22').
     replace(/\\/g, '%5C').
     replace(/\</g, '%3C').
     replace(/\>/g, '%3E').
     replace(/~/g, '%7E').
     replace(/\*/g,'%2A').  
     replace(/\[/g,'%5B'). 
     replace(/\]/g,'%5D').  
     replace(/\{/g,'%7B').  
     replace(/\}/g,'%7D').  
     replace(/\`/g,'%70');  
     
     if(this.active.checked == true)
     {
         check=1;
     }
     else
     {
         check=0;
     }
     
    retval='getFile(\'edit-news\' ,\'asp?'+
     'id='+this.id.value+        
     '&active='+ check + 
     '&ispostback='+ this.ispostback.value + 
     '&expire='    + this.expire.value + 
     '&newsdate='  + this.newsdate.value + 
     '&newstitle=' + this.newstitle.value + 
     '&newsbody='  + newsbody+    
     '\' )';
    //alert(retval);
    //retval=eval(val);
    return(retval);
}


function getValFormN(page_post,first_elem,pCONTENT,pIMAGE)
{
     var retval;
     var newsbody;
     var check;
     
     //  alert(pCONTENT);

     // solo su Explorer
     // retval='getFile(\''+page_post+'\',\'asp?'+first_elem+'='+  this.id.value  + findelems(first_elem)  +    '\' )';
     
     // su tutti i browser
     
     retval='getFile(\''+page_post+'\',\'asp'+findelems(first_elem)+'\',\''+pCONTENT+'\',\''+pIMAGE+'\' )';
    
    
    
    // alert(retval);
    return(retval);
}

// compone la pagina post in automatico
function findelems(first_elem)
{
 var elem,i;
 var elem_text;
 var elem_textarea;
 var elem_check;
 var elem_radio;
 var stringa_post;
 
 // button     x
 // checkbox   x
 // file
 // hidden     x
 // image
 // password
 // radio       
 // reset
 // submit
 // text       x
 
 
 
 stringa_post='';
 elem=document.getElementsByTagName('*');

 for(i in elem)
 {
  
    if(elem[i].name !=  null)    
    {
        if(elem[i].name != '')
        {
            //alert('['+elem[i].name+ ']-->'+first_elem+ '-->'+elem[i].value);

            if(elem[i].name == first_elem)
            { 
               stringa_post='?'+elem[i].name+'='+elem[i].value; 
            }
        }
    }
 }
 
 
 elem=document.getElementsByTagName('*');
 for(i in elem)
 {
  
    if(elem[i].name !=  null)    
    {
        if(elem[i].name != '')
        {
            if(elem[i].name != first_elem)
            { 
                
                if(elem[i].type!=null && elem[i].type!='')
                {
                
                      //alert('['+elem[i].name+ ']-->'+elem[i].type+ ']-->'+elem[i].value);
                     if( elem[i].type == 'textarea')
                     {
                         elem_textarea=encodeURI(elem[i].value).
                         replace(/!/g, '%21').
                         replace(/&/g, '%26').
                         replace(/'/g, '%27').
                         replace(/\(/g, '%28').
                         replace(/\)/g, '%29').
                         replace(/=/g, '%3D').
                         replace(/:/g, '%3A').
                         replace(/\"/g, '%22').
                         replace(/\\/g, '%5C').
                         replace(/\</g, '%3C').
                         replace(/\>/g, '%3E').
                         replace(/~/g, '%7E').
                         replace(/\*/g,'%2A').  
                         replace(/\[/g,'%5B'). 
                         replace(/\]/g,'%5D').  
                         replace(/\{/g,'%7B').  
                         replace(/\}/g,'%7D').  
                         replace(/\`/g,'%70');
                         stringa_post=stringa_post+'&'+elem[i].name+'='+elem_textarea;
                     } 
                     else if( elem[i].type == 'text')
                     {
                         elem_text=encodeURI(elem[i].value).
                         replace(/!/g, '%21').
                         replace(/\//g, '%2F').
                         replace(/&/g, '%26').
                         replace(/'/g, '%27').
                         replace(/\(/g, '%28').
                         replace(/\)/g, '%29').
                         replace(/=/g, '%3D').
                         replace(/:/g, '%3A').
                         replace(/\"/g, '%22').
                         replace(/\\/g, '%5C').
                         replace(/\</g, '%3C').
                         replace(/\>/g, '%3E').
                         replace(/~/g, '%7E').
                         replace(/\*/g,'%2A').  
                         replace(/\[/g,'%5B'). 
                         replace(/\]/g,'%5D').  
                         replace(/\{/g,'%7B').  
                         replace(/\}/g,'%7D').  
                         replace(/\`/g,'%70');
                         stringa_post=stringa_post+'&'+elem[i].name+'='+elem_text;
                     } 
                     else if( elem[i].type == 'hidden')
                     {
                         if(elem[i].name != 'SITE_PS' && elem[i].name != 'LANG_PS' && elem[i].name != 'SERVER_PS')
                         {     
                                    stringa_post=stringa_post+'&'+elem[i].name+'='+elem[i].value;        
                         } 
                     }                    
                     else if( elem[i].type == 'button')
                     {
                         stringa_post=stringa_post+'&'+elem[i].name+'='+elem[i].value; 
                     }
                     else if( elem[i].type == 'checkbox')
                     {
                        if(elem[i].checked == true)
                        {
                           elem_check=1;
                        }
                        else
                        {
                           elem_check=0;
                        }
                        stringa_post=stringa_post+'&'+elem[i].name+'='+elem_check; 
  
                     }
                     else if( elem[i].type == 'select-one')
                     {
	                     stringa_post=stringa_post+'&'+elem[i].name+'='+elem[i].value;   
                     }
                     else
                     {
                      alert ('Attenzione automatizzare:  ['+elem[i].name+ '] ->['+elem[i].type+ '] --> '+elem[i].value);   
                     }
                
                }
                
            }
        }
    }
  }
  //alert('['+stringa_post+']');
 
 
 return (stringa_post);
}

function MM_SX_Restore() 
{ 
    // reset colore menu dopo selezione
    
    MM_swapImage('im2'     ,'gif','img/menu_chisiamo',1);
    MM_swapImage('im3'     ,'gif','img/menu_fisco',1   );
    MM_swapImage('im4'     ,'gif','img/menu_trust',1   ); 
    MM_swapImage('im10'    ,'gif','img/menu_quote',1   ); 
    MM_swapImage('im11'    ,'gif','img/menu_logi',1    ); 
    MM_swapImage('im6'     ,'gif','img/menu_intra',1   );
    MM_swapImage('im7'     ,'gif','img/menu_iva',1     );
    MM_swapImage('im8'     ,'gif','img/menu_world',1   );
    MM_swapImage('im9'     ,'gif','img/menu_contatti',1);
    MM_swapImage('im5'     ,'gif','img/menu_news',1    );
    MM_swapImage('italiano','gif','img/menull_ita',1   );
    MM_swapImage('english' ,'gif','img/menull_en',1    ); 
    MM_swapImage('russo'   ,'gif','img/menull_ru',1    ); 
    MM_swapImage('arabo'   ,'gif','img/menull_ar',1    ); 
    MM_swapImage('cinese'  ,'gif','img/menull_ci',1    );     
    
}
function MM_SX_Restore_SUBMENU() 
{ 
	MM_swapImage('im20','gif','img/link_ravvedimento',1);
	MM_swapImage('im21','gif','img/link_pec',1);
    MM_swapImage('im22','gif','img/link_smart',1); 
    MM_swapImage('im23','gif','img/link_tele',1);  
    MM_swapImage('im24','gif','img/link_contra',1);
    MM_swapImage('im25','gif','img/link_downl',1); 
    // non inserire la riga sotto altrimenti stck overflow da riferimento circolare
    // MM_swapImage('im26','gif','img/link_close',1); 
}
function MM_swapImgRestore() 
{ 
    //v3.0
  var i,x,a=document.MM_sr; 
  var lang;
  var corpo,ext;
  
  lang=document.getElementById('LANG_PS').value;
  //alert(lang);
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)  // ripristina editor >
  {
             corpo=x.oSrc;
             corpo=corpo.replace("-IT","");

             ext = lang+'.gif';
             corpo=corpo.replace(".gif",ext);
             
              
               
               if(!isThere(corpo)) 
               {   
                        //alert('entra='+x.oSrc);
                        x.src=x.oSrc;
               }  
               else
               {
                   //alert('normale='+corpo);
                   x.src=corpo;
                   //window.status=corpo;

               } 
      
    //x.src=x.oSrc;
    //x.src=corpo;

  }
}
function MM_preloadImages()
{
  //v3.0
   var d=document;
   lang=document.getElementById('LANG_PS').value;
//return;
   if(d.images)
   {

     if(!d.MM_p) 
     d.MM_p=new Array();
     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
     
     alert(j);

     for(i=0; i<a.length; i++)  // ripristina editor >
     {
   
         if (a[i].indexOf("#")!=0)
         {

              d.MM_p[j]=new Image;
              
              
              d.MM_p[j++].src=a[i]+lang+'.gif';
              //alert(a[i]+lang+'.gif');

              //alert(d.MM_p[j++].src);
         }
     }
   }
}
// ripristina editor >
function MM_findObj(n, d) {
     //v4.01
     var p,i,x;
     //alert('entra');
     if(!d) 
       d=document; 
     if((p=n.indexOf("?"))>0&&parent.frames.length)
     {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
     }
     if(!(x=d[n])&&d.all) 
         x=d.all[n]; 
     for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];   // ripristina editor >
          
     for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);// ripristina editor >
     
     if(!x && d.getElementById) x=d.getElementById(n);
     
     return x;
}

// ripristina editor >
function MM_swapImage()
{ 
 //v3.0
  var lang;
  var i,j=0,x,a=MM_swapImage.arguments; 
 
  lang=document.getElementById('LANG_PS').value;
   

  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)  // ripristina editor >
  if ((x=MM_findObj(a[i]))!=null) 
  { 
      document.MM_sr[j++]=x; 
      if(!x.oSrc) x.oSrc=x.src;
      {
           
                x.src=a[i+2]+lang+'.'+a[i+1];
         
               
                
                if(!isThere(x.src)) 
                {   
                              alert(x.src);  
               
                              //x.src=a[i+2]+'.'+a[i+1];
               
                }   
                
          
          
          
          
         //x.src=a[i+2]+'.'+a[i+1];
         //alert('0=' + a[i+0]+' 1='+a[i+1] +' 2='+a[i+2]+' 3='+a[i+3]+' 4='+a[i+4]   );
         //alert(x.src);
      }
  }
         
}
function MM_swapImageLang()
{ 
 //v3.0
  var lang;
  var i,j=0,x,a=MM_swapImageLang.arguments; 
 
  lang=document.getElementById('LANG_PS').value;
   

  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)  // ripristina editor >
  if ((x=MM_findObj(a[i]))!=null) 
  { 
      document.MM_sr[j++]=x; 
      if(!x.oSrc) x.oSrc=x.src;
      {
           
                x.src=a[i+2]+'.'+a[i+1];
         
               
                
                if(!isThere(x.src)) 
                {   
                              alert(x.src);  
               
                              //x.src=a[i+2]+'.'+a[i+1];
               
                }   
                
          
          
          
          
         //x.src=a[i+2]+'.'+a[i+1];
         //alert('0=' + a[i+0]+' 1='+a[i+1] +' 2='+a[i+2]+' 3='+a[i+3]+' 4='+a[i+4]   );
         //alert(x.src);
      }
  }
         
}function isThere(url)
{
	var req= new AJ(); // XMLHttpRequest object
	try {
		req.open("HEAD", url, false);
		req.send(null);		
		return req.status== 200 ? true : false;
	}
	catch (er) {
		return false;
	}
}
function AJ() 
{
	var obj;
	if (window.XMLHttpRequest) obj= new XMLHttpRequest(); 
	else if (window.ActiveXObject){
		try{
			obj= new ActiveXObject('MSXML2.XMLHTTP.3.0');
		}
		catch(er){
			try{
				obj= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(er){
				obj= false;
			}
		}
	}
	return obj;
}
// ripristina editor >
// funzione che carica nella pagina il contenuto iniziale o un contenuto di un reload
function start(tipo)
{
   //alert(tipo);
   if(tipo==0)
   {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/chisiamo','html','content','extra_img'); 
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi'); 
       
   }
   if(tipo==1)
   {
      setLingua('-IT');
      //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');

      getFile('news-admin','asp','content','extra_img');
      getFileToDiv('news_preview.asp','asp','newspreview');
      getFileToDiv('pag/menu_sx-IT.html','html','navigation')
      // getFileToDiv('pag/empty.html','html','extra_logi'); 
      
    }
    if(tipo==2)
    {
      setLingua('-IT');
      //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
      //getFile('pag/contatti','html','content','extra_img');
       getFile('contatti','asp','content','extra_img');
 
      getFileToDiv('news_preview.asp','asp','newspreview');

      getFileToDiv('pag/menu_sx-IT.html','html','navigation')
    }
    if(tipo==3) //FISCOPAGHE 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/fisco','html','content','extra_img'); 
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }
    if(tipo==4) //TRUST 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/trust','html','content','extra_img'); 
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }  
    if(tipo==5) //CESSIONE 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/lacessione','html','content','extra_img'); 
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==6) //RAVVEDIMENTO 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/calcolo' ,'html','content');
       getFileToDiv('calc/calcolo_img.html','html','extra_img');      
       getFileToDiv('calc/calcolo.html','html','content2');
       getFileToDiv('calc/calcolo_img.html','html','extra_img');       
       
       
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==7) //PEC 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/pec' ,'html','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==8) //SMART 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/smart' ,'html','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==9) //CONTRATTI DI LOCAZIONE 
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/contra' ,'html','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==10) // INTRASTAT
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/intra' ,'html','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==11) // COMPENSAZIONI IVA
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('pag/iva' ,'html','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }      
    if(tipo==12) // NEWS
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
       getFile('news' ,'asp','content');
       getFileToDiv('news_preview.asp','asp','newspreview');
       getFileToDiv('pag/menu_sx-IT.html','html','navigation')
       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }    
    if(tipo==14) // trust spider
    {
       setLingua('-IT');
       //MM_preloadImages('img/menu_chisiamo','img/menu_fisco','img/menu_trust','img/menu_quote','img/menu_logi');
       //getLang();
        getFile('pag/trust','html','content','extra_img'); 

       // getFileToDiv('pag/empty.html','html','extra_logi');     
    }    
    
}




function clearDiv(div)
{
    // getFileToDiv('pag/empty.html','html',div); 
}    

function getLang(img)
{
   //alert( img+document.getElementById('LANG_PS').value+'.gif');
   document.write ( document.getElementById('LANG_PS').value ) ;
}

function check()
{
	if (document.getElementById('Name').value==0)
		{
			alert("Please enter your Name");
			//document.getElementById('Name').focus();
							 return false;

		}
	    else if(document.getElementById('Email').value==0 || 
	            document.getElementById('Email').value.indexOf("@")==-1 || 
	            document.getElementById('Email').value.indexOf(".")==-1 || 
	            document.getElementById('Email').value.indexOf(" ")==0)
		{
			alert("You must enter a Valid Email ID")
		//	document.getElementById('Email').focus();
							 return false;

		}
	 	//else if (document.myform.Subject[document.myform.Subject.selectedIndex].value.length==0)
		//	{
		//	alert("Please select a Subject");
		//	document.myform.Subject.focus();
		//}
		else if(document.getElementById('Message').value==0)
		{
		alert("Message field cannot be left empty");
		//document.getElementById('Message').focus();
				 return false;

		}
		else
		{
		 return true;
		}
}
function enableTooltips(){
var links=document.getElementsByTagName("a");
for(i=0;i<links.length;i++){
    t=links[i].getAttribute("title");
    if(t!=""){
        links[i].removeAttribute("title");
        links[i].style.position="relative";
        tooltip=document.createElement("em");
        tooltip.className="tooltip";
        tooltip.style.display="none";
        tooltip.appendChild(document.createTextNode(t));
        links[i].appendChild(tooltip);
        links[i].onmouseover=showTooltip;
        links[i].onmouseout=hideTooltip;
        }
    }
}

function showTooltip(event){
    this.style.zIndex="25";
    this.getElementsByTagName("em")[0].style.display="block";
    }

function hideTooltip(event){
    this.style.zIndex="24";
    this.getElementsByTagName("em")[0].style.display="none";
    }
    
    
    
