// images js
var scrOfX = 0, scrOfY = 0, x = 0;
var zdjecia = new Array();
var relink = "";

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);
	document.getElementById('imagebg').className = "visible";
	document.getElementById('image').className = "visible";
	document.getElementById('imagesrc').src = image;
}

function hideimages() {
	document.getElementById('imagebg').className = "nonvisible";
	document.getElementById('image').className = "nonvisible";
	document.getElementById('imagesrc').src = "";
	window.scroll(scrOfX,scrOfY);
}

function showgallery(link) {
	relink = link;
	getScrollXY();
	window.scroll(0,0);
	document.getElementById('gallerybg').className = "visible";
	document.getElementById('gallery').className = "visible";
}

function hidegallery() {
	document.getElementById('gallerybg').className = "nonvisible";
	document.getElementById('gallery').className = "nonvisible";
	window.scroll(scrOfX,scrOfY);
	window.location.href = relink;
}

function showmovies(link) {
	relink = link;
	getScrollXY();
	window.scroll(0,0);
	document.getElementById('moviebg').className = "visible";
	document.getElementById('movie').className = "visible";
}

function hidemovies() {
	document.getElementById('moviebg').className = "nonvisible";
	document.getElementById('movie').className = "nonvisible";
	//window.scroll(scrOfX,scrOfY);
	window.location.href = relink;
}

// others
function mail() {
	regexp = /([0-9A-Za-z-_.]+)@([A-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;
	
	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"; 
	
	if (nok != "") alert(nok); else document.getElementById('formularz').submit();
}