﻿// Tab
var nTab = 4;
function TabLoad() {
    var ActivePanel = $get("ctl00_cph_hfActiveTab").value;
    if (ActivePanel == "") { ActivePanel = 'tab1'; }

    for (i = 1; i < nTab; i++) {
        if ('tab' + i == ActivePanel) {
            $get('div_' + ActivePanel).style.display = '';
            $get(ActivePanel).className = 'TabActive';
        }
        else {
            $get('div_' + 'tab' + i).style.display = 'none';
        }
    }
}

function TabChanged(obj) {
    obj.className = 'TabActive';
    $get('ctl00_cph_hfActiveTab').value = obj.id;

    for (i = 1; i < nTab; i++) {
        if ('tab' + i == obj.id) {
            $get('div_' + obj.id).style.display = '';
        }
        else {
            $get('div_tab' + i).style.display = 'none';
            $get('tab' + i).className = 'Tab';
        }
    }
}



var menuids = ["VerticalMenu"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_vertical() {
    for (var i = 0; i < menuids.length; i++) {
        var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            ultags[t].parentNode.getElementsByTagName("a")[0].className = "subfolderstyle"
            if (ultags[t].parentNode.parentNode.id == menuids[i]) //if this is a first level submenu
                ultags[t].style.left = ultags[t].parentNode.offsetWidth + "px" //dynamically position first level submenus to be width of main menu item
            else //else if this is a sub level submenu (ul)
                ultags[t].style.left = ultags[t - 1].getElementsByTagName("a")[0].offsetWidth + "px" //position menu to the right of menu item that activated it
            ultags[t].parentNode.onmouseover = function() {
                this.getElementsByTagName("ul")[0].style.display = "block"
            }
            ultags[t].parentNode.onmouseout = function() {
                this.getElementsByTagName("ul")[0].style.display = "none"
            }
        }
        for (var t = ultags.length - 1; t > -1; t--) { //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
            ultags[t].style.visibility = "visible"
            ultags[t].style.display = "none"
        }
    }

}


var menuidss = ["HorizontalMenu"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal() {
    for (var i = 0; i < menuidss.length; i++) {
        var ultags = document.getElementById(menuidss[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            if (ultags[t].parentNode.parentNode.id == menuidss[i]) { //if this is a first level submenu
                ultags[t].style.top = ultags[t].parentNode.offsetHeight + "px" //dynamically position first level submenus to be height of main menu item
                ultags[t].parentNode.getElementsByTagName("a")[0].className = "mainfoldericon"
            }
            else { //else if this is a sub level menu (ul)
                ultags[t].style.left = ultags[t - 1].getElementsByTagName("a")[0].offsetWidth + "px" //position menu to the right of menu item that activated it
                ultags[t].parentNode.getElementsByTagName("a")[0].className = "subfoldericon"
            }
            ultags[t].parentNode.onmouseover = function() {
                this.getElementsByTagName("ul")[0].style.visibility = "visible"
            }
            ultags[t].parentNode.onmouseout = function() {
                this.getElementsByTagName("ul")[0].style.visibility = "hidden"
            }
        }
    }
}
function fillthescreen() {
    document.getElementById('container-left').style.height = document.getElementById('container-content').clientHeight + "px";
    //    document.getElementById('container-right').style.height = document.getElementById('container-content').clientHeight + "px";
}



function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}



var min = 11;
var max = 18;
function increaseFontSize() {
    var p = document.getElementById('divContent');
    if (p != null) {
        if (p.style.fontSize) {
            var s = parseInt(p.style.fontSize.replace("px", ""));
        } else {
            var s = 11;
        }
        if (s != max) {
            s += 1;
        }
        p.style.fontSize = s + "px"
    }
}
function decreaseFontSize() {
    var p = document.getElementById('divContent');
    if (p != null) {
        if (p.style.fontSize) {
            var s = parseInt(p.style.fontSize.replace("px", ""));
        } else {
            var s = 11;
        }
        if (s != min) {
            s -= 1;
        }
        p.style.fontSize = s + "px"
    }
}


function getPrint(print_area) {
    var pp = window.open();
    pp.document.writeln('<HTML><HEAD><title>Baskı Önizleme</title></HEAD>')
    pp.document.writeln('<form  method="post">');
    pp.document.writeln('<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right><INPUT ID="PRINT" type="button" value="Yazdır" onclick="javascript:location.reload(true);window.print();"><INPUT ID="CLOSE" type="button" value="Kapat" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
    pp.document.writeln(document.getElementById(print_area).innerHTML);
    pp.document.writeln('</form></body></HTML>');

}


function OpenChildWindow(URL, Width, Height) {
    var sFeatures = "dialogHeight: " + Height + "px;";
    sFeatures += "dialogWidth: " + Width + "px;";
    sFeatures += "center: yes;";
    sFeatures += "scroll: no;";
    sFeatures += "status: yes;";
    sFeatures += "resizable: yes;";

    entryWindow = window.showModalDialog(URL, 'ChildForm', sFeatures);
    if (entryWindow == true) {
        window.document.getElementById('ctl00_cph_btnHiddenForUpdate').click();
    }

}

function WindowClose() {
    window.returnValue = true;
    window.close();
}
function WindowCancel() {
    window.returnValue = false;
    window.close();
}


var w = 800, h = 600;

if (document.all || document.layers) {
    w = screen.availWidth;
    h = screen.availHeight;
}

function openPopup(theURL, Width, Height) { //v2.0

    var popW = Width, popH = Height;

    if (typeof (parent.blnMultilanguage) != "undefined" && popupLocation.indexOf("multilanguage") == -1)
        popH += 180;

    var leftPos = (w - popW) / 2, topPos = (h - popH) / 2;
    if (popH > 500)
        topPos = 0;

    entryWindow = window.open(theURL, 'Keops', 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',status=0,resizable=1,scrollbars=yes,location=yes');


    if (entryWindow == true) {
        window.document.getElementById('ctl00_cph_btnHiddenForUpdate').click();
    }
    else {

    }
}