function mytable() {
    this.inittable = inittable;
    this.refreshTable = refreshTable;
    this.rowsToDisplay = (theRows.length > defrownum) ? defrownum : theRows.length;
    this.iFirst = 0;
    this.showsearch = true;
    this.initsort = new Array(0, 1);
    this.shownum = true;
    this.highlight = true;
    this.searchcolumn = 0;
    this.header = "";
    this.targetname = "table";
    this.tabrows = "";
    this.tabcount = "";
    this.footerend = "";
    this.iLast = this.rowsToDisplay;
    this.theColumn = new Array();
    this.visCols = new Array();
    this.footerstart = "";
    this.tableWidth = 0;
    this.calctablewidth = calctablewidth;
    this.controlaccess = true;
    this.refreshHeader = refreshHeader;
    this.refreshTabRows = refreshTabRows;
    this.refreshTabCount = refreshTabCount;
    this.scrollTable = scrollTable;
    this.scrollTo = scrollTo;
    this.ozel = ozel;
    this.mySort = mySort;
    this.WriteCsv = WriteCsv;
}
var isMinNS6 = (navigator.appName.indexOf("Netscape") >= 0 &&
       			 document.getElementById);

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4 && !document.getElementById) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var isMinIE55 = (isMinIE4 && navigator.appVersion.indexOf("5.5") >= 0) ? 1 : 0;
var kSort = new Array(0, 1);
var defrownum = (screen.availHeight > 600) ? 25 : 15;
var isLimited = false;
arImLoad = ["fpage2", "ppage2", "npage2", "lpage2", "yrdm2", "ara2", "gos2", "fpage", "ppage", "npage", "lpage", "yrdm", "ara", "gos"];

arImList = [];
for (counter in arImLoad) {
    arImList[counter] = new Image();
    arImList[counter].src = "../images/" + arImLoad[counter] + ".gif";
}


