// JavaScript Document
<!--
if (!lang) {var lang='it';}

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_preloadImages() { //v3.0
  var d=document; if(d.img){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimg.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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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 Disclaimer() { 
 window.open('disclaimer.html','Disclaimer','toolbar=0,location=0,status=1,menubar=0,scrollbars=yes,resizable=0,width=650,height=500')
}

function Credits() { 
 window.open('credits.html','Credits','toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,width=580,height=300')
}

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
  if (popWidth>w-20) {popWidth=w-20};
  if (popHeight>h-60) {popHeight=h-60};
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
    if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight;
    if (winAlign.indexOf("right") != -1) leftPos = w-popWidth;
    if (winAlign.indexOf("left") != -1) leftPos = 0;
    if (winAlign.indexOf("top") != -1) topPos = 0;
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;
  }
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
//  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();};
			 }
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function LinkEml() {

// LinkEml('casella','domio','ext','classeLink','e-mail')

var Args = LinkEml.arguments;
var casella = (Args[0] != null) ? Args[0] : 'casella';
var dominio = (Args[1] != null) ? Args[1] : 'dominio';
var ext = (Args[2] != null) ? Args[2] : 'ext';
var classe = (Args[3] != null) ? Args[3] : 'classeLink';
var label = (Args[4] != null) ? Args[4] : casella+'@'+dominio+'.'+ext;
var image = (Args[5] != null) ? Args[5] : false;

  document.write("<a href='");
  document.write("mail");
  document.write("to:");
  document.write(casella);
  document.write("@");
  document.write(dominio);
  document.write(".");
  document.write(ext);
  document.write("' class='"+classe+"'>");
  if (image) {
  document.write("<img src='images/i-email.gif' width='16' height='16' border='0' alt='E-mail'>");
  } else {
  document.write(label);
  }
  document.write("</a>");
}

function LinkEmlMap() {

// LinkEmlMap('casella','domio','ext','Map')

var Args = LinkEmlMap.arguments;
var casella = (Args[0] != null) ? Args[0] : 'casella';
var dominio = (Args[1] != null) ? Args[1] : 'dominio';
var ext = (Args[2] != null) ? Args[2] : 'ext';
var map = (Args[3] != null) ? Args[3] : 'Map';

var href="mail";
href+="to:";
href+=casella;
href+="@";
href+=dominio;
href+=".";
href+=ext;
document.getElementById(map).href=href;
}
function PrintPage() {
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function Prodotti(id) {
 window.open('prodotti.asp?id='+id,'Prodotti','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,width=467,height=495')
}

function Products(id) {
 window.open('products.asp?id='+id,'Prodotti','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,width=467,height=495')
}

function Certificato() { 
 window.open('certificato.asp','Certificato','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,width=650,height=400')
}

function CheckLogin() {
	if (document.FrmLogin.l.value.length!=0) {
		if ((document.FrmLogin.l.value.match(" "))||(document.FrmLogin.l.value.match("'"))) {
			alert ('Caratteri errati nel campo "Login".');
			document.FrmLogin.l.focus()
			return false;
		}
	}
	else {
			alert ('Inserire un valore nel campo "Login".');
			document.FrmLogin.l.focus();
			return false;
	}
	if (document.FrmLogin.p.value.length!=0) {
		if ((document.FrmLogin.p.value.match(" "))||(document.FrmLogin.p.value.match("'"))) {
			alert ('Caratteri errati nel campo "Password".');
			document.FrmLogin.p.focus();
			return false;
		}
	} else {
			alert ('Inserire un valore nel campo "Password".');
			document.FrmLogin.p.focus();
			return false;
	}
 return true;
	//document.FrmLogin.submit();
}

function getScrollingPosition() {
 var position = [0,0];
 if (typeof window.pageYOffset != 'undefined') {
	  position = [window.pageXOffset,window.pageYOffset];
	} else if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0) {
   position = [document.documentElement.scrollLeft,document.documentElement.scrollTop];
 } else if (typeof document.body.scrollTop != 'undefined') {
   position = [document.body.scrollLeft,document.body.scrollTop];
 }
 return position;
}

function BackToTop(){
 var divName='BackToTop';
	var scrollingPosition = getScrollingPosition();
 if (scrollingPosition[1]>0?divVisibility(divName,true):divVisibility(divName,false));
 setTimeout('BackToTop()',250);
}

function divVisibility(idDiv,act){
 var div = MM_findObj(idDiv);
 if (act){
		div.style.visibility="visible";
	} else {
		div.style.visibility="hidden";
	}
}

function AddFavorites() {
   if (document.all) window.external.AddFavorite(location.href, document.title);
}

//var imageCache = new Image();
//imageCache.src = "images/arr-down.jpg";
function divToggle(idDiv){  
    //language defined strings
    var langShow = "Vedi";
    var langHide = "Nascondi"
	var div = MM_findObj(idDiv);
	var img = document.getElementById('ico-'+idDiv);
	if(div != null){
		var isHidden = div.style.display == "none" ? true : false;
		div.style.display = isHidden ? "" : "none";
	}
	if(img != null){  //&& 
		img.src = isHidden ? "images/arr-down.jpg" : "images/arr-right.jpg";
		img.alt = isHidden ? langHide : langShow;
	}
}

function StatusMsg(msgStr) { 
  status=msgStr;
  document.MM_returnValue = true;
}

function zoomImg() {
var Args = zoomImg.arguments;
var img = (Args[0] != null) ? Args[0] : 'images/spacer.gif';
var w = (Args[1] != null) ? parseInt(Args[1]) : null;
var h = (Args[2] != null) ? parseInt(Args[2]) : null;
var txt = (Args[3] != null) ? Args[3] : null;
var name = (Args[4] != null) ? Args[4] : 'W'+ RandomNum(6);

// spazio per la didascalia
if (txt!=null) {
	if (txt.length>0) {
		if (txt.length<50) {h+=25;} else {h+=41;};
	}
}

// apro popup
GP_AdvOpenWindow('services/img.asp?img='+escape(img)+'&w='+w+'&h='+h+'&txt='+escape(txt),name,'toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes',w,h,'center','ignoreLink','',0,'');
}

function RandomNum(cifre){
var ranNum='';
  if (Math.random && Math.round) {
    for(i=1; i<cifre; i++) {
    ranNum = ranNum + Math.round(Math.random()*10);
    }
    return ranNum;
  }
  return false;
}

/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/
function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

function InfoLegali() { 
 GP_AdvOpenWindow('infolegali.asp','infolegali','toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes',300,200,'center','ignoreLink','',0,'');
}

//-->