function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_menuImgRestore() { //v3.0
  var i,x,a=document.MM_mr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_menuImage() { //v3.0
  var i,j=0,x,a=MM_menuImage.arguments; document.MM_mr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_mr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function P7_VScroller(el,dr,ty,oy,spd) { //v1.7 by PVII
 var g,gg,fr,sp,pa='',slw=true,m=false,h,ly;ty=parseInt(ty);
 if((g=MM_findObj(el))!=null){gg=(document.layers)?g:g.style;}else{return;}
 if(dr=="Stop"){if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){pa="px";}
 if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){slw=false;}
 if(spd=="Slow"){sp=(slw)?2:1;fr=(slw)?40:30;}else if(spd=="Medium"){sp=(slw)?4:1;fr=(slw)?40:10;
 }else{sp=(slw)?8:4;fr=(slw)?40:10;}if(spd=="Warp"){sp=5000;}var yy=parseInt(gg.top);if(isNaN(yy)){
 if(g.currentStyle){yy=parseInt(g.currentStyle.top);}else if(document.defaultView&&document.defaultView.getComputedStyle){
 yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}else{yy=0;}}
 if(document.all || document.getElementById){h=parseInt(g.offsetHeight);
 if(!h){h=parseInt(g.style.pixelHeight);}
 }else if(document.layers){h=parseInt(g.clip.height);}ly=ty+parseInt(oy)-h;
 if(dr=="Down"){if(yy>ly){m=true;yy-=sp;if(yy<ly){yy=ly;}}}
 if(dr=="Up"){if(yy<ty){m=true;yy+=sp;if(yy>ty){yy=ty;}}}
 if(dr=="Reset"){gg.top=ty+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if(m){gg.top=yy+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=true;
  eval("g.p7Magic=setTimeout(\"P7_VScroller('"+el+"','"+dr+"',"+ty+","+oy+",'"+spd+"')\","+fr+")");
 }else{g.toMove=false;}
}

function P7AniMagic(el,x,y,a,b,c,s) { //v2.9 PVII-Project Seven Development
 var xx,yy,i,g,elo=el,f="",m=false,d="",pa='px';if(document.layers||window.opera){pa='';}
 x=parseInt(x);y=parseInt(y);var t='g.p7Magic=setTimeout("P7AniMagic(\''+elo+'\','; 
 if((g=MM_findObj(el))!=null){d=(document.layers)?g:g.style;}else{return;}
 if(parseInt(s)>0){eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 xx=parseInt(d.left);if(isNaN(xx)){if(g.currentStyle){xx=parseInt(g.currentStyle.left);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 xx=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));}
 if(isNaN(xx)){xx=0;}}yy=parseInt(d.top);if(isNaN(yy)){if(g.currentStyle){yy=parseInt(g.currentStyle.top);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}
 if(isNaN(yy)){yy=0;}}if(c==1){x+=xx;y+=yy;m=true;c=0;}else if(c==2){m=false;
 if(g.p7Magic){clearTimeout(g.p7Magic);}}else{i=parseInt(a);if(g.p7Magic){clearTimeout(g.p7Magic);}
 if(xx<x){xx+=i;m=true;if(xx>x){xx=x;}}if(xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
 if(yy<y){yy+=i;m=true;if(yy>y){yy=y;}}if(yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if(m){d.left=xx+pa;d.top=yy+pa;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}


function openPopup(theURL) { //v2.0
  window.open(theURL,'popup','scrollbars=yes,width=640,height=340');
}

function DeleteChildren(node){

if(node){

for(var x = node.childNodes.length - 1; x >= 0; x--){

var childNode = node.childNodes[x];
 if(childNode.hasChildNodes()){

DeleteChildren(childNode);

}
node.removeChild(childNode);
   
if(childNode.outerHTML){

childNode.outerHTML = '';

}
childNode=null;   

}
node=null;

}

}

function scrolpos(){
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatibile
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
//	  window.alert( 'Width = ' + myWidth );
//	  window.alert( 'Height = ' + myHeight );

		var scrolleft = myWidth - 50;
		document.getElementById('scrolcontrol').style.left = scrolleft+'px';
}

function resipos(){

	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatibile
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
//	  window.alert( 'Width = ' + myWidth );
//	  window.alert( 'Height = ' + myHeight );

		var annoleft = myWidth - 47;
		var gapWidth = myWidth - 50;
		var backer = document.getElementById('backer');

//		alert (screen.width);
		{
			for (var n = 10 ; n > 0; n--){
				if (document.getElementById){
					var anno=document.getElementById('annoDIV'+n);
		//			var opera=document.getElementById('operaDIV'+n);
					var annopos= (350*10)-(350*n)+74;
				}
			anno.style.top = annopos+'px';
			anno.style.left = annoleft+'px';
		}
//		alert (backer.style.width);
//		alert (timescroll.style.width);
		{
			for (var y = 2011; y > 1964; y--)
				if (document.getElementById){
					var gapDIV = document.getElementById('g'+y);
					var gappos = (70*(2011-y))+10;
					gapDIV.style.width = gapWidth+'px';
					gapDIV.style.top = gappos+'px';
				}
		}
	}
}

function ristpos(){

	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatibile
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
//	  window.alert( 'Width = ' + myWidth );
//	  window.alert( 'Height = ' + myHeight );

		var annoleft = myWidth - 47;
		var gapWidth = myWidth - 50;
		var backer = document.getElementById('backer');

//		alert (screen.width);
		{
			for (var n = 7 ; n > 0; n--){
				if (document.getElementById){
					var anno=document.getElementById('annoDIV'+n);
		//			var opera=document.getElementById('operaDIV'+n);
					var annopos= (350*7)-(350*n)+74;
				}
			anno.style.top = annopos+'px';
			anno.style.left = annoleft+'px';
		}
//		alert (backer.style.width);
//		alert (timescroll.style.width);
		{
			for (var y = 2011; y > 1977; y--)
				if (document.getElementById){
					var gapDIV = document.getElementById('g'+y);
					var gappos = (70*(2011-y))+10;
					gapDIV.style.width = gapWidth+'px';
					gapDIV.style.top = gappos+'px';
				}
		}
	}
}

function changeOp(n) {
	var footer = document.getElementById('footer');
	  if (n == 1){
		footer.setAttribute("class", "footer1"); 
		footer.setAttribute("className", "footer1"); 
	  }
	  
	  else {
		footer.setAttribute("class", "footer0"); 
		footer.setAttribute("className", "footer0"); 
	  }
}

/* function place_controls(pagina) {
	var place = document.getElementById('controls');
	if (pagina == 'home' || pagina == ''){
		place.innerHTML = "<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('printlink','','img/print_1.gif',1)\" href=\"javascript: openstampa('shared/stampa.php?doc="+pagina+"');\"><img id=\"printlink\" alt=\"\" border=\"0\" src=\"img/print_0.gif\" /></a>&nbsp;<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('aumentalink','','img/aumenta_1.gif',1)\" href=\"javascript:aumentaFontSize();\"><img id=\"aumentalink\" alt=\"\" border=\"0\" src=\"img/aumenta_0.gif\" /></a>&nbsp;<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('riducilink','','img/riduci_1.gif',1)\" href=\"javascript:riduciFontSize();\"><img id=\"riducilink\" alt=\"\" border=\"0\" src=\"img/riduci_0.gif\" /></a>";
	}
	else {
		place.innerHTML = "<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('printlink','','img/print_1.gif',1)\" href=\"javascript: openstampa('shared/stampa.php?doc="+pagina+"');\">dsdsd<img id=\"printlink\" alt=\"\" border=\"0\" src=\"img/print_0.gif\" /></a>&nbsp;<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('aumentalink','','img/aumenta_1.gif',1)\" href=\"javascript:aumentaFontSize();\"><img id=\"aumentalink\" alt=\"\" border=\"0\" src=\"img/aumenta_0.gif\" /></a>&nbsp;<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('riducilink','','img/riduci_1.gif',1)\" href=\"javascript:riduciFontSize();\"><img id=\"riducilink\" alt=\"\" border=\"0\" src=\"img/riduci_0.gif\" /></a>";
	}
} */

function openstampa(documento) {
	window.open(documento,'popupstampa','scrollbars=yes,width=640,height=340');
//	popupstampa.focus;
}

function annullastampa() {
	top.window.close();
}


var min=8;
var max=18;
function aumentaFontSize() {
   var page=document.getElementById('page');
   var p = page.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
   var a = page.getElementsByTagName('a');
   for(i=0;i<a.length;i++) {
      if(a[i].style.fontSize) {
         var s = parseInt(a[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      a[i].style.fontSize = s+"px"
   }
   var li = page.getElementsByTagName('li');
   for(i=0;i<li.length;i++) {
      if(li[i].style.fontSize) {
         var s = parseInt(li[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      li[i].style.fontSize = s+"px"
   }
   var hq = page.getElementsByTagName('h4');
   for(i=0;i<hq.length;i++) {
      if(hq[i].style.fontSize) {
         var s = parseInt(hq[i].style.fontSize.replace("px",""));
      } else {
         var s = 14;
      }
      if(s!=max) {
         s += 1;
      }
      hq[i].style.fontSize = s+"px"
   }
}
function riduciFontSize() {
   var page=document.getElementById('page');
   var p = page.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
   var a = page.getElementsByTagName('a');
   for(i=0;i<a.length;i++) {
      if(a[i].style.fontSize) {
         var s = parseInt(a[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      a[i].style.fontSize = s+"px"
   }
   var li = page.getElementsByTagName('li');
   for(i=0;i<li.length;i++) {
      if(li[i].style.fontSize) {
         var s = parseInt(li[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      li[i].style.fontSize = s+"px"
   }
   var hq = page.getElementsByTagName('h4');
   for(i=0;i<hq.length;i++) {
      if(hq[i].style.fontSize) {
         var s = parseInt(hq[i].style.fontSize.replace("px",""));
      } else {
         var s = 14;
      }
      if(s!=min) {
         s -= 1;
      }
      hq[i].style.fontSize = s+"px"
   }
}

function sendmail(){
	
//	alert(document.f_mail.nome.value);
	
	if (document.f_mail.nome.value == ''){
		alert('nome mancante');
		document.f_mail.nome.focus();
	} else if (document.f_mail.youremail.value == ''){
		alert('indirizzo email mancante');
		document.f_mail.youremail.focus();
	} else if (document.f_mail.object.value == ''){
		alert('oggetto email mancante');
		document.f_mail.object.focus();
	} else if (document.f_mail.testo.value == ''){
		alert('testo email mancante');
		document.f_mail.testo.focus();
	} else {
//		document.f_mail.action=window.open('sendmail.php?nome='+ditta,'Mail','');
		document.f_mail.action='shared/sendmail.php';
		document.f_mail.submit();
//		document.location.href='index.php';
	}
}

function sendrequest(){
	
//	alert(document.f_mail.nome.value);
	
	if (document.f_mail.nome.value == ''){
		alert('nome mancante');
		document.f_mail.nome.focus();
	} else if (document.f_mail.youremail.value == ''){
		alert('indirizzo email mancante');
		document.f_mail.youremail.focus();
	} else if (document.f_mail.object.value == ''){
		alert('oggetto email mancante');
		document.f_mail.object.focus();
	} else if (document.f_mail.testo.value == ''){
		alert('testo email mancante');
		document.f_mail.testo.focus();
	} else if (document.f_mail.privacyNO.checked == true){
		alert('E\' necessario prestare il consenso');
		document.f_mail.privacySI.focus();
	} else {
//		document.f_mail.action=window.open('sendmail.php?nome='+ditta,'Mail','');
		document.f_mail.action='shared/sendmail.php';
		document.f_mail.submit();
//		document.location.href='index.php';
	}/*	var server=document.getElementById('ajaxpath').value;
	if (window.XMLHttpRequest)
		req = new XMLHttpRequest();
	else if (window.ActiveXObject)
		req = new ActiveXObject("Microsoft.XMLHTTP");
	else{
		alert('il browser non supporta chiamate AJAX');
		return false;
	}
	var url='http://'+server+'/schede/sendmail.php?nome='+ditta;
	alert(url);
	req.open('GET', url, false);
	req.send(null);
	if(req.status == 200)
	{
		var rc = req.responseText;
		alert(rc);
	}
	hidemail();
*/
}