// Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005
// by Stephen Chapman, Felgall Pty Ltd

// permission is granted to use this javascript provided that the below code is not altered
var DH = 0;var an = 0;var al = 0;var ai = 0;
if (document.getElementById) 
{
  ai = 1; DH = 1;
}
else {
  if (document.all) {
    al = 1; DH = 1;
  } 
  else { 
    browserVersion = parseInt(navigator.appVersion); 
    if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
      an = 1; DH = 1;
    }
  }
} 

function fd(oi, wS) 
{
  if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); 
  if (al) return wS ? document.all[oi].style: document.all[oi]; 
  if (an) return document.layers[oi];
}

function pw() 
{
  return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;
}

function mouseX(evt) {
  if (evt.pageX) 
    return evt.pageX; 
  else if (evt.clientX)
    return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
  else return null;
}

function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}

function popUp(evt,oi) { if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/6); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}

function contact_aj() {
  parta='ma';
  partb='to';
  part1='ajp';
  part2='\@';
  part3='andrewjonesphotography';
  part4='.';
  part5='com';
  parent.location=parta+'il'+partb+':'+part1+part2+part3+part4+part5;
}

function dofaThumbnail(div_id, text, this_height, this_width, cell_width, type, link)
{
  
  var thumbnailId = document.getElementById(div_id);
  var type_info=''
  if (type == 'out') {
    type_info='height=' + this_height + ' width=' + this_width; 
  }
  thumbnailId.innerHTML = '<a href="' + link + '"><center><img border=0 '+ type_info +' align=center src="' + text + '"></center></a>';
}


function doThumbnail(div_id, text, type)
{
  var thumbnailId = document.getElementById(div_id);
  var theClass=' class=d';
  var theAlign=' align=center';
  var theColour='#c0c0c0'
  if ( type == 'over' ) {
    theClass=' class=dover';
    theColour='white';
  }
  else if ( type == 'lover' ) {
    theClass=' class=dover';
    theAlign=' align=left';
    theColour='white';
  }
  else if ( type == 'lout' ) {
    theAlign=' align=left';
    theColour='#c0c0c0';
  }

  thumbnailId.innerHTML = '<p' + theAlign + theClass + '>' + text + '</p>';

  var theImageId = div_id + '_image';
  var theImage = document.getElementById(theImageId);
  if (theImage != null) {
    theImage.bgColor=theColour;
  }
}


function doButton(div_id, type)
{
  var thumbnailId = document.getElementById(div_id);  
  
  if ( type == 'lover' ) {
    theImg='button_submit_over.gif';
  }
  else if ( type == 'lout' ) {
    theImg='button_submit.gif';
  }
  

  //thumbnailId.innerHTML = '<input type=image border=0 src=\"/' + theImg + '\" align=\"absmiddle\" alt=\"submit request\">';

  thumbnailId.innerHTML = '<input type=image border=0 src="button_submit.gif">';

}

function doImageText(text, buyImage, title)
{
  var imageTextId = document.getElementById("image_text");

  displayText = "<p align=left class=\"text_box\">&quot;" + text + "&quot;</p>";
  if (text.search(/^QUOTE;/) != -1) {
    displayText = text;
    displayText = displayText.replace(/^QUOTE;/,"");
    displayText = "<p align=left class=\"text_box\">" + displayText + "</p>";
  }

  if (text.search(/^QUOT2;/) != -1) {
    displayText = text;
    displayText = displayText.replace(/^QUOT2;/,"");
  }
  
  log="<img border=0 width=1 height=1 src=\"/cgi-bin/start.cgi?index=p&title="+ title +"\">";
  extraText = "";
  if (buyImage != "") {
    extraText = "<tr><td align=center><table border=0 cellpadding=0 cellspacing=0><tr><td valign=middle height=50><a href=\"" + buyImage + 
       "\" OnMouseOut=\"setimg('buy',0); window.status=''; return true;\" OnMouseOver=\"setimg('buy',1); window.status='View print details and prices'; return true;\"><img width=79 height=28 border=0 src=\"/button_buy_out.gif\" name=\"buy\" alt=\"View print details and prices\"></a></td><td width=2></td><td><img height=28 width=130 border=0 src=\"/andrewjones1.jpg\"></td></tr></table></td></tr>";           
  }
  imageTextId.innerHTML = "<table align=center border=0 cellspacing=0 cellpadding=0><tr><td height=10></td></tr><tr><td><table align=center border=0 cellspacing=0 cellpadding=1 bgcolor=#606060><tr><td><table width=576 border=0 cellspacing=0 align=center cellpadding=25 bgcolor=#303030><tr><td valign=top>" +
      displayText + "</td></tr></table></td></tr></table></td></tr>" + extraText + "<tr><td height=10></td></tr></table>" + log;
}

