﻿//**************************************************
//**                                              **
//**                Script by jure                **
//**           giorgiobeggiora@email.it           **
//**                                              **
//**************************************************


// ********************************
//   Funzioni di apertura popup documentum.
// ********************************

function apriPopup(url, name, options) {
  browserVer = parseInt(navigator.appVersion);
  browserName = navigator.appName;
  if (browserName == "Netscape") { 
  	if (browserVer >= 3) 
  		version = "n3";
    else 
    	version = "n2";
  }
  else { 
  	if (browserVer > 4) 
  		version = "n3";
    else 
    	version = "n2";
  }
  finestra = window.open(url, name, options).focus();
  if ( version == "n3" ) 
  	finestra.focus();
}


function openWindow(theURL, theName, theFeatures) { //v2.0
  window.open(theURL, theName, theFeatures);
}

function pop(){
	// created by webanana www.e-tree.com
	// pop ( href [,target] [,x] [,y] [,"fullscreen"] [,"center"] [,"scroll"|"noscroll"] )

	var x,y,o,_target="",_params=new Array(),center=false;

	if(arguments.length>0){
		_url=arguments[0];
		for(i=1;i<arguments.length;i++){
			if(isNaN(arguments[i])){
				switch(arguments[i]){
					case"center":
						center=true;
						if( x!=undefined && y!=undefined ){
							_params[_params.length]="left="+((screen.width-x)/2);
							_params[_params.length]="top="+((screen.height-y)/2);
						}
					break;
					case"scroll":
						_params[_params.length]="scrollbars=yes";
					break;
					case"noscroll":
						_params[_params.length]="scrollbars=no";
					break;
					case"fullscreen":
						_params[_params.length]="fullscreen=yes";
					break;
					default:
						_target=arguments[i];
					break;
				}
			}else{
				if(x==undefined){
					x=arguments[i];
					_params[_params.length]="width="+x;
				}else{
					y=arguments[i];
					_params[_params.length]="height="+y;
					if(center){
						_params[_params.length]="left="+((screen.width-x)/2);
						_params[_params.length]="top="+((screen.height-y)/2);
					}
				}
			}
		}

		o=window.open(_url,_target,_params.join(","));
		if(o==undefined)alert("L'apertura della finestra 柳tata bloccata");

	}
}



//Gestione Errore
var c=1;
function handleError(){
if(c>1) location.reload(true);
return true;
}
window.onerror=handleError;

//Dichiarazione Browser, Versione Browser e Sistema Operativo
var safeIEstring = navigator.appVersion;
var VER = parseInt(safeIEstring);
var OS;
var BW;
if(safeIEstring.indexOf("Macintosh") != -1) OS="Mac";
if(safeIEstring.indexOf("Windows") != -1) OS="Win";
if(document.all){
	if(!document.getElementById || (document.getElementById && safeIEstring.indexOf("Opera") == -1)){
		BW="IE";
}
}


/*

modifica ad HOC per i browser Internet Explorer versione >= 5

*/
var vOP = ((ind1 = navigator.userAgent.indexOf("Opera")) > -1) ? 1 : 0;
var vIE = ((ind2 = navigator.appVersion.indexOf("MSIE")) > -1 && !vOP) ? 1 : 0;
var vIE4 = (vIE && parseInt(navigator.appVersion.substr(ind2+5)) == 4) ? 1 : 0;
var vIE5 = (vIE && parseInt(navigator.appVersion.substr(ind2+5)) == 5) ? 1 : 0;
var vIE6 = (vIE && parseInt(navigator.appVersion.substr(ind2+5)) == 6) ? 1 : 0;

//Funzione per la stampa
function printMe(){

if((vIE4) && OS=="Win"){
	document.all.WebBrowser2.ExecWB(6, 1); //1=con 2=senza
	document.all.WebBrowser2.outerHTML = "";
}else{

if(window.print) {self.print();}
else alert("Il Browser non supporta la stampa via Javascript.\nStampare dal Menu del browser")
}
}

function printMappa(){

if(window.print) self.print();
}

if((vIE4) && OS=="Win") document.write("<object ID=WebBrowser2 WIDTH=0 HEIGHT=0 CLASSID=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></object>");

function apriChiudi(div){
if (document.all) {
var doc="document.all.";
var style=".style";
var chiudi="";

} else {
var doc="document.getElementById('";
var style="').style";
var chiudi="')";
}

    visibilita=eval(doc+div+style).visibility;
    if(visibilita=="hidden"){visibilita="visible"}
    else if(visibilita=="visible"){visibilita="hidden"}
    var z = (visibilita=="hidden") ? false : true;
	    var vis =(z)? "visible" : "hidden";
	    var disp =(z)? "" : "none";
	    var img =(z)? "/rasbankit/images/bullet/freccia_aperta.gif" : "/rasbankit/images/bullet/freccia_chiusa.gif";
        eval(doc+'freccia_'+div+chiudi).src=img;
         lay = eval(doc+div+style);
    lay.visibility = vis;
    lay.display =disp ;
}


function show(cosa){
if (document.all) {
var doc="document.all.";
var style=".style";
var chiudi="";
} else {
var doc="document.getElementById('";
var style="').style";
var chiudi="')";
}
if(cosa=='commerciali'){var noncosa="istituzionali";
if(eval(doc+'formContatti'+chiudi)){
eval(doc+'formContatti'+style).visibility='visible';
eval(doc+'formContatti'+style).display='';}
} else {
if(eval(doc+'formContatti'+chiudi)){
eval(doc+'formContatti'+style).visibility='hidden';
eval(doc+'formContatti'+style).display='none';}

}
var noncosa = (cosa=='commerciali') ? 'istituzionali' : 'commerciali';
eval(doc+cosa+style).visibility='visible';
eval(doc+cosa+style).display='';
eval(doc+cosa+'_on'+style).visibility='visible';
eval(doc+cosa+'_on'+style).display='';

eval(doc+noncosa+style).visibility='hidden';
eval(doc+noncosa+style).display='none';
eval(doc+noncosa+'_on'+style).visibility='hidden';
eval(doc+noncosa+'_on'+style).display='none';
}

function uscitaSito(goToURL) {
        url = "/uscita-sito?goto=" + goToURL
        window.open(url , 'popupuscita' ,'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=430,height=350,top=100,left=200');
}

function isEnabledFlash() {
	flashVersion_DONTKNOW = -1;
	 //<![CDATA[
	var requiredVersion = 6;
	var enabled='true';
	 var flashVersion = getFlashVersion();
	if (flashVersion >= requiredVersion) {
		// test
	}else if (flashVersion > 0) {
		change='false';
	}else if (flashVersion == 0) {
		change='false';
	}else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
		change='false';
	}
	
	//mi indica se dovro' switchare su di una immagine in mancanza del plugin flash
	return enabled;
	//]]>
}