function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Lütfen epostainizi Kontrol Edin.")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Lütfen epostainizi Kontrol Edin.")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Lütfen epostainizi Kontrol Edin.")
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Lütfen epostainizi Kontrol Edin.")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Lütfen epostainizi Kontrol Edin.")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Lütfen epostainizi Kontrol Edin.")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("Lütfen epostainizi Kontrol Edin.")
      return false
   }
   return true          
}



function onSubmitkayit() {

if (kayit.ad.value.length < 3) {
        alert("Lütfen Adınızı Girin");
		return false;
	}

	
if (kayit.eposta.value.length < 3) {
        alert("Lütfen epostainizi Girin");
		return false;
	}

if (echeck(kayit.eposta.value)==false){
    kayit.eposta.value=""
    kayit.eposta.focus()
    return false;
  }
	
if (kayit.tel.value.length < 3  ) {
        alert("Lütfen Sabit Telefonunuzu Kontrol Edin.");
		return false;
	}	
	
if (kayit.mesaj.value.length < 10  ) {
        alert("Lütfen mesajınızı yazın");
		return false;
	}


if (kayit.egitim.value == "0") {
        alert("Lütfen Katılmak İstediğniz Eğitimi Seçin");
		return false;
	}
}


function onSubmitbasvuru() {

if (kayit.ad.value.length < 3) {
        alert("Lütfen Adınızı Girin");
		return false;
	}

	
if (kayit.eposta.value.length < 3) {
        alert("Lütfen epostainizi Girin");
		return false;
	}

if (echeck(kayit.eposta.value)==false){
    kayit.eposta.value=""
    kayit.eposta.focus()
    return false;
  }
	
if (kayit.tel.value.length < 3  ) {
        alert("Lütfen Sabit Telefonunuzu Kontrol Edin.");
		return false;
	}	
	
if (kayit.cv.value.length = 0  ) {
        alert("Word dökümani olarak özgeçmisinizi eklemelisiniz");
		return false;
	}


if (kayit.egitim.value == "0") {
        alert("Lütfen Katılmak İstediğniz Eğitimi Seçin");
		return false;
	}
}

function onSubmitdavet() {

if (uye.davet.value.length < 10) {
        alert("Lütfen Davet Listesini Kontrol Edin ");
		return false;
	}
}


function onSubmitgiris() {

if (giris.kadi.value=="Kullanıcı Adı") {
        alert("Lütfen Kullanıcı Adınızı Girin");
		return false;
	}

if (giris.sifre.value== "Sifre") {
        alert("Lütfen Şifrenizi Girin");
		return false;
	}
}	 

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}

function dynamicSelect(id1, id2) {
	// Browser and feature tests to see if there is enough W3C DOM support
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_mac = (agt.indexOf("mac") != -1);
	if (!(is_ie && is_mac) && document.getElementById && document.getElementsByTagName) {
		// Obtain references to both select boxes
		var sel1 = document.getElementById(id1);
		var sel2 = document.getElementById(id2);
		// Clone the dynamic select box
		var clone = sel2.cloneNode(true);
		// Obtain references to all cloned options 
		var clonedOptions = clone.getElementsByTagName("option");
		// Onload init: call a generic function to display the related options in the dynamic select box
		refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
		// Onchange of the main select box: call a generic function to display the related options in the dynamic select box
		sel1.onchange = function() {
			refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
		};
	}
}
function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
	// Delete all options of the dynamic select box
	while (sel2.options.length) {
		sel2.remove(0);
	}
	// Create regular expression objects for "select" and the value of the selected option of the main select box as class names
	var pattern1 = /( |^)(select)( |$)/;
	var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
	// Iterate through all cloned options
	for (var i = 0; i < clonedOptions.length; i++) {
		// If the classname of a cloned option either equals "select" or equals the value of the selected option of the main select box
		if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) {
			// Clone the option from the hidden option pool and append it to the dynamic select box
			sel2.appendChild(clonedOptions[i].cloneNode(true));
		}
	}
}



function ct(){
var t=0;
var theForm = document.tahmin;
for(i=0; i<theForm.elements.length; i++){
if(theForm.elements[i].type == "checkbox"){
 if(theForm.elements[i].checked == true){
 t+=1;
}}}

if(t<10 || t>10 ) {
	
	alert("Seçtiğiniz Maç Sayısı "+t+"\nTahmin Kupununuzda Tam 10 Maç Olmalı.");
	dondur=false;
	}
	else {
    dondur = true;
	}

return dondur;
}

function ct2(){
var t=0;
var theForm = document.tahmin;
for(i=0; i<theForm.elements.length; i++){
if(theForm.elements[i].type == "checkbox"){
 if(theForm.elements[i].checked == true){
 t+=1;
}}}

if(t<1 || t>1 ) {
	
	alert("Seçtiğiniz Maç Sayısı "+t+"\nBir seferde 1 Maç değiştirebilirsiniz.");
	dondur=false;
	}
	else {
    dondur = true;
	}

return dondur;
}




function SayiKontrol(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if((tus<48||tus>57)&&tus!=8) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault();alert('Sadece Sayı Girmelisiniz!') }
	}
}

function ct1(){
var t=0;
var theForm = document.tahmin;
for(i=0; i<theForm.elements.length; i++){
if(theForm.elements[i].type == "text"){
 if(theForm.elements[i].value.length == 0){
 t+=1;
}}}

if(t>0  ) {
	
	alert("Lütfen Tahmin Kuponunuzu Kontrol Edin");
	dondur=false;
	}
	else {
    dondur = true;
	}

return dondur;
}

function toggleMe(obj, a){
  var e=document.getElementById(a);
  if(!e)return true;
    e.style.display="block";
	havale.style.display="none";
  return true;
}

function toggleMe2(obj, a){
  var e=document.getElementById(a);
  if(!e)return true;
    e.style.display="block";
	kredi.style.display="none";
  return true;
}


