  function bookmark()
  {
    var title = "Новости Санкт-Петербурга";
    var url = "http://www.mr7.ru/";

    if (window.sidebar) {
      window.sidebar.addPanel(title, url, "");
        } else if(window.opera && window.print) {
          var elem = document.createElement('a');
          elem.setAttribute('href',url);
          elem.setAttribute('title',title);
          elem.setAttribute('rel','sidebar');
          elem.click();
        }else if(document.all) {
          window.external.AddFavorite(url, title);
           }else {
              alert("Попробуйте добавить в избранное вручную ");
           }

      return false;
  }


// Всплывающее окно
//title - заголовок 
//width - ширина 
//height - высота 
//content - контент 
function open_window(title, width, height, content) 
{ 
    ScrWindow=window.open("","","toolbar=no,location=no,left=0,top=0,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width="+width+",height="+height+""); 
    if (ScrWindow != null && ScrWindow.opener == null) ScrWindow.opener=window; 
    ScrWindow.document.open(); 
    ScrWindow.document.writeln ("<html><head><title>"+title+"</title></head><body>"+content+"</body></html>"); 
    ScrWindow.document.close(); 
} 

function textChange()
{
var count=1000;
 a=document.formText.f_Comment.value.length;
 if((a)>count)document.formText.f_Comment.value=document.formText.f_Comment.value.substring(0,count);
 a=document.formText.f_Comment.value.length;
 document.formText.t.value=count-a;
}


function checkform(f) {
  var errMSG = ""; 
  // цикл ниже перебирает все элементы в объекте f, 
  // переданном в качестве параметра
  // функции, в данном случае - наша форма.            
  for (var i = 0; i<f.elements.length; i++) 
    // если текущий элемент имеет атрибут required
    // т.е. обязательный для заполнения
    if (null!=f.elements[i].getAttribute("required")) 
       // проверяем, заполнен ли он в форме
        if (isEmpty(f.elements[i].value)) // пустой
            errMSG += "  " + f.elements[i].name + "\n"; // формируем сообщение
                                                       // об ошибке, перечисляя 
                                                       // незаполненные поля
        // если сообщение об ошибке не пусто,
        // выводим его, и возвращаем false     
        if ("" != errMSG) {
//            alert("Не заполнены обязательные поля:\n" + errMSG);
            alert("Не заполнены обязательные поля!\n");
            return false;
        }
}

function isEmpty(str) {
   for (var i = 0; i < str.length; i++)
      if (" " != str.charAt(i))
          return false;
      return true;
}

