//<!--
function createXmlHttpRequestObject()
{
var xmlHttp = false;
try 
{ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) 
 {
  try 
  {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
  catch(e2) {xmlHttp = false; }
 }
 
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

return xmlHttp;
}

// БЛОК ДЛЯ ГЕНЕРАЦИИ ДАТЫ И ВРЕМЕНИ
// !!!! текущее время (переменная mydate) задается в шапке сайта !!!!
var dayarray = new Array("Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота");
var montharray = new Array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря");
var year = new String;
var month = new Number;
var daym = new String;
var day = new Number;
var hours = new String;
var minutes = new String;
var seconds = new String;
var outDate = new String;
 

function getthedate() 
 {
  mydate.setUTCMilliseconds(mydate.getUTCMilliseconds() + 1000);
  year = mydate.getUTCFullYear();
  day = mydate.getUTCDay();
  month = mydate.getUTCMonth();
  daym = mydate.getUTCDate();
  hours = mydate.getUTCHours();
  minutes = mydate.getUTCMinutes();
  seconds = mydate.getUTCSeconds();
  
  if (daym < 10) { daym ="0"+daym; }
  if (hours < 10) { hours ="0"+hours;}
  if (minutes < 10) { minutes ="0"+minutes;}
  if (seconds < 10) { seconds ="0"+seconds;}

outDate = dayarray[day] + ",  " + daym + " " + montharray[month] + "  " + year + "<br> Украина, Киев " + hours + ":" + minutes + ":" + seconds;
clock_Obj = document.getElementById("clock");
if(clock_Obj) {clock_Obj.innerHTML = outDate;}
}

function goforit() 
{
  setInterval("getthedate()", 1500);
}

// КОНЕЦ БЛОКА ДЛЯ ГЕНЕРАЦИИ ДАТЫ И ВРЕМЕНИ

// Ддя левого меню - открывает дерево рубрик-подрубрик
function opentree(id) {
var s = document.getElementById (id).style;
if (s.display == '') s.display = 'None';
else s.display = '';
return true;
}
// КОНЕЦ открывания дерева рубрик-подрубрик

// смена пиктограммки в меню
function chng_pict(id) {
var s = document.getElementById(id);
if(s)
{
 if (s.alt == 'Открыть') {s.src = cur_path + 'images/Bullet_Minus.png'; s.alt = 'Закрыть';}
 else {s.src = cur_path + 'images/Bullet_Plus.png'; s.alt = 'Открыть';}
}
return true;
}
// конец смены пиктограммки в меню



//функция формирования вывода цены
function number_format( number, decimals, dec_point, thousands_sep ) { 
 
    var i, j, kw, kd, km;
 
    // input sanitation & defaults
    if( isNaN(decimals = Math.abs(decimals)) ){
        decimals = 2;
    }
    if( dec_point == undefined ){
        dec_point = ",";
    }
    if( thousands_sep == undefined ){
        thousands_sep = ".";
    }
 
    i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
 
    if( (j = i.length) > 3 ){
        j = j % 3;
    } else{
        j = 0;
    }
 
    km = (j ? i.substr(0, j) + thousands_sep : "");
    kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
    //kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).slice(2) : "");
    kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : "");
 
    return km + kw + kd;
}

//ПОДСЧЕТ СУММЫ для корзины
function kalc_all(prod_num)
{
 Price_All = new Number(); 
 Price_i = new Number();
 Kolvo_i = new Number();
 
 for (i=0; i < prod_num; i++)
   {
    Kolvo_i = document.getElementById('Kolvo_' + i).value*1;
	if (isNaN(Kolvo_i)) {alert ('Это не число!'); document.getElementById('Kolvo_' + i).focus(); return; }
    Kolvo_i = Math.round(Kolvo_i);
    Price_i = document.getElementById('Price_' + i).value*1;
	document.getElementById('Price_All_' + i).innerHTML = number_format(Price_i*Kolvo_i, 2, '.', ' ');
    Price_All = Kolvo_i*Price_i + Price_All;	
   }

Price_All = (Math.round(100*Price_All))/100;
document.getElementById('Price_prod').innerHTML = number_format(Price_All, 2, '.', ' ');
}
//КОНЕЦ ПОДСЧЕТА СУММЫ для корзины

//ФУНКЦИЯ ПРОВЕРКИ ПОЛЕЙ обратной связи
function checkFields()
{
var Fields = new Array('name_guest','email_guest','massege');
var Masseges = new Array('Введите Ваше имя!', 'Введите ваш E-mail!','Заполните поле сообщения!');

//БЛОК проверки обычных полей
for (num_field = 0; num_field < Fields.length; num_field++)
{
if (document.all(Fields[num_field]).value =="") 
 { alert(Masseges[num_field]); document.all(Fields[num_field]).focus(); break; return false;} //при пустом значении выдает сообщение, возвращает фокус в нужное поле и выходит из цикла (чтобы не проверять каждый раз все поля)
}
//КОНЕЦ БЛОКА проверки обычных полей 
return true;
}
//КОНЕЦ ФУНКЦИИ ПРОВЕРКИ полей

//-->

