function dataIO(method,url,params)
{
    var xmlHttp = false;
    try
    {
        xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
    }
    catch (err2) 
    {
        try 
        {
            xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
        }
        catch (err3)
        {
            try
            {
                xmlHttp = new XMLHttpRequest();
            }
            catch (err1) 
            {
                xmlHttp = false;
            }
        }
    }
    xmlHttp;
    //if (iolus != false)
    {
        xmlHttp.open(method, url, false);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.send(params);
    }
    return xmlHttp;
}

function posX(obj,n)
{
    var curleft = 0; if(n==undefined) n=0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft+n;
}

function posY(obj,n)
{
    var curtop = 0; if(n==undefined) n=0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop+n;
}

function enterlaAra(e)
{
    if (!e) e = window.event;
    var code = (e.keyCode) ? e.keyCode : e.which;
    if (code == 13 || code == 3)
        document.getElementById("ctl00_aramaButonu").click();
}

function getPageWidth() {
    var scrollValue = ((window.innerWidth && window.scrollMaxX) ? document.body.scrollWidth : ((document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth));
    var w = ((self.innerWidth) ? self.innerWidth : ((document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : ((document.body) ? document.body.clientWidth : 0)));
    return ((scrollValue < w) ? w : scrollValue);
}

function getPageHeight() {
    var scrollValue = ((window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY : ((document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight));
    var h = ((self.innerHeight) ? self.innerHeight : ((document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : ((document.body) ? document.body.clientHeight : 0)));
    return ((scrollValue < h) ? h : scrollValue);
}
function getViewportWidth() {
    return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
}
function getViewportHeight() {
    return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);
}
String.prototype.toRGB = function () {
    var hex = this.replace("#", "");
    var rgb = [parseInt(hex.substr(0, 2), 16), parseInt(hex.substr(2, 2), 16), parseInt(hex.substr(4, 2), 16)];
    return rgb;
}
Number.prototype.toHEX = function () {
    if (isNaN(this)) return "00";
    var n = Math.max(0, Math.min(this, 255));
    return "0123456789ABCDEF".charAt((n - n % 16) / 16) + "0123456789ABCDEF".charAt(n % 16);
}

function lightBox(url)
{
    if (url == undefined) return false;
    this.bgColor = "#000000";
    this.transparency = 90;
    this.closeButtonText = "KAPAT";
    this.closeButtonImage = "";
    var area = null;
    var bs = document.createElement("div");
    bs.id = "bsDIV";
    bs.style.display = "block";
    bs.style.position = "absolute";
    bs.style.left = "0px";
    bs.style.top = "0px";
    bs.style.width = getPageWidth() + "px";
    bs.style.height = getPageHeight() + "px";
    bs.style.backgroundColor = this.bgColor;
    bs.style.opacity = (this.transparency / 100);
    bs.style.MozOpacity = (this.transparency / 100);
    bs.style.KhtmlOpacity = (this.transparency / 100);
    bs.style.filter = "alpha(opacity=" + this.transparency + ")";
    bs.style.zIndex = 99998;
    document.body.appendChild(bs);
    showIMG = function (w, h)
    {
        area = document.createElement("img");
        area.id = "bsIMAGE";
        area.setAttribute("src", url);
        area.setAttribute("width", w);
        area.setAttribute("height", h);
        area.style.position = "absolute";
        area.style.left = ((getViewportWidth() - w) / 2) + "px";
        area.style.top = ((getViewportHeight() - h - 150) / 2) + "px";
        if (parseInt(area.style.top, 10) < 0) area.style.top = "0px";
        area.style.zIndex = 99999;
        document.body.appendChild(area);
    }
    showURL = function (w, h)
    {
        area = document.createElement("iframe");
        area.id = "bsIFRAME";
        area.setAttribute("src", url);
        area.setAttribute("frameborder", "0")
        area.setAttribute("allowtransparency", "true")
        area.style.display = "block";
        area.style.position = "absolute";
        area.style.left = ((getViewportWidth() - w) / 2) + "px";
        area.style.top = ((getViewportHeight() - h - 150) / 2) + "px";
        if (parseInt(area.style.top, 10) < 0) area.style.top = "0px";
        area.style.width = w + "px";
        area.style.height = h + "px";
        area.style.backgroundColor = "transparent";
        area.style.zIndex = 99999;
        document.body.appendChild(area);
    }
    this.show = function (w, h)
    {
        var img = new Image();
        img.onload = function () { if (w == undefined) w = img.width; if (h == undefined) h = img.height; showIMG(w, h); }
        img.onerror = function () { if (w == undefined) w = 720; if (h == undefined) h = 540; showURL(w, h); }
        img.src = url;
        var closeButton = document.createElement("a");
        closeButton.id = "bsCloseButton";
        closeButton.setAttribute("href", "javascript:void(0);");
        closeButton.innerHTML = this.closeButtonText;
        closeButton.style.cursor = "pointer";
        closeButton.style.fontSize = "14px";
        closeButton.style.fontWeight = "bold";
        closeButton.style.textDecoration = "none";
        var color = this.bgColor.toRGB();
        closeButton.style.color = "#" + (255 - color[0]).toHEX() + (255 - color[1]).toHEX() + (255 - color[2]).toHEX();
        closeButton.style.zIndex = 99999;
        closeButton.style.position = "absolute";
        closeButton.style.top = "15px";
        if (this.closeButtonImage != "")
        {
            closeButton.innerHTML = "";
            var closeButtonIMG = document.createElement("img");
            closeButtonIMG.setAttribute("src", this.closeButtonImage);
            closeButtonIMG.style.margin = "0px";
            closeButtonIMG.style.padding = "0px";
            closeButtonIMG.style.border = "none";
            closeButton.appendChild(closeButtonIMG);
        }
        closeButton.onclick = function ()
        {
            document.body.removeChild(area);
            document.body.removeChild(closeButton);
            document.body.removeChild(bs);
        }
        document.body.appendChild(closeButton); closeButton.style.left = (getViewportWidth() - closeButton.offsetWidth - 20) + "px";
    }
}

function sayfaGoster(sayfaID)
{
    for (i = 0; i < document.getElementById("ctl00_bodyContainer_firmalar").getElementsByTagName("*").length; i++)
    {
        if (document.getElementById("ctl00_bodyContainer_firmalar").getElementsByTagName("*")[i].id.indexOf("searchResultDiv") == 0)
        {
            document.getElementById("ctl00_bodyContainer_firmalar").getElementsByTagName("*")[i].style.display = "none";
        }
    }
    for (i = 0; i < document.getElementById("ctl00_bodyContainer_aramaSayfalama").getElementsByTagName("*").length; i++)
    {
        if (document.getElementById("ctl00_bodyContainer_aramaSayfalama").getElementsByTagName("*")[i].id.indexOf("sayfa") == 0)
        {
            document.getElementById("ctl00_bodyContainer_aramaSayfalama").getElementsByTagName("*")[i].style.color = "#3399ff";
            document.getElementById("ctl00_bodyContainer_aramaSayfalama").getElementsByTagName("*")[i].style.fontWeight = "normal";
        }
    }
    document.getElementById("searchResultDiv" + sayfaID).style.display = "block";
    document.getElementById("sayfa" + sayfaID).style.color = "#2673bf";
    document.getElementById("sayfa" + sayfaID).style.fontWeight = "bold";
}
