function effect (arg)	{

	if (arg==1){
		document.getElementsByName('darkBackgroundLayer')[0].style.display='';
	}	
	else	{
		document.getElementsByName('darkBackgroundLayer')[0].style.display='none';
	}

}

//---------------------------------------------------------------------------------


function show(what)	{

//sprawdzanie szerokości przeglądarki

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth-16;
  winH = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth-20;
  winH = document.body.offsetHeight-20;
 }
}

var left_position = (winW-600)/2;
var top_position  = (winH-200)/2;



	var x = document.getElementById(what);
	var q = document.getElementById(what).style.visibility;



	if (q=='' || q=='hidden')
	{
		x.style.top=top_position+300;
		x.style.left=left_position;
		x.style.visibility='visible';
		effect(1);
		JSFX_FloatTopLeft('temp', left_position, top_position);
	}
	else{
		x.style.visibility='hidden';
		effect(0);
	}

}



function go()	{

		advAJAX.submit(document.getElementById("lista"), {

		onSuccess : function(obj) { 
		
		if (obj.responseText==1){
			document.getElementById('progressform').style.visibility='hidden';
			document.getElementById('progressform').style.display='none';
			document.getElementById('form').style.display='none';
			document.getElementById('form').style.visibility='hidden';

			document.getElementById('thxform').style.visibility='visible';
			document.getElementById('thxform').style.display='block';

		} 
		else alert(obj.responseText);
				
		},
		
		onInitialization : function() {
        /* Ukrycie warstwy */
			document.getElementById('form').style.display='none';
			document.getElementById('form').style.visibility='hidden';

	    },
		onLoading : function(obj)
        { /* Wyświetlenie obrazka wskazującego na ładowanie */
			document.getElementById('temp').style.height=100;;
			document.getElementById('progressform').style.visibility='visible';
			document.getElementById('progressform').style.display='block';
		},
		onError : function(obj) {
			//alert("Error: " + obj.status);
			document.getElementById('thxform').style.visibility='visible';
			document.getElementById('thxform').style.display='block';
			document.getElementById('thxform').innerHTML='Wystąpił błąd: '+obj.status;
			
		},
		onComplete : function() {
        /* Ukrycie warstwy */
       // alert('finito');
	    }
		});

}




function wpis_na_liste()
{


Wzor_email  =/^[0-9a-zA-Z._-]+\@[0-9a-zA-Z_-]+\.[0-9a-zA-Z._]+$/;

var blad_imie	    = "Podaj swoje imię!";
var blad_nazwisko   = "Podaj swoje nazwisko!";
var blad_email		= "Podaj poprawny adres e-mail!";

var imie			= document.forms['lista'].imie.value;
var nazwisko			= document.forms['lista'].nazwisko.value;
var email			= document.forms['lista'].email.value;

text = imie;
if (text.length==0)
{
	document.forms['lista'].imie.focus(); 
	document.forms['lista'].imie.select();
	alert(blad_imie); 
	return false;
}

text = nazwisko;
if (text.length==0)
{
	document.forms['lista'].nazwisko.focus(); 
	document.forms['lista'].nazwisko.select();
	alert(blad_nazwisko); 
	return false;
}


text = email;
if (Wzor_email.test(text)!=true)
{
	document.forms['lista'].email.focus(); 
	document.forms['lista'].email.select();
	alert(blad_email);
	return false;
}
go();
}




function JSFX_FloatTopLeft(divname, X, Y)
{
	var startX = X, startY = Y;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var px = document.layers ? "" : "px";
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
		el.x = startX; el.y = startY;
		return el;
	}
	window.stayTopLeft=function()
	{
		var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		var dY = (pY > startY) ? pY : startY;
		ftlObj.y += (dY - ftlObj.y)/8;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 20);
	}
	ftlObj = ml(divname);
	stayTopLeft();
}
