/**
*	Opis: funkcja sprawdza, czy grafika jest aktywna, czy nie
*/
function checkIsOn( a_id )
{
	oButton = document.getElementById( a_id );
	sSrc = oButton.src;
	iLen = sSrc.length;
	sRoz = sSrc.substr( iLen-6, 2 );
	if( sRoz == "_a" )
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

/**
*	Opis: funkcja podmienia obrazki bez tekstu przy wywolaniu
*/
function changeImage2( a_name, on_off ) 
{
	old_img = document.getElementById( a_name );
	old_src = old_img.src;
	len = old_src.length;
	roz = old_src.substr( len-4, len );
	new_src = old_src;
	if( on_off == 1 )
	{
		if( checkIsOn( a_name ) == 0 )
		{
			new_src = old_src.substr( 0, len-4 ) + "_a" + roz;
		}
	}
	else
	{
		if( checkIsOn( a_name ) == 1 )
		{
			new_src = old_src.substr( 0, len-6 ) + roz;
		}
	}
	old_img.src = new_src;
} 

/**
*	Opis: funkcja sprawdza, czy grafika jest aktywna, czy nie
*/
function sendForm( txt, txt2 )
{
	if( ( document.getElementById( 'email' ).value != '' ) || ( document.getElementById( 'phone' ).value != '' ) )
	{
		if( ( document.getElementById( 'email' ).value != '' )  && ( isEMail( document.getElementById( 'email' ).value ) == 0 ) )
		{
			alert( txt2 );
		}
		else
		{
			document.getElementById( 'sendDataForm' ).submit();
		}
	}
	else
	{
		alert( txt );
	}
}

/**
*	Opis: funkcja sprawdza, czy ciag jest poprawnym adresem e-mail
*/
function isEMail( email )
{
	re = /^[-a-z0-9!#$%&\'*+\/=?^_`{|}~]+(\.[-a-z0-9!#$%&\'*+\/=?^_`{|}~]+)*@(([a-z]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$/g;
	check = email.replace( re, "" );
	if( check == '' )
	{
		return 1;
	}
	return 0;
}


