function checkform2(lang){
var list=document.form3.tip;
var listValue = list.selectedIndex;
		
		if (listValue==0){
		if (lang==1){
		alert ("Lütfen Yat Tipini Seçiniz");}
		else{alert ("Please choose a yacht type");}
		document.form3.tip.focus();
		return false;  
	}

		if (document.form3.yat.value == ""){
		if (lang==1){
		alert ("Lütfen  Yat İsmini Giriniz.");}
		else{alert ("Please enter the yacht name");}
		document.form3.yat.focus();
		return false;  
	}
		if (document.form3.boy.value == ""){
		if (lang==1){
		alert ("Lütfen  Uzunluk Giriniz.");}
		else{alert ("Please enter the L.O.A");}
		document.form3.boy.focus();
		return false;  
	}	
		if (document.form3.en.value == ""){
		if (lang==1){
		alert ("Lütfen Genişlik Giriniz.");}
		else{alert ("Please enter the beam");}
		document.form3.en.focus();
		return false;  
	}
		if (document.form3.isim.value == ""){
		if (lang==1){
		alert ("Lütfen  İsminizi Giriniz.");}
		else{alert ("Pease enter your name");}
		document.form3.isim.focus();
		return false;  
	}
	if (document.form3.soyisim.value == ""){
		if (lang==1){
		alert ("Lütfen  Soyadınızı Giriniz.");}
		else{alert ("Pease enter your surname");}
		document.form3.soyisim.focus();
		return false;  
	}

	if (document.form3.email.value == ""){
		if (lang==1){
		alert ("Lütfen e-mail adresinizi Giriniz.");}
		else{alert ("Please enter your e-mail address");}
		document.form3.email.focus();
		return false;  
	}
	
		if (document.form3.telefon.value == ""){
		if (lang==1){
		alert ("Telefon Numaranızı  Giriniz.");}
		else{alert ("Please enter your phone number");}
		document.form3.telefon.focus();
		return false;  
	}
	
		if (document.form3.mesaj.value == ""){
		if (lang==1){
		alert ("Lütfen Mesajınızı Giriniz .");}
		else{alert ("Please enter your message");}
		document.form3.mesaj.focus();
		return false;  
	}
}
function uzunluk(lang){
var mesaj;
mesaj=document.form3.mesaj.value;
if (mesaj.length>200) { 
	document.form3.mesaj.value=document.form3.mesaj.value.substring(0,198);
	return false;}
}
function checkform(lang){

		if (document.form3.isim.value == ""){
		if (lang==1){
		alert ("Lütfen  İsminizi Giriniz.");}
		else{alert ("Pease enter your name");}
		document.form3.isim.focus();
		return false;  
	}
	if (document.form3.soyisim.value == ""){
		if (lang==1){
		alert ("Lütfen  Soyadınızı Giriniz.");}
		else{alert ("Pease enter your surname");}
		document.form3.soyisim.focus();
		return false;  
	}

	if (document.form3.email.value == ""){
		if (lang==1){
		alert ("Lütfen e-mail adresinizi Giriniz.");}
		else{alert ("Please enter your e-mail address");}
		document.form3.email.focus();
		return false;  
	}
	
		if (document.form3.telefon.value == ""){
		if (lang==1){
		alert ("Telefon Numaranızı  Giriniz.");}
		else{alert ("Please enter your phone number");}
		document.form3.telefon.focus();
		return false;  
	}
	
		if (document.form3.mesaj.value == ""){
		if (lang==1){
		alert ("Lütfen Mesajınızı Giriniz .");}
		else{alert ("Please enter your message");}
		document.form3.mesaj.focus();
		return false;  
	}
}

function OpenImage(ImageName)
{
	msgWindow=window.open("","msgWindow","menubar=no, width=640, height=480");
	msgWindow.document.open();
	msgWindow.document.write("<title>Ataköy Marina</title><body topmargin=0 leftmargin=0><img onload='window.resizeTo(document.images[0].width, document.images[0].height + 40 )'  src='" + ImageName + "'></body>")
}
function CheckCalculator(){
	if(hesap_makinesi.boy.value=="" || hesap_makinesi.en.value=="")
	{
		alert("Geminin boyunu ve enini girmelisiniz");
		return (false);
	}
}
function showToolTip(e,text){
      document.all.ToolTip.innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>";
      ToolTip.style.pixelLeft=(e.x+15+document.body.scrollLeft);
      ToolTip.style.pixelTop=(e.y+document.body.scrollTop);
      ToolTip.style.visibility="visible";
}
function hideToolTip(){
      ToolTip.style.visibility="hidden";
} 
function ValidAZaz09(str) {
	var code = window.event.keyCode;
	if (!((48 <= code && code <= 57) || (65 <= code && code <= 90) || (97 <= code && code <= 122) ||
		  ((str != "") & (str.indexOf(String.fromCharCode(code)) >= 0))
		 )) window.event.returnValue = false;
}
function ValidAZaz(str) {
	var code = window.event.keyCode;
	if (!((65 <= code && code <= 90) || (97 <= code && code <= 122) ||
		  ((str != "") & (str.indexOf(String.fromCharCode(code)) >= 0))
		 )) window.event.returnValue = false;
}
function ValidAZ09(str) {
	var code = window.event.keyCode;
	if (!((48 <= code && code <= 57) || (65 <= code && code <= 90) ||
		  ((str != "") & (str.indexOf(String.fromCharCode(code)) >= 0))
		 )) window.event.returnValue = false;
}
function ValidAZ(str) {
	var code = window.event.keyCode;
	if (!((65 <= code && code <= 90) ||
		  ((str != "") & (str.indexOf(String.fromCharCode(code)) >= 0))
		 )) window.event.returnValue = false;
}
function Valid09(str) {
	var code = window.event.keyCode;
	if (!((48 <= code && code <= 57) ||
		  ((str != "") & (str.indexOf(String.fromCharCode(code)) >= 0))
		 )) window.event.returnValue = false;
}

