
function wyslij(){

	var f = document.form;

	var mail= new String(f.email.value);
	var error_message = "Wystąpiły błędy w trakcie przetwarzania formularza!\n\n";
	var wzor_meila=/^([\w]{1,}\.{0,1}\w{1,}@{1}\w{1,}\.{1}\w{1,}\.{0,1}\w{0,}){1}$/;
	var error=0;
	if (wzor_meila.test(mail)==false){
		error_message = error_message + "Nieprawidłowy mail \n";
		error = 1;
	}
	if(f.imie.value==''){
		error_message = error_message + "Proszę podać Imię \n";
		error = 1;	
	}
	if(f.nazwisko.value==''){
		error_message = error_message + "Proszę podać Nazwisko \n";
		error = 1;	
	}
	if(f.ulica.value==''){
		error_message = error_message + "Proszę podać Ulicę i numer mieszkania \n";
		error = 1;	
	}
	if(f.kod.value==''){
		error_message = error_message + "Proszę podać Kod pocztowy \n";
		error = 1;	
	}
	if(f.miasto.value==''){
		error_message = error_message + "Proszę podać Miejscowość \n";
		error = 1;	
	}
	if(f.tel.value==''){
		error_message = error_message + "Proszę podać Telefon \n";
		error = 1;	
	}




	if(error==1){
		alert(error_message);
		
	}else{
		f.submit();
	}

}


$.fn.wait = function(time, type) {
    time = time || 1500;
    type = type || "fx";
    return this.queue(type, function() {
	var self = this;
	setTimeout(function() {
	    $(self).dequeue();
	}, time);
    });
};





function png($img){
		var przegladarka= navigator.userAgent;
		if(przegladarka.indexOf("MSIE 6.0")!=-1 || przegladarka.indexOf("MSIE 6.5")!=-1){
			var $html =
				'<span ' +
					(($img.id)?        "id='"    + $img.id + "' "        : '') +
					(($img.className)? "class='" + $img.className + "' " : '') +
					(($img.title)?     "title='" + $img.title + "' "     : '') +
					'style="' +
						'display: inline-block;' +
						'width: ' + $img.width + 'px;' +
						'height: ' + $img.height + 'px;' +
						"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $img.src + "', sizingMethod='scale'); " +
					$img.style.cssText + '" ';
		
			$html += '></span>';
			$img.outerHTML = $html;
		}
}



function fleszAJAX(flesz,width,height,id_diva) {
		document.getElementById(id_diva).innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="subskrybcja_en" align="middle"> <param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="transparent" /> <param name="movie" value="'+flesz+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+flesz+'" wmode="transparent" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="subskrybcja_pl" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>';
}

var Timer;
function ScrollLeft(){Timer = setInterval("document.getElementById('center_galery').scrollLeft -= 2", 15);}
function ScrollRight(){Timer = setInterval("document.getElementById('center_galery').scrollLeft += 2", 15);}



function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}



$(document).ready(function()
{

	$('.error2').wait().slideUp(1000);	
	$('.error').wait().slideUp(1000);	


	$('.img_obrazek img').click(function(){

		$("#big_img1").html($(".img_hidden").html());
		$("#big_img1").css({'top':f_scrollTop() +50 +'px','left':parseInt($('body').width()/2-275)+'px'});
		$("#cien1").css({'top':'0px','left':'0px','width':$('body').width()+'px','height':$(document).height()+'px','opacity':'0.7'});
		$("#big_img1, #cien1").css({'display':'block'});
	
	})
	$('#big_img1').click(function(){

		$("#big_img1, #cien1").css({'display':'none'});
		
	})

	$('.img_obrazek2 img').click(function(){

		$("#big_img2").html($(".img_hidden2").html());
		$("#big_img2").css({'top':f_scrollTop() +10 +'px','left':parseInt($('body').width()/2-512)+'px'});
		$("#cien1").css({'top':'0px','left':'0px','width':$('body').width()+'px','height':$(document).height()+'px','opacity':'0.7'});
		$("#big_img2, #cien1").css({'display':'block'});
	
	})
	$('#big_img2').click(function(){

		$("#big_img2, #cien1").css({'display':'none'});
		
	})


	
	$('#galeria_kontener .left_galery img').mouseover(function(){
		ScrollLeft();
	})
	$('#galeria_kontener .right_galery img').mouseover(function(){
		ScrollRight();
	})
	$('#galeria_kontener .left_galery img, #galeria_kontener .right_galery img').mouseout(function(){	
		clearInterval(Timer)
	})

	$('#galeria_kontener2 .left_galery img').mouseover(function(){
		ScrollLeft();
	})
	$('#galeria_kontener2 .right_galery img').mouseover(function(){
		ScrollRight();
	})
	$('#galeria_kontener2 .left_galery img, #galeria_kontener2 .right_galery img').mouseout(function(){	
		clearInterval(Timer)
	})
	oknopop_pup(500,282);

})