// JavaScript Document

//funzone per le stagioni

function stagioni(sel){
	
	if(sel == null) sel = season;

	if (sel == "estate") {
		document.getElementById('estate').className='estate_h';
		document.getElementById('inverno').className='inverno_n';
		document.getElementById('txtHomeEstate').style.display="block";
		document.getElementById('txtHomeInverno').style.display="none";
	} else {
		document.getElementById('estate').className='estate_n';
		document.getElementById('inverno').className='inverno_h';
		document.getElementById('txtHomeEstate').style.display="none";
		document.getElementById('txtHomeInverno').style.display="block";
	}
	attachFlash(sel);
}

function popUp(str,nome,Xsize,Ysize){
	finestra = window.open('str', 'nome' ,'width='+Xsize+',height='+Ysize+',scrollbars=auto,resizable=no,status=no,location=no,toolbar=no');
}

function preload()
{
	if(!document.images) return;
	var immagini=new Array();

     for (cont=0;cont<arguments.length;cont++)
     {
          immagini[cont]=new Image(10,10);
          immagini[cont].src=arguments[cont];
     }
}

function preloadFlags()
{
	preload("img/flagIt_h.gif", "img/flagEn_h.gif", "img/flagFr_h.gif", "img/flagTd_h.gif");
}

function openPreventivo(lang)
{
	var url = "preventivo" + (lang == null ? "" : "_" + lang ) + ".htm";
	w = 620;
	h = 650;
	x = (screen.width - w)/8;
	y = (screen.height - h)/4;
	{
		window.open(url,'preventivo','top='+y+',left='+x+',width='+w+',height='+h+',status=no,resizable=no,scrolling=auto');
	}
}

function attachFlash(season)
{
	var carousels = (season == "estate" ? summer_carousels : winter_carousels);
	
	var folder = carousels[0] + "_" + language;
	attachCarousel("carousel_1",folder, 463);
	
	folder = carousels[1] + "_" + language;
	attachCarousel("carousel_2",folder, 464);
}

function attachCarousel(div_id, folder, width)
{
	var fo = new FlashObject("swf/home_carousel.swf", div_id + "_movie", width, "208", "8", "#e36a00");
	
	// mandatory parameters
	fo.addParam("menu", false);
	fo.addParam("allowScriptAccess", "always");
	
	// custom parameters
	fo.addVariable("folder", folder);
	if(!fo.write(div_id)){
		document.getElementById("div_id").innerHTML = '<img src="' + folder + '/default.jpg" width="464" height="208"/>';
	}
}
