//Установка кукеса
function setCookie (name, value) {
  var expDate=new Date();
  expDate.setTime(expDate.getTime()+2592000000); //на месяц
  document.cookie=name+"="+escape(value)+"; expires="+expDate.toGMTString()+"; path=/";
}

var highlight = true;
function ChShow(formobj) {
  var sp = document.getElementsByTagName('SPAN');

  if (highlight==true) {
    for (var i=0; i<sp.length; i++)
      if (sp[i].className=='R')
        sp[i].className='B';

    document.getElementById('SHCH').src='/img/ch1.gif';
    setCookie('h', 0);
    highlight=false;
  } else {
    for (var i=0; i<sp.length; i++)
      if (sp[i].className=='B')
        sp[i].className='R';

    document.getElementById('SHCH').src='/img/ch0.gif';
    setCookie('h', 1);
    highlight=true;
  }

  document.SForm.s.focus();
  return false;
}


//Прячет/показывает окно с логином
function SLogin(type) {
  if (document.getElementById('LoginLayer'))
    if (type==0)
      document.getElementById('LoginLayer').style.display = 'none';
    else
      document.getElementById('LoginLayer').style.display = '';
  return false;
}


//Проверка поиска
function Test(obj) {
  obj.s.value = obj.s.value.replace(/^\s+/, '').replace(/\s+$/, '');
  obj.s.value = obj.s.value.replace('  ', ' ');

  if (obj.s.value.length < 3) {
    alert('Строка запроса должна состоять минимум из 3-х символов!');
    obj.s.focus();
    return false;
  }

  return true;
}


function pWin(hr) {
  pw = window.open(hr, 'popw', 'menubar=no, scrollbars=yes, width=400, height=400, top='+(screen.height/2-400/2-100)+', left='+(screen.width/2-500/2));
  pw.focus();
  return false;
}

