function toggleLayer(warstwa) {
	if (document.getElementById) {
		var style2 = document.getElementById(warstwa).style;
		style2.display = style2.display? "":"block";
	} else if (document.all) {
		var style2 = document.all[warstwa].style;
		style2.display = style2.display? "":"block";
	} else if (document.layers) {
		var style2 = document.layers[warstwa].style;
		style2.display = style2.display? "":"block";
	}
}

function toggleParams() {
	warstwa = 'rightsea';
	warstwa2 = 'leftsea';
	warstwa3 = 'rightsea2';
	if (document.getElementById) {
		var style2 = document.getElementById(warstwa).style;
		var style3 = document.getElementById(warstwa2).style;
		var style4 = document.getElementById(warstwa3).style;
	} else if (document.all) {
		var style2 = document.all[warstwa].style;
		var style3 = document.all[warstwa2].style;
		var style4 = document.all[warstwa3].style;
	} else if (document.layers) {
		var style2 = document.layers[warstwa].style;
		var style3 = document.layers[warstwa2].style;
		var style4 = document.layers[warstwa3].style;
	}
	style2.display = style2.display? "":"none";
	style3.width = style3.width? "":"754px";
	style4.display = style4.display? "":"block";

}

function toggleLayers(warstwa) {
	if (document.getElementById) {
		var style2 = document.getElementById(warstwa).style;
		style2.display = style2.display? "":"inline";
		var style3 = document.getElementById(warstwa+"b").style;
		style3.fontWeight = style3.fontWeight ? "bold":"normal";
	} else if (document.all) {
		var style2 = document.all[warstwa].style;
		style2.display = style2.display? "":"inline";
		var style3 = document.all[warstwa+"b"].style;
		style3.fontWeight  = style3.fontWeight? "bold":"normal";
	} else if (document.layers) {
		var style2 = document.layers[warstwa].style;
		style2.display = style2.display? "":"inline";
		var style3 = document.layers[warstwa+"b"].style;
		style3.fontWeight = style3.fontWeight? "bold":"normal";
	}
}

function Checkall(form){ 
  for (var i = 1; i < form.elements.length; i++){    
    eval("form.elements[" + i + "].checked = form.elements[0].checked");  
  } 
} 

function skasowanie()
{
	var conf = confirm("Czy jesteś pewien?");
	if(conf)
	{
		this.href;
	}
	return conf;
}

window.addEvent('domready',function(){

	var sampleObjectItems =[
			{title:'Morbi elementum', autor:'Lorem', date:'5 Jun 2007', link:'http://www.link1.com'},
			{title:'Mollis leo', autor:'Ipsum', date:'6 Dic 2007', link:'http://www.link2.com'},
			{title:'Nunc adipiscing', autor:'Dolor', date:'9 Feb 2007', link:'http://www.link3.com'},
			{title:'Phasellus volutpat pharetra', autor:'Sit', date:'22 Jul 2007', link:'http://www.link4.com'}
		];

		var info6 = $('box6').getNext().set('opacity',0);
		var nS6 = new noobSlide({
			mode: 'vertical',
			box: $('box6'),
			items: [0,1,2,3,4],
			size: 316,
			handles: $$('#handles6_1 div'),
			handle_event: 'mouseenter',
			button_event: 'click',
			autoPlay: true,
			onWalk: function(currentItem,currentHandle){
					this.handles.removeClass('active1');
					currentHandle.addClass('active1');
			},
			fxOptions: {property:'left',duration:1000, transition:Fx.Transitions.Back.easeOut, wait:false}
			
		});
		
		nS6.walk(0);

		$$('#box6 span').addEvents(
		{
			'mouseover':function(){
				nS6.stop();
			},
			'mouseleave':function(){
				nS6.play(8000,"next",false);
			}
		});

	});
	
function submitJob() {

	var error = '';
	var fstn = $( '#firstname' ).val();
	var lstn = $( '#lastname' ).val();
	var email = $( '#email' ).val();

	if( fstn == '' ){		error += 'Nie podano imienia'+"\n";		}
	if( lstn == '' ){	error += 'Nie podano nazwiska'+"\n";		}
	if( email == '' || !validateEmail( email ) ){
		error += 'Podano nieprawidłowy e-mail.'+"\n";
	}
	if( !$('#form input[type="checkbox"]').is(':checked') ){
		error += 'Nie wyrażono zgody na przetwarzanie danych osobowych.'+"\n";
	}


	if( error != '' ){
		alert( error );
	}
	else { 
	    $( '#form' ).submit();
	}
}

function validateEmail( email ) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if( reg.test( email ) == false ) {
      return false;
   }
   return true;
}


function submitForm() {

	var error = '';
	var fstn = $( '#namef' ).val();
	var lstn = $( '#company' ).val();
	var email = $( '#email' ).val();

	if( fstn == '' ){		error += 'Nie podano imienia i nazwiska'+"\n";		}
	if( lstn == '' ){	error += 'Nie podano nazwy firmy'+"\n";		}
	if( email == '' || !validateEmail( email ) ){
		error += 'Podano nieprawidłowy e-mail.'+"\n";
	}
	
	//if( !$('#form input[type="checkbox"]').is(':checked') ){
	//	error += 'Nie wyrażono zgody na przetwarzanie danych osobowych.'+"\n";
	//}


	if( error != '' ){
		alert( error );
	}
	else { 
	    $( '#form' ).submit();
	}
}

