Utilities = {};

Utilities.getElement = function(i)
{
  return document.getElementById(i);
}

Utilities.DivLathato = function(i)
{
  
  Utilities.getElement(i).style.visibility="visible";
}

Utilities.DivNemLathato = function(i)
{
  
  Utilities.getElement(i).style.visibility="hidden";
}

Utilities.BeKapcsolas = function(o)
{
  Utilities.getElement(o).disabled=false;
}

Utilities.KiKapcsolas = function(o)
{
  Utilities.getElement(o).disabled=true;
}

Utilities.Atlatszosag = function(atl, o)
{
	var object = Utilities.getElement(o).style;
	object.opacity = (atl / 100);
	object.MozOpacity = (atl / 100);
	object.KhtmlOpacity = (atl / 100);
	object.filter = "alpha(opacity=" + atl + ")";
}

Utilities.OpenWin = function(url, ablaknev, width, height)
{
	var l = Math.round((screen.availWidth - width) / 2);
	var t = Math.round((screen.availHeight - height) / 2);
  var prop = "";
	prop += "dependent=yes,";
  prop += "directories=no,";
  prop += "location=no,";
  prop += "menubar=no,";
  prop += "resizable=no,";
  prop += "scrollbars=no,";
  prop += "status=no,";
  prop += "toolbar=no,";
  prop += "height="+height+",";
  prop += "width="+width+",";
	prop += "left="+l+",";
	prop += "top="+t+",";
	prop += "screenX="+l+",";
	prop += "screenY="+t;

  ablak = window.open(url,ablaknev,prop);
  ablak.focus();
}

Utilities.OpenWinResiz = function(url, ablaknev, width, height)
{
	var l = Math.round((screen.availWidth - width) / 2);
	var t = Math.round((screen.availHeight - height) / 2);
  var prop = "";
	prop += "dependent=yes,";
  prop += "directories=no,";
  prop += "location=no,";
  prop += "menubar=no,";
  prop += "resizable=yes,";
  prop += "scrollbars=yes,";
  prop += "status=no,";
  prop += "toolbar=no,";
  prop += "height="+height+",";
  prop += "width="+width+",";
	prop += "left="+l+",";
	prop += "top="+t+",";
	prop += "screenX="+l+",";
	prop += "screenY="+t;

  ablak = window.open(url,ablaknev,prop);
  ablak.focus();
}

Utilities.LoadingCenter = function()
{
	Utilities.getElement("loading").style.top = Utilities.CenterHeight("loading",0)+'px';
	Utilities.getElement("loading").style.left = Utilities.CenterWidth("loading",0)+'px';
}

Utilities.CenterWidth = function(obj, eltolas)
{
	var w;
	if (window.innerWidth)
	  {
	    w = window.innerWidth;
	  }
	  else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ))
	  	{
		    w = document.documentElement.clientWidth;
		  }
		  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ))
		    {
		      w = document.body.clientWidth;
		    }
	return Math.round((w - Utilities.getElement(obj).offsetWidth) / 2 - eltolas);
}

Utilities.CenterHeight = function(obj, eltolas)
{
	var h;
	if (window.innerWidth)
	  {
		  h = window.innerHeight;
		  felso = self.pageYOffset;
	  }
	  else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ))
	  	{
		    h = document.documentElement.clientHeight;
		    felso = document.documentElement.scrollTop;
		  }
		  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ))
		    {
		      h = document.body.clientHeight;
		      felso = document.body.scrollTop;
		    }
	return Math.round((h - Utilities.getElement(obj).offsetHeight) / 2 - eltolas)+felso;
}

Utilities.FelsoPozicio = function()
{
if (navigator.appName == "Microsoft Internet Explorer")
	{
	  return document.body.scrollTop;
	}
	else
	{
	  return self.pageYOffset;
	}
}
