//funzione di creazione dinamica di iframes
//Flash side code:
//	import flash.external.ExternalInterface;
//	var result:String = ExternalInterface.call("openFrame", "myiframeName", );
//align 
// Sets or returns how to align the iframe according to the surrounding text 
// contentDocument 
//  Returns the document the iframe contains 
// frameBorder 
//  Sets or returns whether to display a border for the iframe 
// height 
//  Sets or returns the height of the iframe 
// id 
//  Sets or returns the id of the iframe (In IE 4 this property is read-only) 
// longDesc 
//  Sets or returns a URL to a long description of the iframe 
// marginHeight 
//  Sets or returns the top and bottom margins of the iframe 
// marginWidth 
//  Sets or returns the left and right margins of the frame 
// name 
//  Sets or returns the name of the iframe 
// scrolling 
//  Sets or returns whether the iframe can be scrolled 
// src 
//  Sets or returns the URL to be loaded by the iframe 
// tabIndex 
//  Sets or returns the index that defines the tab order for the iframe 
// width 
//  Sets or returns the width of the iframe
 

function buildiframe (iframeNamesArray) {
	//alert("buildiframe invoked :"+iframeNamesArray);
	var iframeNames =(iframeNamesArray==undefined) ? ["_banner","_iFrame"] : iframeNamesArray;
	//var iframeNames = ["_iFrame","_banner"];
	for(var i in iframeNames){
		//alert(iframeNames[i]);
		var iframe;
		if (document.createElement && (iframe = document.createElement('iframe'))) {
			iframe.frameBorder="no" ;		
			//iframe.width=0; 
			//iframe.height=0;
			//iframe.scrolling="yes";
			iframe.marginWidth=0;
			iframe.marginHeight=0;
			iframe.allowTransparency="true";
			iframe.name = iframe.id = iframeNames[i];
			iframe.style.border="0px";
			iframe.style.position ="absolute"; 
			iframe.style.left="0px"; 
			iframe.style.top="0px"; 
			iframe.style.width="0px"; 
			iframe.style.height="0px"; 
			iframe.style.zIndex=i; 
			iframe.style.visibility="hidden";
			//iframe.style.filter = "alpha(opacity=0)";
			//var opacity = 50;
			//iframe.style.filter="alpha(opacity=" + opacity + ")"; 
			//iframe.opacity="50";
			//iframe.src='';
			document.body.appendChild(iframe);
		}
	}
}
function openiframe (iframeUrl,iframeName,xx,yy,ww,hh) {
	/*params = "openiframe invoked!";
	for ( var i = 0; i < arguments.length; i++){
	params = params+"\r\n"+i+":"+arguments[i];
	}*/
	//alert(params);
	var iframe = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	if (iframe) {
		iframe.frameborder=0;
		iframe.style.left = xx + "px";
		iframe.style.top = yy + "px";
		iframe.style.width = ww+"px";
		iframe.style.height = hh+"px";
		iframe.style.visibility = "visible";
		iframe.src = iframeUrl;
	}
	//fadeIn(iframeName, 1000);
		
}
//
//
//
function setiframe(iframeName,xx,yy,ww,hh) {
	//params = "setiframe invoked!";
	//for ( var i = 0; i < arguments.length; i++){
	//params = params+"\r\n"+i+":"+arguments[i];
	//}
	//alert(params);
	var iframe = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	if (iframe) {
		iframe.frameborder=0;
		iframe.style.left = xx + "px";
		iframe.style.top = yy + "px";
		iframe.style.width = ww+"px";
		iframe.style.height = hh+"px";
	}
}
//
//
function closeiframe(iframeName) {
	//alert("closeiframe invoked on: "+iframeName);
	//alert([iframeName,xx,yy,ww,hh]);
	var iframe = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	if (iframe) {
		iframe.style.visibility = "hidden";
		iframe.src = "";
	}
}


//
//
// 1 parametro: id dell’oggetto sul quale applicare l’effetto
// 2 parametro: tempo dell’animazione
//
//
// 1 parametro: id dell’oggetto sul quale applicare l’effetto
// 2 parametro: tempo dell’animazione
function fadeIn(identificator, time) { 
//alert("fadeIn invoked on"+identificator+" time"+time);
  var speed = Math.round(time / 100); //arrotonda il valore della divisione
  var frame = 0;

  for(fade = 0; fade < 50; fade++) { 
   setTimeout("setOpacity(\""+identificator+"\", "+fade+")", (speed * frame));
    frame++;
  }

}
//
//
// 1 parametro: id dell’oggetto sul quale applicare l’effetto
// 2 parametro: valore di opacità
function setOpacity(identificator, opacity) { 
//alert("setOpacity invoked on"+id+" opacity:"+opacity);
  var element = document.getElementById(identificator);
 element.style.filter = "alpha(opacity=" + opacity + ")"; 
}
