
var noweokno = null;

function NoweOkno(strona, w, h)
{
	if(window.screen)
	{
		aw=screen.availwidth;
		ah=screen.availheight;
	}
	else
	{
		aw=640;
		ah=480;
	}

	ustawienia=
		"left="+(aw-w)/2+","
		+"top="+(ah-h)/2+","
		+"screenX="+(aw-w)/2+","
		+"screenY="+(ah-h)/2+","
//		+"width="+(w+16)+","
		+"width="+(w)+","
		+"height="+h+","
		+"toolbar=no,"
		+"location=no,"
		+"directories=no,"
		+"status=no,"
		+"menubar=no,"
		+"scrollbars=yes,"
		+"resizable=yes"

		if (!(noweokno==null || noweokno.closed))
			noweokno.close();

		noweokno=window.open(strona,'nowe',ustawienia);
		noweokno.focus();

		return false;
}

function checkAnkieta()
{
	ret = false;
	siz = document.ankieta.odp.length;
	
	for( i = 0; i < siz; i++ )
	{
		if( document.ankieta.odp[i].checked )
		{
			ret = true;
			break;
		}
	}

	if( !ret )
	{
		alert( 'Proszę zaznaczyć odpowiedź !' );
	}

	return ret;
}

function isEmail( txt )
{
	i = txt.indexOf('@');
	if( i <= 0 )		return false;

	a = txt.lastIndexOf('@');
	if( i != a )		return false;
	
	j = txt.lastIndexOf('.');
	if( j <= (i+1) )	return false;

	return true;
}

function validator_is_email( frm, elem )
{
	if( !isEmail( frm.elements[elem].value ) )
	{
		alert( 'Proszę podać poprawny e-mail!' );
		frm.elements[elem].focus();
		return false;
	}
	return true;
}

function validator_not_empty( frm, elem )
{
	if( frm.elements[elem].value == '' )
	{
		alert( 'Proszę wypełnić wszystkie pola!' );
		frm.elements[elem].focus();
		return false;
	}

	return true;
}


function newsletter_sprawdz( frm )
{
	if( !isEmail(frm.email.value) )
	{
		alert( 'Nieprawidłowy format adresu e-mail!' );
		frm.email.focus();
		frm.email.select();
		return false;
	}

	return true;
}

function permanentStatus( text )
{
	window.defaultStatus = text;
	return true;
}

function stat( txt )
{
	window.status = txt;
	return true;
}

