/**
 * Description of ajax.js
 *
 * @author Gurhan Sancar
 */
function ajax(){ //bu fonksiyon temel ajax fonksiyonumdur.

    var xmlHttp=null;
    try{
        //firefox,opera, safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e){
        //internet explorer
        try {
        xmlHttp = new ActiveXobject('Msxml2.XMLHTTP');
        }
        catch (e){
            xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
        }
    }
    return xmlHttp;
}

var ajaxHataMesaj ="Tarayıcınız Ajax' a uygun değildir.\nTarayıcınızın ve işletim sisteminizin\n son güncellemelerini yapmanızı öneririz. ";

function html_Guncelle_Update(){

    if(xmlHttp.readyState==4 && xmlHttp.status==200){
        if(xmlHttp.responseText == 'sessionExpire'){
            window.location="login.php";
            return;
        }

        document.getElementById("apDiv3").innerHTML = xmlHttp.responseText;

    }
    else document.getElementById("apDiv3").innerHTML = '<center><img src="lightbox/images/loading.gif" width="32" height="32" /></center>';
}

function ogrenciKarneAna(){

    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }

    var gelenArray = arguments[0].split("_");
    var uygulamaID = gelenArray[0];
    var ogrenciID  = gelenArray[1];
    var ajaxKey = "uygulamaOgrenciKarne";
    var gonderilecek = "uygulamaID="+uygulamaID+"&ogrenciID="+ogrenciID+"&ajaxKey="+ajaxKey;
    var url = "ogrenciUygulamaKarne.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response = xmlHttp.responseText;
                                                        alert(xmlHttp.responseText);
                                                }
                                           }
    xmlHttp.send(gonderilecek);

//	alert(ogrenciID+'_'+uygulamaID+'_');

}

function printdiv(printpage){
    
    var headstr = "<html><head><title></title></head><body>";
    var footstr = "</body>";
    var newstr = document.getElementById(printpage).innerHTML;
    var oldstr = document.body.innerHTML;
    document.body.innerHTML = headstr+newstr+footstr;
    window.print();
    setTimeout(eskiyeDon(oldstr), 5000);
    return;
}

function eskiyeDon(oldHTML){
     document.body.innerHTML = oldHTML;
     tb_reinit('a.thickbox, area.thickbox, input.thickbox');     
}

function openPrintWindow(openHtml){
    var headstr = "<html><head><link href='css/print.css' rel='stylesheet' type='text/css' /><title></title></head><body>";
    var footstr = "</body>";
    var printContent = headstr+document.getElementById(openHtml).innerHTML+footstr;
    var w = window.open('', '', 'width=990,height=530,resizable=no,scrollbars=no,toolbar=no,status=no');

    w.document.write(printContent);
    w.print();
    w.document.close();
    setTimeout(w.close(), 5000);
//    w.close(); // needed for chrome and safari

}

function login(){

    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }

    var TC = document.getElementById("tcBox").value;
    var pass = document.getElementById("pass").value;
    var ajaxKey = "login";
    var gonderilecek = "TC="+TC+"&pass="+pass+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/loginAjax.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    if(xmlHttp.responseText == '1'){
                                                        var cookieCheck = document.getElementById('checker');
                                                        if(cookieCheck.checked)
                                                            newCookie('elektroy', TC+pass);

//                                                        else alert(0);

                                                        window.location="index.php";
                                                    }
                                                    else{
                                                        document.getElementById("loginResult").style.height = "30px";
                                                        document.getElementById("loginResult").style.color = "red";
                                                        document.getElementById("loginResult").innerHTML = xmlHttp.responseText;
                                                        loginKitleKaldir();
                                                    }
                                                }
                                                else{
                                                    document.getElementById("loginResult").innerHTML = ' ';
                                                    loginKitle();
                                                }
                                           }
    xmlHttp.send(gonderilecek);


}

