function changeWebcam(idx)
{
  if(idx==1)
  {
    document.getElementById("webcam-img").src = "http://www.holidayinfo.sk/camera.cgi?c=166079&amp;size=0";
  }
  else if(idx==2)
  {
    document.getElementById("webcam-img").src = "http://www.holidayinfo.sk/camera.cgi?c=687890&amp;size=0";
  }
}

function centerElement(elem,parentElem,xx,yy)
{
  if(parentElem === undefined)
  {
    var pageWidth = f_clientWidth();
    var pageHeight = f_clientHeight();
  }
  else
  {
    var pageWidth = parentElem.offsetWidth;
    var pageHeight = parentElem.offsetHeight;
  }
  if(xx === undefined) xx = true;
  if(yy === undefined) yy = true;
  var elemWidth = elem.offsetWidth;
  var elemHeight = elem.offsetHeight;
  var top = (pageHeight/2) - (elemHeight/2);
  var left = (pageWidth/2) - (elemWidth/2);
  if(top<0) top = 0;
  if(left<0) left = 0; 
  if(yy==true) elem.style.top = top + "px";   
  if(xx==true) elem.style.left = left + "px";
}

function setOpacity(obj, op)
{
  obj.style.opacity=op/100;                      
  obj.style.MozOpacity=op/100;                   
  obj.style.filter='alpha(opacity='+op+')'; 
}

function f_clientWidth() {
	//return f_filterResults (
	//	window.innerWidth ? window.innerWidth : 0,
	//	document.documentElement ? document.documentElement.clientWidth : 0,
	//	document.body ? document.body.clientWidth : 0
	//);
return window.innerWidth != null? window.innerWidth :
document.documentElement && document.documentElement.clientWidth ?
document.documentElement.clientWidth : document.body != null ?
document.body.clientWidth : null;
}

function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		0//document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function f_docHeight()
{
  var body = document.body,
      html = document.documentElement;

  return Math.max( body.scrollHeight, body.offsetHeight, 
                   html.clientHeight, html.scrollHeight, html.offsetHeight );
}

function getXHTTP() {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsersu
      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
 		 // This block handles Mozilla/Firefox browsers...
	    try {
	      xhttp = new XMLHttpRequest();
	    } catch (e3) {
	      xhttp = false;
	    }
      }
    }
  return xhttp; // Return the XMLHTTP object
}

var http = getXHTTP();
