﻿// JScript File

var config = [];
config["webUrl"] = "http://www.filehoo.com/";
config["now"] = new Date();

//hash["alertFunc"] = function(msg){
//  alert(msg);
//}
//var msg = hash["greet"] + " Today is " + hash["now"] + ".";
//hash["alertFunc"](msg);

function doFocusElement(_p1) {
    document.getElementById(_p1).focus();
}
//----------------------------------------------------------------
function lenghtLimitControl(obj, iLenghtLimit) {
    iStrLen = obMetin.value.length;
    if (iStrLen > iLenghtLimit) {
        obj.value = obj.value.substring(0, iLenghtLimit - 1);
        window.alert("Bu alana " + iLenghtLimit + " karakterden uzun bilgi girilemez.");
    }
}
//----------------------------------------------------------------
function opennew(pname, pid, pw, ph, pbg, ptitle, ptitcolor, pswfcolor) {
    var win;
    win = window.open('help/help.aspx?name=' + pname + '&id=' + pid + '&w=' + pw + '&h=' + ph + '&bg=' + pbg + '&title=' + ptitle + '&titcolor=' + ptitcolor + '&swfbg=' + pswfcolor, 'showpic', 'toolbar=0,status=0,resizable=no,width=600,height=510');
    win.focus();
    win.moveTo(200, 100);
};

function ajaxLoadUrl(_url, _loadDiv) {
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById(_loadDiv).innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", _url, true);
    xmlhttp.send();
}
//----------------------------------------------------------------
function NSconvertAscii(htmltext) {
    HTMLtmp = htmltext
    while (HTMLtmp.indexOf('İ') != -1)
        HTMLtmp = HTMLtmp.replace('İ', 'I');
    while (HTMLtmp.indexOf('ı') != -1)
        HTMLtmp = HTMLtmp.replace('ı', 'i');
    while (HTMLtmp.indexOf('ş') != -1)
        HTMLtmp = HTMLtmp.replace('ş', 's');
    while (HTMLtmp.indexOf('Ş') != -1)
        HTMLtmp = HTMLtmp.replace('Ş', 's');
    while (HTMLtmp.indexOf('ğ') != -1)
        HTMLtmp = HTMLtmp.replace('ğ', 'g');
    while (HTMLtmp.indexOf('Ğ') != -1)
        HTMLtmp = HTMLtmp.replace('Ğ', 'G');
    return HTMLtmp;
}

//----------------------------------------------------------------

function toggle(showHideDiv, switchTextDiv) {
    var ele = document.getElementById(showHideDiv);
    var text = document.getElementById(switchTextDiv);
    if (ele.style.display == "block") {
        ele.style.display = "none";
    }
    else {
        ele.style.display = "block";
    }
}

function MM_showHideLayers() {
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) {
            v = args[i + 2];
            if (obj.style) { obj = obj.style; v = (v == 'show') ? 'block' : (v == 'hide') ? 'none' : v; }
            obj.display = v;
        }
}

function sayfaYaz() {
    var docall = (document.all) ? 1 : 0;
    var prtr = (window.print) ? 1 : 0;

    if (!prtr) {
        window.status = "No print";
        return;
    }

    var yazmaAlani = document.getElementById("printArea");

    if (yazmaAlani == null && docall)
        yazmaAlani = document.all.YazdirilacakAlan;

    if (yazmaAlani) {
        var sStart = "<html><head>";

        var wnd = window.open('about:blank', 'printWin', 'width=700,height=500,scrollbars=yes');
        var windowdoc = wnd.document;
        windowdoc.open();
        windowdoc.writeln(sStart);
        windowdoc.writeln('<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">');
        windowdoc.writeln("</head><body>");
        windowdoc.writeln("<table border=0  width=\"640\">");
        windowdoc.writeln("<tr><td width=40>&nbsp;</td><td><br><br></td><td width=40>&nbsp;</td></tr>");
        windowdoc.writeln("<tr><td></td><td><div  align=justify id=\"YazdirilacakAlan\">");
        windowdoc.writeln(yazmaAlani.innerHTML);
        windowdoc.writeln("</div></td><td></td></tr>");
        windowdoc.writeln("<tr><td></td><td><br><br><br><br><br></td><td></td></tr>");
        windowdoc.writeln("</table>");
        windowdoc.writeln("</body></html>");

        windowdoc.close();
        wnd.print();
    }
}

function kucukPencere(adres) {
    window.open(adres, "", "left=50,top=20,width=800,height=600,scrollbars=1,resizable=1");
}

function loadjscssfile(filename, filetype) {
    if (filetype == "js") { //if filename is a external JavaScript file
        var fileref = document.createElement('script')
        fileref.setAttribute("type", "text/javascript")
        fileref.setAttribute("src", filename)
    }
    else if (filetype == "css") { //if filename is an external CSS file
        var fileref = document.createElement("link")
        fileref.setAttribute("rel", "stylesheet")
        fileref.setAttribute("type", "text/css")
        fileref.setAttribute("href", filename)
    }
    if (typeof fileref != "undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref)
}
