		window.onload = function() {
				
				
				var elenco_menu = $$('div.type3');
				
				for ( i=0; i<elenco_menu.length; i++ ) {
					if(elenco_menu[i].className.substr(0,10)!='type3 open'){
						elenco_menu[i].style.display='none';
						
					}
				}
				
				
				if($('rightTab2')) $('rightTab2').style.display = 'none';				
				if($('rightTab4')) $('rightTab4').style.display = 'none';
				if($('tabRic2')) $('tabRic2').style.display = 'none';

				if($('slider1')){
					new Control.Slider('sele1','slider1',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele1')}	});
				   
					new Control.Slider('sele2','slider2',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele2')}	});
				   
					new Control.Slider('sele3','slider3',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele3')}	});
				   
					new Control.Slider('sele4','slider4',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele4')}	});
				   
					new Control.Slider('sele5','slider5',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele5')}	});
				   
					new Control.Slider('sele6','slider6',{range:$R(0,47),values:[0,16,32,47],onChange:function(v){changeValue(v,'sele6')}	});	
				}
				
				if($('scroll')){
					widthDiv = getDimensionScroll();
					timeScroll = '';
					$('contScroll').style.width = 50+parseInt(widthDiv)+'px';
					$('scrollGallery').style.width = '450px';
				}
				
				size=getCookie("fontsize");             //reperisce il cookie
				if(size!=null) SetFontSize(size);      //setta le impostazioni
				
				if($('menu6')){
					cloudTag();					
				}
				
				if($('mediaCenterScelte')){
					changeOrder('zona',$('standardORD'))
				}
		}
		
		function changeValue(position,divs){
			
			if(position==0) valore=0;
			else if(position==16) valore=1;
			else if(position==32) valore=2;
			else if(position==47) valore=3;
			
			
			inputValue = divs.replace('sele','int_');
			$(inputValue).value = valore;
			mostra=false;
			hideTip()
			showTip($(divs).firstChild);
		}
	
		function showTip(links){
			mostra=true;

			divs = links.parentNode;
			if(!$('tooltip')){
			
				idDiv = divs.id;
							
				var inputValue = divs.id.replace('sele','int_');
				var position = $(inputValue).value;
				
				if(position==0) valore='nullo';
				else if(position==1) valore='basso';
				else if(position==2) valore='medio';
				else if(position==3) valore='alto';
				
				var stringInterest = 'Livello d’interesse: '+valore;
				
				tooltip ='<div id="tooltip" onmousemove="checkTooltip()" onmouseout="offTooltip()"><img src="i/bg_tooltipInterest.png" width="134" height="31" class="pngImage"/><div>'+stringInterest+'</div></div>';
				
				$(divs).innerHTML+=tooltip;
			}
		}		
		function offTooltip(){		
			mostra = false;
			time = setTimeout('hideTip()',400);
		}
		function checkTooltip(){
			mostra = true;	
			hideTip();
		}
		function hideTip(){
			
			if (mostra==true){
				clearTimeout(time);
			}
			else{
				if($('tooltip')) Element.remove('tooltip');
			}
		}
		
		
		function blindMenu(elementoLink,id){
			var idMenu = 'menu'+id;
			var listaLink = elementoLink.parentNode.getElementsByTagName('a');
			
			if($(idMenu).style.display=='none'){
				if(listaLink.length>1){
					listaLink[0].firstChild.src = 'i/ico_close.gif';
					listaLink[1].className = 'open';
				}
				else{
					listaLink[0].className = 'open';					
				}
				
				Effect.BlindDown(idMenu,{
								   	duration:0.4,
									scaleTo:80,
									scaleFrom:0,
									transition:Effect.Transitions.sinoidal
								   });	
			}
			else{
				if(listaLink.length>1){
					listaLink[0].firstChild.src = 'i/ico_open.gif';
					listaLink[1].className = '';
				}
				else{
					listaLink[0].className = '';					
				}
				Effect.BlindUp(idMenu,{
								   	duration:0.6,
									scaleTo:0,
									scaleFrom:80,
									transition:Effect.Transitions.sinoidal
								   });		
			}
		}
		
		function changeRightTab(elementoLink,divToshow,divTohide){
			if(	$(divToshow).style.display=='none'){
				$(divTohide).style.display='none';
				$(divToshow).style.display='block';
				
				var divTitle = elementoLink.parentNode.parentNode;
				var divTabBox = divTitle.parentNode;
				
				var divAcceso = Element.select(divTabBox, 'div.titleRed');
				divAcceso[0].className = divAcceso[0].className.replace('Red','Grey');
				
				var immagini = divAcceso[0].getElementsByTagName('img');
				immagini[0].src = immagini[0].src.replace('Red','Grey');
				immagini[1].src = immagini[1].src.replace('Red','Grey');
				
				divTitle.className = divTitle.className.replace('Grey','Red');
				
				var immagini = divTitle.getElementsByTagName('img');
				immagini[0].src = immagini[0].src.replace('Grey','Red');
				immagini[1].src = immagini[1].src.replace('Grey','Red');
			}
		}


function showDidascalia(testo){
		$('didascalia').innerHTML = testo;
}


function scrollGal(dir,mode){
	if ( mode == 'up'){
		clearTimeout(timeScroll);
	}
	else{
		var move = true;	
		var widthScroll = getDimensionScroll();
		
		var widthDiff = $('scrollGallery').style.width.replace('px','') - widthScroll;
		if ($('scroll').style.left=='') $('scroll').style.left='0px';
		
		
		if(dir=='right'){
			var segno='-';
			if ( $('scroll').style.left.replace('px','') <= widthDiff ){
				var move = false;	
			}
		}
		else{
			var segno='+';
			if(	$('scroll').style.left.replace('px','') >=0){
				var move = false;	
			}
		}
		
		if(move){
			
				new Effect.Move('scroll',{
						x:segno+10,
						y:0,
						mode:'relative',
						duration:0.1,
						transition:Effect.Transitions.sinoidal
								}
						)
				timeScroll = setTimeout(	'scrollGal(\''+dir+'\',\''+mode+'\')', 100	);
		}
	}
	
	
}

function getDimensionScroll(){
	var widthDiv = $('scroll').getElementsByTagName('img').length;
	widthDiv++;
	widthDiv = (widthDiv * 2) + (widthDiv * 100);
	return widthDiv;
}

//EO GALLERIA


function SetFontSize(s){
	if(s=='') s=='0.7';
	document.getElementsByTagName('body')[0].style.fontSize = s+'em';
	setCookie("fontsize",s,30);
}

function setCookie(name, value, expdays) {   //memorizza il cookie
	var now = new Date();
	var exp = new Date(now.getTime() + (1000*60*60*24*expdays));
	document.cookie = name + "=" + escape(value) + ";" + "expires=" + exp.toGMTString() + ";" + "path=/";
}

function getCookie(name) {    //restituisce il cookie
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		var start = dc.indexOf(cname);
		if (start != -1) {
			start += cname.length;
			var stop = dc.indexOf(";", start);
			if (stop == -1) stop = dc.length;
			return unescape(dc.substring(start,stop));
			}
		}
	return null;
}
//EO RESIZE TEXT

function cloudTag(){
		if(document.all) {
			var http = new ActiveXObject("Microsoft.XMLHTTP");
			http.open("GET", 'xml/highlights.xml', false);
			http.send(null);
			xmlDoc = http.responseXML;
			lista = xmlDoc.getElementsByTagName('highlights')[0].getElementsByTagName('parola');
		
			for(var i=0; i<lista.length; i++){		
				importanza = lista[i].getAttribute('position');
				parola = lista[i].getAttribute('testo');
				grandezza = 0.7 * (importanza/10 +1)
				var div = '<div style="font-size:'+grandezza+'em">'+parola+'</div>';
				$('cloud').innerHTML += div;
			}
			
		} else {
			var xmlDoc = new Ajax.Request('xml/highlights.xml', {
										  method: 'get',
										  onSuccess: function(ajax){ 


				this.xmlDoc = ajax.responseXML;
		
			
				lista = this.xmlDoc.getElementsByTagName('highlights')[0].getElementsByTagName('parola');
		
				for(var i=0; i<lista.length; i++){		
					importanza = lista[i].getAttribute('position');
					parola = lista[i].getAttribute('testo');
					grandezza = 0.7 * (importanza/10 +1)
					var div = '<div style="font-size:'+grandezza+'em">'+parola+'</div>';
					$('cloud').innerHTML += div;
				}																					   
			}});
		}
			
		
}

function showMeteo(tagPeriodo,div){
	
	if (div.className=='img'){
		padre = div.parentNode.parentNode;
		
		div_acceso =$$('div.img.choose');
		div_acceso[0].className='img';
		div.className='img choose';
		
		
		
		
		
		if(document.all) {
		
			var http = new ActiveXObject("Microsoft.XMLHTTP");
			http.open("GET", 'xml/meteo.xml', false);
			http.send(null);
			xmlDoc = http.responseXML;
			lista = xmlDoc.getElementsByTagName('meteo')[0].getElementsByTagName(tagPeriodo)[0];
			
			$('fotoMeteo').innerHTML='<img src="i/'+lista.getElementsByTagName('img')[0].firstChild.nodeValue+'" />';
			$('meteo_situazione').innerHTML = lista.getElementsByTagName('situazione')[0].firstChild.nodeValue;
			$('meteo_stato').innerHTML = lista.getElementsByTagName('stato')[0].firstChild.nodeValue;
			$('meteo_venti').innerHTML = lista.getElementsByTagName('venti')[0].firstChild.nodeValue;
			$('meteo_mari').innerHTML = lista.getElementsByTagName('mari')[0].firstChild.nodeValue;
			$('meteo_temperature').innerHTML = lista.getElementsByTagName('temperature')[0].firstChild.nodeValue;	
	
		} else {
			var xmlDoc = new Ajax.Request('xml/meteo.xml', {
										  method: 'get',
										  onSuccess: function(ajax){ 

				this.xmlDoc = ajax.responseXML;
				lista = this.xmlDoc.getElementsByTagName('meteo')[0].getElementsByTagName(tagPeriodo)[0];
				Element.cleanWhitespace(lista);
				
				$('fotoMeteo').innerHTML='<img src="i/'+lista.getElementsByTagName('img')[0].firstChild.nodeValue+'" />';
				$('meteo_situazione').innerHTML = lista.getElementsByTagName('situazione')[0].firstChild.nodeValue;
				$('meteo_stato').innerHTML = lista.getElementsByTagName('stato')[0].firstChild.nodeValue;
				$('meteo_venti').innerHTML = lista.getElementsByTagName('venti')[0].firstChild.nodeValue;
				$('meteo_mari').innerHTML = lista.getElementsByTagName('mari')[0].firstChild.nodeValue;
				$('meteo_temperature').innerHTML = lista.getElementsByTagName('temperature')[0].firstChild.nodeValue;				
				
				
																	}
															}
										);
		}
			
	}
}


function changeOrder(campo,elementoLink){
	
	$('listMediacenter').innerHTML='loading...';
	var linkAcceso = Element.select($('mediaCenterScelte'), 'a.choose');
	
	linkAcceso[0].className = '';
	elementoLink.className = 'choose';
	
		if(document.all) {
		
			var http = new ActiveXObject("Microsoft.XMLHTTP");
			http.open("GET", 'xml/media_center.xml?ordinamento='+campo, false);
			http.send(null);
			xmlDoc = http.responseXML;
			
			lista = xmlDoc.getElementsByTagName('media')[0].getElementsByTagName('lista');
				
				var testo='';			
				for (i=0; i<lista.length; i++){
				testo += '<div class="boxMediacenter">'+
								'<div class="header">'+lista[i].getAttribute('nome')+'</div>'+
								'<div class="middle">';
							
					lista2= lista[i].getElementsByTagName('item');
					Element.cleanWhitespace(lista2);
					for (j=0; j<lista2.length; j++){
						testo+='<div class="rigo">'+
                            	'<div class="col1">'+
                                	'<div class="title">'+lista2[j].getElementsByTagName('autore')[0].getAttribute('nome')+'</div>'+
                                	'<div class="testo">'+lista2[j].getElementsByTagName('autore')[0].firstChild.nodeValue+'</div>'+
                                '</div>'+
                                '<div class="col2">'+
                                	'<div class="title">'+lista2[j].getElementsByTagName('zona')[0].getAttribute('luogo')+'</div>'+
                                	'<div class="testo">'+lista2[j].getElementsByTagName('zona')[0].firstChild.nodeValue+'</div>'+
                                '</div>'+
                                '<div class="col3"><img src="i/ico_mc_'+lista2[j].getElementsByTagName('file')[0].getAttribute('tipo')+'.gif" alt="'+lista2[j].getElementsByTagName('file')[0].getAttribute('titolo')+'" /></div>'+
                                '<div class="col4">'+lista2[j].getElementsByTagName('file')[0].getAttribute('peso')+'</div>'+
                                '<div class="col5">'+
                                	'<div class="roundButton">'+
                                        '<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
                                        '<div class="corpoCen"><a href="'+lista2[j].getElementsByTagName('file')[0].firstChild.nodeValue+'" title="'+lista2[j].getElementsByTagName('file')[0].getAttribute('titolo')+'">DOWNLOAD</a></div>'+
                                        '<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>'+
                                    '</div>'+
                                '</div>'+
                                '<div class="col6">'+
                                    '<div class="roundButton">';
									
									if(lista2[j].getElementsByTagName('file')[0].getAttribute('mobile')==1){
										
                                       testo+='<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
                                        '<div class="corpoCen"><a href="#" title="testo_indicativo">MOBILE</a></div>'+
                                        '<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>';
									}
									
                                    testo+='</div>'+
                                '</div>'+
                                '<div class="clear"><br class="clear" /></div>'+
                           ' </div>';
							
							
							
						}
							testo+='<div class="other">'+
										'<div class="roundButton">'+
											'<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
											'<div class="corpoCen"><a href="#" title="testo_indicativo">PI&Ugrave; ELEMENTI</a></div>'+
											'<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>'+
										'</div>'+
										'<div class="clear"><br class="clear" /></div>'+
									'</div>'+
								'</div>'+
								'<div class="footer"><img src="i/bottomBoxMediacenter.gif" width="745" height="4" alt="testo_indicativo" /></div>';
								
					
				}
				$('listMediacenter').innerHTML=testo;
							
	
		} else {
			var xmlDoc = new Ajax.Request('xml/media_center.xml', {
										  method: 'get',
										  param: 'ordinamento='+campo,
										  onSuccess: function(ajax){ 

				this.xmlDoc = ajax.responseXML;
				lista = this.xmlDoc.getElementsByTagName('media')[0].getElementsByTagName('lista');
				Element.cleanWhitespace(lista);
				var testo='';			
				for (i=0; i<lista.length; i++){
				testo += '<div class="boxMediacenter">'+
								'<div class="header">'+lista[i].getAttribute('nome')+'</div>'+
								'<div class="middle">';
							
					lista2= lista[i].getElementsByTagName('item');
					Element.cleanWhitespace(lista2);
					for (j=0; j<lista2.length; j++){
						testo+='<div class="rigo">'+
                            	'<div class="col1">'+
                                	'<div class="title">'+lista2[j].getElementsByTagName('autore')[0].getAttribute('nome')+'</div>'+
                                	'<div class="testo">'+lista2[j].getElementsByTagName('autore')[0].firstChild.nodeValue+'</div>'+
                                '</div>'+
                                '<div class="col2">'+
                                	'<div class="title">'+lista2[j].getElementsByTagName('zona')[0].getAttribute('luogo')+'</div>'+
                                	'<div class="testo">'+lista2[j].getElementsByTagName('zona')[0].firstChild.nodeValue+'</div>'+
                                '</div>'+
                                '<div class="col3"><img src="i/ico_mc_'+lista2[j].getElementsByTagName('file')[0].getAttribute('tipo')+'.gif" alt="'+lista2[j].getElementsByTagName('file')[0].getAttribute('titolo')+'" /></div>'+
                                '<div class="col4">'+lista2[j].getElementsByTagName('file')[0].getAttribute('peso')+'</div>'+
                                '<div class="col5">'+
                                	'<div class="roundButton">'+
                                        '<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
                                        '<div class="corpoCen"><a href="'+lista2[j].getElementsByTagName('file')[0].firstChild.nodeValue+'" title="'+lista2[j].getElementsByTagName('file')[0].getAttribute('titolo')+'">DOWNLOAD</a></div>'+
                                        '<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>'+
                                    '</div>'+
                                '</div>'+
                                '<div class="col6">'+
                                    '<div class="roundButton">';
									
									if(lista2[j].getElementsByTagName('file')[0].getAttribute('mobile')==1){
										
                                       testo+='<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
                                        '<div class="corpoCen"><a href="#" title="testo_indicativo">MOBILE</a></div>'+
                                        '<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>';
									}
									
                                    testo+='</div>'+
                                '</div>'+
                                '<div class="clear"><br class="clear" /></div>'+
                           ' </div>';
							
							
							
						}
							testo+='<div class="other">'+
										'<div class="roundButton">'+
											'<div class="angSx"><img src="i/button_left.gif" alt="testo_indicativo" /></div>'+
											'<div class="corpoCen"><a href="#" title="testo_indicativo">PI&Ugrave; ELEMENTI</a></div>'+
											'<div class="angDx"><img src="i/button_right.gif" alt="testo_indicativo" /></div>'+
										'</div>'+
										'<div class="clear"><br class="clear" /></div>'+
									'</div>'+
								'</div>'+
								'<div class="footer"><img src="i/bottomBoxMediacenter.gif" width="745" height="4" alt="testo_indicativo" /></div>';
								
					
				}
				$('listMediacenter').innerHTML=testo;
																	}
															}
										);
		}
	
	
}

function loadCanali(limit){
	if(document.all) {
		altezza = $('footer').offsetTop-358;
	}
	else{
		altezza = $('footer').offsetTop-338;
	}
	
	if(limit!=0){
		idDiv = 'listaCanali';
	}
	else{
		idDiv = 'listaCanaliBig';
		newDIV = Builder.node( 'div', {id:'listaCanaliBigCont'});
		
		newDIV.innerHTML = '<div class="canale">'+
				'<div class="whiteBoxImgBig"><img src="i/canaleTop.png" alt="testo_indicativo" class="pngImage" width="993" height="16" /></div>'+
				'<div class="whiteBoxBig popup">'+
					'<div class="listaBoxCanale">'+
						'<div class="icoVedi">'+
							 '<div class="roundButton">'+
								'<div class="angSx"><img src="i/button_left.gif" /></div>'+
								'<div class="corpoCen"><a href="#" title="testo_indicativo" onclick="closeDiv(\'listaCanaliBigCont\');">CHIUDI</a></div>'+
								'<div class="angDx"><img src="i/button_right_su.gif" /></div>'+
							'</div>'+            
							'<div class="clear"><br class="clear" /></div>'+
						'</div>'+
						'<div class="clear"><br class="clear" /></div>'+
						'<div id="listaCanaliBig">'+
						'</div>'+
					'</div>'+
				'</div>'+
				'<div class="whiteBoxImg"><img src="i/canaleBottom.png" alt="testo_indicativo" class="pngImage" height="16" width="993" /></div>'+
			
		'</div>';
	
		$('contentWhiteBox').appendChild(newDIV);
	}
	
	
	$(idDiv).innerHTML='loading';
	total=Builder.node( 'div');
	rigo = Builder.node( 'div', {className:'rigoCanale'});		
	
			if(document.all) {
		
				var http = new ActiveXObject("Microsoft.XMLHTTP");
				http.open("GET", 'xml/canale.xml', false);
				http.send(null);
				xmlDoc = http.responseXML;
				lista = xmlDoc.getElementsByTagName('canale')[0].getElementsByTagName('item');
					
					
					for (i=0;i<lista.length;i++){
						cont=i+1;
						
						boxCanale = Builder.node( 'div', {className:'boxCanale'});
	
						ico = Builder.node( 'div', {className:'ico'}, [Builder.node( 'img', {src:'i/'+lista[i].getElementsByTagName('ico')[0].firstChild.nodeValue})] );
						title = Builder.node( 'div', {className:'title'},lista[i].getElementsByTagName('title')[0].firstChild.nodeValue);
						title_img = Builder.node('img', {src:'i/ico_arrowLink.gif',style: 'width:7px;height:7px;'});
						elenco = Builder.node( 'ul', {className:'elenco'})
						
						lista2 = lista[i].getElementsByTagName('voci')[0].getElementsByTagName('elem');
						if(limit!=0){
							var fine = limit;	
						}
						else{
							var fine = lista2.length;
						}
						for (var j=0;j<fine;j++){
							li = Builder.node('li',[Builder.node('a',{href: lista2[j].getAttribute('link')},lista2[j].firstChild.nodeValue)]);
							elenco.appendChild(li);						
						}					
						
						boxCanale.appendChild(ico);
						title.appendChild(title_img);
						boxCanale.appendChild(title);
						boxCanale.appendChild(elenco);
						rigo.appendChild(boxCanale);
						
						
						if(((cont%4)==0) && (cont!=0)){
						
							clearDiv = Builder.node( 'div', {className:'clear'}, [Builder.node( 'br', {className:'clear'})] );
							
							rigo.appendChild(clearDiv);
							total.appendChild(rigo);
							rigo=Builder.node( 'div', {className:'rigoCanale'});			
						}						
					}
					$(idDiv).innerHTML=$(idDiv).innerHTML.replace('loading','');
					$(idDiv).appendChild(total);
																
																
		
			} else {
				var xmlDoc = new Ajax.Request('xml/canale.xml', {
											  method: 'get',
											  onSuccess: function(ajax){ 
	
					this.xmlDoc = ajax.responseXML;
					lista = this.xmlDoc.getElementsByTagName('canale')[0].getElementsByTagName('item');
					Element.cleanWhitespace(lista);
					
					for (i=0;i<lista.length;i++){
						cont=i+1;
						
						boxCanale = Builder.node( 'div', {className:'boxCanale'});
	
						ico = Builder.node( 'div', {className:'ico'}, [Builder.node( 'img', {src:'i/'+lista[i].getElementsByTagName('ico')[0].firstChild.nodeValue})] );
						title = Builder.node( 'div', {className:'title'},lista[i].getElementsByTagName('title')[0].firstChild.nodeValue);
						title_img = Builder.node('img', {src:'i/ico_arrowLink.gif',style: 'width:7px;height:7px;'});
						elenco = Builder.node( 'ul', {className:'elenco'})
						
						lista2 = lista[i].getElementsByTagName('voci')[0].getElementsByTagName('elem');
						if(limit!=0){
							var fine = limit;	
						}
						else{
							var fine = lista2.length;
						}
						for (var j=0;j<fine;j++){
							li = Builder.node('li',[
								Builder.node('a',{href:lista2[j].getAttribute('link')}, lista2[j].firstChild.nodeValue)
							]);

							elenco.appendChild(li);						
						}					
						
						boxCanale.appendChild(ico);
						title.appendChild(title_img);
						boxCanale.appendChild(title);
						boxCanale.appendChild(elenco);
						rigo.appendChild(boxCanale);
						
						
						if(((cont%4)==0) && (cont!=0)){
						
							clearDiv = Builder.node( 'div', {className:'clear'}, [Builder.node( 'br', {className:'clear'})] );
							
							rigo.appendChild(clearDiv);
							total.appendChild(rigo);
							rigo=Builder.node( 'div', {className:'rigoCanale'});			
						}						
					}
					$(idDiv).innerHTML=$(idDiv).innerHTML.replace('loading','');
					$(idDiv).appendChild(total);
																
																}}
											);
			}

	
}


function closeDiv(idDiv){
	$(idDiv).remove();	
}



function addFlash(u, w, h, t, s, va, ha, n, b, v){

    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + w + '" height="' + h + '" id="' + n + '" align="middle" >');
    document.write('<param name="allowScriptAccess" value="sameDomain" />');
    document.write('<param name="allowFullScreen" value="false" />');
    document.write('<param name="movie" value="' + u + '" />');
    document.write('<param name="quality" value="high" />');
    if (s == 'y') {
        document.write('<param name="scale" value="noscale" />');
        var vaPar = '', haPar = '';
        if (va == 'top') {
			vaPar = 't';
        }
        if (va == 'bottom') {
            vaPar = 'b';
        }
        if (va == 'middle') {
            vaPar = '';
        }
        if (ha == 'left') {
            haPar = 'l';
        }
        if (ha == 'right') {
            haPar = 'r';
        }
        if (ha == 'middle') {
            haPar = '';
        }        
        document.write('<param name="salign" value="' + vaPar + '' + haPar + '" />');        
    }
    if (b != '') {
        document.write('<param name="bgcolor" value="' + b + '" />');
    }
    if (t == 'y') {
        document.write('<param name="wmode" value="transparent">');
    }
    if (v != 'n') {
        document.write('<param name="flashvars" value="' + v + '">');
    }
    document.write('<embed src="' + u + '" quality="high"');	
	if (s == 'y') {
        document.write(' scale="noscale"');
        var vaPar = '', haPar = '';
        if (va == 'top') {
            vaPar = 't';
        }
        if (va == 'bottom') {
            vaPar = 'b';
        }
        if (va == 'middle') {
            vaPar = '';
        }
        if (ha == 'left') {
            haPar = 'l';
        }
        if (ha == 'right') {
            haPar = 'r';
        }
        if (ha == 'middle') {
            haPar = '';
        }        
        document.write(' "salign="' + vaPar + '' + haPar + '"');        
    };
	if (b != '') {	
		document.write(' bgcolor="' + b + '"');
	};	
	if (t == 'y') {
        document.write(' wmode="transparent"');
    };
    if (v != 'n') {
        document.write(' flashvars="' + v + '"');
    };
    document.write(' width="' + w + '" height="' + h + '" name="' + n + '"');
    document.write(' align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
}

// get element by ID (with browser check)
function getObj(objID){
	if (!document.getElementById)	return null;	// not compatible
	//else
	return document.getElementById(objID);
}

// show and hide DIV
function alternateShow(divToShow,divToHide) {

	// hide
	if (divToHide!=null&&divToHide.style!=null) {
		divToHide.style.display = "none";
	}

	// show
	if (divToShow!=null&&divToShow.style!=null) {
		divToShow.style.display = "block";
	}
}
		// cambio tab
		var oldtab="tabIndirizzi";
		function swapTab(newTab)	{
			if (oldtab==newTab)	return;
			var obj=getObj(newTab);
			if (!obj)	return;
			alternateShow(obj,getObj(oldtab));
			oldtab=newTab;
		}
		
		var oldLog="";
			function swapLog(newLog)	{
			if (oldLog==newLog)	return;
			var obj=getObj(newLog);
			if (!obj)	return;
			alternateShow(obj,getObj(oldLog));
			oldLog=newLog;
		}
		
		function popwin( url, width, height) {
			var outStr = 'height=' + height + ',width=' + width;
			var sname="Privacy";
			outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,top=0,left=0';
			window.open(url, sname, outStr);
			}	
