﻿//variabili configurazione e-brochure
var ebrochure_urlPath = location.protocol + "//"+location.hostname + "/it/CMSIT/LocalRes/EBrochure/";
var ebrochure_mailUrlPath = "http://www.loginmito.it/emailgiulietta/sendmail.php";
var ebrochure_xmlUrlPath = location.protocol + "//"+location.hostname + "/it/CMSIT/LocalRes/EBrochure/xmldata/book.xml";
var ebrochure_pdfUrlPath = location.protocol + "//"+location.hostname + "/it/CMSIT/LocalRes/EBrochure/ext_assets/Giulietta.pdf"

//variabili gestione visibilità  <div>
var ebrochure_state = 'none'; 
var ebrochure_height = '560px'; 
var ebrochure_disabledState = 'true';

//variabile riferimento <div> E-Brochure
var ebrochure_layerRef = 'eBrochureDiv';

var ebrochure_mainVisibility = 'visible';
var ebrochure_topPosition = "0px";

//openEBrochure: da chiamare lato flash
function openEBrochure(){
	var ebrochure_altContainer = document.createElement('div');
	ebrochure_altContainer.setAttribute('id', 'flashcontentEBrochureAlternative');
	ebrochure_altContainer.innerHTML = '<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" border="0" /></a>';
	document.getElementById(ebrochure_layerRef).appendChild(ebrochure_altContainer);
	//
	var flashvars = {};
	flashvars.url = ebrochure_urlPath;
	flashvars.inside = true;
	flashvars.mailUrl = ebrochure_mailUrlPath;
	flashvars.xmlUrl = ebrochure_xmlUrlPath;
	flashvars.pdfUrl = ebrochure_pdfUrlPath;
	
	var params = {};
	params.bgcolor = "#333333";
	params.menu = "false";
	params.quality = "high";
	params.allowfullscreen = "true";
	params.allowscriptaccess = "sameDomain";
	var attributes = {};
	attributes.id = "AlfaEBrochure";
	attributes.name = "AlfaEBrochure";
	swfobject.embedSWF(ebrochure_urlPath + "AlfaEBrochure.swf", "flashcontentEBrochureAlternative", "1000", "560", "9.0.124", "/_layouts/FGA/js/expressinstall.swf", flashvars, params, attributes);
	
	showhideEBrochure();
}
function closeEBrochure(){
	var obj = document.getElementById(ebrochure_layerRef);
	try {
		obj.removeChild(document.getElementById("AlfaEBrochure"));
	} catch (err) {
		try{console.log(err)}catch(err){}
	};
	
	showhideEBrochure();
}
//funzione per nascondere/rendere visibile <div> calcolatrice

function showhideEBrochure()
{ 
 	if(ebrochure_state == 'block'){
 		ebrochure_state = 'none'; 
		ebrochure_disabledState = 'true';
		ebrochure_height = '0px';
		ebrochure_topPosition = "0px";
		ebrochure_mainVisibility = "visible";
	}else{
		ebrochure_state= 'block'; 
		ebrochure_disabledState = 'false';
		ebrochure_height = '560px';
		ebrochure_topPosition = "-10000px"; 
		ebrochure_mainVisibility = "hidden";
	}
	if (document.getElementById){ 
		var ebrochure_container = document.getElementById(ebrochure_layerRef);
		ebrochure_container.style.display = ebrochure_state;
		ebrochure_container.style.height = ebrochure_height;
		document.getElementById('flashcontent').style.top = ebrochure_topPosition;
	}
	else if(document.all){ //IS IE 4 or 5 (or 6 beta) 
		eval("document.all." + ebrochure_layerRef + ".style.display = '" + ebrochure_state+ "'");
		eval("document.all.flashcontent.style.visibility = '"+ ebrochure_mainVisibility + "'");
	} 
	else if (document.layers) //IS NETSCAPE 4 or below 
	{ 
		document.layers[ebrochure_layerRef].display = ebrochure_state; 
		document.layers['flashcontent'].visibility = ebrochure_mainVisibility; 
	} 
} 
/**
 * ########################################
 * SOLO PER TEST
 * ########################################
 */
/*
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(openEBrochure);
*/
