
  // Серверные часы, идущие на клиенте.
  var nSeconds = pServerDate.getSeconds();

  function OnShowServerClock()
  {
          pServerDate.setSeconds(nSeconds);

          if(nSeconds >= 60)
             nSeconds = 1;
          else
             nSeconds++;

          nSecond = pServerDate.getSeconds();
          nHour   = pServerDate.getHours();
          nMinute = pServerDate.getMinutes();
          nDay    = pServerDate.getDate();
          nMonth  = pServerDate.getMonth() + 1;
          nYear   = pServerDate.getFullYear();

          if(nSecond <= 9)
             nSecond = "0" + nSecond;
          if(nMinute <= 9)
             nMinute = "0" + nMinute;
          if(nHour <= 9)
             nHour   = "0" + nHour;
          if(nDay  <= 9)
             nDay    = "0" + nDay ;

          if(nMonth == 1)
             strMonth="Января";
          if(nMonth == 2)
             strMonth="Февраля";
          if(nMonth == 3)
             strMonth="Марта";
          if(nMonth == 4)
             strMonth="Апреля";
          if(nMonth == 5)
             strMonth="Мая";
          if(nMonth == 6)
             strMonth="Июня";
          if(nMonth == 7)
             strMonth="Июля";
          if(nMonth == 8)
             strMonth="Августа";
          if(nMonth == 9)
             strMonth="Сентября";
          if(nMonth == 10)
             strMonth="Октября";
          if(nMonth == 11)
             strMonth="Ноября";
          if(nMonth == 12)
             strMonth="Декабря";

          setTimeout("OnShowServerClock()", 1000);

          document.getElementById("l_Clock").innerHTML = "<b>" + nDay + " " + strMonth + " " + nYear + " года</b>, "+ nHour + ":" + nMinute;
  }

  // Активировать ярлычок, по оторму кликнули.
  function OnSetShortCut(strCellName)
  {
          if(strCellName=="")
             OnRemoveAllShortCuts();
          else
          {
                    pObjectStyle = document.getElementById(strCellName).style;

                    pObjectStyle.backgroundColor='#FF9933';
                    pObjectStyle.backgroundImage='url(images/i_bgShortCut.gif)';
                    pObjectStyle.color='#FFFFFF';
                    pObjectStyle.fontWeight='bold';
          }
  }

  // Снять все ярлычки. Громоздко. Странно работает если в цикле.
  function OnRemoveAllShortCuts()
  {
          pObjectStyle = document.getElementById("l_Main").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';

          pObjectStyle = document.getElementById("l_Tenders").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';

          pObjectStyle = document.getElementById("l_Info").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';

          pObjectStyle = document.getElementById("l_Contacts").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';

        /*  pObjectStyle = document.getElementById("l_Advert").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';               */

          pObjectStyle = document.getElementById("l_Wishes").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';

          pObjectStyle = document.getElementById("l_Members").style;
          pObjectStyle.backgroundColor='#FFFFFF';
          pObjectStyle.backgroundImage='none';
          pObjectStyle.color='#000000';
          pObjectStyle.fontWeight='normal';
  }

 // Проверить форму поиска на пустые значения.
 function OnCheckKeyWord()
 {
         if(document.frm_Search.keyword.value.replace(/(^\s*)|(\s*$)/,"")=="")
            alert("Укажите ключевое слово для поиска.");
         else if(document.frm_Search.keyword.value.length < 3)
              alert("Cлишком короткий запрос для поиска.");
         else
            document.frm_Search.submit();
 }

 // Проверить форму входа в систему на пустые значения.
 function OnCheckLoginForm()
 {
         if(document.frm_Login.username.value.replace(/(^\s*)|(\s*$)/,"")=="")
            alert("Для входа в систему вы должны указать своё имя пользователя.");
         else if(document.frm_Login.password.value.replace(/(^\s*)|(\s*$)/,"")=="")
            alert("Для входа в систему вы должны указать свой пароль.");
         else
            document.frm_Login.submit();
 }

 // Открытие новости или анонса в новом окне.
 function OnLoadText(strPath)
 {
         var m_nX=160;
         var m_nY=300;
         var pWindow = window.open(strPath, "text", "toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=auto, width=410, height=490, top="+m_nX+", left="+m_nY);
         pWindow.focus();
 }

 // Функция для проверки строк на пустоту.
 function IsEmpty(strString)
 {
        if(strString.replace(/(^\s*)|(\s*$)/,"")=="")
           return true;
        else
           return false;
 }

function OnValidateFeedbackForm()
{
        pForm = document.letter;

        if(pForm.name.value=="")
        {
                alert("Пожалуйста, укажите Ваше имя!");
                return;
        }
        if(pForm.email.value=="")
        {
                alert("Пожалуйста, укажите Ваш обратный адрес электронной почты!");
                return;
        }
        if(pForm.email.value.indexOf('@')==-1 || pForm.email.value.indexOf('.')==-1)
        {
                alert("Извините, но Ваш адрес электронной почты написан неверно.");
                return;
        }
        if(pForm.message.value=="")
        {
                alert("Пожалуйста, напишите Ваше сообщение!");
                return;
        }
        if(pForm.message.value.length>10000)
        {
                alert("Извините, но Ваше сообщение слишком длинное!");
                return;
        }

        pForm.go.disabled=true;
        pForm.submit();
}
