function trim(Stringa) {
	return Stringa.replace(/^\s+|\s+$/g,"")
	}

function centra(){
	

		if(window.innerHeight>543){
			winH = window.innerHeight;
			}
		if(document.body.clientHeight>543){
			winH = document.body.clientHeight;
			}
		if(document.documentElement.clientHeight>543){
			winH = document.documentElement.clientHeight;
			}
			
		if(winH){
				temp=(winH-543)/2;
				
				_gb('main').style.top=temp+"px";
				
				_gb('body').style.background=" url(img/sf_fascia.jpg)  repeat-x #BDCED8 0px "+temp+"px ";
				_gb('main').style.visibility="visible";
				if(_gb('ZoomCenter')){
				_gb('ZoomCenter').style.top=temp+"px";
			}		
		}
	}
	
	
function _gb(Id){
	return document.getElementById(Id);
	}

/* 
 * Cross-browser event handling, by Scott Andrew
 */
 
function addEvent(element, eventType, lamdaFunction, useCapture) {
    if (element.addEventListener) {
        element.addEventListener(eventType, lamdaFunction, useCapture);
        return true;
    } else if (element.attachEvent) {

		element.detachEvent('on' + eventType, lamdaFunction);
        var r = element.attachEvent('on' + eventType, lamdaFunction);
        return r;
    } else {
        return false;
    }
}

 


// JavaScript Document
function includeSwf(FlashVars,src,width,height,id)
{
	document.write(
    '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="'+id+'" align="middle">\n'+
      '<param name="FlashVars" value="'+FlashVars+'">\n'+
      '<param name="allowScriptAccess" value="always" />\n'+
      '<param name="movie" value="'+src+'" />\n'+
      '<param name="quality" value="high" />\n'+
      ' <param name="wmode" value="transparent" />\n'+
      '<embed src="'+src+'" wmode="transparent" quality="high" bgcolor="#000000" FlashVars="'+FlashVars+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'+
    '</object>');
}

function AddClickFoto(){
	ArrayATag=document.getElementsByTagName('a');
	for (i=0;i<ArrayATag.length;i++){
		if(ArrayATag[i].getAttribute("zoom")){
			addEvent(ArrayATag[i], 'click', ApriFoto, false)
		}
		}
	}

function ApriFoto(e){
	var target = window.event ? window.event.srcElement : e ? e.target : null;
	_gb('ZoomImg').src=target.getAttribute('zoom');
	_gb('ZoomImgTitolo').firstChild.nodeValue=target.getAttribute('titolo');
	_gb('ZoomImgDescrizione').firstChild.nodeValue=target.getAttribute('descrizione');
	_gb('ZoomBox').style.display="block";
	}
	
function ChiudiFoto(){
	_gb('ZoomBox').style.display="none";
	}

