/*

	SüperSonik Ajax v5.0
	Gökhan ILDIR
		mail : gokhandiyebiri@gmail.com
		msn  : takendisi@gokhandiyebiri.com
		web  : www.vegokhan.com
		
    NEDEN KAYNAK KODLARINI DİDİKLEME HİSSİ DUYDUN ŞEKERİM ? 

*/


//AJax fonkisyonumuz
function nesneyarat() {
    var nesne;
    var tarayici = navigator.appName;
    if(tarayici == "Microsoft Internet Explorer"){
        nesne = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        nesne = new XMLHttpRequest();
    }
    return nesne;
}

var http = nesneyarat();
function gobek() {
    http.open('get', '/dokumanlar/kalibrasyon_nedir.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function kalibrasyon_nedir() {
    http.open('get', '/dokumanlar/kalibrasyon_nedir.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function tibbi_cihazlar() {
    http.open('get', '/dokumanlar/tibbi_cihazlar.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function endust_cihazlar() {
    http.open('get', '/dokumanlar/end_cihazlar.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function egitim() {
    http.open('get', '/dokumanlar/egitim.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function projdanis() {
    http.open('get', '/dokumanlar/projdanis.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}
function teknik_servis() {
    http.open('get', '/dokumanlar/teknik_servis.asp');
    http.onreadystatechange = okubakim;
    http.send(null);
}


//
function okubakim() {
    if(http.readyState == 1){
        document.getElementById('iceriq').innerHTML = "<center><br>sayfa yükleniyor lütfen bekleyiniz...</center>";
	}
    if(http.readyState == 4){
        document.getElementById('iceriq').innerHTML = http.responseText;
	}
}

//mesaj sil
function silaq(gelio){
		window.location = "/@mesajgonder.asp?islem=sil&id=" + gelio
}
function geri(){
		window.location = "/"
}

//hata mesajı a.q
 function errorAQ(mesajAQ){
        document.getElementById('hata').innerHTML = "<div class=ajaxhata><a onclick=gokhan_hideshow('hata') class=kapatCAM><img src=/images/div_kapat.gif alt=kapat a.q></a>"+mesajAQ+"</div>";
  }
// kayıt kontrolü
  function kayitKontrolAQ(){
   if( document.kayit.kullanici.value.length < 3 ){
      errorAQ("kullanıcı adınız 3 karakterden az olamaz");
      document.kayit.kullanici.focus();
    }else if( document.kayit.sifre.value.length < 3 ){
      errorAQ("okadar kısa şifre yemez...");
      document.kayit.sifre.focus();   
   }else if( document.kayit.name.value.length < 3 ){
      errorAQ("asd diye isim olmadığını biliyoruz delikanlı olun...");
      document.kayit.name.focus();     
   }else if( document.kayit.mail.value.length < 5 ){
      errorAQ("öyle bir mail adresi olamaz arkadaşım ?");
      document.kayit.mail.focus();     
    }else if( document.kayit.city.value.length < 3 ){
      errorAQ("Öyle bir şehir yok :/");
      document.kayit.city.focus();    
    }else if( document.kayit.imza.value.length > 250 ){
      errorAQ("İmzanız çok uzun maksimum 250 karekter...");
      document.kayit.imza.focus();    
   }else{
      document.kayit.submit();
    }
  }
//giriş kontrolü
  function giriskontrolAQ(){
   if( document.giris.kullanici.value.length < 3 ){
      errorAQ("kullanıcı adınız 3 karakterden az olamaz");
      document.giris.kullanici.focus();
    }else if( document.giris.sifre.value.length < 2 ){
      errorAQ("okadar kısa şifre yemez...");
      document.giris.sifre.focus();
    }else{
      document.giris.submit();
    }

  }  

//imza 250 karekteri geçerse... 4 satir bilem çok...
function imzauyari(){

    var imza = document.kayit.imza.value;
    var satir = imza.split("\n").length;
    var karakter = imza.length;
   
    document.getElementById("satir").value = satir;
    document.getElementById("karakter").value = karakter;

    if( satir > 4 ){
      document.getElementById("satir").style.backgroundColor = "#FF9999";
    }else{
      document.getElementById("satir").style.backgroundColor = "#EFEFEF";    
    }
    
    if( karakter > 250 ){ 
      document.getElementById("karakter").style.backgroundColor = "#FF9999";
    }else{
      document.getElementById("karakter").style.backgroundColor = "#EFEFEF";    
    }
  
  }  

  
//kişisel iletide bi bokluk varmı bakıoz :)
    function iletikontrolAQ(){
    if( document.iletim.ileti.value =="" ){
      errorAQ("hiç kişisel bir ileti boş olurmuymuş... hurafedir hurafe...");
      document.iletim.ileti.focus();
      //kürt varsa gözlerinden öpelim :D
     }else if( document.iletim.ileti.value =="kürdistan"  ){
      errorAQ("götümle gülüyorum sana :D a.qdum sittir...");
      document.iletim.ileti.focus();
    }else{
      document.iletim.submit();
    }

  } 
// Ekstra pencereyi kapatıyoruz ya da açıyoruz kafamıza göre a.q
function gokhan_hideshow(elementid){
var gokhan = document.getElementById(elementid);
gokhan.style.display = (gokhan.style.display =="none") ? "block" : "none";

}
//Arsiv İçin Zıplıyoruz
function Zipla(URL) {
if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
return true;
}
//Değiş tokuş
function HokusFokus(Degis){
	if (!Degis.base) Degis.base = Degis.value
	if (Degis.value == Degis.base) Degis.value = "";
	else if (Degis.value == "") Degis.value = Degis.base;
}
