function addEngine(name,ext,cat,type)
{
  if ((typeof window.sidebar == "object") && (typeof
  window.sidebar.addSearchEngine == "function"))
  {
    window.sidebar.addSearchEngine(
      "http://engine.aox.pl/"+name+".src",
      "http://engine.aox.pl/"+name+"."+ext,
      name,
      cat );
  }
  else
  {
    errorMsg();
  }
}

function swatch()
{
var time = new Date();
var swatch = document.getElementById('swatch');
if (!swatch) {
  var swatch = 0;
}
//pobranie aktualnej godziny, minuty i sekundy
var time = new Date();
hours = time.getHours(); if (hours <= 9) {hours = "0"+hours;}
minuts = time.getMinutes(); if (minuts <= 9) {minuts = "0"+minuts;}
secounds = time.getSeconds(); if (secounds <= 9) {secounds = "0"+secounds;}
swatch.value = hours + ":" + minuts + ":" + secounds;
}

setInterval("swatch()",1000);

function remove(uri,msg) {
  var test;
  test=confirm(msg);
  if(test) window.open(uri,'_top');
}

function checkAll(theCheck) {
  theForm = theCheck.form;
  chk=theCheck.checked;
  name=theCheck.name;
  for (i=0;i<theForm.length;i++) {
     if (theForm.elements[i].type=='checkbox' && theForm.elements[i].name.indexOf(name)==0) {
         theForm.elements[i].checked=chk;
     }
  }
}

function myRequest(myUrl)
{
  if(window.XMLHttpRequest) {
    xmlhttp = new XMLHttpRequest(); // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera, Internet Explorer 7
  } else if(window.ActiveXObject) {
     try{
    xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); // Internet Explorer 6
     } catch(e) {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 4,5
     }
  } else {
    return false;
  }

//  xmlhttp.open("GET", myUrl, true); // Open a connection. Replace GET with HEAD in order to do a HEAD request.

//  xmlhttp.onreadystatechange=storeCategoryHandler;
//  xmlhttp.send(null); // send() is used to initiate the transfer. No actual data have to be sent in this case.
//  alert(xmlhttp.getAllResponseHeaders());
}

function storeCategoryHandler(){
  if (xmlhttp.readyState == 4 && xmlhttp.status==200){
    if (xmlhttp.responseText.indexOf('invalid') == -1) {

      var xmlDocument = xmlhttp.responseXML;
      users = xmlDocument.getElementsByTagName('users');

      for (i=0; i<users[0].childNodes.length; i++){
        user = users[0].childNodes.item(i);
        //alert(user);
        id = user.childNodes[0].firstChild.data;
        name = user.childNodes[1].firstChild.data;
        //alert(name);
      }
      user.selectedIndex = 0;
    }
  }
}


function displayWindow(url, width, height, x, y){
	window.open(url,"displayWindow",'width=' + width + ',height=' + height +', resizable=1,scrollbars=yes,menubar=no,location=no,directories=no,status=no,' );
}

function showWindow(windowName) {
  var Element = document.getElementById(windowName);
  if (Element.style.display == 'block')
  {
    Element.style.display = 'none';
  } else {
    Element.style.display = 'block';
  }
}

function showCompanyForm()
{
  var Element = document.getElementById('companyForm');
  Element.style.display = 'block';
}

function hideCompanyForm()
{
  var Element = document.getElementById('companyForm');
  Element.style.display = 'none';
}