<!--

var datasourceHome="xml/home.xml";
var datasourceHome_en="xml/home_en.xml";
var datasourceHomeThemes="dataService/HomeThemes.aspx";
var datasourceHomeNews="dataService/HomeNews.aspx";
var datasourceHomeHilights="dataService/HomeHighlights.aspx";
var themesDatasource="dataService/menuThemes.aspx";
var datasourceProducts="dataService/menuProducts.aspx";
var datasource="xml/menuTop.xml";
var datasource_en="xml/menuTop_en.xml";
var flashPath="swf/";

var currentProductConfigSrc="";
var currentLeftMenuTree="";


function selectItem(itemType, id, parentId) {
    if (itemType=='MacroCategory')
        location.href = 'categoria.aspx?CategoryId='+id;
    else
        location.href = 'categoria.aspx?CategoryId='+id;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function centerWin() {
	if (document.layers) {
		var sinist = screen.width / 2 - outerWidth / 2;
		var toppo = screen.height / 2 - outerHeight / 2;
	} else {
		var sinist = screen.width / 2 - document.body.offsetWidth / 2;
		var toppo = screen.height / 2 - document.body.offsetHeight / 2;
	}
	window.moveTo(sinist, toppo);
	window.focus();
}

// -- HOME
function printHomepage(){
	var ds=datasourceHome;
	var ds2=datasource;
	if(lang=="EN"){
		ds=datasourceHome_en;
		ds2=datasource_en;
	}
	var id="SWFhome";
	var pars="id="+id+"&server="+flashPath+"&datasourceHome="+ds+"&datasourceHomeThemes="+datasourceHomeThemes+"&datasourceHomeNews="+datasourceHomeNews+"&datasourceHomeHilights="+datasourceHomeHilights+"&datasource="+ds2+"&datasourceProducts="+datasourceProducts+"&currenturl="+currenturl;
	var html = '<div id="SWFhome" style="display:block;float:left;width:100%;height:720px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">';
	html += '<param name="movie" value="swf/main.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/main.swf" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed>';
	html += '</object></div>';
	document.write(html);
}

// -- MENU

function printLeftMenu(tree){
	if(tree==null){
		tree="X";	
	}
	currentLeftMenuTree=tree;
}
function printLeftMenuSwf(){
	if(!currentLeftMenuTree){
		return;	
	}
	var cntid="flashleftmenu";
	var id="SWFmenu";
	var w="100%";
	var h="100%";
	var tree=currentLeftMenuTree;
	var pars="id="+id+"&cntid="+cntid+"&datasource="+datasourceProducts+"&tree="+tree+"&currenturl="+escape(currenturl);
	var html = '<div id="SWFmenu" style="display:block;float:left;width:100%;height:100%;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="swf/menu.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/menu.swf" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
	html += '</object></div>';
	//document.write(html);
	if(document.all && !document.getElementById) {
 		document.all[cntid].innerHTML = html;
	}else{
		document.getElementById(cntid).innerHTML = html;
	}
}


// -- THEMES MENU
function printThemesMenu(tree){
	var pars="datasource="+themesDatasource+"&tree="+tree;
	var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="614" height="42">';
	html += '<param name="movie" value="swf/menuCanale.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/menuCanale.swf" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="614" height="42"></embed>';
	html += '</object>';
	document.write(html);
}

// -- HEADER

function printHeader(tree,tabstract,ttitle,imagesrc){
	var ds=datasource;
	if(lang=="EN"){
		ds=datasource_en;
	}
	var pars="server="+flashPath+"&abstract="+tabstract+"&title="+ttitle+"&img="+imagesrc+"&datasource="+ds+"&tree="+tree;
	var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">';
	html += '<param name="movie" value="swf/headerSmall.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/headerSmall.swf" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed>';
	html += '</object>';
	document.write(html);
}

function printHeaderById(tree,tabstract,ttitle,imageId){
	var headersId={};
	headersId["Qualit%e0"]="images/headers/qualita.jpg";
	headersId["Stile"]="images/headers/stile.jpg";
	headersId["Comfort"]="images/headers/comfort.jpg";
	headersId["Movimento"]="images/headers/movimento.jpg";
	printHeader(tree,tabstract,ttitle,headersId[imageId]);
}


// -- ALIAS TEXT

// print alias text with default font
function printAliasText(w,h,type,color,text){
	// colors settings
	var colors={};
	colors["color1"]="#D1748B";
	colors["Qualit%e0"]="#3F729A";
	colors["Stile"]="#FCC20E";
	colors["Comfort"]="#82C720";
	colors["Movimento"]="#BCE10E";
		
	var pars="type="+type+"&col="+colors[color]+"&text="+text;
	var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="swf/aliastext.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="salign" value="LT" />';
	html += '<param name="scale" value="noscale" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/aliastext.swf" quality="high" scale="noscale" salign="LT" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
	html += '</object>';
	document.write(html);
}


// --  PRODUCTS -- //

// color print
// print alias text with default font
function printProductColor(src){
	var pars="src="+src;
	var w=22;
	var h=22;
	var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="swf/iconColor.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="salign" value="LT" />';
	html += '<param name="scale" value="noscale" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/iconColor.swf" quality="high" scale="noscale" salign="LT" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
	html += '</object>';
	document.write(html);
}
// print product configuration
function printProductConfig(src){
	currentProductConfigSrc=src;
}
function printProductConfigSwf(){
	if(!currentProductConfigSrc){
		return;	
	}
	src=currentProductConfigSrc;
	var cntid="SWFproductConfig";
	var id="SWFprconf";
	var pars="id="+id+"&cntid="+cntid+"&src="+src;
	var w="100%";
	var h="100%";
	var html = '<div id="SWFprconf" style="display:block;float:left;width:100%;height:100%;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="swf/productConfig.swf" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="menu" value="false" />';
	html += '<param name="salign" value="LT" />';
	html += '<param name="scale" value="noscale" />';
	html += '<param name="FLASHVARS" value="'+pars+'" />';
	html += '<embed flashvars="'+pars+'" src="swf/productConfig.swf" quality="high" scale="noscale" salign="LT" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
	html += '</object></div>';
	//document.write(html);
	if(document.all && !document.getElementById) {
 		document.all[cntid].innerHTML = html;
	}else{
		document.getElementById(cntid).innerHTML = html;
	}
}


// CHECK FLASH OBJECTS
function checkFlashObjects(){
	printProductConfigSwf();
	printLeftMenuSwf();
}

// FLASH OBJECT RESIZE
function upgradeFlashObj(objName,cntName,nx,ny){
	//setFlashSize(objName,nx,ny);
	setFlashHeight(objName,ny);
	setFlashHeight(cntName,ny);
}
function upgradeFlashObj2(objName,cntName,nx,ny){
	setFlashSize(objName,nx+1,ny);
	//setFlashHeight(objName,ny);
	setFlashHeight(cntName,ny);
}
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
	//alert(newH);
	document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}


