function trim(str) {return str.replace(/(^\s*)|(\s*$)/g,'')}
function vword(str, name) {if(str.match(/\W/)!=null) {alert("Недопустимые символы в поле ''"+name+"''\n\nдопускаются:\n    - латинские символы\n    - цифры\n    - нижнее подчеркивание");return false}else{return true}}
function vmail(str) {return (str.search(/[^A-Za-z0-9_@.-]/)==-1&&str.search(/@(.*)@/)==-1&&str.search(/@(.*)\./)!=-1&&str.indexOf('@')!=0&&str.lastIndexOf('.')!=str.length-1)}
function GoToPage(pageURL) { document.location=pageURL; }
function setHomepage(f, url) {
  f.style.behavior='url(#default#homepage)';
  var ohp=f.isHomePage(url);
  f.setHomePage(url);
  var nhp=f.isHomePage(url);
  return false;
}
function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  return true;
}
function look(url, winame, ww, wh, ws, wr) { popwin = self.open(url, winame, 'toolbar=no, location=no, status=no, menubar=no, scrollbars='+ws+', width='+ww+', height='+wh+', resizable='+wr); popwin.focus(); }
function fixPNG(element)
{
  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
  {
    var src;
    if (element.tagName=='IMG')
    {
      if (/\.png$/.test(element.src))
      {
        src = element.src;
        element.src = "/images/1.gif";
      }
    }
    else
    {
      src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      if (src)
      {
        src = src[1];
        element.runtimeStyle.backgroundImage="none";
      }
    }
    if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='crop')";
  }
}