function demoGiris(){

    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }

    if(arguments[2]=='cookie'){
        var TC = arguments[0];
        var pass = arguments[1];
    }
    else{
        var TC = '12345678910';
        var pass = '123456';
    }
    var ajaxKey = "login";
    var gonderilecek = "TC="+TC+"&pass="+pass+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/loginAjax.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    if(xmlHttp.responseText == '1'){
                                                        window.location.reload();
                                                    }
                                                    else{
                                                        document.getElementById("loginResult").style.height = "30px";
                                                        document.getElementById("loginResult").style.color = "red";
                                                        document.getElementById("loginResult").innerHTML = xmlHttp.responseText;
                                                        loginKitleKaldir();
                                                    }
                                                }
                                                else{
                                                    document.getElementById("loginResult").innerHTML = ' ';
                                                    loginKitle();
                                                }
                                           }
    xmlHttp.send(gonderilecek);

}
//-------------------------preLoding uygulaması baslangici-----------//

function preLoading(containerID,newDivID,silinmeyecek){
    // containerID preloading uygulamasinin hangi div icerisinde gercekelesigini belirtir
    // newDivID preLoading icin olusturulacak div'in id bilgisidir.
    // silinemeyecek, containerID'nin içinde silinmeden bırakılacak eleman sayısıdır.
    if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
        if(xmlHttp.responseText == 'sessionExpire'){
            window.location="login.php";
            return;
        }
        container = document.getElementById(containerID);
        i = 0;
        while(i<=container.childNodes.length-silinmeyecek){
            container.removeChild(container.lastChild);
            i++
        }
        newDiv = document.createElement("div");
        newDiv.id = newDivID;
        newDiv.innerHTML = xmlHttp.responseText;
        container.appendChild(newDiv);
    }
    else{
        var container = document.getElementById(containerID);
//        alert (container.childNodes.length-silinmeyecek);
        var i = 0;
        while(i<=container.childNodes.length-silinmeyecek){
            container.removeChild(container.lastChild);
            i++
        }
        var newDiv = document.createElement("div");
        newDiv.id = containerID+"PreLoading";
        container.appendChild(newDiv);
    }

}

//-------------------------preLoding uygulaması bitimi-----------//

var loginKilit = 0;
function loginKitle(){
    if(loginKilit == 0){
        var loginDiv = document.getElementById("loginModul");
        var newDiv = document.createElement("div");
        newDiv.id = "loginKitle";
        newDiv.innerHTML = "<center style='margin-top:30px;'> </center>"
        loginDiv.appendChild(newDiv);
        loginKilit = 1;
    }
}
function loginKitleKaldir(){

        var loginContent = document.getElementById("loginModul");
        var silinecek = document.getElementById("loginKitle");
        loginContent.removeChild(silinecek);
        loginKilit = 0;
}

function veliKontrol(veliTc){

    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    var ajaxKey = functionName(arguments);
    var gonderilecek = "tc="+veliTc+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/ajaxGelen.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');

    xmlHttp.onreadystatechange =  function(){if(xmlHttp.readyState==4 && xmlHttp.status == 200){

                                                    var rslt = xmlHttp.responseText;
                                                    alert(rslt);
                                                    return 'a';
//                                                    return rslt;
                                                    
                                            }
                                }
    xmlHttp.send(gonderilecek);
    
}

