﻿// JScript File
var allowNavigation = false;
function Navigate(event) {
    if (allowNavigation) {
        if (event.ctrlKey && event.keyCode == 37) {
            document.location = document.getElementById('ctl00_MainContentPlaceHolder_nextLink').innerHTML;
        }
        else if (event.ctrlKey && event.keyCode == 39) {
            document.location = document.getElementById('ctl00_MainContentPlaceHolder_prevLink').innerHTML;
        }
    }
}

function ConfirmDelete(text)
{
    if(confirm('Вы уверены, что хотите удалить ' + text + '?'))
        return true;
    else return false;
}

function ChangeCssProperty(myclass, element, value) {
    var CSSRules
    if (document.all) {
        CSSRules = 'rules';
    }
    else if (document.getElementById) {
        CSSRules = 'cssRules';
    }
    for (var i = 0; i < document.styleSheets[0][CSSRules].length; i++) {
        if (document.styleSheets[0][CSSRules][i].selectorText == myclass) {
            document.styleSheets[0][CSSRules][i].style[element] = value;
        }
    }
}

function CorrectColumns() {
    //alert(document.body.clientWidth);
    if (document.body.clientWidth > 1655 && document.body.clientWidth < 1681) {
        //ChangeCssProperty('.columns', 'float', 'left');
        ChangeCssProperty('.columns', 'width', '500px');
    }
    else if (document.body.clientWidth > 1899 && document.body.clientWidth < 1921) {
        ChangeCssProperty('.columns', 'width', '600px');
        //ChangeCssProperty('.columns', 'float', 'left');
    }
    else {
        ChangeCssProperty('.columns', 'width', 'auto');
    }
}


