/*  (C) 2005-2008 Pescetelli Impianti Snc - All rights reserved  */

var IMG = new Array (4);
IMG[0] = '<A HREF="condizionamento.htm" TARGET="_top"><IMG WIDTH=234 HEIGHT=225 SRC="img/condizionatori.jpg" ALT="Condizionatori" BORDER=0></A>';
IMG[1] = '<A HREF="riscaldamento.htm" TARGET="_top"><IMG WIDTH=234 HEIGHT=225 SRC="img/caldaie.jpg" ALT="Caldaie" BORDER=0></A>';
IMG[2] = '<A HREF="termoidraulica.htm" TARGET="_top"><IMG WIDTH=234 HEIGHT=225 SRC="img/cascata.jpg" ALT="Cascata" BORDER=0></A>';
IMG[3] = '<A HREF="ristrutturazioni.htm" TARGET="_top"><IMG WIDTH=234 HEIGHT=225 SRC="img/piantina.gif" ALT="Piantina" BORDER=0></A>';

homepage_off = new Image ();
homepage_off.src = "gif/9-homepage.gif";
homepage_on = new Image ();
homepage_on.src = "gif/5-homepage.gif";
condizionamento_off = new Image ();
condizionamento_off.src = "gif/9-condizionamento.gif";
condizionamento_on = new Image ();
condizionamento_on.src = "gif/5-condizionamento.gif";
riscaldamento_off = new Image ();
riscaldamento_off.src = "gif/9-riscaldamento.gif";
riscaldamento_on = new Image ();
riscaldamento_on.src = "gif/5-riscaldamento.gif";
termoidraulica_off = new Image ();
termoidraulica_off.src = "gif/9-termoidraulica.gif";
termoidraulica_on = new Image ();
termoidraulica_on.src = "gif/5-termoidraulica.gif";
ristrutturazioni_off = new Image ();
ristrutturazioni_off.src = "gif/9-ristrutturazioni.gif";
ristrutturazioni_on = new Image ();
ristrutturazioni_on.src = "gif/5-ristrutturazioni.gif";

function buttonswitch () {
	if (document.images) {
		for (var i = 0; i < buttonswitch.arguments.length; i += 2) {
			document[buttonswitch.arguments[i]].src = eval (buttonswitch.arguments[i+1] + ".src");
		}
	}
}