function ValidDate(str) {
	var li_Index, li_Day, li_Month, li_Year;
	// the date string can not contain any spaces
	if (str.search(" ") > 0) return false;
	// the date string must be a valid date in (DD*MM*YYYY) format
	li_Day = Number(str.substr(0, 2));
	li_Month = Number(str.substr(3, 2));
	li_Year = Number(str.substr(6, 4));
	if (li_Day < 1 || li_Day > 31 || li_Month > 12 || li_Month < 0 || li_Year < 1 ||
	    ((li_Month == 2 || li_Month == 4 || li_Month == 6 || li_Month == 9 || li_Month == 11) && li_Day > 30) ||
		(li_Year % 4 != 0 && li_Month == 2 && li_Day > 28)) return false;
	return true;
}
function CheckDate(str) {
	if (ValidDate(str))
		return true;
	else {
		alert("Tarih değerini hatalı girdiniz, kontrol edip düzeltiniz");
		return false;
	}
}

function WriteGun() {
	for (i=1;i<32;i++) {
		ii = new String(i);
		if (ii.length < 2) ii = "0" + i;
		document.write("<option value=\"" + i + "\">" + ii + "</option>");
	}
}

function WriteAy() {
	var aylar = "Ocak,Şubat,Mart,Nisan,Mayıs,Haziran,Temmuz,Ağustos,Eylül,Ekim,Kasım,Aralık";
	ayarray = aylar.split(",");
	for (i=0;i<ayarray.length;i++) {
		ii = new String(i+1);
		iii = ii
		if (ii.length < 2) ii = "0" + ii;
		document.write("<option value=\"" + iii + "\">" + ayarray[i] + "</option>");
	}
}

function WriteAy2() {
	for (i=1;i<13;i++) {
		ii = new String(i);
		if (ii.length < 2) ii = "0" + i;
		document.write("<option value=\"" + i + "\">" + ii + "</option>");
	}
}

function WriteYil() {
	for (i=1990;i>1939;i--) {
		ii = new String(i);
		document.write("<option value=\"" + i + "\">" + ii + "</option>");
	}
}


function WriteYil2() {
	for (i=2010;i>2006;i--) {
		ii = new String(i);
		document.write("<option value=\"" + i + "\">" + ii + "</option>");
	}
}

function WriteYil3() {
	for (i=2007;i>1959;i--) {
		ii = new String(i);
		document.write("<option value=\"" + i + "\">" + ii + "</option>");
	}
}
function CheckAll() {
	// eMail control
	var ls_eMail, li_1stATPos;
	var ls_SpecChars = "@.";
	var ls_ErrStr = "";
	ls_eMail = MessageSend.eMail.value;
	li_1stATPos = ls_eMail.indexOf("@");
	if (ls_eMail.length < 9) { // length must be greater than 8
		ls_ErrStr = "e-posta adresi yeterli uzunlukta değil";
	} else if (li_1stATPos <= 0) { // '@' must be contained but not as the first character
		ls_ErrStr = "e-posta adresinde '@' işareti girilmeli";
	} else if (li_1stATPos != ls_eMail.lastIndexOf("@")) { // '@' must be contained at most 1 time
		ls_ErrStr = "e-posta adresine '@' karakterinden en fazla 1 tane girilebilir";
	} else if (ls_eMail.indexOf(".") <= 0) { // '.' must be contained but not as the first character
		ls_ErrStr = "e-posta adresi '.' işareti barındırmalı fakat '.' işareti ile başlamamalı";
	} else if (ls_SpecChars.indexOf(ls_eMail.charAt(ls_eMail.length - 1)) >= 0) { // '@' or '.' could not be the last character
		ls_ErrStr = "e-posta adresi '.' işartei ile sonlandırılamaz";
	} else if (ls_eMail.indexOf(".", li_1stATPos) < li_1stATPos + 4) { // '@' must be followed with at least 3 characters before any '.'
		ls_ErrStr = "site adı en az 3 karakter olmalı";
	}
	if (ls_ErrStr != "") {
		alert(ls_ErrStr);
		MessageSend.eMail.focus();
		return (false);
	}
	// control the first name to ensure it is fulfilled
	if (MessageSend.FirstName.value == ""){
		alert("Lütfen adınızı giriniz");
		MessageSend.FirstName.focus();
		return (false);
	}
	// control the last name to ensure it is fulfilled
	if (MessageSend.LastName.value == ""){
		alert("Lütfen soyadınızı giriniz");
		MessageSend.LastName.focus();
		return (false);
	}
	// return success
	return (true);
}
