function on(nos) {if (document.images) document[nos].src = eval(nos + "on.src");}
function off(nos) {if (document.images) document[nos].src = eval(nos + "off.src");}

function doRel()
{
  var t = 'rel2', f = 'rel1';
  if (document.body.offsetWidth > 1100) {t = 'rel1'; f = 'rel2';}
  document.getElementById(f).style.display = 'none';
  document.getElementById(t).style.display = 'block';
}

function checkMail()
{
  var s = document.getElementById('eml').value;
  if (isEmail(s)) return true; else alert('E-mail address is incorrect!');
  return false;
}

function isEmail(s)
{
  var re = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
  if (String(s).search(re) == 0) return true; else return false;
}
function checkContacts(frm)
{
  for (var i=0; i<4; i++)
  {
    if (i==2) continue;
    if (frm.elements[i].value.length == 0)
    {
      alert('Please fill all required fields!');
      frm.elements[i].focus();
      return false;
    }
  }
  if (!isEmail(frm.elements[1].value))
  {
    alert('E-mail address is incorrect!');
    frm.elements[1].focus();
    return false;
  }
  frm.submit();
  /*
  http.url = frm.action;
  http.method = frm.method;
  for (var i=0; i<7; i++)
  {
    http.params[frm.elements[i].name] = frm.elements[i].value;
  }
  http.send(checkContactsU);
  */
  return false;
}
function checkContactsU()
{
  var el=document.getElementById('cf');
  var o=document.getElementById('cfs');
  el.style.display='none';
  o.style.display='';
}
function dP(i)
{
  var u = '/contacts/';
  if (i) u += 'p/' + i + '/';
  self.location.href = u;
}

function dS(s)
{
  var u = '/search/';
  if (s) u += 'q/' + s + '/';
  self.location.href = u;
}

var http = new httpa();

function httpa()
{
  this.reset = function()
  {
    this.url = '';
    this.params = {};
    this.method = 'GET';
  };

  this.reset();
};

httpa.prototype.sethttp = function()
{
  if(navigator.appName == 'Microsoft Internet Explorer')
  {
    this.obj = new ActiveXObject('Microsoft.XMLHTTP');
  }
  else
  {
    this.obj = new XMLHttpRequest();
  }
};

httpa.prototype.param = function()
{
  var cnt = arguments.length;
  if (cnt==0 || cnt%2==1)
  {
    alert('httpa error: Incorrect arguments count!');
    return;
  }
  this.params = {};
  for(i=0; i<arguments.length; i+=2) this.params[arguments[i]] = arguments[i + 1];
};

httpa.prototype.send = function(f)
{
  var s='',l=0;
	for(k in this.params) s += k + '='+escape(this.params[k])+'&';
	l = s.length;
	s = s.substr(0, l - 1);

	this.sethttp();

	var copy = this;

	this.obj.onreadystatechange = function()
	{
    if (copy.obj.readyState == 4)
    {
      if (copy.obj.status == 200)
      {
        if (f) f();
      }
      else
      {
        alert('httpa error: Loading failed!')
      }
    }
	};

	if (this.method.toUpperCase() == 'GET')
	{
    if (l) s = '?'+s;
    s = this.url+s;
    this.obj.open(this.method, s);
    this.obj.send(null);
	}
  else
  {
    this.obj.open(this.method, this.url);
    this.obj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    this.obj.send(s);
  }
};

httpa.prototype.response = function()
{
  return this.obj.responseText;
};

function doClk()
{
  var f = $('clickhere');
  window.location.href = f.href;
}