// this to check flash version and/or what to load on page
var requiredVersion = 7;
var useRedirect = false;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var flash9Installed = false;
var maxVersion = 9;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
jsVersion = 1.1;
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n');
}
function detectFlash(movie_path_params,name_id,swfWidth,swfHeight) {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.substring(16));
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }  
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;    
  if (actualVersion >= requiredVersion) {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);  
      } else {
        window.location = flashPage;
      }
    }    
    hasRightVersion = true;                
  } else {  
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
 if (!useRedirect) {
  if(hasRightVersion) {
    var oeTags = '<OBJECT CLASSID="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
    + 'WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '" '
	+ 'id="'+ name_id+ '"'
    + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">'
    + '<PARAM NAME="MOVIE" VALUE="' + movie_path_params + '">'
    + '<PARAM NAME="allowScriptAccess" VALUE="always">'
    + '<PARAM NAME="QUALITY" VALUE="high">'
    + '<PARAM NAME="MENU" VALUE="false">'
    + '<PARAM NAME="WMODE" VALUE="transparent">'
    + '<EMBED SRC="' + movie_path_params + '"'
    + 'QUALITY="high"'
    + 'bgcolor="#ffffff"'
    + 'WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '"'
    + 'swLiveConnect="true"'
    + 'name="'+ name_id+ '"'
    + 'MENU="false"'
    + 'wmode="transparent"'
    + 'allowScriptAccess="always"'
    + 'TYPE="application/x-shockwave-flash"'
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    + '<\/EMBED>'
    + '<\/OBJECT>';

    document.write(oeTags);
  } else {  
    var alternateContent = '<p style="background-color: #FF3300; color: white; padding: 8px; margin-top: 16px;">'
                            + '<strong>Attenzione</strong><br/>'
                            + 'Non hai installata la versione di Macromedia Flash Player necessaria per vedere questa pagina.'
                            + 'Puoi installare una versione pi&ugrave; recente <a href="http://www.macromedia.com/go/getflashplayer">cliccando qui</a>'
                            + '</p>';
    document.write(alternateContent);
  }
 } 
}

// this to perform actions on flash mappa cae
function set_text(param) {
        var IE = navigator.appName.indexOf("Microsoft") != -1;
        var obj = IE ? window.map_cae : window.document.map_cae;
        obj.SetVariable("_root.selected_param", param);
        obj.TCallFrame("_root", 9)
}
function flashTesto(param) {
        document.getElementById("flash_more_info").innerHTML=param;
}

function ShowBox(number){ 
	var o;
	o = top.document.getElementById('box_'+number+'_open');
	if (o != null)
		o.style.display = 'none';
	
	o = top.document.getElementById('box_'+number+'_close');	
	if (o != null)
		o.style.display = 'block';	
	
	o=top.document.getElementById('box_'+number+'_content');
	if (o != null)
		o.style.display = 'block';	
		
	return;
 }
 function HideBox(number){ 
	var o;
	o = top.document.getElementById('box_'+number+'_open');
	if (o != null)
		o.style.display = 'block';
	o = top.document.getElementById('box_'+number+'_close');	
	if (o != null)
		o.style.display = 'none';	

	o=top.document.getElementById('box_'+number+'_content');
	if (o != null)
		o.style.display = 'none';	
		
	 return;
}