﻿<!-- 
function display(){
    rtime=etime-ctime;
    if (rtime>60)
        m=parseInt(rtime/60);
    else
        m=0;
    s=parseInt(rtime-m*60);
    window.setTimeout("checktime()",1000)
}
function settimes(){
    var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    etime=hours*3600+mins*60+secs;
    etime+=5;
    checktime();
}
function checktime(){
    var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    ctime=hours*3600+mins*60+secs;
    if(ctime>=etime)
        expired();
    else
        display();
}
function expired()
{
    showOrHide(0);
}
function showOrHide(value, name) 
{
    var sms;
	if (name == null) 
	{
    	if (document.body.offsetWidth > 1024) sms = "msg2";
    	else sms = "msg";
	}
	else 
	    sms = name;
	var doc = document.getElementById(sms);
	if (doc != null)
	{
        if (value==0) 
            doc.style.visibility='hidden';
        else if (value==1) 
            doc.style.visibility='visible'; 
	    if (name == null) settimes();
	}
}
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 window_onload()
{
    var doc = document.getElementById('tabl');
    h=doc.offsetHeight;
    z=Math.round(h/675);
    if (z < h/675) z=z+1;
    z=z*675;
    doc.style.height=z+"px";
}
function move(w, h)
{
    window.resizeTo(w,h);
    window.moveTo(200,25);
}
function InputPlaceholder (input, value, cssFilled, cssEmpty)
{
    var thisCopy = this;
    this.Input = input;
    this.Value = value;
    this.SaveOriginal = (input.value == value);
    this.CssFilled = cssFilled;
    this.CssEmpty = cssEmpty;
    this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()});
    this.setupEvent (this.Input, 'blur', function() {return thisCopy.onBlur()});
    this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()});
    if (input.value == '') this.onBlur();
    return this;
}
InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
    if (elem.attachEvent)
        elem.attachEvent ('on' + eventType, handler);
    if (elem.addEventListener)
        elem.addEventListener (eventType, handler, false);
}
InputPlaceholder.prototype.onFocus = function()
{
    if (!this.SaveOriginal && this.Input.value == this.Value)
        this.Input.value = '';
    else
        this.Input.className = '';
}
InputPlaceholder.prototype.onKeyDown = function()
{
    this.Input.className = '';
}
InputPlaceholder.prototype.onBlur = function()
{
    if (this.Input.value == '' || this.Input.value == this.Value)
    {
        this.Input.value = this.Value;
        this.Input.className = this.CssEmpty;
    }
    else
    {
        this.Input.className = this.CssFilled;
    }
}
function searchonsite() 
{
    var doc = document.getElementById('SearchField');
    if (doc != null) location.href = "../searchonsite/?qos=" + doc.value;
}
function trim(string)
{
    return string.replace(/(^\s+)|(\s+$)/g, "");
}
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('body');
    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('body');
    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;
}
// -->