﻿var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
document.onkeydown = function(e) {
    if (!isIE) { if (e.keyCode == 13) { goin(); return false; } }
    else { if (event.keyCode == 13) { goin(); return false; } }
}

function goin() {
    var form = document.forms[0];
    if (form.search.value != "") location.href = "/search/default.aspx?txt=" + form.search.value;
}

var xPos = 0;
var yPos = 0;

document.onmousedown = function(e) {
//if (!isIE) {
//    if (e.button == 2) {
//        location.reload();
//        return false;
//    }
//} else {
//    if (event.button == 2) {
//        location.reload();
//        return false;
//    }
//} 
xPos = parseInt((e)?e.pageX:event.clientX + document.body.scrollLeft);
yPos = parseInt((e) ? e.pageY : event.clientY + getScrollOffsetY());
}

function bigOpen(name) {
    var dbp = document.getElementById('bigPhoto');
    dbp.innerHTML = "<img src='img/030608/" + name + "' style='cursor:pointer;' alt='Р·Р°РєС_С<С'С_' onclick='closeBig()' />";
    dbp.style.top = yPos + "px";
}
function closeBig() { document.getElementById('bigPhoto').innerHTML = ""; }
function getScrollOffsetY() {
    var x, y;
    if (self.pageYOffset) // all except Explorer
    {
        x = self.pageXOffset;
        y = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
    // Explorer 6 Strict
    {
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }
    else if (document.body) // all other Explorers
    {
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    }
    return y;
}
function fonShow() {
    var x = { "w": getWindowWidth(), "h": getWindowHeight1() };
    
    var fon = document.getElementById("Fon");
    fon.style.display = "block";
    fon.style.width = x.w + "px";
    fon.style.height = x.h + "px";
    fon.onclick = function() { this.style.display = "none"; document.getElementById("imgView123").style.display = "none"; }
    return x;
}

function showImg(src,dw,dh) {
    var win = fonShow();
    var img = document.getElementById("imgView123");
    if (!img) {
        var img = document.createElement("img");
        img.style.position = "absolute";
        img.style.zIndex = 100000;
        img.style.left = win.w / 2 - dw + "px";
        img.style.top = win.h / 2 - dh + "px";
        img.setAttribute("id", "imgView123");
        document.documentElement.lastChild.appendChild(img);
    }
    img.style.display = "block";
    img.setAttribute("src", src);
    img.onclick = function() { document.getElementById("Fon").style.display = "none"; this.style.display = "none"; }
}


function getWindowWidth() {
    var _out;
    if (document.documentElement && document.documentElement.clientWidth) {
        _out = document.documentElement.clientWidth;
    }
    else if (document.body) {
        _out = document.body.clientWidth;
    } else if (self.innerWidth) {
        _out = self.innerWidth;
    }
    return _out;
}
function getWindowHeight1() {
    var _out;
    if (document.documentElement.scrollHeight) {
        _out = document.documentElement.scrollHeight;
    } else if (self.innerHeight) {
        _out = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        _out = document.documentElement.clientHeight;
    }
    else if (document.body) {
        _out = document.body.clientHeight;
    }
    return _out;
}
function getScrollOffsetY1() {
    var x, y;
    if (self.pageYOffset) // all except Explorer
    {
        x = self.pageXOffset;
        y = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
    // Explorer 6 Strict
    {
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }
    else if (document.body) // all other Explorers
    {
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    }
    return y;
}
