var httpRequest = createHttpRequest();
var result = '';


function sendRequest(file, _result, getRequestProc) {
result = _result;
document.getElementById(result).innerHTML = 'Загрузка... <img src="/loading.gif">';
httpRequest.open('POST', file, true)
httpRequest.onreadystatechange = getRequest;
httpRequest.send(null);
}


function getRequest() {
if (httpRequest.readyState == 4) {
document.getElementById(result).innerHTML = httpRequest.responseText;
}}

function createHttpRequest()
{
    if (window.XMLHttpRequest) {
        try {
            return new XMLHttpRequest();
        } catch (e){}
    } else if (window.ActiveXObject) {
        try {
            return new ActiveXObject('Msxml2.XMLHTTP');
        } catch (e){
          try {
              return new ActiveXObject('Microsoft.XMLHTTP');
          } catch (e){}
        }
    }
    return null;
}




var authFormWindow = {

        form_window: null,
        overlay : null,
        form_window_id : "login-form-window",
        login_field_id : "auth-user-login",

        ShowLoginForm : function()
        {
                if (!this.form_window)
                {
                        this.form_window = document.getElementById(this.form_window_id);
                        if (!this.form_window)
                                return false;

                        try {document.body.appendChild(this.form_window);}
                        catch (e){}
                }

                this.form_window.style.display = "block";

                if (this.GetOpacityProperty())
                        this.CreateOverlay();

                var loginField = document.getElementById(this.login_field_id);
                if (loginField)
                {
                        loginField.focus();
                        loginField.select();
                }
                return false;
        },

        CloseLoginForm : function()
        {
                if (this.form_window)
                        this.form_window.style.display = "none";

                if (this.overlay)
                        this.overlay.style.display = "none";

                return false;
        },


        CreateOverlay : function()
        {
                if (!this.overlay)
                {
                        this.overlay = document.body.appendChild(document.createElement("DIV"));
                        this.overlay.className = "login-form-overlay";

                        var _this = this;
                        this.overlay.onclick = function() {_this.CloseLoginForm()};
                }

                var windowSize = this.GetWindowScrollSize();

                this.overlay.style.width = windowSize.scrollWidth + "px";
                this.overlay.style.height = windowSize.scrollHeight + "px";
                this.overlay.style.display = "block";
        },

        GetOpacityProperty : function()
        {
                if (typeof document.body.style.opacity == 'string')
                        return 'opacity';
                else if (typeof document.body.style.MozOpacity == 'string')
                        return 'MozOpacity';
                else if (typeof document.body.style.KhtmlOpacity == 'string')
                        return 'KhtmlOpacity';
                else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5)
                        return 'filter';

                return false;
        },

        GetWindowScrollSize : function(pDoc)
        {
                var width, height;
                if (!pDoc)
                        pDoc = document;

                if ( (pDoc.compatMode && pDoc.compatMode == "CSS1Compat"))
                {
                        width = pDoc.documentElement.scrollWidth;
                        height = pDoc.documentElement.scrollHeight;
                }
                else
                {
                        if (pDoc.body.scrollHeight > pDoc.body.offsetHeight)
                                height = pDoc.body.scrollHeight;
                        else
                                height = pDoc.body.offsetHeight;

                        if (pDoc.body.scrollWidth > pDoc.body.offsetWidth ||
                                (pDoc.compatMode && pDoc.compatMode == "BackCompat") ||
                                (pDoc.documentElement && !pDoc.documentElement.clientWidth)
                        )
                                width = pDoc.body.scrollWidth;
                        else
                                width = pDoc.body.offsetWidth;
                }
                return {scrollWidth : width, scrollHeight : height};
        }
}

var authPreloadImages = ["close.gif", "auth-form-bg.gif"];

authPreloadImages = null;