function buttonmenu (page) {
	document.write ("<TABLE WIDTH=234 CELLSPACING=0 CELLPADDING=0 BORDER=0><TR VALIGN=TOP><TD WIDTH=40></TD><TD WIDTH=152>");
	if (page == 'homepage') {
		document.write ("<P><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/7-homepage.gif\" ALT=\"Pescetelli Impianti Homepage\" BORDER=0></P>");
	}
	else {
		document.write ("<P><A HREF=\"./\" onMouseOver=\"buttonswitch('homepage','homepage_on')\" onMouseOut=\"buttonswitch('homepage','homepage_off')\"><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/9-homepage.gif\" ALT=\"Pescetelli Impianti Homepage\" NAME=\"homepage\" BORDER=0></A>");
	}
	if (page == 'condizionamento') {
		document.write ("<P><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/7-condizionamento.gif\" ALT=\"Pescetelli Impianti Condizionamento\" BORDER=0></P>");
	}
	else {
		document.write ("<P><A HREF=\"condizionamento.htm\" onMouseOver=\"buttonswitch('condizionamento','condizionamento_on')\" onMouseOut=\"buttonswitch('condizionamento','condizionamento_off')\"><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/9-condizionamento.gif\" ALT=\"Pescetelli Impianti Condizionamento\" NAME=\"condizionamento\" BORDER=0></A>");
	}
	if (page == 'riscaldamento') {
		document.write ("<P><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/7-riscaldamento.gif\" ALT=\"Pescetelli Impianti Riscaldamento\" BORDER=0></P>");
	}
	else {
		document.write ("<P><A HREF=\"riscaldamento.htm\" onMouseOver=\"buttonswitch('riscaldamento','riscaldamento_on')\" onMouseOut=\"buttonswitch('riscaldamento','riscaldamento_off')\"><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/9-riscaldamento.gif\" ALT=\"Pescetelli Impianti Riscaldamento\" NAME=\"riscaldamento\" BORDER=0></A>");
	}
	if (page == 'termoidraulica') {
		document.write ("<P><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/7-termoidraulica.gif\" ALT=\"Pescetelli Impianti Termoidraulica\" BORDER=0></P>");
	}
	else {
		document.write ("<P><A HREF=\"termoidraulica.htm\" onMouseOver=\"buttonswitch('termoidraulica','termoidraulica_on')\" onMouseOut=\"buttonswitch('termoidraulica','termoidraulica_off')\"><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/9-termoidraulica.gif\" ALT=\"Pescetelli Impianti Termoidraulica\" NAME=\"termoidraulica\" BORDER=0></A>");
	}
	if (page == 'ristrutturazioni') {
		document.write ("<P><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/7-ristrutturazioni.gif\" ALT=\"Pescetelli Impianti Ristrutturazioni\" BORDER=0></P>");
	}
	else {
		document.write ("<P><A HREF=\"ristrutturazioni.htm\" onMouseOver=\"buttonswitch('ristrutturazioni','ristrutturazioni_on')\" onMouseOut=\"buttonswitch('ristrutturazioni','ristrutturazioni_off')\"><IMG WIDTH=152 HEIGHT=28 SRC=\"gif/9-ristrutturazioni.gif\" ALT=\"Pescetelli Impianti Ristrutturazioni\" NAME=\"ristrutturazioni\" BORDER=0></A>");
	}
	document.write ("</TD><TD WIDTH=42></TD></TR></TABLE>");
}

function today () {
	var now = new Date();
	var year = now.getYear();
	var month = now.getMonth() + 1;
	var day = now.getDate();
	var hour = now.getHours();
	var minute = now.getMinutes();
	var second = now.getSeconds()
	var output = (year < 1900) ? (year + 1900) + "/" : year + "/";
	output += (month < 10) ? "0" + month + "/" : month + "/";
	output += (day < 10) ? "0" + day + " " : day + " ";
	output += (hour < 10) ? "0" + hour + ":" : hour + ":";
	output += (minute < 10) ? "0" + minute + ":" : minute + ":";
	output += (second < 10) ? "0" + second : second;
	return output;
}

function reference () {
	var now = new Date();
	var year = now.getYear(); 
	var month = now.getMonth() + 1;
	var day = now.getDate();
	var hour = now.getHours();
	var minute = now.getMinutes();
	var second = now.getSeconds()
	year = (year > 1900) ? year - 2000 : year;
	year = (year > 99) ? year - 100 : year;
	var output = (year <10) ? "0" + year : year;
	output += (month < 10) ? "0" + month : month;
	output += (day < 10) ? "0" + day  : day;
	output += (hour < 10) ? "0" + hour : hour;
	output += (minute < 10) ? "0" + minute : minute;
	output += (second < 10) ? "0" + second : second;
	return output;
}

function pageinfo () {
	document.getElementById ('pageinfo').style.visibility='visible';
	return false;
}

function mailto () {
	var email = 'info' + unescape ('%40') + 'pescetelliimpianti' + unescape ('%2E') + 'it';
	var mailbox = "info";
	var domain = "pescetelliimpianti.it";
	var subject = "Richiesta informazioni " + reference ();
	var at = unescape ('%40');
	document.write ('<A HREF=\"mailto:' + email + '?subject=' + subject + '\">'); 
	document.write (email + '</A>');
}

function randomnumber (start, total) {
	return Math.round (Math.random() * (total - 1) + start);
}

function randomimage () {
	return IMG[randomnumber (0, IMG.length)];
}

function disabletext () {
	if (document.all) {
		document.onselectstart = function () { return false; };
	}
	else {
		document.onmousedown = function () { return false; };
	}
}