// STORE LOCATOR 
function openWhere(wid,label){
	execEmTo(wid,"Contatto da internet: "+label,true);
}

// BEGIN editable --//
var antispamDoamin="cotonella";
var antispamExtension="com";
var antispamEm=[
				["pre","ss"],
				["in","fo"],
				["in","fo"]
				];
// STORE LOCATOR EMAILS //
var antispamEmWhere=[
				["valleaosta"],
				["piemonte"],
				["lombardia"],
				["trentino"],
				["veneto"],
				["friuli"],
				["liguria"],
				["emiliaromagna"],
				["toscana"],
				["umbria"],
				["marche"],
				["lazio"],
				["abruzzo"],
				["molise"],
				["campania"],
				["basilicata"],
				["puglia"],
				["calabria"],
				["sicilia"],
				["sardegna"]
				];
// END OF editable --//

var antispamAct1="mai";
var antispamAct2="lto";
var antispamAct3=":";
var antispamJoin="@";
var antispamSpacer=".";
function getEm(id){
	return antispamEm[id].join("")+antispamJoin+antispamDoamin+antispamSpacer+antispamExtension;
}
function getEmWhere(id){
	return antispamEmWhere[id].join("")+antispamJoin+antispamDoamin+antispamSpacer+antispamExtension;
}
function execEmTo(id,subject,isWhere){
	var ac=antispamAct1+antispamAct2+antispamAct3;
	if(isWhere==true){
		var em=getEmWhere(id);
	}else{
		var em=getEm(id);	
	}
	var fu=ac+em;
	if(subject!=null){
		fu+="?subject="+subject	
	}
	location.href=fu;
}



//-->
