function submitForm( $formId )
{
  $element = document.getElementById( $formId );
  $element.submit();
}

function openPopupWindow(theURL, winName, features)
{ //v2.0
  var $left = screen.width / 2 - 200;
  var $top = screen.height / 2 - 250;
  
  $pattern = /width[ ]?=[ ]?([0-9]{1,3})/;
  if ( found = features.match($pattern) )
  {
    if (found[1])
    {
      $left = parseInt( screen.width / 2 - found[1] / 2 );

    }
  }
  
  $pattern = /height=([0-9]{1,3})/;
  if ( found = features.match($pattern) )
  {
    if (found[1])
    {
      $top = parseInt( screen.height / 2 - found[1] / 2 );

    }
  }
  window.open(theURL, winName, features + ", left=" + $left + ", top=" + $top);  
}

function loadResource( $imageId, $code )
{
  $('loadData').style.display = '';
  var $pars = '';

  var $url = '/load-image/xml-http-request/'+$imageId+'/'+$code;
  
  var myAjax = new Ajax.Request(
                                  $url,
                                     {method: 'get', parameters: $pars, onComplete: showImages} );

}

function showImages( originalRequest )
{
  $('imageBasic').innerHTML = originalRequest.responseText;
  $('loadData').style.display = 'none';
}

