﻿function XMLHTTPObj() {
    var xmlhttp = null;

    if (window.XMLHttpRequest) {
        // IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        // IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else {
        alert("Tarayicinizin AJAX uyumlu değil!");
    }

    return xmlhttp;
}

function CreateTable(data) {
    var table = document.createElement("table");
    for (var i = 0; i < 2; i++) {
        //Resim
        row = document.createElement("tr");
        col = document.createElement("td");
        col.setAttribute("style", "vertical-align:top;");
        link = document.createElement("A");
        link.setAttribute("href", "KitapDetay.aspx?Kitap_Id=" + data[i].ID);         
        img = document.createElement("img");
        img.setAttribute("src", data[i].Resim);
        img.setAttribute("style", "border-color:#666;border-width:1px;");
        img.setAttribute("border", "0");
        link.appendChild(img);
        col.appendChild(link);
        row.appendChild(col);
        table.appendChild(row);
        col = document.createElement("td");
       //Kitap Adı
        text = document.createElement("span");
        temptext = document.createTextNode("Kitabın Adı: ");
        text.appendChild(temptext);
        text.setAttribute("class", "AjaxBaslik");
        
        text1 = document.createElement("span");
        temptext = document.createTextNode(data[i].Kitap);
        text1.appendChild(temptext);
        text1.setAttribute("class","AjaxIcerik")
        col.appendChild(text);
        col.appendChild(text1);
        col.appendChild(document.createElement("br"));
        //Yazar Adı
        text = document.createElement("span");
        temptext = document.createTextNode("Yazarın Adı: ");
        text.appendChild(temptext);
        text.setAttribute("class", "AjaxBaslik");
        
        text1 = document.createElement("span");
        temptext = document.createTextNode(data[i].Yazar);
        text1.appendChild(temptext);
        text1.setAttribute("class","AjaxIcerik")
        col.appendChild(text);
        col.appendChild(text1);
        col.appendChild(document.createElement("br"));
        
        //Cevirenin Adı
        
        text = document.createElement("span");
        temptext = document.createTextNode("Çeviren: ");
        text.appendChild(temptext);
        text.setAttribute("class", "AjaxBaslik");
        
        text1 = document.createElement("span");
        temptext = document.createTextNode(data[i].Ceviren);
        text1.appendChild(temptext);
        text1.setAttribute("class","AjaxIcerik")
        col.appendChild(text);
        col.appendChild(text1);
        col.appendChild(document.createElement("br"));
        
        //ISBN
        text = document.createElement("span");
        temptext = document.createTextNode("ISBN: ");
        text.appendChild(temptext);
        text.setAttribute("class", "AjaxBaslik");
        
        text1 = document.createElement("span");
        temptext = document.createTextNode(data[i].ISBN);
        text1.appendChild(temptext);
        text1.setAttribute("class","AjaxIcerik")
        col.appendChild(text);
        col.appendChild(text1);
       
       
        

        
        //Ozet
        
        text = document.createElement("span");
        temptext = document.createTextNode("Özet: ");
        text.appendChild(temptext);
        text.setAttribute("class", "AjaxBaslik");
        col.appendChild(document.createElement("br"));
        text1 = document.createElement("span");
        temptext = document.createTextNode(data[i].Ozet+" ...");
        text1.appendChild(temptext);
        text1.setAttribute("class","AjaxIcerik")
        col.appendChild(text);
        col.appendChild(text1);

        row.appendChild(col);
        table.appendChild(row);
    }
    //Single Next Button
    row = document.createElement("tr");
    col = document.createElement("td");
    link = document.createElement("A");
    link.setAttribute("href", "javascript:next(" + data[0].ID + ", " + data[1].ID + ");");
    img = document.createElement("img");
    img.setAttribute("src","images/btn_ajaxok.jpg");
//    img.setAttribute("style", "text-align:right;");
    img.setAttribute("border", "0");
    link.appendChild(img);
    col.appendChild(link);
    row.appendChild(col);
    table.appendChild(row);

    return table;
}