function parentRegister(){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    
    var ajaxKey = functionName(arguments);
    var gonderilecek = arguments[0]+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/kayit.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    var uyariArray = response.split('_');
                                                    var uyariKod   = uyariArray[0];
                                                    var uyariMetin = uyariArray[1];

                                                        if (uyariKod == '0'){
                                                            document.getElementById('register_uyari2').style.height = '50px';
                                                            document.getElementById('register_uyari2').innerHTML = uyariMetin+'<br />';

                                                        }
                                                        else if(uyariKod == '1' ){
                                                            document.getElementById('register_uyari2').style.height = '0px';
                                                            document.getElementById('register_uyari2').innerHTML ='';


                                                        }
                                                        else if(uyariKod == 'ok'){
                                                            document.getElementById('register_content').style.height = '200px';
                                                            document.getElementById('icerik2').innerHTML ='Üyeliğiniz Başarıyla Oluşturulmuştur.<br /><a href="index.php">Buradan</a> Giriş Yapabilirsiniz.';
                                                        }
                                                        else if(uyariKod == 'updateOk'){
                                                            document.getElementById('register_uyari2').style.height = '50px';
                                                            document.getElementById('register_uyari2').innerHTML ='Güncelleme İşleminiz Başarıyla Tamamlanmıştır!';

                                                        }
                                                        else{
                                                            document.getElementById('register_uyari2').style.height = '0px';
                                                            document.getElementById('register_uyari2').innerHTML =response;
                                                        }

                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

function updateParent(){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }

    var ajaxKey = functionName(arguments);
    var gonderilecek = arguments[0]+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/kayit.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
//                                                    var uyariArray = response.split('_');
//                                                    var uyariKod   = uyariArray[0];
                                                    var uyariMetin = response;

                                                        if (uyariMetin == 'not'){
                                                            document.getElementById('register_uyari').style.height = '50px';
                                                            document.getElementById('register_uyari').style.padding = '5px';
                                                            document.getElementById('register_uyari').style.backgroundImage = 'url(css/images/uyari-icon.gif)';
                                                            document.getElementById('register_uyari').innerHTML = uyariMetin+'<br />';

                                                        }
                                                        else if(uyariMetin == 'updateOk' ){
                                                            document.getElementById('register_uyari').style.height = '30px';
//                                                            document.getElementById('register_uyari').style.padding = '5px';
                                                            document.getElementById('register_uyari').style.backgroundImage = 'url(css/images/ok-icon.png)';
                                                            document.getElementById('register_uyari').innerHTML ='Bilgileriniz Başarıyla Güncellenmiştir!';
                                                            document.getElementById('register_uyari').style.padding = '15px 0px 0px 10px';
                                                        }

                                                        else{
                                                            document.getElementById('register_uyari').style.height = '50px';
                                                            document.getElementById('register_uyari').style.padding = '5px';
                                                            document.getElementById('register_uyari').style.backgroundImage = 'url(css/images/uyari-icon.gif)';
                                                            document.getElementById('register_uyari').innerHTML =response;
                                                        }

                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

function codeControl(){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }

    var ajaxKey = functionName(arguments);
    var gonderilecek = "code="+arguments[0]+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/kayit.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
//                                                    alert('asdf'+xmlHttp.responseText);
                                                  controlResult = xmlHttp.responseText;
//                                                   return(result);

                                                }
//                                                else {}
                                           }
    xmlHttp.send(gonderilecek);


}

