<!--
// ---------------------------------------
// JavaScript Misc File: <sitename>
// ---------------------------------------

// verfica che l'importo in Euro immesso sia nel formato standard 9999.99
function IsEuroImport(importo) {
	if (importo==0) return true
	var first_comma_sign = importo.indexOf(".")
	var last_comma_sign = importo.lastIndexOf(".")
	if (first_comma_sign != last_comma_sign || first_comma_sign <= 0) return false
	
	var lmax = first_comma_sign + 3
	if (first_comma_sign == last_comma_sign && importo.length == lmax)
	{
			if (navigator.appName == "Netscape") 
			{
			var num=importo.replace(/\,/g,"").replace(/\./g,"")
			if(num.search(/[^0-9]/) != -1) return false
			}
	return true
	}
	else return false
}

// stringa data in formato GG/MM/YYYY
function IsDate(strDate) {

	var partOfDate = strDate.split("/")
	var d = partOfDate[0]
	var m = partOfDate[1] - 1	
	var y = partOfDate[2]

	var objDate = new Date(y, m, d)

	if (d != objDate.getDate() || m != objDate.getMonth() || y != objDate.getFullYear()) {
		return false
	} else {
		if (objDate.getFullYear() > 1900 && objDate.getFullYear() < 2079) {
			return true	
		} else {
			return false
		} 
	}
}

// verifica che la stringa immessa sia un numero
function isNumber(inputStr) { 
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i)
		if (oneChar < "0" || oneChar > "9") {
			return false
		}
	}
	return true
}

// verfica che la stinga immessa sia composta di lettere
function IsAlfa(stringa) {
	var charcode 
	for (var i = 0; i < stringa.length; i++)
		{
		charcode = stringa.charCodeAt(i)
		if ( !( (charcode >= 65 && charcode <=90) || (charcode >= 97 && charcode <=122) ) ) 
			return false
		}
		return true
}

function isAlfaNumber(inputStr) {
	var charcode 
	for (var i = 0; i < inputStr.length; i++)
		{
		charcode = inputStr.charCodeAt(i)
		if ( !( (charcode >= 65 && charcode <=90) || (charcode >= 97 && charcode <=122) ) ) 
			return false
		}
		return true
}

// Macromedia Stuff

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_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 un numero.\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+' deve contenere un numero fra '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' è un campo obbligatorio.\n'; }
  } if (errors) alert('Attenzione, si sono verificati i seguenti errori:\n'+errors);
  document.MM_returnValue = (errors == '');
}

// -----------------------------------------------------
// Copyright (c) 2002 Net-Style snc - All rights reserved 
// -----------------------------------------------------
//-->

