function hide_comment_form()
 {
  document.getElementById('commentform').style.display='none';
  document.getElementById('show_commentform').style.display='block';
 }
 
function show_comment_form()
 {
  document.getElementById('commentform').style.display='block';
  document.getElementById('show_commentform').style.display='none';
  location.hash='commentform';
  document.getElementById('comment_text').focus();
 }
 
function show_comments()
 {
  document.getElementById('commentcontainer').style.display='block';
  document.getElementById('commentlink').style.display='none';
  location.hash='comments';
 }

function adjustPhoto()
 {
  var margin = 60;
  if(window.innerHeight) 
   {
    var width = window.innerWidth;
   }
  else // IE
   {
    var docEl = (document.documentElement && document.all)? "documentElement" : "body";
    var width = document[docEl].clientWidth;
   }    
  var photocontentWidth = document.getElementById('photocontent').offsetWidth;
  
  if(photocontentWidth > width-margin)
   {
    newPhotoWidth = width-margin;
    newPhotoHeight = newPhotoWidth / (document.getElementById('photo').width/document.getElementById('photo').height);
    document.getElementById('photo').width = newPhotoWidth;
    document.getElementById('photo').height = newPhotoHeight;
    document.getElementById('photonav').style.width = newPhotoWidth+2+'px';
    document.getElementById('photocontent').style.width = newPhotoWidth+2+'px';
   }
 }
 
function adjustFooter()
 {
  if(document.getElementById('mainwrapper'))
   {
    var mainwrapperMargin = 50;
    var yPos = document.getElementById('mainwrapper').offsetTop;
    var contentHeight = document.getElementById('mainwrapper').offsetHeight;
    if(typeof(oldContentHeight) == 'undefined') oldContentHeight = contentHeight;
    if(window.innerHeight) 
     {
      var newContentHeight = window.innerHeight - yPos - document.getElementById('bottomwrapper').offsetHeight;
     }
    else // IE
     {
      var docEl = (document.documentElement && document.all)? "documentElement" : "body";
      var newContentHeight = document[docEl].clientHeight - yPos - document.getElementById('bottomwrapper').offsetHeight;
     }  
    if(newContentHeight>oldContentHeight)
     {
      document.getElementById('mainwrapper').style.height=newContentHeight-mainwrapperMargin+"px";
     }
    else
     {
      //document.getElementById('mainwrapper').style.height=oldContentHeight+'px';
     }
   }
 }

window.onload = adjustFooter;
window.onresize = adjustFooter;
