testFormularza={
	rodzajePol:{
 		niepuste:[/.+/,'Proszę wypełnić pole'],
 		email:[/^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/,'Proszę podać prawidłowy adres e-mail'],
 		liczbacalkowita:[/^\d+$/,'Prawidłową wartością tego pola jest liczba całkowita'],
 		liczbarzeczywista:[/^(\d+|\d+,\d+)$/,'Proszę podać liczbę rzeczywistą (można użyć przecinka)'],
 		data:[/^\d+\-\d+\-\d{4}$/,'Proszę wpisać datę w formacie DD-MM-RRRR (numer dnia-numer miesiąca-rok) np. 23-02-2003'],
 		kodpocztowy:[/^\d{2}\-\d{3}$/,'Proszę podać kod pocztowy np. 06-600'],
 		m20m100:[/^.{20,100}$/,'Proszę wpisać nie więcej niż 100 znaków, ale też nie mniej niż 20.'],
 		duzelitery:[/^[A-Z]+$/,'Proszę używać wyłšcznie dużych liter w tym polu'],
 		url:[/^http\:\/\/.+\.[a-z]{2,5}$/i,'Proszę podać prawidłowy adres strony www np. http://strona.pl']
 	},
 	testuj:function(f){
 	var i,rodz;
 	for(i=0;i<f.elements.length;i++){
 		E=f.elements[i];
 		if(rodz=this.rodzajePol[E.getAttribute('rodzajpola')])
 			if(!rodz[0].test(E.value)){
 				E.focus();
 				E.select();
 				alert('"'+E.value+'" nie jest prawidłową wartością tego pola formularza!\n'+(E.getAttribute('komunikat')||rodz[1]));
 				return false;
 			}
 		}
 		return true;
 	}
}

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 pokaz()
		{
			var arrayPageSize = getPageSize();
			var widthZ = (arrayPageSize[2]-18)+'px';
			var heightZ = arrayPageSize[1]+'px';
			var marg = arrayPageSize[2]/2 - 310+'px';
			document.getElementById('tlo_szare').style.display =  'block';
			document.getElementById('tlo_szare').style.width = widthZ;
			document.getElementById('tlo_szare').style.height = heightZ;
			//document.getElementById('zamienniki_box').style.display =  'block';
			var ttop= document.documentElement.scrollTop;
			document.getElementById('popup').style.display =  'block';
			document.getElementById('popup').style.top =  ttop+60+'px';
			document.getElementById('popup').style.left =  marg;
		}
		function pokaz2(diva)
		{
			document.getElementById(diva).style.display =  'block';
		}
		
		function zamknij()
		{
			document.getElementById('tlo_szare').style.display =  'none';
			document.getElementById('popup').style.display =  'none';
		}
		function zamknijp2()
		{
			document.getElementById('tlo_szare').style.display =  'none';
			document.getElementById('popup2').style.display =  'none';
		}
		function zamknijDEMO()
		{
			document.getElementById('tlo_szare').style.display =  'none';
			document.getElementById('popupDEMO').style.display =  'none';
		}
		function zamknij2()
		{
			document.getElementById('opisProduktu').style.display =  'none';
			document.getElementById('funkcjeProduktu').style.display =  'none';
			document.getElementById('zestawieniaProduktu').style.display =  'none';
			document.getElementById('przykladoweEkrany').style.display =  'none';
			if (document.getElementById('porownanieWersji'))
			{
				document.getElementById('porownanieWersji').style.display =  'none';
			}
			if (document.getElementById('historiaWersji'))
			{
				document.getElementById('historiaWersji').style.display =  'none';
			}
			if (document.getElementById('film'))
			{
				document.getElementById('film').style.display =  'none';
			}
		}
		
		function pokazLista(program)
		{
			var arrayPageSize = getPageSize();
			var widthZ = (arrayPageSize[2]-18)+'px';
			var heightZ = arrayPageSize[1]+'px';
			var marg = arrayPageSize[2]/2 - 310+'px';
			document.getElementById('tlo_szare').style.display =  'block';
			document.getElementById('tlo_szare').style.width = widthZ;
			document.getElementById('tlo_szare').style.height = heightZ;
			//document.getElementById('zamienniki_box').style.display =  'block';
			var ttop= document.documentElement.scrollTop;
			document.getElementById('popup').style.display =  'block';
			document.getElementById('popup').style.top =  ttop+60+'px';
			document.getElementById('popup').style.left =  marg;
			document.getElementById('frameZAM').src = '/inc/zamowienie.php?program='+program;
		}
		function czyjestTEL(ff)
		{
			if(ff.telefon.value == '' && ff.typ_kontakt.value == 'telefoniczny'){
				alert('Prosimy podać numer telefonu.');	
				ff.telefon.focus();
				return false
			}	
			return testFormularza.testuj(ff);
		}
		
		function jestZgoda(ff)
		{
			if(ff.zgoda1.checked && ff.zgoda2.checked){
				return testFormularza.testuj(ff);
			}
			else{
				alert('Prosimy wypełnić pola oznaczone *.');	
				ff.zgoda1.focus();
				return false	
			}
		}
		
		function pokazFormDemo()
		{
			var arrayPageSize = getPageSize();
			var widthZ = (arrayPageSize[2]-18)+'px';
			var heightZ = arrayPageSize[1]+'px';
			var marg = arrayPageSize[2]/2 - 310+'px';
			document.getElementById('tlo_szare').style.display =  'block';
			document.getElementById('tlo_szare').style.width = widthZ;
			document.getElementById('tlo_szare').style.height = heightZ;
			//document.getElementById('zamienniki_box').style.display =  'block';
			var ttop= document.documentElement.scrollTop;
			document.getElementById('popupDEMO').style.display =  'block';
			document.getElementById('popupDEMO').style.top =  ttop+60+'px';
			document.getElementById('popupDEMO').style.left =  marg;
		}
		function zapytajLista(program)
		{
			var arrayPageSize = getPageSize();
			var widthZ = (arrayPageSize[2]-18)+'px';
			var heightZ = arrayPageSize[1]+'px';
			var marg = arrayPageSize[2]/2 - 310+'px';
			document.getElementById('tlo_szare').style.display =  'block';
			document.getElementById('tlo_szare').style.width = widthZ;
			document.getElementById('tlo_szare').style.height = heightZ;
			//document.getElementById('zamienniki_box').style.display =  'block';
			var ttop= document.documentElement.scrollTop;
			document.getElementById('popup2').style.display =  'block';
			document.getElementById('popup2').style.top =  ttop+60+'px';
			document.getElementById('popup2').style.left =  marg;
			document.getElementById('frameZAP').src = '/inc/zapytanie.php?program='+program;
		}
		function pokazChat()
		{
			document.getElementById('chat1').style.display =  'none';
			document.getElementById('chat2').style.display =  'block';
		}
		function pokazReklama()
		{
			var arrayPageSize = getPageSize();
			var widthZ = (arrayPageSize[2]-18)+'px';
			var heightZ = arrayPageSize[1]+'px';
			var marg = arrayPageSize[2]/2 - 400+'px';
			var ttop= document.documentElement.scrollTop;
			var tttop = screen.height/2 - 200;
			document.getElementById('reklama').style.display =  'block';
			document.getElementById('reklama').style.top =  ttop+tttop+'px';
			document.getElementById('reklama').style.left =  marg;
		}
		function zamknijReklama()
		{
			document.getElementById('reklama').style.display =  'none';
		}
