/* preload immagini per rollover */
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.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_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_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];} }

/* pop-up da link */
function winOpen(URL, windowName, width, height, left, top, resizable, location, menubar, scrollbars, status, toolbar, directories){
	var windowFeatures;
	windowFeatures = '';
	if (width != '')
		windowFeatures = windowFeatures+'width='+width+',';
	if (height != '')
		windowFeatures = windowFeatures+'height='+height+',';
	if (left != '')
		windowFeatures = windowFeatures+'left='+left+',';
	if (top != '')
		windowFeatures = windowFeatures+'top='+top+',';
	if (resizable)
		windowFeatures = windowFeatures+'resizable,';
	if (location)
		windowFeatures = windowFeatures+'location,';
	if (menubar)
		windowFeatures = windowFeatures+'menubar,';
	if (scrollbars)
		windowFeatures = windowFeatures+'scrollbars,';
	if (status)
		windowFeatures = windowFeatures+'status,';
	if (toolbar)
		windowFeatures = windowFeatures+'toolbar,';
	if (directories)
		windowFeatures = windowFeatures+'directories,';
	window.open(URL, windowName, windowFeatures);
}

/* menu con elemento select */
function changeLocation(menuObj) {
  var i = menuObj.selectedIndex;
  if(i > 0) {
    window.location = menuObj.options[i].value;
  }
}

/* antispam */
function mailTo()
{ if (!document.getElementById("mailTo")) return false;
  var spanobj = document.getElementById("mailTo");
  var anch = document.createElement("a");
  var email = "info@serecosrl.it";
  var mailto = "mailto:" + email;
  anch.setAttribute("href",mailto);
  spanobj.appendChild(anch);
  var txt = document.createTextNode(email);
  anch.appendChild(txt);
  return true; } 
window.onload = mailTo;


/* impedisci selezione (per evitare copia/incolla) */
function disableSelection(element) {
    element.onselectstart = function() {
      return false; };
    element.unselectable = "on";
    element.style.MozUserSelect = "none";
    element.style.cursor = "default"; }
function onLoad() {
  disableSelection(document.getElementById("text"));
}

/* a tutto schermo 
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);
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight); }
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth; } 
} */

/* data (anno) */
function WebDate() {
	var now = new Date();
	var year= now.getYear();if (year < 1000) year += 1900;
	document.write(year); 
}

/* saluto, data e ora */
function aggiorna() {
var mesi = new Array("gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre");
var nomeGiorno = new Array('Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato');
Data = new Date()
Giorno = Data.getDate()
Mese = Data.getMonth()
Anno = Data.getFullYear() 
Ore = Data.getHours()
Minuti = Data.getMinutes()
Secondi = Data.getSeconds()
if ((Ore > 5) && (Ore < 14)) Saluto = "Buon giorno"
if ((Ore > 13) && (Ore < 17)) Saluto = "Buon pomeriggio"
if ((Ore > 16) && (Ore < 22)) Saluto = "Buona sera"
if (Ore > 21) Saluto = "Buona notte"
if (Ore < 6) Saluto = "Buona notte"
if (Minuti < 10) Minuti = "0" + Minuti
if (Secondi < 10) Secondi = "0" + Secondi
/*messaggio = Saluto + ", sono le ore " + Ore + ":" + Minuti + "." + Secondi + " di " + nomeGiorno[Data.getDay()] + ", " + Giorno + " " + mesi[Mese] + " " + Anno*/
messaggio = nomeGiorno[Data.getDay()] + " " + Giorno + " " + mesi[Mese] + " " + Anno + " - ore " + Ore + "." + Minuti + "." + Secondi + " - " + Saluto
if(!document.layers){
  aggsec = setTimeout("aggiorna();",1000);}
if (document.getElementById){
    document.getElementById('clock').innerHTML=messaggio;}
else if (document.all){ 
    document.all.clock.innerHTML=messaggio;}
else if(document.layers){
    document.write(messaggio);}
}
aggiorna();