function doArchive(div_id)
{
  var thumbnailId = document.getElementById(div_id);
  thumbnailId.innerHTML = "<table width=588 align=center border=0 cellspacing=1 cellpadding=0 bgcolor=#606060><tr><td><table border=0 cellspacing=0 align=center cellpadding=8 bgcolor=#303030><tr height=10><td colspan=5></td></tr>" + 
    getRecentTextl('na_ns_rapidcolours3','Nova Scotia','The coastal and woodland wilderness of Atlantic Canada in the Fall, including the Cape Breton Highlands, Kejimkujik National Park, and the picturesque fishing village of Peggy&#039s Cove.','Nova%20Scotia') + 
    getRecentTextl('uk_hs_balloon_inside2','Balloon  Flight','An early morning balloon flight over the mist covered fields and woodland of North Hampshire in mid-summer.','July 2008') + 
    getRecentTextl('uk_nb_dunstanburgh2','Northumberland','The coast of Northumberland including the well known castles of Bamburgh, Dunstanburgh, and Holy Island.','Northumberland') + 
    getRecentTextl('uk_cley_windmill','Norfolk','The endless horizons of the extensive marshes of Norfolk together with the sandy beaches of the north east coast including a colony of Grey Seals.','Norfolk') + 
    getRecentTextl('eu_be_damme_houses','Belgium','The historic medieval city of Bruges with its picturesque architecture together with the wide open countryside of Flanders in the middle of winter. Including Damme and its surroundings.','Belgium') + 
    getRecentText('uk_wl_golden_cliffs','Wales','The mountains of the Brecon Beacons and Snowdonia together with the coastal seascapes of the heritage coast of south Wales.','Wales%20UK%20landscape') + 
    getRecentTextl('uk_hs_frog_on_lily','Hampshire Widlife','The wildlife of Hampshire taken over the late spring and early summer months; either in my own garden or the surrounding countryside of north Hampshire.','Hampshire%20wildlife') + 
    getRecentTextl('uk_cw_nanven_sunset','Cornwall','The dramatic coastline of Cornwall. Including the secluded coastline of Porth Nanven, Lantivet Bay, and the picturesque fishing village of Polperro.','Cornwall') + 
    getRecentTextl('eu_ir_cliffsofmoher','Ireland','The south west of Ireland in late September, to experience the dramatic seascapes of the Emerald Isle and the striking limestone landscapes of the Burren.','Ireland%202006') + 
    getRecentTextl('uk_sl_calanais','The&nbsp;Hebrides','The islands of Skye, Harris and Lewis, that lie off the north western coast of Scotland. A visit in late March coincided with some heavy falls of snow that fell right down to the coastline.','March%202006') + 
    getRecentTextl('af_nm_distant_dune','Namibia','The desert landscapes of western Namibia with the highest dunes in the world, together with the African game of Etosha National Park. This trip included a balloon trip and light aircraft flight over the spectacular desert scenery.','Namibia%202005') + 
    getRecentTextl('eu_sw_matterhorn_sunset','Switzerland','The high alpine scenery of the Swiss Alps in early summer, centred around the village of Zermatt and the dominating peak of the Matterhorn.','Switzerland%202005') + 
    getRecentTextl('uk_hs_bluebell_sunrise3','Bluebells','The great spectacle of the late British spring, the carpets of Bluebells covering the ground of broadleaved woodlands.','Bluebells') + 
    getRecentTextl('eu_nw_lofoten_church','Norway','The Lofoten Islands and the huge fjord of Tysfjorden after the first falls of snow of the winter. This visit also included a couple of whale watching trips out into Tysfjorden to see Orcas (Killer Whales).','Norway%202004') + 
    getRecentTextl('uk_sc_old_man_of_storr2','Scotland','Some of the best landscape locations that Scotland can provide together with some Scottish wildlife. These photographs were taken on a number of visits in the autumn and the winter.','Scotland') + 
    getRecentTextl('eu_ic_jokulsarlon','Iceland','A mid-summer visit to the south and west of Iceland, including some of the best waterfalls on the island. A lucky encounter with some young Arctic Foxes resulted in a few good wildlife photographs.','Iceland%202004') + 
    getRecentTextl('uk_ds_burton_low3','Dorset','The striking coastal scenery of Dorset. Photographs from a number of locations along the coast of the Isle of Purbeck.','Dorset%20200') + 
    getRecentTextl('au_sa_ki_two_pelicans','Australia','The landscapes and wildlife of Victoria, South Australia, and the Red centre. This included encounters with many of the unique animals of the continent such as Koala, Echidna, Kangaroo, and Emu.','October%202003') + 
    getRecentTextl('au_nz_mt_cook5','New Zealand','Mainly concentrating on the spectacular mountain scenery and coastal wildlife of the south island.','New%20Zealand%202002') + 
    getRecentTextl('sa_torres_sunrise2','Argentina & Chile','The Patagonian grasslands of Peninsula Valdes with its varied wildlife, the mountainous scenery of Tierra del Fuego and Torres del Paine, together with the contrast of the sub-tropical Iguazu Falls.','South%20America%202001') + 
    getRecentTextl('europe_walrus_sea','Svalbard','The circumnavigation of Spitsbergen, the main island of the high arctic archipelago of Svalbard. Taken in mid-summer, just after the ice had cleared enough to allow passage around the entire island.','Svalbard') + 
    getRecentTextl('antarctica_iceberg','Antarctica','A cruise from the southern tip of South America, across the Drake Passage, to the Antarctic Peninsula. Making landfall by Zodiac landing craft, many huge penguin colonies were visited.','Antarctica') + 
  "<tr height=10><td colspan=5></td></tr></table></td></tr></table>";               

}


