function UIClass(absRoot, jSessionId) 
{
  var _UI = this;
  
  this.absRoot = absRoot;
  this.jSessionId = jSessionId;

  this.isCookiesEnabled = function ()
  {
    return (document.cookie != '');
  }
  
  this.addJSessionId = function()
  {
    if (! _UI.isCookiesEnabled())
    {
      return ';jsessionid=' + _UI.jSessionId;
    }
    else
    {
      return '';
    }     
  }
  
  this.displayLoading = function()
  {  
    Element.show("loading");
  }

  this.hideLoading = function ()
  {
    if(Ajax.activeRequestCount == 0)
    {
      Element.hide("loading");
    }
  }
  
  this.registerAjaxResponders = function()
  {
	Ajax.Responders.register
	(
	  {
	    onCreate:_UI.displayLoading,
	    onComplete:_UI.hideLoading
	  }
	);
  }
  
  this.failureAjaxUpdater = function(error)
  {
    alert('Error ' + error.status + ' - ' + error.statusText);
  }

  this.popupImage = function(imgURL, popupPage) 
  { 
    window.open(_UI.absRoot + '/' + popupPage + "?"+imgURL,"","location=0, menubar=0, resizable=1, scrollbars=0, status=0, titlebar=0, toolbar=0, height=200, width=200, left=25, top=25");
  }
  
  this.setIdFocus = function(id) 
  {
    document.getElementById(id).focus();
  }
  
  this.checkCR = function(evt) 
  {
    var evt  = (evt) ? evt : ((event) ? event : null);    
    if (evt.keyCode == 13) 
    {
      var srcObject = evt.target || evt.srcElement;
      if (srcObject.name == 'amountProduct')
      {
        srcObject.onchange(srcObject);
      }        
      return false;
    }
  }
   
  _UI.registerAjaxResponders();
}
