function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function preloadimages() {
  var d = document;
  if(document.images) {
  	if(!document.MM_p)
  		document.MM_p = new Array();
  	var i, j = document.MM_p.length, a = preloadimages.arguments;
  	for(i = 0; i < a.length; i++)
  		if(a[i].indexOf("#") != 0) {
  			document.MM_p[j] = new Image;
  			document.MM_p[j++].src=a[i];
  		}
  }
} // preloadimages()

function pwSetDivHeight() {
	var i = 0;
	var a = arguments;
	var l = a.length / 2;
	var aDivObjs = new Array();
	var aDivAdd = new Array();
	var maxDH = 0;
	for(i = 0; i < l; i++) {
		aDivObjs[i] = document.getElementById(a[i * 2]);
		aDivAdd[i] = a[(i * 2) + 1];
	}
	for(i = 0; i < l; i++) {
		if((aDivObjs[i].offsetHeight + aDivAdd[i]) > maxDH) {
			maxDH = aDivObjs[i].offsetHeight;
		}
	}
	for(i = 0; i < l; i++) {
		aDivObjs[i].style.height = (maxDH + aDivAdd[i]) + "px";
	}
}


function pwAloneMenuSwitch(objId) {
	objC = document.getElementById("C" + objId);
	objsK = document.getElementById("tresc").getElementsByTagName("DIV");
	if(objC.style.display == "block") {
		objC.style.display = "none";
		objC.style.visibility = "hidden";
	} else {
		for (i = 0; i < objsK.length; i++) {
			if(objsK[i].id.substring(0,1) == "C") {
				objsK[i].style.display = "none";
				objsK[i].style.visibility = "hidden";
			}
		}
		objC.style.display = "block";
		objC.style.visibility = "visible";
	}
} // pwAloneMenuSwitch()




function blokShow(id, nr, max) {
	var tab, tab2;
	for(var i = 1; i <= max; i++) {
		tab = document.getElementById(id + i);
		if(tab) {
			if(i == nr) {
				tab.style.visibility = 'visible';
				tab.style.display = 'block';
			} else {
				tab.style.visibility = 'hidden';
				tab.style.display = 'none';
			}
		}
	}
}



function sprawdz(sKod, sTyp) {
	var oKod = document.getElementById(sKod);
	var oRez = document.getElementById(sKod + "rez");
	var rezOk = '<span class="rezOk">OK</span>';
	var rezError = '<span class="rezError">Popraw</span>';
	var error = false;
	var val = oKod.value;
	if(sKod == 'pyt4337') {
		var oKod2 = document.getElementById('pyt4338');
		var oRez2 = document.getElementById('pyt4338rez');
	}
	if(sKod == 'pyt4338') {
		var oKod0 = document.getElementById('pyt4337');
		var oRez0 = document.getElementById('pyt4337rez');
	}
	switch(sTyp) {
		case 'kod':
			if(val.search(/^\d\d\-\d\d\d$/) < 0) {
				if(val.search(/^\d\d \d\d\d$/) < 0) {
					if(val.search(/^\d\d\d\d\d$/) < 0) {
						error = true;
					}
				}
			}
			break;
		case 'txt':
			if(val.length == 0) {
				error = true;
			}
			break;
		case 'tel':
			if((val.length < 9) || (val.length > 20) || !(val + 0 > 0)) {
				error = true;
			}
			break;
		case 'em@':
			if(val.search(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/) < 0) {
				error = true;
			}
			break;
	}
	if(error) {
		oRez.innerHTML = rezError;
	} else {
		oRez.innerHTML = rezOk;
	}
	if(oKod2) {
		if((oKod2.value != "") && (oKod.value != oKod2.value)) {
			oRez2.innerHTML = rezError;
		}
	}
	if(oKod0) {
		if(oKod.value != oKod0.value) {
			oRez.innerHTML = rezError;
		}
	}
	sprawdzOk();
} // function sprawdzKodPocztowy();



var pytania = new Array(4339, 4340, 4332, 4333, 4334, 4335, 4336, 4337, 4338);
function sprawdzOk() {
	var iOk = 0;
	var obj;
	for(var i = 0; i < 9; i++) {
		obj = document.getElementById('pyt' + pytania[i] + 'rez');
		if(obj.innerHTML.indexOf('OK') > 0) {
			iOk++;
		}
	}
	if(iOk == pytania.length) {
		document.getElementById('submit').disabled = false;
	} else {
		document.getElementById('submit').disabled = true;
	}
} // function sprawdzOk();



function removeClassName(el, name) {
  var i, cC6ist, newList;
  if (el.className == null)
    return;
  newList = new Array();
  cC6ist = el.className.split(" ");
  for (i = 0; i < cC6ist.length; i++)
    if (cC6ist[i] != name)
      newList.push(cC6ist[i]);
  el.className = newList.join(" ");
}

