function init() {
 if (!document.getElementById) return false;
  var f = document.getElementById('form_newslatter');
  var u = f.elements[0];
  f.setAttribute("autocomplete", "off");
  u.focus();
}
	
function loginform_submit() {
  document.getElementById('pw_hash').value=sha1Hash(document.getElementById('loginform_password').value);
  document.getElementById('loginform').submit();
}

function element_focus(element) {
  document.getElementById(element).focus();
}

function element_show(element) {
  document.getElementById(element).style.display='block';
}

function element_hide(element) {
  document.getElementById(element).style.display='none';
}

function element_changecolor(id,color) {
  document.getElementById(id).style.color=color;
}

function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}

function changeSpanColor(id, color) {
  document.getElementById(id).style.color = color;
}

function ajax_get_request(url) {
  var xmlHttp;
  var _continue = true;

  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }

  catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        alert('Váš prehliadač nepodporuje AJAX! Použite prosím najnovší prehliadač Mozilla Firefox.');
        _continue = false;
      }
    }
  }

  if (_continue) {
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
  }
}

function ShowHide(id, img) {
	$('#'+id).slideToggle(300, function() {
		post = $('#'+id).css('display');
		$('#'+img).attr({
    src: "http://amiportal.net/images/showhide-"+post+".png"
     });
  });
}
