function wo(href,width,height)
{
	window.open(href,null,"height="+(height+50)+",width="+(width+40)+",status=no,toolbar=no,scrollbars=yes,resiable=1,menubar=no,left="+Math.floor((screen.width-width)/2)+",top="+Math.floor((screen.height-height)/2));
}

function wo2(href,width,height)
{
	window.open(href,1,"height="+(height+50)+",width="+(width+40)+",status=no,toolbar=no,scrollbars=yes,resiable=1,menubar=no,left="+Math.floor((screen.width-width)/2)+",top="+Math.floor((screen.height-height)/2));
}

function ays(address){
  if(confirm("Jste si jistý?")){
    window.location.href=address;
  }
}

function mail_link(uid,domain,text,home_url){
  var zavinac = "@"
  var link
  text=text.replace("_at_","<img src='"+home_url+"pics/zavinac.gif' alt='zavinac' />")
  link = "<a class='small' href='mailto:"+uid+""+zavinac+""+domain+"'>"+text+"</a>"
  document.write(link)
  
}

function showhide(elementid) 
{
  if(document.getElementById(elementid).style.display=='block')
    document.getElementById(elementid).style.display = 'none';
  else
    document.getElementById(elementid).style.display = 'block';
}

function show(elementid) 
{
    document.getElementById(elementid).style.display = 'block';
}

function hide(elementid) 
{
    document.getElementById(elementid).style.display = 'none';
}

function submitOnEnter(e,elementid){
var keynum
if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
	if(keynum==13){
		document.getElementById(elementid).submit();
	}
}

function checkall(id) {
var el = document.getElementById(id);
	for (var i = 0; i < el.elements.length; i++) {
	  el.elements[i].checked=true;
	}
}
function uncheckall(id) {
var el = document.getElementById(id);
	for (var i = 0; i < el.elements.length; i++) {
	  el.elements[i].checked=false;
	}
}

function ScreenRes(home_url){
  if (window.location.search == "") {
    makeRequest(home_url+"screen.php?width=" + screen.width + "&height=" + screen.height);
  }

}

var http_request = false;
function makeRequest(link) {
  if (window.XMLHttpRequest) { // Mozilla, Safari, IE7...
      http_request = new XMLHttpRequest();
  } else if (window.ActiveXObject) { // IE6 and older
      http_request = new ActiveXObject("Microsoft.XMLHTTP");
  }
  http_request.onreadystatechange = alertContents;
  //alert(link);
  http_request.open("GET", link, true);
  http_request.send(null);
} 

function alertContents() {
  if (http_request.readyState == 4) {
     if (http_request.status == 200) {
        result = http_request.responseText;
        //alert('Screen: '+result);
     } else {
        //alert('There was a problem with the request.');
     }
  }
}
