var zdjecia = new Array();
var zdjecia_alt = new Array();
var x = 0, scrOfX = 0, scrOfY = 0;
var timeout;


function highlight(id) {
	document.getElementById(id).className = "menuover";
}

function unhighlight(id) {
	document.getElementById(id).className = "menu";
}

function change_main(photo) {
	clearTimeout(timeout);
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	filename = "files/main/"+photo;
	document.getElementById("mimage").src = filename;
	if ((version >= 5.5) && (document.body.filters)) {
		pngfix("mimage");
	}
}

function change_photo_time() {
	timeout = setTimeout("change_main('first.png')", 180);
}

function pokaz_obraz() {
	if (x == max) x = 0;
	document.getElementById("intpicture").src = "files/360x270/" + zdjecia[x];
	document.getElementById("intpicture").alt = zdjecia_alt[x];
	document.getElementById("intpicture").title = zdjecia_alt[x];
	x++;
}

function newsletter() {
	regexp = /([A-Za-z-_.]+)@([A-Za-z-_.]+)\.([a-z]+)/;
	if (document.getElementById('newsinput').value.match(regexp) != null) { 
		document.getElementById('newsform').submit(); 
	} else { 
		alert("Prosimy podać prawidłowy adres e-mail");
	}
}

function mail() {
	regexp = /([0-9A-Za-z-_.]+)@([0-9A-Za-z-_.]+)\.([a-z]+)/;
	if (document.getElementById('mail').value.match(regexp) != null) { return true; } else { return false; }
}

function formver() {
	ok = 0;
	nok = "";
	c1 = document.getElementById('imie').value;
	c2 = document.getElementById('nazwisko').value;
	c3 = document.getElementById('nazwa').value;
	c4 = document.getElementById('stanowisko').value;
	c5 = document.getElementById('ulica').value;
	c6 = document.getElementById('miasto').value;
	c7 = document.getElementById('telefon').value;
	c8 = document.getElementById('mail').value;
	c9 = document.getElementById('source').value;
	
	if (c1 != "") ok++; else nok = nok+"prosimy o podanie imienia\n";
	if (c2 != "") ok++; else nok = nok+"prosimy o podanie nazwiska\n";
	if (c3 != "") ok++; else nok = nok+"prosimy o podanie nazwy firmy\n";
	if (c4 != "") ok++; else nok = nok+"prosimy o podanie stanowiska\n";
	if (c5 != "") ok++; else nok = nok+"prosimy o podanie adresu\n";
	if (c6 != "") ok++; else nok = nok+"prosimy o podanie miasta\n";
	if (c7 != "") ok++; else nok = nok+"prosimy o podanie numeru telefonu\n";
	if (c8 != "") 
		if (mail()) ok++; else nok = nok+"prosimy o wpisanie prawidłowego adresu e-mail\n"; 
	if (c9 != "0") ok++; else nok = nok+"prosimy o wskazanie źródła informacji o stronie";
	
	if (nok != "") alert(nok); else document.getElementById('formularz').submit();
}

function getScrollXY() {
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
}

function showimages(image) {
	getScrollXY();
	window.scroll(0,0);
	if (navigator.appVersion.search("MSIE 7.0") != "-1") {
		document.getElementsByTagName("html")[0].style.overflowY = "hidden";
	} else {
		document.getElementById('body').className = "hideoverflow";
	}
	document.getElementById('imagebg').className = "visible";
	document.getElementById('image').className = "visible";
	document.getElementById('imagesrc').src = image;
}

function hideimages() {
	if (navigator.appVersion.search("MSIE 7.0") != "-1") {
		document.getElementsByTagName("html")[0].style.overflowY = "scroll";
	} else {
		document.getElementById('body').className = "showoverflow";
	}
	document.getElementById('imagebg').className = "nonvisible";
	document.getElementById('image').className = "nonvisible";
	document.getElementById('imagesrc').src = "";
	window.scroll(scrOfX,scrOfY);
}

function ftp() {
	document.getElementById('ftp').href = "ftp.html";
}