// всякая хрень, которую прибить жалко
function popupIcon( icon ) { alert( "Подсказка:\n\n" + icon.alt, "") ; }
function undef(param) { return param; }
function sign(x) { if (x > 0) return 1; if (x < 0) return -1; return 0; }

// окно для edit1click
function NewWindow(mypage,myname,w,h,scroll,resize)
{
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+resize;
win=window.open(mypage,myname,settings);
}

// проверка на то, what -- это email адрес. Для подписки например.
function is_email( what )
{
  if (what.match(/^[a-z0-9\._\-]+@[a-z0-9\._\-]+\.[a-z]+$/i, "")) return true;
  return false;
}


// для викиедита стандартная функция
function weSave()
{
  if (confirm("Really save?"))
   document.forms[0]._event[0].click();
}


// для даблклика
var isDOM=document.getElementById;
var isIE=document.all && document.all.item;
var isMZ=isDOM && (navigator.appName=="Netscape");
var isO=window.opera && isDOM;
function doubleclickBind(frame,location)
{
  doubleclickBind.loc      = location;
  doubleclickBind.frame    = frame;
  if(isIE || isO)
  {
    document.ondblclick=function()
    {
      op = event.srcElement;
      while (op!=null && op.className!=doubleclickBind.frame && op.tagName!="BODY")
      {
        op=op.parentElement;
      }
      if (op.className==doubleclickBind.frame) 
      {
        document.location=doubleclickBind.loc.replace(/^\/\//, "/") ;
      }
      return true;
    }
  }
  else 
  if (isMZ) 
    document.addEventListener("dblclick", doubleclickHandle, true);
}
function doubleclickHandle(event) 
{
     op = event.target;
     while (op!=null && op.className!=doubleclickBind.frame && op.tagName!="BODY")
       op=op.parentNode;
     if (op!=null && op.className==doubleclickBind.frame) {
      document.location=doubleclickBind.loc;
     }
}

