/* JavaScript */

function validEmailAddr(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1) return false;
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
	if (str.indexOf(at,(lat+1))!=-1) return false;
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
	if (str.indexOf(dot,(lat+2))==-1) return false;
	if (str.indexOf(" ")!=-1) return false;
	return true;
}

function formValidation() {
	var f = document.iletisim;
	if (!f.adsoyad.value) {
		f.adsoyad.style.backgroundColor='#FFFFAA';
		alert("Adınızı ve soyadınızı girin.");
		f.adsoyad.focus();
		return false;
	} else {
		f.adsoyad.style.backgroundColor='#FFFFFF';
	}
	if (!f.eposta.value) {
		f.eposta.style.backgroundColor='#FFFFAA';
		alert("E-Posta adresinizi girin.");
		f.eposta.focus();
		return false;
	} else if (!validEmailAddr(f.eposta.value)) {
		f.eposta.style.backgroundColor='#FFFFAA';
		alert("Geçerli bir E-Posta adresi girin.");
		f.eposta.focus();
		return false;
	} else {
		f.eposta.style.backgroundColor='#FFFFFF';
	}
	if (!f.telefon1.value) {
		f.telefon1.style.backgroundColor='#FFFFAA';
		alert("Bir telefon numarası girin.");
		f.telefon1.focus();
		return false;
	} else if (f.telefon1.value.length < 7) {
		f.telefon1.style.backgroundColor='#FFFFAA';
		alert("Geçerli bir telefon numarası girin. Alan kodunu yazmayı unutmayın.");
		f.telefon1.focus();
		return false;
	} else {
		f.telefon1.style.backgroundColor='#FFFFFF';
	}
	if (!f.adres.value) {
		f.adres.style.backgroundColor='#FFFFAA';
		alert("Adresinizi girin.");
		f.adres.focus();
		return false;
	} else {
		f.adres.style.backgroundColor='#FFFFFF';
	}
	if (!f.sehir.value) {
		f.sehir.style.backgroundColor='#FFFFAA';
		alert("Yaşadığınız ilin adını girin.");
		f.sehir.focus();
		return false;
	} else {
		f.sehir.style.backgroundColor='#FFFFFF';
	}
	if (!f.ulke.value) {
		f.ulke.style.backgroundColor='#FFFFAA';
		alert("Yaşadığınız ülkeyi seçin.");
		f.ulke.focus();
		return false;
	} else {
		f.ulke.style.backgroundColor='#FFFFFF';
	}
	if (!f.oda_tipi.value) {
		f.oda_tipi.style.backgroundColor='#FFFFAA';
		alert("İhtiyacınıza göre oda tipini seçin.");
		f.oda_tipi.focus();
		return false;
	} else {
		f.oda_tipi.style.backgroundColor='#FFFFFF';
	}
	if (!f.oda_adedi.value) {
		f.oda_adedii.style.backgroundColor='#FFFFAA';
		alert("İhtiyacınıza göre oda tipini seçin.");
		f.oda_adedi.focus();
		return false;
	} else {
		f.oda_adedi.style.backgroundColor='#FFFFFF';
	}
	if (!f.check_in.value) {
		f.check_in.style.backgroundColor='#FFFFAA';
		alert("Otelimize geliş tarihini seçin.");
		f.check_in.focus();
		return false;
	} else {
		f.check_in.style.backgroundColor='#FFFFFF';
	}
	if (!f.check_out.value) {
		f.check_out.style.backgroundColor='#FFFFAA';
		alert("Otelimizden ayrılış tarihini seçin.");
		f.check_out.focus();
		return false;
	} else {
		f.check_out.style.backgroundColor='#FFFFFF';
	}
	return true;
}

/* end */

