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;
}}



var httpRequest2 = createHttpRequest(); var result2 = '';
function sendRequest2(file, _result, getRequestProc) { result2 = _result;
document.getElementById(result2).innerHTML = '<img src="/images/blank.gif">';
httpRequest2.open('POST', file, true); httpRequest2.onreadystatechange = getRequest2; httpRequest2.send(null);
}
function getRequest2() { if (httpRequest2.readyState == 4) { document.getElementById(result2).innerHTML = httpRequest2.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 OBJ;
function myFunc (x)
{
var t = document.getElementById (x);
if (OBJ != t)
   {
   if (OBJ) OBJ.style.display = 'none';
   t.style.display = 'block';
   OBJ = t;
   }
//********
else {t.style.display = 'none'; OBJ = null}
//********
}


function  backet(x)  { 
var count=document.getElementById('CountBasket').innerHTML;
var count = parseInt(count); 
count=count + 1;
document.getElementById('CountBasket').innerHTML=count;
document.getElementById('bac1').style.display='block';
document.getElementById('bac2').style.display='none';
if (count==1) { document.getElementById('tovar').innerHTML='товар';  }
if ((count>=2) && (count<=4)) { document.getElementById('tovar').innerHTML='товара';  }
if (count>=5) { document.getElementById('tovar').innerHTML='товаров';  }
}


function  Over(x)  {
var NM='NM' + x;
document.getElementById(NM).style.backgroundColor = '#C9EEF3';
document.getElementById(NM).style.color = '#084186';
}

function  Out(x) {
var NM='NM' + x;
document.getElementById(NM).style.background = 'url(/images/blank.gif) left top no-repeat';
document.getElementById(NM).style.color = '#000000';
}


function  OverHot()  {
document.getElementById('BigImg').style.background='url(/images/HotDiamonds.jpg)';
document.getElementById('BigImg').style.zIndex='90';
}

function  OutHot() {
document.getElementById('BigImg').style.background='url(/images/blank.gif)';
document.getElementById('BigImg').style.zIndex='0';
}


function  OverHot2()  {
document.getElementById('BigImg').style.background='url(/images/HotDiamonds.jpg)';
document.getElementById('BigImg').style.zIndex='90';
}

function  OutHot2() {
document.getElementById('BigImg').style.background='url(/images/blank.gif)';
document.getElementById('BigImg').style.zIndex='0';
}


function  IncliudeSearch(a, b, c, d, e) {
document.write("<br/>");
document.write("<form action=\"/search/big_search.php\" method=\"get\">");
document.write("<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">");
document.write("<tr>");
document.write("<td class=\"m7\"></td>");
document.write("<td valign=\"top\" class=\"m8\">");
document.write("<div class=\"m9\"><img src=\"/images/s.png\"></div>");
document.write("<div class=\"m10\">");
document.write("<span class=\"m12\">Цена</span><br/>");
document.write("<select name=\"price\" class=\"m11\">");
document.write("<option>Не важно</option>");
document.write("<option "); if (a=='до 10.000 руб.') { document.write("selected"); } document.write(">до 10.000 руб.</option>");
document.write("<option "); if (a=='до 30.000 руб.') { document.write("selected"); } document.write(">до 30.000 руб.</option>");
document.write("<option "); if (a=='до 50.000 руб.') { document.write("selected"); } document.write(">до 50.000 руб.</option>");
document.write("<option "); if (a=='до 100.000 руб.') { document.write("selected"); } document.write(">до 100.000 руб.</option>");
document.write("<option "); if (a=='свыше 100.000 руб.') { document.write("selected"); } document.write(">свыше 100.000 руб.</option>");
document.write("</select>");
document.write("</div>");
document.write("<div class=\"m10\">");
document.write("<span class=\"m12\">Тип изделия</span><br/>");
document.write("<select name=\"tip\" class=\"m11\">");
document.write("<option "); if (b=='Не важно') { document.write("selected"); } document.write(">Не важно</option>");
document.write("<option "); if (b=='Браслеты') { document.write("selected"); } document.write(">Браслеты</option>");
document.write("<option "); if (b=='Броши') { document.write("selected"); } document.write(">Броши</option>");
document.write("<option "); if (b=='Запонки') { document.write("selected"); } document.write(">Запонки</option>");
document.write("<option "); if (b=='Колье') { document.write("selected"); } document.write(">Колье</option>");
document.write("<option "); if (b=='Кольца') { document.write("selected"); } document.write(">Кольца</option>");
document.write("<option "); if (b=='Ожерелье') { document.write("selected"); } document.write(">Ожерелье</option>");
document.write("<option "); if (b=='Пирсинг') { document.write("selected"); } document.write(">Пирсинг</option>");
document.write("<option "); if (b=='Подвески') { document.write("selected"); } document.write(">Подвески</option>");
document.write("<option "); if (b=='Серьги') { document.write("selected"); } document.write(">Серьги</option>");
document.write("<option "); if (b=='Сувениры') { document.write("selected"); } document.write(">Сувениры</option>");
document.write("<option "); if (b=='Цепочки') { document.write("selected"); } document.write(">Цепочки</option>");
document.write("<option "); if (b=='Часы') { document.write("selected"); } document.write(">Часы</option>");
document.write("</select>");
document.write("</div>");
document.write("<div class=\"m10\">");
document.write("<span class=\"m12\">Металл</span><br/>");
document.write("<select name=\"metall\" class=\"m11\">");
document.write("<option "); if (c=='Не важно') { document.write("selected"); } document.write(">Не важно</option>");
document.write("<option "); if (c=='золото') { document.write("selected"); } document.write(">золото</option>");
document.write("<option "); if (c=='платина') { document.write("selected"); } document.write(">платина</option>");
document.write("<option "); if (c=='серебро') { document.write("selected"); } document.write(">серебро</option>");
document.write("<option "); if (c=='палладий') { document.write("selected"); } document.write(">палладий</option>");
document.write("<option "); if (c=='белое золото') { document.write("selected"); } document.write(">белое золото</option>");
document.write("</select>");
document.write("</div>");
document.write("<div class=\"m10\">");
document.write("<span class=\"m12\">Вставка</span><br/>");
document.write("<select name=\"vstavka\" class=\"m11\">");
document.write("<option "); if (d=='Не важно') { document.write("selected"); } document.write(">Не важно</option>");
document.write("<option "); if (d=='агат') { document.write("selected"); } document.write(">агат</option>");
document.write("<option "); if (d=='аметист') { document.write("selected"); } document.write(">аметист</option>");
document.write("<option "); if (d=='бриллиант') { document.write("selected"); } document.write(">бриллиант</option>");
document.write("<option "); if (d=='гранат') { document.write("selected"); } document.write(">гранат</option>");
document.write("<option "); if (d=='жемчуг') { document.write("selected"); } document.write(">жемчуг</option>");
document.write("<option "); if (d=='изумруд') { document.write("selected"); } document.write(">изумруд</option>");
document.write("<option "); if (d=='лазурит') { document.write("selected"); } document.write(">лазурит</option>");
document.write("<option "); if (d=='оникс') { document.write("selected"); } document.write(">оникс</option>");
document.write("<option "); if (d=='опал') { document.write("selected"); } document.write(">опал</option>");
document.write("<option "); if (d=='раухтопаз') { document.write("selected"); } document.write(">раухтопаз</option>");
document.write("<option "); if (d=='рубин') { document.write("selected"); } document.write(">рубин</option>");
document.write("<option "); if (d=='сапфир') { document.write("selected"); } document.write(">сапфир</option>");
document.write("<option "); if (d=='топаз') { document.write("selected"); } document.write(">топаз</option>");
document.write("<option "); if (d=='турмалин') { document.write("selected"); } document.write(">турмалин</option>");
document.write("<option "); if (d=='фианит') { document.write("selected"); } document.write(">фианит</option>");
document.write("<option "); if (d=='хризолит') { document.write("selected"); } document.write(">хризолит</option>");
document.write("<option "); if (d=='циркон') { document.write("selected"); } document.write(">циркон</option>");
document.write("<option "); if (d=='цитрин') { document.write("selected"); } document.write(">цитрин</option>");
document.write("</select>");
document.write("</div>");
document.write("<div class=\"m10\">");
document.write("<span class=\"m12\">В комлекте</span><br/>");
document.write("<select name=\"a\" class=\"m11\">");
document.write("<option "); if (e=='Не важно') { document.write("selected"); } document.write(">Не важно</option>");
document.write("<option "); if (e=='В комплекте') { document.write("selected"); } document.write(">В комплекте</option>");
document.write("</select>");
document.write("</div>");
document.write("<div class=\"m13\"><input type=\"image\" src=\"/images/search.gif\" class=\"m14\"></div>");
document.write("</td>");
document.write("<td class=\"m15\"></td>");
document.write("</tr>");
document.write("</table>");
document.write("</form>");
}



function  IncliudeFooter() {
document.write("<!--LiveInternet counter-->");
document.write("<a href='http://www.liveinternet.ru/click' "+
"target=_blank><img src='//counter.yadro.ru/hit?t11.10;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: показано число просмотров за 24"+
" часа, посетителей за 24 часа и за сегодня' "+
"border='0' width='88' height='31'><\/a>")
document.write("<!--/LiveInternet-->");
document.write("&nbsp;");

document.write("<!--Rating@Mail.ru counter-->");
d=document;var a='';a+=';r='+escape(d.referrer);js=10; 
a+=';j='+navigator.javaEnabled();js=11;
s=screen;a+=';s='+s.width+'*'+s.height;
a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth);js=12;
js=13;
d.write('<a href="http://top.mail.ru/jump?from=1806210" target="_top">'+
'<img src="http://df.c8.bb.a1.top.mail.ru/counter?id=1806210;t=57;js='+js+
a+';rand='+Math.random()+'" alt="Рейтинг@Mail.ru" border="0" '+
'height="31" width="88"><\/a>');if(11<js)d.write('<'+'!-- ');
document.write("<noscript><a target=\"_top\" href=\"http://top.mail.ru/jump?from=1806210\"><img src=\"http://df.c8.bb.a1.top.mail.ru/counter?js=na;id=1806210;t=57\" height=\"31\" width=\"88\" border=\"0\" alt=\"Рейтинг@Mail.ru\"></a></noscript>");
if(11<js)d.write('--'+'>');
document.write("<!--// Rating@Mail.ru counter-->");

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16601582-4']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


document.write("<!-- Yandex.Metrika counter -->");
document.write("<div style=\"display:none;\">");
(function(w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter7629469 = new Ya.Metrika({id:7629469, enableAll: true});
        }
        catch(e) { }
    });
})(window, 'yandex_metrika_callbacks');
document.write("</div>");
document.write("<script src=\"//mc.yandex.ru/metrika/watch.js\" type=\"text/javascript\" defer=\"defer\"></script>");
document.write("<noscript><div><img src=\"//mc.yandex.ru/watch/7629469\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>");
document.write("<!-- /Yandex.Metrika counter -->");
}


function ajaxTop()
{ 
if (document.getElementById('phone').value=='') { document.getElementById('phone').value=' '; } 
	var ErrorText = "";
	var Fields = new Array();
		Fields["fio"]    = "Ваше имя";
		Fields["email"]   = "E-mail";
		Fields["phone"]   = "Номер телефона";
		Fields["message"]   = "Вопрос";
	var BackForm = document.getElementById("formOrder");
	var Elements = BackForm.elements;
	for(var i=0; i < 4; 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 ajaxOrder()
{ 
	var ErrorText = "";
	var Fields = new Array();
		Fields["fio"]    = "Ваше имя";
		Fields["phone"]   = "Номер телефона";
		Fields["article"]   = "Артикул изделия";
	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(); }
}
