
var kolor_bad='#FF423B';

/////

function exporter()
{
    var pole = document.forms.sped.exporter;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function osoba()
{
    var pole = document.forms.sped.osoba;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function wzor()
{
    var pole = document.forms.sped.wzor;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function tel()
{
    var pole = document.forms.sped.tel;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function mail()
{
    var pole = document.forms.sped.mail;    

    if ( pole.value.match( /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/ ) )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function odbiorca()
{
    var pole = document.forms.sped.odbiorca;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function od_adres()
{
    var pole = document.forms.sped.od_adres;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function od_tel()
{
    var pole = document.forms.sped.od_tel;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function od_osoba()
{
    var pole = document.forms.sped.od_osoba;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function notify()
{
    var pole = document.forms.sped.notify;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function warunki()
{
    var pole = document.forms.sped.warunki;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

/////////////////////////////////////////////////////////////////////////////////

function polename()
{
    var pole = document.forms.sped.name;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function waga()
{
    var pole = document.forms.sped.waga;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function ilosc()
{
    var pole = document.forms.sped.ilosc;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

/////////////////////////////////////////////////////////////////////////////////

function port_wyladunku()
{
    var pole = document.forms.sped.port_wyladunku;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function gotowosc()
{
    var pole = document.forms.sped.gotowosc;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

/////////////////////////////////////////////////////////////////////////////////

function rodzaj()
{
    var pole = document.forms.sped.rodzaj;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function wymiary()
{
    var pole = document.forms.sped.wymiary;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function oznakowanie()
{
    var pole = document.forms.sped.oznakowanie;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function transport()
{
    var pole = document.forms.sped.transport;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function stawka()
{
    var pole = document.forms.sped.stawka;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////


function wypelniajacy()
{
    var pole = document.forms.sped.wypelniajacy;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function data()
{
    var pole = document.forms.sped.data;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


/////////////////////////////////////////////////////////////////////////////////


function kontener()
{
    var pole = document.forms.sped.kontener;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function dzien()
{
    var pole = document.forms.sped.dzien;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////


function godzine()
{
    var pole = document.forms.sped.godzine;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}
/////////////////////////////////////////////////////////////////////////////////

function kubatura()
{
    var pole = document.forms.sped.kubatura;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

/////////////////////////////////////////////////////////////////////////////////


function ilosc_kontenerow()
{
    var pole = document.forms.sped.ilosc_kontenerow;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


/////////////////////////////////////////////////////////////////////////////////


function kontener_adres()
{
    var pole = document.forms.sped.kontener_adres;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}



// // // // // // // // // // // // // // // 

function select()
{
    var pole = document.forms.sped.kontener;
    var inne = document.forms.sped.inne;    

    if ( pole.value=='inne' )
    {	
		inne.style.display = '' ;
    }
    else inne.style.display = 'none' ;
 
}







/////////////////////////////////////////////////////////////////////////////////

function miejsce_dostawy()
{
    var pole = document.forms.sped.miejsce_dostawy;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

///////////////////////////////////////////////////////////


function miejsce_zaladunku()
{
    var pole = document.forms.sped.miejsce_zaladunku;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


///////////////////////////////////////////////////////////


function bank()
{
    var pole = document.forms.sped.bank;    

    if ( pole.value )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

///////////////////////////////////////////////////////////

function ilosc_kontenerow()
{
   // var pole = document.getElementById('ilosc_kontenerow');    
    var pole = document.forms.sped.ilosc_kontenerow;    


    if ( pole.value || pole.selectedIndex )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


function rozmiar_konteneru()
{
    var pole = document.forms.sped.rozmiar_konteneru;    

    if ( pole.value || pole.selectedIndex )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}

function typ_konteneru()
{
    var pole = document.forms.sped.typ_konteneru;    

    if ( pole.value  || pole.selectedIndex )
    {
		return 1; //ok
    }
    else
    {   		
		pole.style.backgroundColor = kolor_bad ;
		return 0; //zle
    }
 
}


/////////////////////////////////////////////////////////////////////////////////
									///
/////////////////////////////////////////////////////////////////////////////////
									///
/////////////////////////////////////////////////////////////////////////////////

function checkAll() {
	
	var blad;
 	var typ = document.forms.sped.typ;   
	
	
//////f1	
	if(  typ.value=='export-lcl'  )
	{
		if( !exporter()		 ) blad=1; 
		if( !osoba()		 ) blad=1; 
		if( !tel()			 ) blad=1; 
		if( !mail()   		 ) blad=1; 	
		if( !odbiorca()		 ) blad=1;
		if( !od_adres()		 ) blad=1;
		if( !od_tel()		 ) blad=1;
		if( !od_osoba()		 ) blad=1;
		if( !bank()		 	 ) blad=1;		
		//if( !notify()		 ) blad=1;
		if( !warunki()		 ) blad=1;
		if( !polename()		 ) blad=1;
		//if( !waga()	 		 ) blad=1;
		//if( !ilosc()	 	 ) blad=1;
		if( !port_wyladunku()) blad=1;
		if( !gotowosc()		 ) blad=1;
		//if( !transport() 	 ) blad=1;
		if( !stawka() 		 ) blad=1;
		if( !wypelniajacy()	 ) blad=1;
		if( !data()			 ) blad=1;	
		
		//if( !rodzaj()		 ) blad=1;
		//if( !wymiary()	 	 ) blad=1;
		//if( !oznakowanie() 	 ) blad=1;	
		if( !miejsce_zaladunku()	) blad=1;
		//if( !kubatura() 	 ) blad=1;	
	}
	
//////f2	
	if(  typ.value=='import-lcl'  )
	{
		if( !exporter()		 ) blad=1; 
		if( !osoba()		 ) blad=1; 
		if( !tel()			 ) blad=1; 
		if( !mail()   		 ) blad=1; 	
		if( !odbiorca()		 ) blad=1;
		if( !bank()		 	 ) blad=1;		
		//if( !od_adres()		 ) blad=1;
		if( !od_tel()		 ) blad=1;
		//if( !od_osoba()		 ) blad=1;
		if( !warunki()		 ) blad=1;
		if( !polename()		 ) blad=1;
		//if( !waga()	 		 ) blad=1;
		//if( !ilosc()	 	 ) blad=1;
		if( !port_wyladunku()) blad=1;
		if( !gotowosc()		 ) blad=1;
		//if( !transport() 	 ) blad=1;
		if( !stawka() 		 ) blad=1;
		if( !wypelniajacy()	 ) blad=1;
		if( !data()			 ) blad=1;
		
		//if( !rodzaj()		 ) blad=1;
		//if( !wymiary()	 	 ) blad=1;
		if( !miejsce_zaladunku()	) blad=1;
		//if( !oznakowanie() 	 ) blad=1;
		
		//if( !kubatura() 	 ) blad=1;			
	}
	
//////f3
	if(  typ.value=='export-fcl'  )
	{
		if( !exporter()		 ) blad=1; 
		if( !osoba()		 ) blad=1; 
		if( !tel()			 ) blad=1; 
		if( !mail()   		 ) blad=1; 	
		if( !odbiorca()		 ) blad=1;
		if( !od_adres()		 ) blad=1;
		if( !od_tel()		 ) blad=1;
		if( !od_osoba()		 ) blad=1;
		if( !bank()		 	 ) blad=1;		
		//if( !notify()		 ) blad=1;
		if( !warunki()		 ) blad=1;
		if( !polename()		 ) blad=1;
		//if( !waga()	 		 ) blad=1;
		//if( !ilosc()	 	 ) blad=1;
		if( !port_wyladunku()) blad=1;
		if( !gotowosc()		 ) blad=1;
		//if( !transport() 	 ) blad=1;
		if( !stawka() 		 ) blad=1;
		if( !wypelniajacy()	 ) blad=1;
		if( !data()			 ) blad=1;
		
		if( !miejsce_dostawy()		) blad=1;
		if( !miejsce_zaladunku()	) blad=1;
		
		if( !ilosc_kontenerow()	) blad=1;
		if( !rozmiar_konteneru()) blad=1;
		if( !typ_konteneru()	) blad=1;	
		
	}
	
//////f4	
	if(  typ.value=='import-fcl'  )
	{
		if( !exporter()		 ) blad=1; 
		if( !osoba()		 ) blad=1; 
		if( !tel()			 ) blad=1; 
		if( !mail()   		 ) blad=1; 	
		if( !odbiorca()		 ) blad=1;
		if( !bank()		 	 ) blad=1;
		//if( !od_adres()		 ) blad=1;
		if( !od_tel()		 ) blad=1;
		if( !od_osoba()		 ) blad=1;
		//if( !notify()		 ) blad=1;
		if( !warunki()		 ) blad=1;
		if( !polename()		 ) blad=1;
		//if( !waga()	 		 ) blad=1;
		//if( !ilosc()	 	 ) blad=1;
		if( !port_wyladunku()) blad=1;
		if( !gotowosc()		 ) blad=1;
		//if( !transport() 	 ) blad=1;
		if( !stawka() 		 ) blad=1;
		if( !wypelniajacy()	 ) blad=1;
		if( !data()			 ) blad=1;
		
		if( !ilosc_kontenerow()	) blad=1;
		if( !rozmiar_konteneru()) blad=1;
		if( !typ_konteneru()	) blad=1;
		
		
		
		
		//if( !miejsce_dostawy()		) blad=1;
		if( !miejsce_zaladunku()	) blad=1;
		

	
						
	}			
	


//////  	

	 
	var pole = document.getElementById("err");
	 	
    if( !blad )
    {
    	 pole.style.display = 'none' ;
    	 document.forms.sped.submit();
    }  
	else
	{    
		pole.style.color = kolor_bad ;
		pole.style.display = '' ;
	}	
//

}