function sayfalama(sayfaNo){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
//    alert(getElementByClass('contentRightCenter').innerHTML);
    var gonderilecek = "sayfaNo="+sayfaNo;
//    alert(gonderilecek);
    var url = "ogrenciUygualamaListe.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    getElementByClass('contentRightCenter').innerHTML = response;
                                                    tb_init('a.thickbox, area.thickbox, input.thickbox');

                                                }
                                                else{
                                                
                                                    getElementByClass('contentRightCenter').innerHTML = "<div id='uygulamaLoading'> </div>";
                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

/********** getElementByClass*********************/

var allHTMLTags = new Array();
function getElementByClass(theClass) {

    //Create Array of All HTML Tags
    var allHTMLTags=document.getElementsByTagName('*');

    //Loop through all tags using a for loop
    for (i=0; i<allHTMLTags.length; i++) {

        //Get all tags with the specified class name.
        if (allHTMLTags[i].className==theClass) {

            //Place any code you want to apply to all
            //pages with the class specified.
            //In this example is to “display:none;” them
            //Making them all dissapear on the page.

            return allHTMLTags[i];
        }
    }
}
/********** getElementByClass*********************/

function IcerikGetir(){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    var gelenSayfa = arguments[0];
//    alert(getElementByClass('contentRightCenter').innerHTML);
    var gonderilecek = "gelenSayfa="+gelenSayfa;
//    alert(gonderilecek);
    var url = "abc1.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    getElementByClass('contentRightCenter').innerHTML = response;
                                                    getElementByClass('contentRightCenter').style.height = '100%';
                                                    document.getElementById('contentRight').style.height = '100%';
//                                                    tb_init('a.thickbox, area.thickbox, input.thickbox');

                                                }
                                                else{

                                                    getElementByClass('contentRightCenter').innerHTML = "<div id='uygulamaLoading'> </div>";
                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

function grhnBasariKarnesi(ogrenciID, uygulamaID, height, width, butonOption ){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
//    alert(getElementByClass('contentRightCenter').innerHTML);
    var gonderilecek = "ogrenciID="+ogrenciID+"&uygulamaID="+uygulamaID+"&btnOpt="+butonOption;
//    alert(gonderilecek);
    var url = "ogrenciUygulamaKarne.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    creatediv('ogrenciSoruSahte', response, 870, 470, 25, 30, 10, 1, '#FFFFFF', 1, 5);
                                                }
                                                else if(xmlHttp.readyState==1){
                                                    var html = "<div style='float:right; background: #000000; opacity:1;'><input type='button' onclick=\"sahteKapat('ogrenciSoruSahte', 'sahte'); sahteKapat('ogrenciSoruGoster')\" value='KAPAT' /></div>";
                                                    creatediv('sahte', html, 938, 538, 1, 1, 5, 0.85 , '#000000', 0, 0);
                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

function creatediv(id, html, width, height, left, top, zindex, opacityim, backgroundColor, border, padding, borderColor ) {
    
    if(document.getElementById(id)){
        document.getElementById('TB_ajaxContent').removeChild(document.getElementById(id));
    }
    
    if(id == 'ogrenciSoruGoster' && document.getElementById('sahte') ){
        top = 63;
        left = 31;
    }
    
    var newdiv = document.createElement('div');
    newdiv.setAttribute('id', id);

    if (width) {
       newdiv.style.width = width+'px';
    }

    if (height) {
       newdiv.style.height = height+'px';
    }
    if ((left || top) || (left && top)) {
       newdiv.style.position = "absolute";
       newdiv.style.zIndex = zindex;
       newdiv.style.top = top+"px";
       newdiv.style.left = left+"px";

    }
    newdiv.style.backgroundColor = backgroundColor;
    newdiv.style.opacity = opacityim;
    borderColor = (!borderColor ? '#FFFFFF' : borderColor);
    newdiv.style.border = border+"px solid "+ borderColor;
    newdiv.style.padding = padding+'px';

    if (html) {
       newdiv.innerHTML = html;
    } else {
       newdiv.innerHTML = "";
    }
    document.getElementById('TB_ajaxContent').appendChild(newdiv);
    
}

function sahteKapat(divID1, divID2){
    var silinecek2 = document.getElementById(divID1);
    
    if(document.getElementById(divID2)){
        document.getElementById('TB_ajaxContent').removeChild(document.getElementById(divID2));
    }

    document.getElementById('TB_ajaxContent').removeChild(silinecek2);
    
}

function sifreHatirlat(){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    var veliEmail = document.getElementById('email').value;
    var gonderilecek = "veliEmail="+veliEmail;
    var url = "sifre.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    if (response == 'NOT'){
                                                        document.getElementById('user_registration').style.width = '430px';
                                                        document.getElementById('sifre_uyari').style.height = '0px';
                                                        document.getElementById('sifre_uyari').style.margin = '15px 0px 3px 0px';

                                                        yukseklikAyarla('sifre_uyari', 0, 40, 1);
                                                        document.getElementById('sifre_uyari').style.background = 'url(css/images/uyari-icon.gif) no-repeat left';
                                                        document.getElementById('sifre_uyari').innerHTML = 'Girdiğiniz E-Posta Adresi Sistemde Mevcut Değildir!'+
                                                                                                                '<br />E-Posta Adresinizi Kontrol Ederek Tekrar Deneyiniz!';
                                                        document.getElementById('sifre_uyari').style.padding = '15px 0px 0px 50px';

                                                    }
                                                    else if(response == 'OK' ){
                                                        document.getElementById('sifre_uyari').style.height = '0px';
                                                        document.getElementById('sifre_uyari').style.margin = '15px 0px 3px 0px';
                                                        yukseklikAyarla('sifre_uyari', 0, 55, 1);
                                                        document.getElementById('sifre_uyari').style.background = 'url(css/images/ok-icon.png) no-repeat left';
                                                        document.getElementById('sifre_uyari').innerHTML ='Şifre Sıfırlama Talebiniz Alınmıştır.<br />Lütfen E-Posta Kutunuzu Kontrol Ediniz!\n\
                                                                                                           <br />İstenmeyen, Spam veya Junk Mail Kutularınızı da <br /> Kontrol Ediniz!';
                                                        document.getElementById('sifre_uyari').style.padding = '3px 0px 0px 10px';
                                                        document.getElementById('icerik').style.display = 'none';
                                                    }
                                                    else{
                                                        document.getElementById('sifre_uyari').style.height = '15px';
                                                        document.getElementById('sifre_uyari').innerHTML = 'E-Posta Adresinizi Girmediniz!';
                                                        document.getElementById('sifre_uyari').style.background = 'none no-repeat center';
                                                    }
                                                }
                                                else if(xmlHttp.readyState==1){
                                                    document.getElementById('sifre_uyari').style.height = '20px';
                                                        document.getElementById('sifre_uyari').innerHTML = '';
                                                        document.getElementById('sifre_uyari').style.margin = '0px 0px 3px 0px';
                                                        document.getElementById('sifre_uyari').style.background = 'url(css/images/loading.gif) no-repeat center';

                                                }
                                           }
    xmlHttp.send(gonderilecek);
}

