
function renderArtwork(source, artwork_id, size) {

  var div = $('artwork');
  div.setStyle({ display: 'block' });

  var url = '?action=render_artwork';
  var pars = 'artwork_id='+artwork_id+'&size='+size;

  var myAjax = new Ajax.Request(
    url,
    {
      method: 'post',
      postBody: pars,
      encoding: 'ISO-8859-1',
      onComplete:
      function renderArtworkResponse(resp) {
        if (source) $('artwork').style.top = source.parentNode.offsetTop + "px";
        $('artwork').innerHTML = resp.responseText;
        var left = String(890/2 - $('artwork').offsetWidth/2) + "px";
        $('artwork').style.left = left;
      }
    });
}

/*function renderArtworkResponse(resp) {
  $('artwork').innerHTML = resp.responseText;
}*/


function closeArtwork() {
  document.getElementById('art_item').style.display = 'none';
}




function renderExhibition(exhibition_id) {

  var url = '?action=render_exhibition_ajax';
  var pars = 'exhibition_id='+exhibition_id;

  var myAjax = new Ajax.Request(
    url,
    {
      method: 'post',
      postBody: pars,
      encoding: 'ISO-8859-1',
      onComplete: renderArtistResponse
    });
}

function renderArtistResponse(resp) {
  $('default_01').innerHTML = resp.responseText;
}






/* exhibition info */
function showExhibitionInfo(sourcediv, exhibition_id) {
  var pars = 'action=show_exhibition_info&exhibition_id='+exhibition_id;
  new Ajax.Request('?',
  {
    method: 'post', postBody: pars, encoding: 'ISO-8859-1',
    onComplete:
      function(resp) {
        if (resp.status == 200) {
          var div = $('exhibitionInfo');
          div.innerHTML = '';
          div.style.marginTop = sourcediv.parentNode.offsetTop - 20 + 'px';
          div.style.marginLeft = sourcediv.parentNode.offsetLeft + 75 + 'px';
          var elem = document.createElement('div');
          elem.innerHTML = resp.responseText;
          div.appendChild(elem);
          div.style.display = 'block';
        }
      }
  });
}

function hideExhibitionInfo() {
  $('exhibitionInfo').style.display = 'none';
}

