﻿<!--
var client_h;
//page_load
function page_load()
{
    var doc = document.getElementById('center');
    h=doc.offsetHeight;
    z=Math.round(h/675);
    if (h > 680 && z < h/675) z=z+1;
    z=z*675;
    doc.style.height=z+"px";
    client_h = document.documentElement?document.documentElement.clientHeight:(window.innerHeight?window.innerHeight:20);
    if (z == 675 && client_h > 675)
    {
        client_h = (client_h-675)/2;
        doc.style.marginTop = client_h + "px";
     }
     else
        client_h = 20;
} 
//show or hide message box
function showOrHide(value, id) 
{
	var doc = document.getElementById(id);
	if (doc != null)
	{
        if (value==0) 
            doc.style.display='none';
        else
        {
            if (id == 'message')
                doc.style.top = (client_h + 225) + "px";
            doc.style.display=''; 
            window.setTimeout("showOrHide('0', '" + id + "')", 2500);
        }
	}
}
//move & resize extra windows
function move(w, h)
{
    window.resizeTo(w,h);
    window.moveTo(200,25);
}
function OpenMenu(obj)
{
    var doc = document.getElementById(obj);
    if (doc != null) 
    {
        if (doc.style.display == "none") doc.style.display="";
        else doc.style.display="none";
    }
}
function searchdefaultvalue(value)
{
    return (value == 'поиск по сайту' || value.length == 0);
}
function searchonsite() 
{
    var doc = document.getElementById('SearchField');
    if (doc != null && !searchdefaultvalue(doc.value)) location.href = "../searchonsite/?qos=" + doc.value;
}
//search for site finish
//trim
function trim(string)
{
    return string.replace(/(^\s+)|(\s+$)/g, "");
}
//search start
//advance search form display
function AdvanceForm(id) 
{
    var doc = document.getElementById(id);
    if (doc != null) 
    {
        if (doc.style.display == "")
            doc.style.display="none";
        else if (doc.style.display == "none")
            doc.style.display="";
        else
            doc.style.display="none";
    }
}
function SyntaxApply(varq, index)
{
    var doc = document.getElementById(varq),
        word = document.getElementById('word' + index),
        words = document.getElementById('words' + index),
        begin = document.getElementById('begin' + index),
        verbatim = document.getElementById('verbatim' + index),
        enter = false;
    switch (doc.value)
    {
        case "3":
            word.className = begin.className = words.className = "syntax";
            verbatim.className = "syntax_select";
            break;
        case "2":
            word.className = words.className = verbatim.className = "syntax";
            begin.className = "syntax_select";
            break;
        case "1":
            word.className = begin.className = verbatim.className = "syntax";
            words.className = "syntax_select";
            break;
        default:
            verbatim.className = begin.className = words.className = "syntax";
            word.className = "syntax_select";
            break;
            
    }
}
function addSyntax(variant, varq, index)
{
    var doc = document.getElementById(varq);
    if (doc != null) doc.value = variant;
    SyntaxApply(varq, index);
}
function CreateClientRequest(i, q, f, v)
{
    return req = '&q' + i + '=' + escape(q) + '&f' + i + '=' + escape(f) + '&v' + i + '=' + v;
}
function Opens(data) 
{ if (data != null) {
 if (data.value == '27спр')
window.open('sigla.aspx?name=27спр','','location=no,status=no,menubar=no,scroll=no,width=675,height=225,left=392,top=292');	} }
//показать сиглы хранения/заказать
function showStoring(uid)
{
    var body = document.getElementById('center');
    if (body != null)
    {
        setElementOpacity(body, 0.3);
        var storing = document.getElementById('storing');
        if (storing != null)
        {
            storing.style.display = '';
            storing.style.top = (ClientHeight()/2 + ClientScrollTop() - 100) + 'px';
        }
        StoringSupport(uid);
    }
}
//вернуться к поиску, скрыть хранения
function hideStoring()
{
    var body = document.getElementById('center');
    if (body != null)
    {
        setElementOpacity(body, 1.0);
        var storing = document.getElementById('storing');
        if ( storing != null)
            storing.style.display = 'none';
    }
}
function getOpacityProperty()
{
  if (typeof document.body.style.opacity == 'string') // CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9)
    return 'opacity';
  else if (typeof document.body.style.MozOpacity == 'string') // Mozilla 1.6 и младше, Firefox 0.8 
    return 'MozOpacity';
  else if (typeof document.body.style.KhtmlOpacity == 'string') // Konqueror 3.1, Safari 1.1
    return 'KhtmlOpacity';
  else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) // Internet Exploder 5.5+
    return 'filter';
  return false; //нет прозрачности
}
function setElementOpacity(element, nOpacity)
{
  var opacityProp = getOpacityProperty();
  if (!element || !opacityProp) return;
  if (opacityProp=="filter") // IE 5.5+
  {
    nOpacity *= 100;
    var oAlpha = element.filters['DXImageTransform.Microsoft.alpha'] || element.filters.alpha;
    if (oAlpha) oAlpha.opacity = nOpacity;
    else element.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";
  }
  else
    element.style[opacityProp] = nOpacity;
}
//высота прокрутки клиентского скола
function ClientScrollTop()
{
    return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
//высота клиентской области
function ClientHeight()
{
    return document.compatMode=='CSS1Compat' ? document.documentElement.clientHeight : document.body.clientHeight;
}
// -->