function ogrenciEkle(aktivasyonKod, ogrenciTC, ogrenciAd, ogrenciSoyad, veliTC){
    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    var ajaxKey = functionName(arguments);
    var gonderilecek = "aktivasyonKod="+aktivasyonKod+"&ogrenciTC="+ogrenciTC+"&ogrenciAd="+ogrenciAd+"&ogrenciSoyad="+ogrenciSoyad+"&veliTC="+veliTC+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/ajaxGelen.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
//                                                    alert(response);

                                                }
                                            }
    xmlHttp.send(gonderilecek);

}

function ogrenciDegis(ogrnID){

    xmlHttp = ajax();
    if(xmlHttp == null){
        alert(ajaxHataMesaj);
        return;
    }
    var ajaxKey = 'ogrenciDegis';
    var gonderilecek = "ogrnID="+ogrnID+"&ajaxKey="+ajaxKey;
    var url = "gClass/ajaxPhp/ajaxGelen.php";
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader('If-Modified-Since', 'Sat, Jan 2000 00:00:00 GMT');
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlHttp.setRequestHeader('Content-length', gonderilecek.length);
    xmlHttp.setRequestHeader('Connection', 'close');
    xmlHttp.onreadystatechange =  function(){
                                                if(xmlHttp.readyState==4 && xmlHttp.status == 200){
                                                    var response   = xmlHttp.responseText;
                                                    if(response == 'OK'){
                                                        window.location = window.location;
                                                    }

                                                }
                                                else{
                                                    getElementByClass('contentRightCenter').innerHTML = "<div id='uygulamaLoading'> </div>";
                                                }
                                            }
    xmlHttp.send(gonderilecek);

}
