//********************************************************************************
//Copyright (C) 2001 Promecut srl (R)
//This script is made by and copyrighted to Massimo Donati at www.promecut.it
//Visit for more info.
//This may be used freely as long as this msg is intact!
//********************************************************************************

var ilddayName = new Array ("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato")
var ildmonName = new Array ("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre")
var ildnow = new Date
var ilddatacont = null;
var ildflagcont = false;

//Avvio data-ora
function ildavvio(){
  ildstoppa();
  ildconta();
}

//ferma conteggio
function ildstoppa(){
  if(ildflagcont)
    clearTimeout(ilddatacont)
  ildflagcont = false
}

//Finestre popup
function ildopenw(ildurl, ildwindowname) {
	window.open(ildurl, ildwindowname);
}
//Finestre popup + attr.
function ildopenwat(ildurl, ildwindowname, ildatrib) {
	window.open(ildurl, ildwindowname, ildatrib);
}

function ildconta() {
  ildoggi = new Date();
  ildore = ildoggi.getHours();
  ildminuti = ildoggi.getMinutes();
  ildsecondi = ildoggi.getSeconds();

  ildmese = null;
  ildmese = ildmonName[ildoggi.getMonth()];

   if (ildore < 10) {ildored = 0}
   else {ildored = ""};
   if (ildminuti < 10) {ildminutid = 0}
   else {ildminutid = ""};
   if (ildsecondi < 10) {ildsecondid = 0}
   else {ildsecondid =""};

   ildtempox = ('' +"Oggi è "+ ilddayName[ildoggi.getDay()] + ", " +ildoggi.getDate()+ " "+ildmese+
   " "+ildoggi.getYear()+" ore "
   +ildored+""+ildore+":"+ildminutid+""+ildminuti+ ":"+ildsecondid+""+ildsecondi+
'');

//if (document.all) {
//  document.all.ildorologio.innerText = ildtempox; }
//else {
//   document.getElementById('ildorologio').innerHTML = ildtempox;
//}
   
   document.getElementById('ildorologio').innerHTML = ildtempox;
   
   ilddatacont = setTimeout("ildconta()",1000)
   ildflagcont = true
 }

function ildpopupPage(ildURL,ildw,ildh) {
var ildwindowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no" +",left=" + 0 + ",top=" + 0 + ",width=" + ildw + ",height=" + ildh;
ildpopup = window.open(ildURL,"nome",ildwindowprops);
ildavvio();
}

function ildsaluto() {
if (ildnow.getHours() < 5) {document.write("<h>Buonanotte.</h>")}
	else if (ildnow.getHours() < 9) {document.write("<h>Buona mattina.</h>")}
	else if (ildnow.getHours() < 13) {document.write("<h>Buongiorno.</h>")}
	else if (ildnow.getHours() < 17) {document.write("<h>Buon pomeriggio.</h>")}
	else if (ildnow.getHours() < 21) {document.write("<h>Buonasera.</h>")}
	else {document.write("<h>Buonanotte.</h>")}
	}

function ildmailto(ildtomail, ildobjmail, ildtxtmail) {
var ildtomail="mailto:info@aiw.it"
var ildobjmail="?subject=aiw cerca me"
var ildtxtmail="&body=Chiedo di essere contattato per il lavoro di commerciale. Vi autorizzo al trattamento dei dati personali, ai sensi della Legge 675 del 31.12.1996, unicamente per questa richiesta di contatto:%0b";
window.location.href=ildtomail+ildobjmail+ildtxtmail;
}

function pro_toCaps(obj) {
	var kCode = window.event.keyCode;
//	if (event.keyCode == 13) wndClose('')
	if ((kCode >= 97) && (kCode <=122)) {
		window.event.keyCode = (kCode - 32);
		}
	else {
		switch (kCode) {
		case 224 :  //à
			window.event.keyCode = 65; break;
		case 232 :  //è
			window.event.keyCode = 69; break;
		case 233 :  //é
			window.event.keyCode = 69; break;
		case 236 :  //ì
			window.event.keyCode = 73; break;
		case 242 :  //ò
			window.event.keyCode = 79; break;
		case 249 :  //ù
			window.event.keyCode = 85; break;
		case 231 :	//ç
			window.event.keyCode = 67; break;
		case 34 :	//"
			window.event.keyCode = 39; break;
			}
		}
	}
	
