// funkcja przełącza TabSheet
function changeTabSheet() {
	if ((!this) || (this.className == 'front')) return false;
	var ul = this.parentNode;
	var li = ul.getElementsByTagName('LI');
	for (var i=0; i<li.length; i++ ) {
		li[i].className = (li[i]==this) ? li[i].className.replace('back','front') : li[i].className.replace('front','back');
		var pg = document.getElementById('page'+i);
		if (pg) {
			pg.className = (li[i]==this)? pg.className.replace('back','front') : pg.className.replace('front','back');
		}
	}
	return false;
}
function activateTabSheet() {
	var ul = document.getElementsByTagName('UL');
	for( i=0; i<ul.length; i++ ) {
		if (ul[i].className != 'tabs') continue;
		var li = ul[i].getElementsByTagName('LI');
		for( j=0; j<li.length; j++ )
			li[j].onclick = changeTabSheet;
	}
}
	

window.onload = function() {
	activateTabSheet();
}

/******* JJ *******/

function checkEmail( strEmial )
{
	return strEmial.match( /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i ); 
}

function clearFormElement( objNode, strValue, strClass )
{
    if ( objNode.value == strValue ) {
        objNode.value = "";
		if ( strClass !== undefined )
		{
			objNode.className = strClass;
		}
    }
}

function checkNewsletter( nodeForm )
{
	if ( checkEmail( nodeForm.nlEmail.value ) )
	{
		return true;
	}
	else
	{
		alert( 'Prosze podać prawidłowy e-mail' );
		return false;
	}
}

function checkHelp(	strIDEmail, strIDArea )
{	
	var nodeEmail = document.getElementById( strIDEmail );
	if ( !( nodeEmail.Cleared && checkEmail( nodeEmail.value ) ) )
	{
		alert( 'Podany E-mail jest niepoprawny' );
		return false;
	}

	var nodeArea = document.getElementById( strIDArea );
	
	if ( !( nodeArea.Cleared && ( nodeArea.value != true ) ) )
	{
		alert( 'Pole wiadomoĹ�ci jest puste' );
		return false;
	}
	 
	return true;
}