/**
 * Application booter
 * 
 * @author DG [Den Golotyuk]
 */

/**
 * Init page
 */

function initPage()
{
	try
	{
	  onBodyLoad();
	}
	catch ( e )
	{
	}
}

/**
 * Element getter
 * 
 * @param {String} elementId
 */
function $( elementId )
{
    if ( el = document.getElementById(elementId) )
    {
	    el.hide = function()
	    {
	      this.style.display = 'none';
	    };
	    
	    el.show = function()
	    {
	      this.style.display = 'block';
	    };
	    
	    return el;
    }
    
    return null;
}

/**
 * Redirect to URL
 * 
 * @param {String} URL
 */
function redirectTo( URL )
{
  document.location = URL;
}

/**
 * Retrieve I18N formatted URL
 */
function getI18NURL( URL )
{
  if ( URL.indexOf('/') == 0 )
  {
    URL = url_language_prefix + URL;
  }

  return URL;
}

/**
 * Popup window
 */
function popup(url, name, options)
{
    url = ( url.indexOf('?') > 0 ) ? url + '&' : url + '?';
    url += 'language=' + environment_language

    open(url, name, options);
}