function vids(x)
{
 if (x==0) { document.getElementById('MySdat').style.display = 'none'; document.getElementById('MySnat').style.display = 'none';  document.getElementById('heightTB').style.height = '440px';  } 
 if (x==1) { document.getElementById('MySdat').style.display = 'block'; document.getElementById('MySnat').style.display = 'none';  document.getElementById('heightTB').style.height = '580px';  } 
 if (x==2) { document.getElementById('MySdat').style.display = 'none'; document.getElementById('MySnat').style.display = 'block'; document.getElementById('heightTB').style.height = '580px';  } 
}


function check1()
{ 
	var ErrorText = "";
	var Fields = new Array();
		Fields["fio"]    = "Ваше имя";
		Fields["phones"]   = "Номер телефона";
	var BackForm = document.getElementById("formOrder");
	var Elements = BackForm.elements;
	for(var i=0; i < 2; i++) { if(Elements[i].value.length == 0) { ErrorText += Fields[Elements[i].name] + ", "; } }
	if(ErrorText.length > 0) alert("Незаполнены обязательные поля:\n" + ErrorText.slice(0, ErrorText.length-2) + " !");
	else	{ BackForm.submit(); }
}


function check2()
{
	var ErrorText = "";
	var Fields = new Array();
		Fields["fio"]    = "Ваше имя";
		Fields["email"]   = "E-mail";
		Fields["info"]   = "Задать вопрос";

	var BackForm = document.getElementById("formOrder");
	var Elements = BackForm.elements;
	for(var i=0; i < 3; i++) { if(Elements[i].value.length == 0) { ErrorText += Fields[Elements[i].name] + ", "; } }
	if(ErrorText.length > 0) alert("Незаполнены обязательные поля:\n" + ErrorText.slice(0, ErrorText.length-2) + " !");
	else	{ BackForm.submit(); }
}


var OBJ;
function myFunc (x)
{
var t = document.getElementById (x);
for (j=1; j< 40; j++) {  var s= 'STB_'+ j;  var p= 'PTB_'+ j; 
  if(document.getElementById(s)) { document.getElementById(s).style.color='#C56F06';  }
  if(document.getElementById(p)) { document.getElementById(p).style.display='none';  } 
}
var STB= 'S'+ x;
var PTB= 'P'+ x;
document.getElementById(STB).style.color='#1B5B39'; 
if(document.getElementById(PTB)) { document.getElementById(PTB).style.display='block';  }
if (OBJ != t)
   {
   if (OBJ) OBJ.style.display = 'none';
   t.style.display = 'block';

   OBJ = t;
   }
//********
else {t.style.display = 'none'; OBJ = null}
//********
}



function Incliude_Footer1()
{
document.write("<!-- begin of Top100 code -->");
document.write("<script id=\"top100Counter\" type=\"text/javascript\" src=\"http://counter.rambler.ru/top100.jcn?1827641\"></script><noscript><img src=\"http://counter.rambler.ru/top100.cnt?1827641\" alt=\"\" width=\"1\" height=\"1\" border=\"0\"/></noscript>");
document.write("<!-- end of Top100 code -->");
document.write("<!-- begin of Top100 logo -->");
document.write("<a href=\"http://top100.rambler.ru/home?id=1827641\" target=\"_blank\"><img src=\"http://top100-images.rambler.ru/top100/banner-88x31-rambler-green2.gif\" alt=\"Rambler's Top100\" width=\"88\" height=\"31\" border=\"0\" /></a>");
document.write("<!-- end of Top100 logo -->");
document.write("&nbsp;");

document.write("<!--LiveInternet counter-->");
document.write("<a href='http://www.liveinternet.ru/click' "+
"target=_blank><img src='http://counter.yadro.ru/hit?t38.2;r"+
escape(document.referrer)+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
";"+Math.random()+
"' alt='' title='LiveInternet' "+
"border='0' width='31' height='31'><\/a>")
document.write("<!--/LiveInternet-->");

document.write("<!-- YaMetrics begin -->");
var ya_cid=115377;
document.write("<script src=\"http://bs.yandex.ru/resource/watch.js\" type=\"text/javascript\"></script>");
document.write("<noscript><div style=\"display: inline;\"><img src=\"http://bs.yandex.ru/watch/115377\" width=\"1\" height=\"1\" alt=\"\"></div></noscript>");
document.write("<!-- YaMetrics end -->");
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("UA-13267031-2");
pageTracker._trackPageview();
} catch(err) {}
document.write("<!-- Yandex.Metrika counter -->");

