var LOADING_STATUS_PAGE = '/shared/loading.html';
var INCLUDED_SCRIPTS = new Array();

function include(src)
{
  if(typeof(INCLUDED_SCRIPTS[src]) != 'undefined')
    return;

  script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = src;
  document.getElementsByTagName('head')[0].appendChild(script);

  INCLUDED_SCRIPTS[src] = true;
}

include('/shared/js/browser.js');
include('/shared/js/http.js');
include('/shared/js/window.js');
include('/shared/js/events.js');
include('/shared/js/forms.js');
include('/shared/js/cookie.js');
include('/shared/js/security.js');
include('/shared/js/string.js');
include('/shared/js/dom.js');
include('/shared/js/favourites.js');//remove later!
include('/shared/js/ims.js');//remove later!

if(!window.ON_LOAD_SET)
{
  ON_LOAD_SET = 0;
}

function post_load_handler()
{
  if(get_query_item(location.href, 'popup'))
    process_popup();
}

if(ON_LOAD_SET == 0) //protection from repeated common.js includes
{
  //we can't use nice add event here, because it may be not loaded yet
  var prev_window_on_load_handler = window.onload;
  window.onload = function()
  {
    if(typeof(prev_window_on_load_handler) == 'function')
      prev_window_on_load_handler();

    post_load_handler();
  }
  ON_LOAD_SET = 1;
}
