function change_artwork(filename, year, work)
{
  document.getElementById('loading').style.display='inline';
  
  document.getElementById('op1').style.display = 'none';
 
  document.getElementById('artwork-image').src = filename;
  
  set_image_width(filename);
  set_image_height(filename);
  
 
  
  
  
  /* AJAX THE ARTWORK TITLE ETC */
  
  
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function() {
      if (xmlHttp.readyState==4) {
      document.getElementById('artwork-details').innerHTML=xmlHttp.responseText;
      document.getElementById('loading').style.display='none';
     
        }
      }
    xmlHttp.open("GET","/artwork/get_artwork_details.php?year="+year+"&work="+work,true);
    xmlHttp.send(null);
  
  
    
  

  
  
  

}



function set_image_width(filename)
{
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function() {
      if (xmlHttp.readyState==4) {
      document.getElementById('artwork-image').width=xmlHttp.responseText;
        }
      }
   xmlHttp.open("GET","/artwork/get_artwork_width.php?filename="+filename,true);
   xmlHttp.send(null);
}




function set_image_height(filename)
{
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function() {
      if (xmlHttp.readyState==4) {
      document.getElementById('artwork-image').height=xmlHttp.responseText;
        }
      }
   xmlHttp.open("GET","/artwork/get_artwork_height.php?filename="+filename,true);
   xmlHttp.send(null);
}











var t;
var wait = 50;
var move = 10;
  function up()
    {
      
    
    
      var existing = document.getElementById('cv').scrollTop;
      if (existing < move)
        document.getElementById('cv').scrollTop = 0;
      else
      { 
        document.getElementById('cv').scrollTop = existing - move;
         t=setTimeout("up()",wait); 
      }
    }
    function down()
    {
      
    
      var existing = document.getElementById('cv').scrollTop;
      
      if (existing < (document.getElementById('cv').scrollHeight-move))
      {
        document.getElementById('cv').scrollTop = existing + move;
         t=setTimeout("down()",wait); 
      }
    }
    
    function stop_scroll()
    {
    document.getElementById('up_arrow').src = '/images/up_arrow.png';
    document.getElementById('down_arrow').src = '/images/down_arrow.png';
      clearTimeout(t);
    }
    
    
    
    
    
    
    
    
    
    
function toggle_panel(event)
{
  if (event.target.id == 'main')
  {
    if (document.getElementById('panel').style.display == 'none')  {
      document.getElementById('panel').style.display='inline';
    } else {
      document.getElementById('panel').style.display='none';
    }
  }
}