(function(w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter115377 = new Ya.Metrika(115377);
             yaCounter115377.clickmap(true);
             yaCounter115377.trackLinks(true);

        } catch(e) {}
    });
})(window, 'yandex_metrika_callbacks');

document.write("<script src=\"//mc.yandex.ru/metrika/watch.js\" type=\"text/javascript\" defer=\"defer\"></script>");
document.write("<noscript><div style=\"position:absolute\"><img src=\"//mc.yandex.ru/watch/115377\" alt=\"\" /></div></noscript>");
document.write("<!-- /Yandex.Metrika counter -->");
document.write("<!-- Yandex.Metrika Marked Phone -->");
document.write("<script type=\"text/javascript\" src=\"//mc.yandex.ru/metrika/phone.js?counter=115377\" defer=\"defer\"></script>");
document.write("<!-- /Yandex.Metrika Marked Phone -->");
}




function Incliude_Footer2()
{
document.write("<!-- begin of Top100 code -->");
document.write("<script id=\"top100Counter\" type=\"text/javascript\" src=\"http://counter.rambler.ru/top100.jcn?1827641\"></script><noscript><img src=\"http://counter.rambler.ru/top100.cnt?1827641\" alt=\"\" width=\"1\" height=\"1\" border=\"0\"/></noscript>");
document.write("<!-- end of Top100 code -->");
document.write("<!-- begin of Top100 logo -->");
document.write("<a href=\"http://top100.rambler.ru/home?id=1827641\" target=\"_blank\"><img src=\"http://top100-images.rambler.ru/top100/banner-88x31-rambler-green2.gif\" alt=\"Rambler's Top100\" width=\"88\" height=\"31\" border=\"0\" /></a>");
document.write("<!-- end of Top100 logo -->");
document.write("&nbsp;");

document.write("<!--LiveInternet counter-->");
document.write("<a href='http://www.liveinternet.ru/click' "+
"target=_blank><img src='//counter.yadro.ru/hit?t40.6;r"+
escape(document.referrer)+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
";"+Math.random()+
"' alt='' title='LiveInternet' "+
"border='0' width='31' height='31'><\/a>")
document.write("<!--/LiveInternet-->");

document.write("<!-- YaMetrics begin -->");
var ya_cid=115377;
document.write("<script src=\"http://bs.yandex.ru/resource/watch.js\" type=\"text/javascript\"></script>");
document.write("<noscript><div style=\"display: inline;\"><img src=\"http://bs.yandex.ru/watch/115377\" width=\"1\" height=\"1\" alt=\"\"></div></noscript>");
document.write("<!-- YaMetrics end -->");
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-13267031-2");
pageTracker._trackPageview();
} catch(err) {}
document.write("<!-- Yandex.Metrika counter -->");

(function(w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter115377 = new Ya.Metrika(115377);
             yaCounter115377.clickmap(true);
             yaCounter115377.trackLinks(true);

        } catch(e) {}
    });
})(window, 'yandex_metrika_callbacks');

document.write("<script src=\"//mc.yandex.ru/metrika/watch.js\" type=\"text/javascript\" defer=\"defer\"></script>");
document.write("<noscript><div style=\"position:absolute\"><img src=\"//mc.yandex.ru/watch/115377\" alt=\"\" /></div></noscript>");
document.write("<!-- /Yandex.Metrika counter -->");
document.write("<!-- Yandex.Metrika Marked Phone -->");
document.write("<script type=\"text/javascript\" src=\"//mc.yandex.ru/metrika/phone.js?counter=115377\" defer=\"defer\"></script>");
document.write("<!-- /Yandex.Metrika Marked Phone -->");
}




