function LDM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
												   }

function LDM_swapImgRestore() { 
  var i,x,a=document.LDM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function LDM_preloadImages() {
  var d=document; if(d.images){ if(!d.LDM_p) d.LDM_p=new Array();
    var i,j=d.LDM_p.length,a=LDM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.LDM_p[j]=new Image; d.LDM_p[j++].src=a[i];}}
}

function LDM_swapImage() { 
  var i,j=0,x,a=LDM_swapImage.arguments; document.LDM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=LDM_findObj(a[i]))!=null){document.LDM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function LDM_findObj(n, d) { 
  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=LDM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function LDM_validateForm() { 
  var i,p,q,nm,test,num,min,max,errors='',args=LDM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=LDM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve contenere un indirizzo email.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' deve contenere solo numeri.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' è un campo obbligatorio!\n'; }
  } if (errors) alert('Attenzione:\n\n'+errors);
  document.LDM_returnValue = (errors == '');
}

  function illumina(x) {
	  
if (x=='a')   {
     document.all.a.className = "bgtxt3"; 
	 document.all.b.className = "bgtxt2"; 
	 document.form1.tipo_ricerca.disabled =false;
	 document.form1.enzo3.value ='90,00';
	 document.form1.enzo.value =90*1.2+",00";
	 document.form1.tipo_ricerca1.disabled = true;
	 document.form1.tipo_ricerca1.value ="";
	 document.form1.tipo_ricerca.disabled = false;
	 var hh = document.form1.paga;
		for(var i=0; i<hh.length; i++){
		hh[i].checked= false;
		hh[i].className = "";
     								  }
	 		 }
 if (x==b)   {
     document.all.a.className = "bgtxt2"; 
	 document.all.b.className = "bgtxt3"; 
	 document.form1.enzo3.value ='50,00';
 	 document.form1.enzo.value = '60,00';
 	 document.form1.tipo_ricerca.disabled = true;
	 document.form1.tipo_ricerca.value ="";
 	 document.form1.tipo_ricerca1.disabled = false;
	  document.form1.tipo_ricerca1.value ="50";
 	  var hh = document.form1.paga;
		for(var i=0; i<hh.length; i++){
		hh[i].checked= false;
		hh[i].className = "";
									  }
	        }
                       }

function scelta_ricerca()
{
   var f = document.form1;
   var wtipo_ricerca = f.tipo_ricerca.options[f.tipo_ricerca.selectedIndex].value;
   var e = wtipo_ricerca*2;
   var tot=90+e;
   var iva = parseFloat(tot*1.2)
   var numero=Math.round(iva*100) / 100
   document.form1.enzo3.value =tot+',00';
   document.form1.enzo.value =numero;
}
function scelta_ricerca1()
{
   var f = document.form1;
   var wtipo_ricerca1 = f.tipo_ricerca1.options[f.tipo_ricerca1.selectedIndex].value;
   var e = wtipo_ricerca1;
   var tot=e;
   var iva = parseFloat(tot*1.2)
   var numero=Math.round(iva*100) / 100
   document.form1.enzo3.value =tot+',00';
   //document.form1.enzo.value =numero;
}
 function vai(x){
	    window.location.href="ricerca_1.asp?cat="+x
	 }

function CheckForm () { 
	//Initialise variables
	var errorMsg = "";
	
   if(document.newsletter.newsmail.value == ""  || document.newsletter.newsmail.value == "inserisci la tua email") {
     errorMsg += "\nInserisci la tua email";
   }
  if(document.newsletter.newsmail.value != ""  && document.newsletter.newsmail.value != "inserisci la tua email") {   
   EmailAddr = document.newsletter.newsmail.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
 if (!Filtro.test(EmailAddr)){
      errorMsg += "\nInserisci un indirizzo e-mail valido";
   }
    }
	if (errorMsg != ""){
				
		msg = "Attenzione, compilare correttamente il modulo:\n";
		msg += "__________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n");
		return false;
	}
	 
}