function getCookie(name) {
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0) {
        begin = dc.indexOf(cname);
        if (begin != -1) {
            begin += cname.length;
            end = dc.indexOf(";", begin);
            if (end == -1) end = dc.length;
            return unescape(dc.substring(begin, end));
        }
    }
    return null;
}
function setCookie(name, value, expires) {
    document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

// Use this function to delete a cookie.
function delCookie(name) {
    document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}



function calctablewidth() {
    var oldw = this.tableWidth;
    this.tableWidth = 0;
    for (j = 0; j < theCols.length; j++) {
        if (this.visCols[j]) this.tableWidth += theCols[j][2];
    }
    if (oldw != 0 & oldw != null) {
        carpan = oldw / this.tableWidth;
        for (j = 0; j < theCols.length; j++) {
            if (this.visCols[j])
                theCols[j][2] = theCols[j][2] * carpan;
        }
        theCols[theCols.length - 1][2] = 0;
        this.tableWidth = oldw;

    }

    if (this.shownum) this.tableWidth += 20;
}
function inittable() {
    kSort[0] = this.initsort[0];
    kSort[1] = this.initsort[1];
    
    this.rowsToDisplay = (theRows.length < this.rowsToDisplay + 1) ? theRows.length : this.rowsToDisplay;
    this.iLast = this.iFirst + this.rowsToDisplay;
    if (this.visCols.length != theCols.length)
        for (var i = 0; i < theCols.length; i++) {
        this.visCols[i] = true;
    }
    this.calctablewidth();
    for (var i = 0; i < theRows.length; i++) {
        this.theColumn[i] = new Array(0, i);
    }
    if (this.iFirst == 0 & this.iLast == theRows.length) {
        this.footerend = "</table></td></tr>";
    }
    else {
        this.footerend = "<table border=0 cellspacing=0 cellpadding=0 align=center bgcolor=#CEDEFA width=\"100%\"> \n<tr>";
        var kodlist = new Array();
        for (var i = 0; i < theRows.length; i++) {
            this.theColumn[i] = new Array(0, i);
            x = theRows[i][this.searchcolumn];
            x = innerText(x); //.toUpperCase();
            kodlist[kodlist.length] = x;
        }
        if (this.showsearch) {
            this.footerend += "\n<TD>\n<select  style='BACKGROUND-COLOR: #EBEADB' id=\"hisse\"  NAME=\"hisse\" SIZE=\"1\">";
            kodlist.sort();
            for (var i = 0; i < theRows.length; i++) {
                this.footerend += "<option id=\"" + kodlist[i] + "\" name=\"" + kodlist[i] + "\">" + kodlist[i] + "</option>";
            }
            this.footerend += "</select>&nbsp;<a href=\"javascript:thetable.scrollTo();\" onmouseOver=\"javascript:document.images[\'ara\'].src=arImList[12].src;\" onmouseOut=\"javascript:document.images[\'ara\'].src=arImList[5].src;\"><img src=../images/ara2.gif id=ara name=ara width=51 height=21 border=0 align=absbottom></TD>";
        }
        this.footerend += "\n<TD align=right valign=bottom>Sayfada &nbsp; <INPUT style='BACKGROUND-COLOR: #EBEADB' ID=\"rowcount\"  NAME=\"rowcount\" TYPE=\"TEXT\"  SIZE=\"1\" MAXLENGTH=\"3\" VALUE=\"" + this.rowstoDisplay + "\"> &nbsp;satır\n</td><td valign=bottom align=left><a href=\"javascript:thetable.scrollTable(-2);\" onmouseOver=\"javascript:document.images[\'gos\'].src=arImList[13].src;\" onmouseOut=\"javascript:document.images[\'gos\'].src=arImList[6].src;\"><img src=../images/gos2.gif id=gos name=gos width=70 height=21 border=0 align=absbottom>\n</td> \n</tr> ";
        this.footerend += "</table>\n</td></tr></table></td></tr>";
    }
    var s = "newwin=window.open('" + theHlp + "','Yardım','toolbar=no,status=no,scrollbars=yes,resizable=yes,width=628,height=400,screenX=155,screenY=180,top=180,left=155'); newwin.focus();";

    this.tabStart = "<table class=maintable1  cellspacing=0 cellpadding=0 align=left width=" + this.tableWidth + "><tr>\n<td height=60>\n";
    this.tabStart += "<table class=maintable1 bordercolor=#69697D cellspacing=0 cellpadding=0 align=left width=100%><tr>\n<td>\n";
    this.tabStart += "<table border=0 cellspacing=0 cellpadding=0 align=center width=\"100%\"> \n"
    if (window.theTitle)
        if (window.theTitle != "") {
        this.tabStart += "<tr class=light><th class=title align=left ondblclick=\"javascript:thetable.WriteCsv();\">" + theTitle + "</th></tr>";
    }
    this.tabStart += "</table> \n";
    this.tabStart += "<table border=0 cellspacing=0 cellpadding=0 align=center width=\"100%\"> \n <tr> <th class=head align=left ondblclick=\"javascript:thetable.ozel();\">&nbsp;&nbsp;" + theCaption + " </th><th class=head><A href=\"javascript:thetable.ozel();\">&nbsp;</A></TH>";
    if (theHlp != null && theHlp != "") this.tabStart += "<th align=right class=head><A href=\"javascript:void(0)\" onclick=\"" + s + "\" onmouseOver=\"javascript:document.images[\'helpw2k\'].src=arImList[11].src;\" onmouseOut=\"javascript:document.images[\'helpw2k\'].src=arImList[4].src;\"><img id=helpw2k name=helpw2k border=0 align=middle width=70 height=21></a>&nbsp;</th>";
    this.tabStart += "</tr></table>"
    this.tabStart += "<table border=1 bordercolor=#E2D8D8 bgcolor=#FFFFFF cellspacing=0 cellpadding=0 align=center width=\"100%\" > \n<tr> \n";
};
function refreshHeader() {
    var str = "";
    if (this.shownum)
        str = "<th class=colhead width=20 align=center  OnMouseOver=\"this.classname='colheadover'\"  OnMouseOut=\"this.classname='colhead'\"  >&nbsp;aa</TH>";
    for (k = 0; k < theCols.length; k++) {
        if (this.visCols[k]) {
            str += "<th valign=top class=colhead  OnMouseOver=\"this.style.borderBottom='#F9A900 2px solid';this.style.backgroundColor='#FFFFFF'\"  OnMouseOut=\"this.style.borderBottom='black 1px solid';this.style.backgroundColor='#EBEADB'\" ";
            if (theCols[k][2] != 0)
                str += "width=" + theCols[k][2];
            str += " align=center><a class=head href=\"javaScript:thetable.mySort(" + k + ")\">" + theCols[k][0] + ((kSort[0] == k) ? ((kSort[1] == 1) ? "<br><img src=\"../images/up.gif\" border=0>" : "<br><img src=\"../images/down.gif\" border=0>") : "&nbsp;") + "</a></th>";
        }
    }
    return str;
};
function uyari() {
    var mywin = window.open("", "WindowName", "status=no,resizable=yes,top=0,left=0,scrollbars=no,height=300,width=475");
    var str = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1254"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-9"><head><body>';
    str += '<p><b><font size="4">Sayın Abonemiz;</font></b></p>';
    str += '<p>&nbsp;&nbsp; <b>Müşteri kayıtlarımızda bilgileriniz eksik görünmektedir.</b></p>';
    str += '<p>&nbsp;&nbsp; <b>Bu eksikliğin acilen giderilebilmesi için 0-212-556 74 78 den</b></p>';
    str += '<p>&nbsp;&nbsp; <b>Satış Temsilcisi Perim ENGİN Hanım ile görüşmenizi';
    str += '&nbsp;veya</b></p>';
    str += '<p><b>&nbsp;&nbsp;&nbsp; yandaki mail adresini tıklayarak </b>&nbsp;&nbsp; <b><a href="mailto:finnet@finnet.gen.tr">finnet@finnet.gen.tr</a></b></p>';
    str += '<p><b>&nbsp;&nbsp; adresine mail atmanızı <font color="#FF0000">önemle rica';
    str += '&nbsp;ederiz.</font></b></p>';
    str += '<p><b>FINNET Elk. Yay. Ltd. Şti.</b></p></bpdy>';

    if (isMinNS4) {
        mywin.document.open("text/html", "replace");
        mywin.document.write(str);
        mywin.document.close();
    }
    else {
        mywin.document.open("text/html", "replace");
        mywin.document.write(str);
        mywin.document.close();
    }
    mywin.focus();
}
function ozel() {
    var xstr = ""
    xstr += "<script language=javascript>\n";
    xstr += "function checkCols()\n{";
    xstr += "if (window.opener.isMinNS4){var myframe=window.opener.document.layers[\"table\"];}else{var myframe=window.opener.document.all.table;};";
    xstr += "for (var i=0; i < window.opener.thetable.visCols.length; i++)\n";
    xstr += "{";
    xstr += 'if (document.forms[i].elements[1].checked)\n';
    xstr += "{window.opener.thetable.visCols[i]=false}";
    xstr += "else{window.opener.thetable.visCols[i]=true}";
    xstr += "}\n";
    xstr += "window.opener.thetable.inittable();";
    xstr += "window.opener.thetable.refreshTable();";
    xstr += "close();";
    xstr += "return true;";
    xstr += "}";
    xstr += "</script>\n";
    var str = "<html><head>" + xstr + "</head><body>";
    var lstr = "</body></html>";
    var mywin = window.open("", "WindowName", "status=no,resizable=yes,top=200,left=200,scrollbars=yes");
    str += '<p align="center"><b><font size="4">' + theTitle + ' Tablosunu Özelleştir</font></b>';
    str += '<table align=center border="1" width="302" cellspacing="0" cellpadding="0">\n<tr>\n<th>\n';
    str += '<table border="0" width="100%">\n<tr>\n<th width="150">Sütun</th>\n<th width="75">Göster</th>\n<th width="75">Gösterme</th>\n</tr>\n</table></th></tr>';

    for (i = 0; i < theCols.length; i++) {
        str += '<tr><td><form method="POST" action="" id=Kolon' + i + ' name=Kolon' + i + '>\n';
        str += '<table cellspacing=0 cellpadding=0 border="0" width="100%">\n<tr>\n<td align=left width="150">' + theCols[i][0] + '</td>\n<td align=center width="75">\n<p align="center">';
        str += '<input type="radio" value="V1"' + ((this.visCols[i] == true) ? ' checked ' : ' ') + 'name="Kolon' + i + 'Check0"></p>\n</td>\n<td align=center width="75">\n<p align="center"><input type="radio" name="Kolon' + i + 'Check0" value="V2"' + ((this.visCols[i] == false) ? ' checked ' : ' ') + '></p>\n</td>\n</tr>\n</table>\n</form>\n</td>\n</tr>';
    }
    str += "<tr>\n<td valign=\"middle\" align=\"center\">\n<form method=\"POST\" action=\"javascript:checkCols();\">\n<p align=\"center\"><input type=submit value=\"Tabloyu Oluştur\" name=B1></p>\n</form>\n</td>\n</tr>";
    str += '</table>';
    if (isMinNS4) {
        mywin.document.open("text/html", "replace");
        mywin.document.write(str + lstr);
        mywin.document.close();
        //mywin.document.height=mywin.document.height;

    }
    else {
        mywin.document.open("text/html", "replace");
        mywin.document.write(str + lstr);
        mywin.document.close();
        //mywin.innerHTML=str+lstr; 
    }
    mywin.focus();

}
function unload() {
    if (top.frmMenu) {
        if (top.frmMenu.oCFMenu) {
            top.frmMenu.oCFMenu.loaded = 0
        }
    }
}
function refreshTabRows() {
    var currentRows = "";
    var posit = 0;
    var deger = 0;
    posit = Math.floor(((this.iFirst + this.iLast) / 2) / (theRows.length / (this.iLast - this.iFirst)));
    deger = this.iFirst + posit;
    for (var k = this.iFirst; k < this.iLast; k++) {
        theRec = theRows[this.theColumn[k][1]];
        currentRows += "\n<tr";
        if (this.highlight) {
            currentRows += " OnMouseOver=\"this.bgColor='#FFF7D6'\" OnMouseOut=\"this.bgColor='#FFFFFF'\"";
        }
        currentRows += ">";
        if (this.shownum)
            currentRows += "<td align=right class=exc>" + (k + 1) + " </td>";
        for (l = 0; l < theCols.length; l++) {
            if (this.visCols[l]) {
                var currentValue = (theRec[l] == "") ? "&nbsp;" : theRec[l];
                var theCell = "<td  width=" + theCols[l][2] + " class=bord nowrap='noWrap'";
                switch (theCols[l][1]) {
                    case 0:
                        theCell += (" align=center>" + ((theRec[l]) ? "<img src='check.gif'>" : "&nbsp;"));
                        break;
                    case 1:
                        theCell += " align=right >" + currentValue;
                        break;
                    case 2:
                        theCell += (" align=right >" + currentValue);
                        break;
                    case 3:
                        theCell += (" align=center>" + theCols[l][3].split("<option>")[currentValue]);
                        break;
                    case 4:
                        theCell += (" align=left >" + currentValue);
                        break;
                    case 5:
                        x = innerText(currentValue);
                        re = /,/gi;
                        x = x.replace(re, "");
                        re = /"\""/gi;
                        x = x.replace(re, "");
                        if (x == "-") {
                            theCell += " align=right >" + currentValue + "&nbsp;<font face=symbol size=1 color=#00A000><b>=</b></font>";
                        }
                        else {
                            currentValue = eval(x);
                            if (currentValue == 0)
                            { theCell += " align=right >" + currentValue + "&nbsp;<font face=symbol size=1 color=#00A000><b>=</b></font>"; }
                            else {
                                if (currentValue > 0) {
                                    { theCell += " align=right style=\"color: #009C00;\">" + currentValue + "&nbsp;<font face=symbol size=1 color=#009C00><b>İ</b></font>"; }
                                }
                                else {
                                    { theCell += " align=right style=\"color: #9C0000;\">" + currentValue + "&nbsp;<font face=symbol size=1 color=#9C0000><b>ß</b></font>"; }
                                }
                            }
                        }
                        break;
                    default:
                        theCell += (">" + currentValue);
                }
                currentRows += (theCell + "</td>");
            }
        }
        currentRows += "</tr>";
    }
    if (theFooter.length > 0 & !isLimited) {
        currentRows += "<tr>";

        for (l = 0; l < theCols.length; l++) {
            if (this.visCols[l]) {
                if (theFooter[l]) {
                    if (theFooter[l] != "") {
                        currentValue = theFooter[l];
                    }
                    else {
                        currentValue = "&nbsp;";
                    }
                }
                else {
                    currentValue = "&nbsp;";
                }
                var theCell = "<th class=footer nowrap='noWrap' width=" + theCols[l][2];
                if (this.shownum & l == 0) theCell += " colspan=2";
                switch (theCols[l][1]) {
                    case 0:
                        theCell += (" align=center>" + ((theRec[l]) ? "<img src='check.gif'>" : "&nbsp;"));
                        break;
                    case 1:
                        theCell += (" align=right >" + currentValue);
                        break;
                    case 2:
                        theCell += (" align=right >" + currentValue);
                        break;
                    case 3:
                        theCell += (" align=center>" + theCols[l][3].split("<option>")[currentValue]);
                        break;
                    case 4:
                        theCell += (" align=left >" + currentValue);
                        break;
                    case 5:
                        theCell += (" align=right >" + currentValue);
                        break;
                    default:
                        theCell += (">" + currentValue);
                }
                currentRows += (theCell + "</th>");
            }
        }

    }
    currentRows += "</tr>\n</table>";
    return currentRows + ("\n");
};
function refreshTabCount() {
    var N = this.theColumn.length;
    var st = '</table><table width=100%><tr><TD class=toplam align=center align=center>\n';
    st += (N > 0) ? ("[" + (this.iFirst + 1) + " - " + this.iLast + "] Toplam : " + N) : "Kritere Uygun Kayıt Bulunamadı";
    st += '</TD>\n';
    st += '</TR>\n</TABLE>\n';
    return st;
};

function refreshTable() {
    var N = this.theColumn.length;
    var st = '<TD class=toplam   width=80% align=center>\n';
    st += (N > 0) ? ("[" + (this.iFirst + 1) + " - " + this.iLast + "] Toplam : " + N) : "Kritere Uygun Kayıt Bulunamadı";
    st += '</TD>\n';
    if (isMinNS4) {
        var myframe = document.layers[this.targetname];
    }
    else {
        if (isMinNS6) {
            var myframe = document.getElementById(this.targetname);
        }
        else {
            var myframe = eval('document.frames["' + this.targetname + '"]');
        }
    }
    var footstr = "";
    if (this.iFirst == 0 & this.iLast == theRows.length) {
        footstr += "";
    }
    else {

        footstr += "<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CEDEFA align=center width=\"100%\"> \n<tr> \n";
        footstr += st;
        if (this.iFirst == 0) {
            footstr += "<td width=40 align=center><img src=../images/fpage3.gif border=0 height=17 width=20></td><td  width=40 align=center><img src=../images/ppage3.gif border=0 height=17 width=20></td>";
        }
        else {
            footstr += "<td width=40 align=center> \n<a href=\"javascript:thetable.scrollTable(-2);\"  id='firstbtn'  name='firstbtn' onmouseOver=\"javascript:document.images[\'frw\'].src=arImList[7].src;\" onmouseOut=\"javascript:document.images[\'frw\'].src=arImList[0].src;\"><img name=\"frw\" border=0 height=17 width=20></A></TD>\n<TD align=center width=40><a href=\"javascript:thetable.scrollTable(-1);\" onmouseOver=\"javascript:document.images[\'rew\'].src=arImList[8].src;\" onmouseOut=\"javascript:document.images[\'rew\'].src=arImList[1].src;\"><img name=\"rew\"  border=0 height=17 width=20></td>\n";
        };
        if (this.iLast == this.theColumn.length) {
            footstr += "<td width=40 align=center><img src=../images/npage3.gif border=0 height=17 width=20></td><td width=40 align=center><img src=../images/lpage3.gif border=0 height=17 width=20></td>";
        }
        else {
            footstr += "<td width=40 align=center><a href=\"javascript:thetable.scrollTable(1);\" name='nextbtn' onmouseOver=\"javascript:document.images[\'for\'].src=arImList[9].src;\" onmouseOut=\"javascript:document.images[\'for\'].src=arImList[2].src;\"><IMG name=\"for\" border=0 height=17 width=20></A></TD>\n<TD align=center width=40><A href=\"javascript:thetable.scrollTable(2);\"  onmouseOver=\"javascript:document.images[\'ffor\'].src=arImList[10].src;\" onmouseOut=\"javascript:document.images[\'ffor\'].src=arImList[3].src;\"><img name=\"ffor\"  border=0 height=17 width=20> </A></TD>\n";
        };
        footstr += "</TR>\n</table>";
    }
    footstr += "\n";
    if (myframe) {
        if (isMinNS4) {
            var oldheight = parent.document.height;
            myframe.document.open("text/html", "replace");

            myframe.document.write(this.tabStart + this.refreshHeader() + this.refreshTabRows() + this.footerstart + footstr + this.footerend);
            myframe.document.close();
        }
        else {
            var str1 = "";
            var str2 = "";
            str1 = this.refreshHeader();
            str2 = this.refreshTabRows();
            myframe.innerHTML = this.tabStart + str1 + str2 + this.footerstart + footstr + this.footerend;
        }
        if (isMinNS6) {
            if (document.images["for"])
                document.images["for"].src = arImList[2].src;
            if (document.images["ffor"])
                document.images["ffor"].src = arImList[3].src;
            if (document.images["rew"])
            { document.images["rew"].src = arImList[1].src; }
            if (document.images["frw"])
                document.images["frw"].src = arImList[0].src;
            document.images["helpw2k"].src = arImList[4].src;
        }
        else {
            if (myframe.document.images["for"])
                myframe.document.images["for"].src = arImList[2].src;
            if (myframe.document.images["ffor"])
                myframe.document.images["ffor"].src = arImList[3].src;
            if (myframe.document.images["rew"])
            { myframe.document.images["rew"].src = arImList[1].src; }
            if (myframe.document.images["frw"])
                myframe.document.images["frw"].src = arImList[0].src;
            if (myframe.document.images["helpw2k"])
                myframe.document.images["helpw2k"].src = arImList[4].src;
        }
        if (isMinNS6) {
            if (document.getElementById("rowcount") != null)
                document.getElementById("rowcount").value = this.rowsToDisplay;
        }
        else
            if (myframe.document.forms[0].elements["rowcount"] != null) {
            var myinput = myframe.document.forms[0].elements["rowcount"];
            myinput.value = this.rowsToDisplay;

        }
    }
};
function innerText(str) {
    str = String(str);
    while (str.indexOf("<") != -1) {
        a = str.indexOf("<");
        b = str.indexOf(">");
        str = str.substring(0, a) + str.substring(b + 1, str.length);
    }
    return (str);
};
function compare(a, b) {

    if (a[0] == "-" & b[0] == "-") return 0;
    if (a[0] == "-") return 1;
    if (b[0] == "-") return -1;
    if (a[0] < b[0]) return -kSort[1];
    if (a[0] > b[0]) return kSort[1];
    return 0;
};
function scrollTable(x) {

    if (isMinNS4) {
        var myframe = document.layers["table"];

    }
    else {
        if (isMinNS6) var myframe = document.getElementById("table");
        else var myframe = document.all.table;
    }
    if (isMinNS6) {
        if (document.getElementById("rowcount") != null)
            var myinput = document.getElementById("rowcount").value;
    }
    else {
        if (myframe.document.forms[0].elements["rowcount"])
            var myinput = parseInt(myframe.document.forms[0].elements["rowcount"].value, 10)
        else
            var myinput = theRows.length;
    }
    if (myinput) {
        if (!isNaN(myinput)) {
            if (myinput == "" | myinput > this.theColumn.length) {
                this.rowsToDisplay = Math.min(myinput, this.theColumn.length);
            }
            else { this.rowsToDisplay = (myinput == 0) ? Math.min(defrownum, this.theColumn.length) : (myinput); }
        }
        else { this.rowsToDisplay = Math.min(defrownum, this.theColumn.length); }
    }
    else { this.rowsToDisplay = defrownum; }
    switch (x) {

        case -3:
            if (this.iFirst != 0) {
                this.iFirst += -1;
            }
            break;
        case -2:
            this.iFirst = 0;
            break;
        case 2:
            this.iFirst = Math.min(Math.max(0, this.theColumn.length - 1), this.theColumn.length - (this.theColumn.length % this.rowsToDisplay == 0) ? this.theColumn.length - this.rowsToDisplay : this.theColumn.length % this.rowsToDisplay);
            break;
        case 1:
            this.iFirst = Math.min(Math.max(0, this.iFirst += x * this.rowsToDisplay), this.theColumn.length - this.theColumn.length % this.rowsToDisplay);
            break;
        case -1:
            this.iFirst = Math.min(Math.max(0, this.iFirst += x * this.rowsToDisplay), this.theColumn.length - this.theColumn.length % this.rowsToDisplay);
            break;
        case 3:
            this.iFirst += 1;
            break;
    }
    this.iLast = Math.min(parseInt(this.iFirst) + parseInt(this.rowsToDisplay), this.theColumn.length);
    this.refreshTable();
};

function scrollTo() {
    found = false;
    if (isMinNS4) {
        var myframe = document.layers["table"];
    }
    else {
        if (isMinNS6) var myframe = document.getElementById("table");
        else
            var myframe = document.all.table;
    }
    if (isMinNS6) {
        var myinput = document.getElementById("rowcount")
    }
    else
        var myinput = myframe.document.forms[0].elements["rowcount"];
    if (myinput) {
        if (!isNaN(parseInt(myinput.value, 10))) {
            if (myinput.value == "" | myinput.value > this.theColumn.length) {
                this.rowsToDisplay = Math.min(myinput.value, this.theColumn.length);
            }
            else { this.rowsToDisplay = (parseInt(myinput.value, 10) == 0) ? Math.min(defrownum, this.theColumn.length) : parseInt(myinput.value, 10); }
        }
        else { this.rowsToDisplay = Math.min(defrownum, this.theColumn.length); }
    }
    else { this.rowsToDisplay = defrownum; }
    if (isMinNS6) {
        var kod = document.getElementById("hisse").options[document.getElementById("hisse").selectedIndex].text;
    }
    else {
        if (isMinNS4) {
            var kod = myframe.document.forms[0].elements["hisse"].options[myframe.document.forms[0].elements["hisse"].selectedIndex].text;
        }
        else {
            var kod = myframe.document.forms[0].elements["hisse"].options[myframe.document.forms[0].elements["hisse"].selectedIndex].name;
        };
    };
    kod = kod.replace(" ", "");
    for (i = 0; i < theRows.length; i++) {
        var mykod = theRows[i][this.searchcolumn];
        if (mykod.indexOf(kod) != -1) {
            fno = i;
            found = true;
            break;
        }
    }

    if (found) {
        for (i = 0; i < this.theColumn.length; i++) {
            if (this.theColumn[i][1] == fno) {
                this.iFirst = i;
                this.iLast = Math.min(this.iFirst + this.rowsToDisplay, this.theColumn.length);
                this.refreshTable();
                break;
            }
        }
    }
};

function dateToNum(dateString) {
    var dateArray = dateString.split("/");
    return dateArray[2] * 10000 + dateArray[1] * 100 + eval(dateArray[0]);
}

function mySort(k) {
    var dataType = theCols[k][1];
    if (kSort[0] == k) {
        kSort[1] = -kSort[1];
    }
    else {
        kSort[0] = k;
        if (dataType == 1)
            kSort[1] = -1;
        else { kSort[1] = 1; }
    }



    this.sortdatatype = dataType;
    for (var j = 0; j < this.theColumn.length; j++) {
        var x = theRows[this.theColumn[j][1]][k];
        switch (dataType) {
            case 0:
                this.theColumn[j][0] = (x) ? 1 : 0;
                break;
            case 1:
                x = innerText(x);
                re = /,/gi;
                x = x.replace(re, "");
                re = /"\""/gi;
                x = x.replace(re, "");
                if (x == "-") {
                    this.theColumn[j][0] = x;
                }
                else {
                    this.theColumn[j][0] = eval(x);
                }
                break;
            case 5:
                x = innerText(x);
                re = /,/gi;
                x = x.replace(re, "");
                re = /"\""/gi;
                x = x.replace(re, "");
                if (x == "-") {
                    this.theColumn[j][0] = x;
                }
                else {
                    this.theColumn[j][0] = eval(x);
                }
                break;
            case 3:
                this.theColumn[j][0] = eval(x);
                break;
            case 2:
                if (x != "") this.theColumn[j][0] = dateToNum(x);
                else { this.theColumn[j][0] = 0; }
                break;
            default:
                this.theColumn[j][0] = innerText(x).toUpperCase();
        }
    }
    this.theColumn = this.theColumn.sort(compare);
    this.scrollTable(-2);
}

function WriteCsv() {
    //iptal
    return;
    var fso, f, r

    var ForReading = 1, ForWriting = 2;
    if (isMinIE4) {
        fso = new ActiveXObject("Scripting.FileSystemObject")
        //	fname=InputBox("Lütfen Dosya Adını Giriniz","Tablo C:\'a kaydedilecektir");
        fname = theCaption.substr(0, 8)
        if (fname == "") {
            fname = theTitle.substr(0, 8)
            if (fname == "")
                return;
        }

        f = fso.OpenTextFile("c:\\" + "aktar" + ".csv", ForWriting, true)
        for (var k = 0; k < theRows.length; k++) {
            var currentRows = "";
            theRec = theRows[this.theColumn[k][1]];
            for (l = 0; l < theCols.length; l++) {
                if (this.visCols[l]) {

                    var str = innerText(theRec[l]).replace(" ", "");
                    str = str.replace("&nbsp;", "");
                    currentRows += str;
                    currentRows += ";";
                }
            }
            f.WriteLine(currentRows);
        }

        f.Close();
        alert("c:\\" + "aktar" + ".csv dosyası kaydedildi.");
    }
}


