function getValoreParametro(name)
{
  var regexS = "[\\?&]" + name + "=([^&#]*)";
  var regex = new RegExp(regexS,'i');
  var results = regex.exec(window.location.href);
  return (results === null ? "" : results[1]);
}

function ReadLocalization(localfile)
{
   var request = GXmlHttp.create();
   request.open("GET", localfile, true);
   request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = request.responseXML;
                 
          var keys = xmlDoc.documentElement.getElementsByTagName("key");
          var applicafiltro=false; 
          var arVersion = navigator.appVersion.split("MSIE")
		  var version = parseFloat(arVersion[1])
		  if ((version >= 5.5) && (document.body.filters)) applicafiltro=true;
		
          for (var a = 0; a < keys.length; a++) {
                
            var id = keys[a].getAttribute("id");
            var tipo = keys[a].getAttribute("tipo");
            var source = keys[a].getAttribute("source");
			if(tipo == 'text')
			{  aTesti[id] = source;
	    	 }
			else
			{
			 var control = document.getElementById(id);
             if (control == null)
             {
              alert(id + ' ERROR');
              continue;
             }
                
             
			 switch(tipo)
			 {
				case 'label' :
				control.innerHTML = source;
				break;
				case 'div' :
				control.innerHTML = source;
				break;
				case 'a' :
				control.innerHTML = source;
				break;
				case 'option' :
				control.text = source;
				break;
				case 'IMG' :
				control.src = source;
				if (applicafiltro) // IE fix per PNG 
				{
 				 var img = control;
				 var imgName = img.src.toUpperCase();
      
     			 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
				 {
				  var imgID = (img.id) ? "id='" + img.id + "' " : "";
				  var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				  var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				  var imgStyle = "display:inline-block;" + img.style.cssText; 
				  if (img.align == "left") imgStyle = "float:left;" + imgStyle;
				  if (img.align == "right") imgStyle = "float:right;" + imgStyle;
				  if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
				  var strNewHTML = "<span " + imgID + imgClass + imgTitle
				      + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				      + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"; 
				      img.outerHTML = strNewHTML;
			     }
				}
					
				break;
            case 'button' :
				control.value = source;
				break;
            
			 }
			 
			}            
		  
           } // fine for
			
        } //end if
        
      } //end funtion
      request.send(null);
  }