// image = uk_hs_frog_on_lily
// area = Hampshire
// text = The....
function getRecentText(image,area,text,search)
{ 
  return "<tr><td width=1></td><td onMouseOver='javascript:doThumbnail(\"" + image + "\", \"<b>" + area + "</b>\", \"lover\");' onMouseOut='javascript:doThumbnail(\"" + image + "\", \"<b>" + area + "</b>\", \"lout\")'><table border=0 cellspacing=0 cellpadding=1 bgcolor=#cccccc><tr><td id=" + image + "_image><table border=0 cellspacing=0 cellpadding=1 bgcolor=#707070><tr><td><a href=\"/cgi-bin/getindex.cgi?index=f&cont=&cregi=&loc=&type=&flags=&search=" + search + "\" onMouseOut=\"javascript: window.status=''; return true;\" onMouseOver=\"javascript: window.status='View " + area + " Photographs'; return true;\"><img height=40 width=60 border=0 src=\"/graphics/" + image + "_ts.gif\" title=\"View " + area + " Photographs\" alt=\"View " + area + " Photographs\"></a></td></tr></table></td></tr></table></td><td width=94 id=\"" + image + "\"><p align=left class=d><b>" + area + "</b></p></td><td><p align=left class=text_box>" + text + "</p></td><td width=1></td></tr><tr height=3><td colspan=5></td></tr>";
}

// image = uk_hs_frog_on_lily
// area = Hampshire
// text = The....
function getRecentTextl(image,area,text,search)
{ 
  return "<tr><td width=1></td><td onMouseOver='javascript:doThumbnail(\"" + image + "\", \"<b>" + area + "</b>\", \"lover\");' onMouseOut='javascript:doThumbnail(\"" + image + "\", \"<b>" + area + "</b>\", \"lout\")'><table border=0 cellspacing=0 cellpadding=1 bgcolor=#cccccc><tr><td id=" + image + "_image><table border=0 cellspacing=0 cellpadding=1 bgcolor=#707070><tr><td><a href=\"/cgi-bin/getindex.cgi?index=f&cont=&cregi=&loc=&type=&flags=&search=" + search + "\" onMouseOut=\"javascript: window.status=''; return true;\" onMouseOver=\"javascript: window.status='View " + area + " Photographs'; return true;\"><img height=40 width=60 border=0 src=\"/graphics/" + image + "l_ts.gif\" title=\"View " + area + " Photographs\" alt=\"View " + area + " Photographs\"></a></td></tr></table></td></tr></table></td><td width=94 id=\"" + image + "\"><p align=left class=d><b>" + area + "</b></p></td><td><p align=left class=text_box>" + text + "</p></td><td width=1></td></tr><tr height=3><td colspan=5></td></tr>";
}

