function przelicz_form( selection )
	{
	  		document.getElementById('allpayaukcja').cwartosc.value=1.23*document.getElementById('allpayaukcja').ile.value + ' PLN';
	  		var wartosc = document.getElementById('allpayaukcja').cwartosc.value;
	  		document.getElementById('allpayaukcja').kwota.value = wartosc;
	  		var email1 = document.getElementById('allpayaukcja').email.value;
	  		var kwota = document.getElementById('allpayaukcja').kwota.value;
	  		var ile1 = document.getElementById('allpayaukcja').ile.value;
	  		document.getElementById('allpayaukcja').URLC.value = "http://midi-pliki.pl/allpay/allpay_a.php?wart="+ile1+"&mail="+email1;
				document.getElementById('allpayaukcja').URL.value = "http://midi-pliki.pl/";
	  		document.getElementById('allpayaukcja').opis.value = "midi_kod_"+(Math.floor(ile1*123+0.50000000001)/100);
	}

function chkformallpay()
	{
		var email = document.getElementById('allpayaukcja').email.value;
		pattern = new RegExp( '^([a-zA-Z0-9\-\.\_]+)(\@)([a-zA-Z0-9\-\.]+)([\.])([a-zA-Z]{2,4})$' );
		if ( !pattern.test(email) )
		{
			alert("Podaj poprawny email!");
			document.getElementById('allpayaukcja').focus();
			return false;
		}
		
		var kwota1 = document.getElementById('allpayaukcja').ile.value;
		pattern = new RegExp( '^([0-9]+)$' );
		if (!pattern.test(kwota1)) 
		{
				alert("Podaj poprawną liczbę plików!");
			document.getElementById('allpayaukcja').focus();
			return false;
		}
		if (kwota1<=3)
		{
			alert("Podaj poprawną liczbę plików!");
			document.getElementById('allpayaukcja').focus();
			return false;
		}
		
		return true;
  	}
	
	
function send_allpay( selection )
	{
		przelicz_form();
		if (chkformallpay())
		{
	  		document.getElementById('allpayaukcja').method = "post";
	  	  	document.getElementById('allpayaukcja').action = "https://ssl.dotpay.pl/";
			document.getElementById('allpayaukcja').submit();	
		}
	}
