//this function includes all necessary js files for the application
function myjsinclude(file)
{

  var script  = document.createElement('script');
  script.src  = file;
  script.type = 'text/javascript';
  script.defer = true;

  document.getElementsByTagName('head').item(0).appendChild(script);

}

/* include any js files here */
//myjsinclude("/ZAdmin/j/ddmenu.js");
//myjsinclude("/ZAdmin/j/lib/prototype.js");
//myjsinclude("/ZAdmin/j/src/effects.js");
//myjsinclude("/ZAdmin/j/src/dragdrop.js");
//myjsinclude("/ZAdmin/j/src/controls.js");
//myjsinclude("/ZAdmin/j/multiselect.js");
//myjsinclude("/ZAdmin/j/lightbox/lightbox.js");


function updateElement(id, url, highlightid)
  {
    new Ajax.Updater(id, url, {onComplete:function(request){}, evalScripts:true, asynchronous:true});
  }
  
function submitAJAXForm(formid, posturl, updateid, hightlightid)
  {
    new Ajax.Updater(updateid, posturl, {onComplete:function(request){new Effect.Highlight(highlightid);}, parameters:Form.serialize(formid), evalScripts:true, asynchronous:true});
  }
  
function confirmAJAXDelete(updateid, url, highlightid)
  {
    if(confirm("Are you sure you wish to delete this record?"))
      {
        new Ajax.Updater(updateid, url, {onComplete:function(request){new Effect.Highlight(highlightid);}, evalScripts:true, asynchronous:true});
      }
  }

function confirmDelete(url)
  {
    if(confirm("Are you sure you wish to delete this record?"))
      {
        document.location = url;
      }
  }

  function addWorkToPage(workid, pagetype, pageid, otheropts)
    {
      var url = '/xml' + pagetype + '/' + pageid + '/addWork?workid=' + workid + otheropts;
      updateElement('thumbs', url, 'list-info');
    }

  function donothing()
    {
    }

  function removeFromShow(show_id, workid, otheropts)
    {
      var url = '/xmlexhibitions/' + show_id + '/removeWork?workid=' + workid + otheropts;
      updateElement('thumbs', url, 'list-info');
    }