function pro_touppercounter(formname_pro, formfield_pro, formfield_length,formfield_counter, upper) {
if (upper == "S") {
	if (document.forms[formname_pro].elements[formfield_pro].value.length > formfield_length) {
    document.forms[formname_pro].elements[formfield_pro].value = document.forms[formname_pro].elements[formfield_pro].value.substring(0,formfield_length).toUpperCase();
    }
else {
	document.forms[formname_pro].elements[formfield_counter].value = formfield_length - document.forms[formname_pro].elements[formfield_pro].value.length;
	document.forms[formname_pro].elements[formfield_pro].value = document.forms[formname_pro].elements[formfield_pro].value.toUpperCase();
	} 
}
if (upper == "N") {
 if (document.forms[formname_pro].elements[formfield_pro].value.length > formfield_length) {
    document.forms[formname_pro].elements[formfield_pro].value = document.forms[formname_pro].elements[formfield_pro].value.substring(0,formfield_length);
    }
else {
    document.forms[formname_pro].elements[formfield_counter].value = formfield_length - document.forms[formname_pro].elements[formfield_pro].value.length;
	}
	}
}

  function pro_toupper(formname_pro, formfield_pro) {
document.forms[formname_pro].elements[formfield_pro].value = document.forms[formname_pro].elements[formfield_pro].value.toUpperCase();
	}	
	
	
	
//Celle Mouse over & Mouse out
function turnOnRow(obj){
	obj.style.backgroundColor='#999999'
}

function turnOffRow(obj){
	obj.style.backgroundColor='transparent'
}

function goPost(frm,url){
	frm.action=url;
	frm.method='post';
	frm.submit();
}
//Fine Celle Mouse over & Mouse out


// LANCIA RICERCHE ----------------
function ildricercagoogle() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://www.google.it/search?q="+ricercacosa+"&hl=it&lr=";
  }
function ildricercayahoo() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://it.search.yahoo.com/search/it?p="+ricercacosa+"&y=y";
  }
function ildricercamsn() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://search.msn.it/results.aspx?FORM=MSNH&q="+ricercacosa;
  }
function ildricercaaltavista() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://it.altavista.com/web/results?q="+ricercacosa;
  }
function ildricercavirgilio() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://search.virgilio.it/search/cgi/search.cgi?qs=" + ricercacosa;
  }
function ildricercaarianna() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://arianna.libero.it/search/abin/search?query="+ricercacosa+"&radiobutton=arianna";
  }
function ildricercailtrovatore() {
     var ricercacosa = document.ricercaform.cosa.value;
location.href = "http://search.iltrovatore.it/cgi-bin/index.cgi?q="+ricercacosa+"&cs=iso-8859-1";
  }
// FINE RICERCHE ----------------

function ildloadFrames(ildframe1,ildpage1,ildframe2,ildpage2) {
eval("parent."+ildframe1+".location='"+ildpage1+"'");
eval("parent."+ildframe2+".location='"+ildpage2+"'");
} 

// -------EXIT CALL ------- 
// ------- copyright Promecut Srl  
function infogoogle(URL) {
googleww = window.open(URL, "Google");
}
// -------BANNER ANIMATE ------- 
// ------- copyright Promecut Srl  
function ildbanneranimate(ildhref, ildstringimg, ildstringtxt, ildrefstop, ildw, ildh) {
var ildbannerimgstring = "<img src=" + ildstringimg + " width=" + ildw + " height=" + ildh + " border=0 alt=" + ildstringtxt + ">";
   	document.writeln(ildhref);
   	document.write(ildbannerimgstring);
	document.writeln(ildrefstop);
}