function doArrows(div_id, text, type)
{
  var thumbnailId = document.getElementById(div_id);
  var theClass=' class=vd';
  var theAlign='right';
  if ( type == 'over' ) {    
    theClass=' class=d';
  }
  if ( div_id == 'next_arrow' ) {
    theAlign='left';
  }
  thumbnailId.innerHTML = '<p align=' + theAlign + theClass + '>' + text + '</p>';
}
	
      
function thumb(theId, event) {

  colour='black';  
  if (event == 1){
    colour='#999999';
  }

  var thumbId = document.getElementById(theId);
  thumbId.bgColor=colour;
 
}

function thumb2(theId, event) {

  colour='#c0c0c0';  
  if (event == 1){
    colour='white';
  }

  var thumbId = document.getElementById(theId);
  thumbId.bgColor=colour;

}

function thumb3(theId, theTextId, theText, event) {

  colour='#c0c0c0';  
  if (event == 1){
    colour='white';
  }

  var thumbId = document.getElementById(theId);
  thumbId.bgColor=colour;

  var theStyle='color:#808080; font-size:8pt'; 

  if ( event == 1 ) {
    theStyle='color:#c0c0c0; font-size:8pt';
  }

  var textId = document.getElementById(theTextId);
  textId.innerHTML = '<p align=center style=\"' + theStyle + '\">' + theText + '</p>';
 
}

function displayMonthImage()
{

  var monthId = document.getElementById("whole_month");

  var m_names = new Array("January", "February", "March", "April", "May", "June",
                          "July", "August", "September", "October", "November", "December");

  var date = new Date();
  var current_month = date.getMonth();
  var month_name=m_names[current_month];

  var image_width=32;
  var image_height=40;
  var image_name="";
  var image_search="";
  
  switch(current_month) {
    case 0:
      image_name="uk_ds_burton_low2_ps";
      image_search="Sandstone%20Coast%20BB02";
      break;
    case 1:   
      image_name="uk_sl_glencoe_bem2_qs";
      image_search="Buachaille%20Etive%20Mor";
      break;
    case 2:
      image_name="uk_cw_nanven_shore_tp";
      image_search="Rocky%20Shore";
      break;
    case 3:
      image_name="uk_adders_ps";
      image_search="Adders%20Duelling";
      break;
    case 4:
      image_name="uk_hs_bluebell_sunrise2_ps";
      image_search="Bluebell%20Sunrise";
      break;
    case 5:
      image_name="uk_dm_wistmans_ps";
      image_search="Wistmans%20Wood";
      break;
    case 6:
      image_name="uk_poppy_pan_ns";
      image_search="Poppy%20Panorama";
      break;
    case 7:
      image_name="uk_hs_barley_sunset_qs";
      image_search="Barley%20Sunset";
      break;
    case 8:
      image_name="uk_nanjizal_ps";
      image_search="Nanjizal%20Bay";
      break;
    case 9: 
      image_name="uk_hs_yellowleaf_ss";
      image_search="The%20Yellow%20Leaf";
      break;
    case 10:
      image_name="uk_wl_autumn_trees2_ps";
      image_search="Autumn%20Trees%20Wiltshire";
      break;
    case 11:
      image_name="uk_bb_pen-y-fan_ps";
      image_search="Distant%20Ridge%20Walker";
      break;
    default:
      return;
      break;
  }  

  var cell_width=image_width+2;
  var cell_height=image_height+2;
  var month_text="&nbsp;Previous<br>&nbsp;" + month_name + "<br>&nbsp;Image";

  monthId.innerHTML = "<table border=0 cellspacing=0 cellpadding=0><tr valign=top>" +
                      "  <td valign=middle align=center height=" + cell_height + " width=" + cell_width + " id=this_month bgcolor=#c0c0c0><center><a href='/cgi-bin/getphoto.cgi?photo=999&index=n&cont=&cregi=&loc=&type=&flags=&search=" + image_search + "' OnMouseOut=\"javascript:thumb3('this_month','this_month_text','" + month_text + "',0);window.status=''; return true;\" OnMouseOver=\"javascript:thumb3('this_month','this_month_text','" + month_text + "',1);window.status=''; return true;\"><img border=0 height=" + image_height + " width=" + image_width + " src=\"/graphics/" + image_name + ".gif\" alt=\"View previous " + month_name + " image\"</a><center></td>" +
                      "  <td width=7></td>" +
                      "  <td id=this_month_text><p align=center style=\"color:#808080; font-size:8pt\">" + month_text + "</p></td>" +
                      " </tr></table>";
  
}

