$(document).ready(function(){
/* IFR */ 
$('.lightbox').lightBox({fixedNavigation:true});
 });

function load() { 
var zoom=15; 
var point = new GLatLng(50.564112, 22.054539);  
var marker = new GMarker(point);

	if (GBrowserIsCompatible()) { 
	var mapa = new GMap2(document.getElementById("map")); 
	GEvent.addListener(marker, "click", function() {
		alert("MZB w Stalowej Wola, ul. Dmowskiego 1, 37-450 Stalowa Wola");
		});

	mapa.addControl(new GSmallZoomControl());
	mapa.setCenter(new GLatLng(50.565385,22.054303), zoom); 
	mapa.addOverlay(marker);
	}
}
//maps.google.pl/maps?daddr=Romana+Dmowskiego,+Stalowa+Wola&geocode=&dirflg=&saddr=&f=d&sll=50.566671,22.05323&sspn=0.008055,0.022745&ie=UTF8&ll=,&spn=0.008055,0.022745&z=16&iwloc=ddw1
function CheckForm(obj){
	 
	var data_przyjazdu = document.getElementById( 'data_przyjazdu' ).value;
	if (!data_przyjazdu) {
		alert('Prosimy o podanie daty przyjazdu.');
			  return false;
				}
	var data_wyjazdu = document.getElementById( 'data_wyjazdu' ).value;
	if (!data_wyjazdu) {
		alert('Prosimy o podanie daty wyjazdu.');
			  return false;
				}
	var imie_i_nazwisko = document.getElementById( 'imie_i_nazwisko' ).value;
	if (!imie_i_nazwisko) {
		alert('Prosimy o podanie imienia oraz nazwiska osoby kontaktowej.');
			  return false;
				}
				
	var telefon = document.getElementById( 'telefon' ).value;
	var email = document.getElementById( 'email' ).value;
	
	if (!telefon && !email) {
		alert('Prosimy o podanie przynajmniej jednej formy kontaktu: telefon lub e-mail.');
			  return false;
				}
	
	if (email && isEmail(email) == false ){
		alert('E-mail wydaje się być nieprawidłowy.');
			  return false;
		
		}
	
	
	return true;				
}

function CheckForm1(obj){
	 
	var imie_i_nazwisko = document.getElementById( 'imie_i_nazwisko' ).value;
	if (!imie_i_nazwisko) {
		alert('Prosimy o podanie imienia oraz nazwiska osoby kontaktowej.');
			  return false;
				}
				
	var email = document.getElementById( 'email' ).value;
	
	if (!email) {
		alert('Prosimy o podanie e-mail kontaktowego.');
			  return false;
				}
				
	if (email && isEmail(email) == false ){
		alert('E-mail wydaje się być nieprawidłowy.');
			  return false;
		}
		
	var zapytanie = document.getElementById( 'zapytanie' ).value;
	if (!zapytanie) {
		alert('Prosimy o uzupełnienie treści zapytania.');
			  return false;
				}
	
	
	return true;				
}

function isEmail(email) {
var regEmail = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{2,4})$/;
if (!regEmail.test(email)) return false;
else return true;
}

function WyczyscPole(){
	document.getElementById( 'mail' ).value = "";
	}

function DodajDoNewslettera( ){
		
		var mail = document.getElementById( 'mail' ).value;
		
		advAJAX.get({
			url: 'index.php?module=newsletter&mail='+mail+'&ajax=1',
			onInitialization : function() {
				document.getElementById( 'mail' ).value = 'czekaj...';
			},
			onSuccess : function(obj) {	
				//document.getElementById( 'mail' ).value = 'Twój e-mail został zapisany w bazie Sosnowego Dworu';

				document.getElementById( 'mail' ).value = obj.responseText;
			
			},
			onError : function(obj) {
				document.getElementById( 'mail' ).value = 'Wystąpil nieoczekiwany błąd...';
			}	
		});
	}