/**
 * Rozszerzenie funkcjonalności obiektu window o informacje dotyczące
 * rozmiaru obszaru roboczego (dokumentu)
**/

window.size = function()
{
	var iWidth = 0;
	var iHeight = 0;

	if(!window.innerWidth)
	{
		if(!(document.documentElement.clientWidth == 0))
		{
			iWidth = document.documentElement.clientWidth;
			iHeight = document.documentElement.clientHeight;
		}
		else
		{
			iWidth = document.body.clientWidth;
			iHeight = document.body.clientHeight;
		}
	}
	else
	{
		iWidth = window.innerWidth;
		iHeight = window.innerHeight;
	}
	return {width:iWidth, height:iHeight};
}

/**
 * Pobranie elemntu po identyfikatorze (alias metody)
 *
 * @param string elemId
 * @return object|null
**/

function $(elemId)
{
	return document.getElementById(elemId);
}

/**
 * Zablokowanie w elemencie zdarzenia po klawiszu ENTER
 *
 * @param string elemId
 * @return object|null
**/

function disableEnter(e)
{
     var key;
     
     if(window.event)
          key = window.event.keyCode;
     else
          key = e.which;  

     return (key != 13);
}								

/**
 * Ekran odświeżania strony "proszę czekać"
**/

function pleaseWait(customMessage)
{
	window.scroll(0,0);
	
	pwElement = document.createElement('div');

	if(customMessage != '')
	pwElement.innerHTML = '<div class="please-wait"><div class="content"><p>'+customMessage+'</p><img src="layout/Default/images/loader.gif" alt="" /></div></div>';
	else
	pwElement.innerHTML = '<div class="please-wait"><div class="content"><p>Trwa odświeżanie strony, proszę czekać.</p><img src="layout/Default/images/loader.gif" alt="" /></div></div>';

	document.body.appendChild(pwElement);
}

	

