function makearray(n) {
	this.length = n;
	for(var i = 1; i <= n; i++)
		this[i] = 0;
	return this;
}
function hex(i) {
	if (i < 0)	  return "00";
	else if (i > 255) return "ff";
	else		  return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}
function hexnumtodec(hexchar) {
	if (parseInt(hexchar) == hexchar) return Number(hexchar)
	hexchar = hexchar.toUpperCase()
	switch (hexchar) {
		case 'A': return 10; break;
		case 'B': return 11; break;
		case 'C': return 12; break;
		case 'D': return 13; break;
		case 'E': return 14; break;
		case 'F': return 15; break;
	}
}
function hextodec(daHex) {
	var daDec = Number((16 * hexnumtodec(daHex.substring(0,1))) + hexnumtodec(daHex.substring(1,2)))
	return daDec
}

function setColor(r,g,b) {
	var hr = hex(r); var hg = hex(g); var hb = hex(b);
	var daColor = "#"+hr+hg+hb
	daEl.style.backgroundColor = daColor
	if (daColor == colorend.toLowerCase()) {
		clearInterval(iId)
		iId = null
		timerRunning = false
	}
}

function fade() {
	i++
	setColor(
		Math.floor(sr * ((step-i)/step) + er * (i/step)),
		Math.floor(sg * ((step-i)/step) + eg * (i/step)),
		Math.floor(sb * ((step-i)/step) + eb * (i/step)));
}
hexa = new makearray(16);
for(var i = 0; i < 10; i++)
	hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

var i
var iId = null
var sr, sg, sb
var er, eg, eb
var interval = 1
var step = 16
var colorstart
var colorend
var daEl
var timerRunning = false

function myfade(el,cs,ce,iv,st) {
	daEl = el
	colorstart = cs
	colorend = ce
	interval = iv
	step = st
	i = 0
	if (timerRunning) {
		clearInterval(iId)
		iId = null
	}
	var myRe = /#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i
	if (colorstart.match(myRe)) {
		sr = hextodec(RegExp.$1)
		sg = hextodec(RegExp.$2)
		sb = hextodec(RegExp.$3)
	}
	if (colorend.match(myRe)) {
		er = hextodec(RegExp.$1)
		eg = hextodec(RegExp.$2)
		eb = hextodec(RegExp.$3)
	}
	timerRunning = false;
	iId = setInterval("fade()",interval)
	timerRunning = true;
}
function cellover(table_cell) {
	// play around with these values
	// element, from_color, to_color, interval(milliseconds), transition steps
	myfade(table_cell,'#F0F4FB','#FAE68C',5,10)
}
function cellout(table_cell) {
	if (timerRunning) {
		clearInterval(iId)
		iId = null
	}
	table_cell.style.backgroundColor = '#F0F4FB'
}
function cellover2(table_cell) {
	// play around with these values
	// element, from_color, to_color, interval(milliseconds), transition steps
	myfade(table_cell,'#F9C214','#AEC4E8',5,10)
}
function cellout2(table_cell) {
	if (timerRunning) {
		clearInterval(iId)
		iId = null
	}
	table_cell.style.backgroundColor = '#F9C214'
}
function cellover3(table_cell) {
	// play around with these values
	// element, from_color, to_color, interval(milliseconds), transition steps
	myfade(table_cell,'#F0F4FB','#AEC4E8',5,10)
}
function cellout3(table_cell) {
	if (timerRunning) {
		clearInterval(iId)
		iId = null
	}
	table_cell.style.backgroundColor = '#F0F4FB'
}
function cellover4(table_cell) {
	// play around with these values
	// element, from_color, to_color, interval(milliseconds), transition steps
	myfade(table_cell,'#497AAA','#27415A',5,10)
}
function cellout4(table_cell) {
	if (timerRunning) {
		clearInterval(iId)
		iId = null
	}
	table_cell.style.backgroundColor = '#497AAA'
}

// Autorem skryptu jest: SŁAWOMIR KOKŁOWSKI
// www.kurshtml.boo.pl
// Jeśli chcesz wykorzystać ten skrypt na swojej stronie, nie usuwaj tego komentarza!
function przycisk(podstawowy, wskazany, klikniety, tekst)
{
  if (document.images)
  {
    this.name = "img" + przyciski.length;
    if (podstawowy) { this.normal = new Image(); this.normal.src = podstawowy }
    if (wskazany) { this.over = new Image(); this.over.src = wskazany }
    if (klikniety) { this.down = new Image(); this.down.src = klikniety }
  }
  if (tekst) this.opis = tekst;

  this.normalizuj = normalizuj;
  this.podswietl = podswietl;
  this.kliknij = kliknij;

  return this;
     
  function normalizuj() { if (document.images) document.images[this.name].src = this.normal.src; window.status = "" }
  function podswietl() { if (document.images && this.over) document.images[this.name].src = this.over.src; if (this.opis) window.status = this.opis }
  function kliknij() { if (document.images) document.images[this.name].src = this.down.src }
}
przyciski = new Array("");
if (document.images)
{
// Dodawanie kolejnych przycisków:
przyciski[1] = new przycisk("obrazki/start.gif", "obrazki/start.png", "", "Strona główna");
przyciski[2] = new przycisk("obrazki/ofirmie.gif", "obrazki/ofirmie.png", "", "Informacje o firmie MTLSystem");
przyciski[3] = new przycisk("obrazki/gwarancja.gif", "obrazki/gwarancja.png", "", "Gwarancja");
przyciski[4] = new przycisk("obrazki/promocja.gif", "obrazki/promocja.png", "", "Promocje");
przyciski[5] = new przycisk("obrazki/hurt.gif", "obrazki/hurt.png", "", "Sprzedaż hurtowa");
przyciski[6] = new przycisk("obrazki/serwis.gif", "obrazki/serwis.png", "", "Serwis");
przyciski[7] = new przycisk("obrazki/kontakt.gif", "obrazki/kontakt.png", "", "Kontakt");
przyciski[8] = new przycisk("obrazki/sklep.png", "obrazki/sklep.gif", "", "Sklep internetowy");
}