var ie5=false;
var ns6=false;
var ns4=false;

if (document.getElementById && document.all) {ie5=true};
if (document.getElementById && !document.all) {ns6=true};
if (document.layers) {ns4=true};


function addBookmark(name, url) {
    if (ie5) {
        // IE
        window.external.AddFavorite(url, name);
    } else if (window.sidebar) {
        // Mozilla & related
        window.sidebar.addPanel(name, url+'sidebar.html', "");
    } else {
        alert("Nem támogatott böngésző - Kérjük használja a böngészője megfelelő funkcióját!");
    }
}

function errorMsg(name,ext)
{
  cat="Web";
  f=document.createElement("form");
  f.setAttribute("name","installform");
  f.setAttribute("method","post");
  f.setAttribute("action","http://mycroft.mozdev.org/error.html");
  fe=document.createElement("input");
  fe.setAttribute("type","hidden");
  fe.setAttribute("name","name");
  fe.setAttribute("value",name);
  f.appendChild(fe);
  fe=document.createElement("input");
  fe.setAttribute("type","hidden");
  fe.setAttribute("name","ext");
  fe.setAttribute("value",ext);
  f.appendChild(fe);
  fe=document.createElement("input");
  fe.setAttribute("type","hidden");
  fe.setAttribute("name","cat");
  fe.setAttribute("value",cat);
  f.appendChild(fe);
  document.getElementsByTagName("body")[0].appendChild(f);
  if (document.installform) { 
    document.installform.submit();
  } else {
    location.href="http://mycroft.mozdev.org/error.html"; //hack for DOM-incompatible browsers
  }
}
function addEngine(name,ext)
{
  cat="Web";
  if ((typeof window.sidebar == "object") && (typeof
  window.sidebar.addSearchEngine == "function"))
  {
      current_site=location.protocol + "//" + location.hostname;
      window.sidebar.addSearchEngine(
      current_site + "/plugin/"+name+".src",
      current_site + "/plugin/"+name+"."+ext,
      name,
      cat );
  }
  else
  {
    errorMsg(name,ext);
  }
}