// -------BANNER INTERACTIVE ------- 
// ------- copyright Promecut Srl  
function ildbannerinteractive(ildhref, ildstringswf, ildstringtxt, ildrefstop, ildw, ildh) { 
 var ildbannerswfstring = "<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 width=" + ildw + " height=" + ildh + " align=center><param name=movie value=" + ildstringswf + "><param name=quality value=high><embed src=" + ildstringswf + " quality=high pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash width=" + ildw + " height=" + ildh + " align=center></embed></object>";
   document.writeln(ildhref);
   document.write(ildbannerswfstring);
   document.writeln(ildrefstop);
}

// ------- copyright Macromedia 
// ------- modify by Promecut Srl   
function MM_checkPluginildbannertype(ildhref, ildstringimg, ildstringswf, ildstringtxt, ildrefstop, ildw, ildh)
 {
 	var	IEGoesToURLild = true
	 var pluginild = "Shockwave Flash"; //v2.0
  if ((navigator.plugins && navigator.plugins[pluginild]) || //if NS, or
      (IEGoesToURLild &&  //if flag set, and MSIE browser for Win95/NT (ActiveX)
       navigator.appName.indexOf('Microsoft') != -1 &&
       navigator.appVersion.indexOf('Mac') == -1 &&
       navigator.appVersion.indexOf('3.1') == -1)) {
     ildbannerinteractive(ildhref, ildstringswf, ildstringtxt, ildrefstop, ildw, ildh);
  } else {
     ildbanneranimate(ildhref, ildstringimg, ildstringtxt, ildrefstop, ildw, ildh);
  }
}

// ------- copyright Macromedia  
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();
}


function chk_email(mail){
	 Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
     if (Filtro.test(mail)) return (true);
     else return (false);
	
}

function data_maggiore_uguale(input1,input2){
 
   var data1 =new Array(3);
   var data2 =new Array(3);
   
   data1 =input1.split('-');
   gg1=data1[2];
   mm1=data1[1];
   aa1=data1[0];
 
   data2 =input2.split('-');
   gg2=data2[2];
   mm2=data2[1];
   aa2=data2[0];
   
   var data1Ob = new Date(aa1,mm1,gg1);
   var data2Ob = new Date(aa2,mm2,gg2);
   
   if (data1Ob.getTime() >= data2Ob.getTime()) {
      return false;
   }
   return true;
}

function controllaPIVA(pi) 
{ 
  if( pi == '' ) return ''; 
   if( pi.length != 11 ) 
     return "La lunghezza della partita IVA non èn" + 
     "corretta: la partita IVA dovrebbe essere lungan" + 
     "esattamente 11 caratteri.n"; 
   validi = "0123456789"; 
   for( i = 0; i < 11; i++ ){ 
     if( validi.indexOf( pi.charAt(i) ) == -1 ) 
     return "La partita IVA contiene un carattere non valido `" + 
     pi.charAt(i) + "'.nI caratteri validi sono le cifre.n"; 
   } 
   s = 0; 
   for( i = 0; i <= 9; i += 2 ) 
     s += pi.charCodeAt(i) - '0'.charCodeAt(0); 
   for( i = 1; i <= 9; i += 2 ){ 
     c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) ); 
     if( c > 9 ) c = c - 9; 
     s += c; 
   } 
   if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) ) 
     return "La partita IVA non è valida:n" + 
     "il codice di controllo non corrisponde.n"; 
   return ''; 
} 


function ControllaCF(cf)
{
    var validi, i, s, set1, set2, setpari, setdisp;
    if( cf == '' )  return '';
    cf = cf.toUpperCase();
    if( cf.length != 16 )
        return "La lunghezza del codice fiscale non ?"
        +"corretta: il codice fiscale dovrebbe essere lungo\n"
        +"esattamente 16 caratteri.\n";
    validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    for( i = 0; i < 16; i++ ){
        if( validi.indexOf( cf.charAt(i) ) == -1 )
            return "Il codice fiscale contiene un carattere non valido `" +
                cf.charAt(i) +
                "'.\nI caratteri validi sono le lettere e le cifre.\n";
    }
    set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
    setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
    s = 0;
    for( i = 1; i <= 13; i += 2 )
        s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
    for( i = 0; i <= 14; i += 2 )
        s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
    if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )
        return "Il codice fiscale non ?orretto:\n"+
            "il codice di controllo non corrisponde.\n";
    return "";
}




MM_reloadPage(true);