var mykey;

//watch out for a key press
if (window.Event){
document.captureEvents(Event.KEYDOWN);
}

//call the function myKeyDown if there is a key press
document.onkeydown = myKeyDown;

function myKeyDown(e){
 if (window.Event){
 mykey = e.which;
 }
 else{
 mykey = event.keyCode
 }


 //left arrow
 if ((mykey == 37) && (navigation != "next")){document.location.href = 'd' + prevfile + '.html';}
 //right arrow
 else if ((mykey == 39) && (navigation != "previous")){document.location.href = 'd' + nextfile + '.html';}
 //H is for home
 else if (mykey == 72) {document.location.href = 'http://www.deilbh.net/';}
 //A is for about
 else if (mykey == 65) {document.location.href = 'http://www.deilbh.net/photoblog/about.html';}
 //L is for links
 else if (mykey == 76) {document.location.href = 'http://www.deilbh.net/photoblog/links.html';}
 //M is for more in the archives
 else if (mykey == 77) {document.location.href = 'http://www.deilbh.net/photoblog/archive.html';}
}

function codetitle() {
 document.write('<title>...deilbh::' + title + '...' + '</title>');
 document.write('<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.deilbh.net/rss_feed.xml" />');
}

function codenavigation() {
 if (navigation == "previous") {
  document.write('<div id="header">'); 
  document.write('<a class="nav_left" href="d' + prevfile + '.html"> &larr; </a>');
  document.write('</div>');
 } 
 else if (navigation == "next") {
  document.write('<div id="header">'); 
  document.write('<a class="nav_right" href="d' + nextfile + '.html"> &rarr; </a>');
  document.write('</div>');
 } 
 else {
  document.write('<div id="header">'); 
  document.write('<a class="nav_left" href="d' + prevfile + '.html"> &larr; </a>');
  document.write('<a class="nav_right" href="d' + nextfile + '.html"> &rarr; </a>');
  document.write('</div>');
 }
}

function codephoto() {
 document.write('<div id="photo-box">');
 if (navigation == 'previous' || navigation == 'prevnext') {
  document.write('<a href="d' + prevfile + '.html"><img src="photos/p' + currfile + '.jpg" border="0"></a>');
 }
 else {
  document.write('<img src="photos/p' + currfile + '.jpg">');
 }
 document.write('</div>');
}

function codefooter() {
 document.write('<div id="footer"><p>');
 document.write(title + '&nbsp;&#8226;&nbsp;');
 document.write(date + '&nbsp;&#8226;&nbsp;' + place);
 if (note == "") {
  document.write('<br>');
 } else {
  document.write('<br>' + note + '<br>')
 }
 document.write('<A HREF="http://www.deilbh.net/">&nbsp;home&nbsp;</A>&nbsp;&#8226;&nbsp;');
 document.write('<A HREF="about.html">&nbsp;about&nbsp;</A>&nbsp;&#8226;&nbsp;');
 document.write('<A HREF="links.html">&nbsp;links&nbsp;</A>&nbsp;&#8226;&nbsp;');
 document.write('<A HREF="archive.html">&nbsp;archive&nbsp;</A>&nbsp;&#8226;&nbsp;');
 document.write('<a href="http://www.deilbh.net/rss_feed.xml" title="xml rss feed" target="_self">rss</a><br />');
 document.write('<br /> <br />');
 document.write('</p></div>');
}

function move_in(img_name,img_src) {
 document[img_name].src=img_src;
}

function move_out(img_name,img_src) {
 document[img_name].src=img_src;
}