var gsTitle;
var gbIsPrintable;

var SiteName="Cradley Links";
var Domain="www.cradleylinks.com";
var HTTPDomain="http://"+Domain;
var HTTPDomainSlash=HTTPDomain+"/";

var gsImageURL;
var gsImageCaption;
var gsiImageWidth;
var gsiImageHeight;
var gsDir;

var topc1 ="#9C9C9C"; 
var topc2= "white";
var topc3="white";
var topc4="#9C9C9C";
var topc5="white";
var topc6="#C4B87F";
var topc7="white";
var topbannerc1="#470D0F";
var footerc1="white";
var menuc1="#A38686"; 

var menuwidth=180;

var copyrightURL="copyright_and_fair_usage.html";

var menu =[

  [0, "Find", ""],
  [0, "", ""], 

  [0, "Home", "home.html"],
  [0, "", ""], 
  
  [0, "1782 and 1785 Enclosure surveys", "surveys_1782_1785.html"],
    [1, "About this data", "enclosure_surveys.html"],
    [1, "Field survey (1782)", "field_survey_1782.html"],
    [1, "House survey (1782)", "house_survey_1782.html"],
    [1, "Field and house survey (1785)", "field_and_house_survey_1785.html"],
    [1, "Field names", "field_names.html"],
    [1, "Place names", "place_names.html"],

  [0, "About Cradley Links", "about_cradley_links.html"],
    [1, "Contact Cradley Links", "contact.html"],
    [1, "Contributions", "contribute.html"],
    [1, "Copyright and fair usage", "copyright_and_fair_usage.html"],
    [1, "Jill Guest", "jill_guest.html"],
    [1, "Nigel Brown", "nigel_brown.html"],
    [1, "What people are saying", "site_reviews.html"],

  [0, "Books and videos", "books_and_videos.html"],
    [1, "How and where to purchase Cradley books", "books.html"],
    [1, "Brickyards of the Black Country", "review_brickyards.html"],
    [1, "Court Rolls - Part One", "review_court_rolls_1.html"],
    [1, "A Cradley Album", "review_a_cradley_album.html"],
    [1, "Cradley, a History", "review_cradley_a_history.html"],
    [1, "Cradley - Impressions from Old Photographs", "review_impressions.html"],
    [1, "Cradley : Looking Back", "review_cradley_looking_back.html"],
    [1, "A Mirror to the Flock", "review_mirror_flock.html"],
    [1, "Cradley Then and Now", "cradley_then_and_now_book.html"],    
    [1, "Cradley Timeline", "cradley_timeline.html"],
    [1, "The History of Cradley: Wills and Inventories", "review_wills_and_inventories.html"],
    [1, "A Journey down the River Stour", "stour_journey.html"],
    [1, "Through the Years", "review_castings.html"],
    [1, "When I was a Boy", "review_willetts.html"],

  [0, "Census analysis (1881)", "census_1881_analysis.html"],
    
  [0, "Churches and chapels", "churches.html"],
    [1, "Census of Religious Worship (1851)", "census_1851_religious_worship.html"],
    [1, "Park Lane Unitarian Chapel", "park_lane_history.html"],
    [1, "St Peter's", "st_peters.html"],
    [1, "The story of Providence Methodist Church, Colley Gate, 1856 - 2004","providence_history.html"],
    [1, "A visit to the bell tower of St Peter's Church", "bell_tower.html"],
    [1, "Cradley Parish Magazine (1897)", "parish_magazine_1897.html"],
    [1, "Cradley Parish Magazine (1925)", "parish_magazine_1925.html"],
    [1, "Cradley Parish Magazine (1940)", "parish_magazine_1940.html"],
    [1, "Cradley Wesleyan Sunday School Centenary (1925)", "wesleyan_1925.html"],
    [1, "Cradley Trinity Methodist Church Sunday School Souvenir Booklet (1965)", "trinity_1965.html"],

  [0, "Cradley at school", "cradley_at_school.html"],
    [1, "Jill Guest remembers Caslon Primary School", "caslon_school_memories.html"],
    [1, "Colley Lane Primary School", "colley_lane_primary.html"],
    [1, "Colley Lane Centenary celebrations", "centenary.html"],
    [1, "Colley Lane Foundation Day 2003", "colley_lane_foundation_2003.html"],
    [1, "Cradley High School", "cradley_high_school.html"],
    [1, "The Cradley School Board meets at last (1900)", "cradley_school_board.html"],
    [1, "Hazel Willetts remembers Colley Lane", "hazel_willetts.html"],
    [1, "Historical Sketch of High Town Ragged School (1878)", "hightown_1878.html"],

  [0, "Cradley at war", "cradley_at_war.html"],
    [1, "The Avenue Of Remembrance, Cradley Churchyard", "avenue.html"],
    [1, "Bombs along the Stour", "wartime_john_grice.html"],
    [1, "The Cradleys at Gallipoli", "cradleys_at_gallipoli.html"],
    [1, "The Funeral of Sgt. Tyler", "tyler_funeral.html"],
    [1, "Heroes every one", "heroes.html"],
    [1, "An Old Soldier", "an_old_soldier.html"],
    [1, "Schoolboy memories of Cradley at war", "wartime_alf_clift.html"],
    [1, "Sergeant Alfred Willetts", "alfred_willetts.html"],
    [1, "War memorial", "cradley_war_memorial.html"],
    [1, "Winnie Brown's wartime memories", "wartime_winnie_brown.html"],

  [0, "Cradley at work", "cradley_at_work.html"],
    [1, "Chain making", "cradley_and_chain_making.html"],
    [1, "Land of the chain-makers", "land_of_chainmakers.html"],
    [1, "Coal mining", "cradley_and_coal_mining.html"],

  [0, "Cradley people remembered", "cradley_people_remembered.html"],
    [1, "Sam Bate - Elegy for a Craftsman", "elegy_for_a_craftsman.html"],
    [1, "Joe Beasley - A Black Country Farmer", "a_black_country_farmer.html"],
    [1, "Steve Bloomer - King of Goal Scorers", "bloomer.html"],
    [1, "Steve Bloomer and the Derby RamsTrust", "bloomer_rams_trust.html"],
    [1, "William Caslon", "william_caslon.html"],
    [1, "The Cradleys at Gallipoli", "cradleys_at_gallipoli.html"],
    [1, "Benjamin Hodgetts - A Loss to Cradley", "benjamin_hodgetts.html"],
    [1, "Mr. Jeston Homfray and The Old Worse and Worse", "jeston_homfray.html"],
    [1, "Sarah Jones", "sarah_jones.html"],
    [1, "Mahlah Addyes Scott", "mahlah.html"],
    [1, "Joey Stevens", "joey_stevens.html"],
    [1, "Sam Taylor", "sam_taylor.html"],
    [1, "Tommy Two-Sticks", "tommy_two_sticks.html"],
    [1, "The Funeral of Sgt. Tyler", "tyler_funeral.html"],
    [1, "The Wandering Vicar of Cradley", "wandering_vicar.html"],
    [1, "Alfred Westwood - An Early Cradley Radical ", "westwood.html"],

  [0, "Cradley today", "cradley_today.html"],

  [0, "Directories", "directories.html"],
    [1, "Lewis' 1820 directory", "lewis_1820.html"],
    [1, "Pigot and Co.'s 1829 directory", "pigots_1829.html"],
    [1, "Pigot and Co.'s 1835 directory", "pigots_1835.html"],
    [1, "Bentley's 1840/41 directory", "bentleys_1840.html"],
    [1, "Pigot and Co.'s 1844 directory", "pigots_1844.html"],
    [1, "1845 Post Office directory", "directory_post_office_1845.html"],
    [1, "1854 Post Office directory", "directory_1854.html"],
    [1, "Billing's 1855 directory", "billings_1855.html"],
    [1, "Preston's 1860 directory", "preston_1860.html"],
    [1, "Kelly's 1860 directory", "kellys_1860.html"],
    [1, "Kelly's 1864 directory", "kellys_1864.html"],
    [1, "Jones's 1865 directory", "directory_jones_1865.html"],
    [1, "Kelly's 1868 directory", "kellys_1868.html"],
    [1, "1872 Post Office directory", "directory_post_office_1872.html"],
    [1, "Littlebury's 1873 directory", "directory_littleburys_1873.html"],
    [1, "Kelly's 1876 directory", "kellys_1876.html"],
    [1, "Kelly's 1878 directory", "kellys_1878.html"],
    [1, "Kelly's 1880 directory", "kellys_1880.html"],
    [1, "Owens' 1880 directory", "owens_1880.html"],
    [1, "Kelly's 1884 directory", "kellys_1884.html"],
    [1, "Kelly's 1888 directory", "kellys_1888.html"],
    [1, "Kelly's 1892 directory", "kellys_1892.html"],
    [1, "Kelly's 1896 directory", "kellys_1896.html"],
    [1, "Kelly's 1900 directory", "kellys_1900.html"],
    [1, "Kelly's 1904 directory", "kellys_1904.html"],
    [1, "Kelly's 1908 directory", "kellys_1908.html"],
    [1, "Kelly's 1912 directory", "kellys_1912.html"],
    [1, "Kelly's 1916 directory", "kellys_1916.html"],
    [1, "Kelly's 1921 directory", "kellys_1921.html"],
    [1, "Kelly's 1924 directory", "kellys_1924.html"],
    [1, "Kelly's 1928 directory", "kellys_1928.html"],
    [1, "Kelly's 1932 directory", "kellys_1932.html"],
    [1, "Kelly's 1936 directory", "kellys_1936.html"],
    [1, "Kelly's 1940 directory", "kellys_1940.html"],

  [0, "Essays by Peter Barnsley", "essays_by_peter_barnsley.html"],
    [1, "About Peter Barnsley", "about_peter_barnsley.html"],
    [1, "An Old Soldier", "an_old_soldier.html"],
    [1, "The Aphrodisiac on the Cradley Line", "aphrodisiac.html"],
    [1, "Sam  Bate - Elegy for a Craftsman", "elegy_for_a_craftsman.html"],
    [1, "Joe Beasley - A Black Country Farmer", "a_black_country_farmer.html"],
    [1, "Steve Bloomer - King of Goal Scorers", "bloomer.html"],
    [1, "The Blue Ball Inn", "barnsley_blue_ball.html"],
    [1, "How Cradley Chose Its First Little Parliament", "how_cradley_chose_its_first_little_parliament.html"],
    [1, "Cradley's Forgotten Connections", "cradleys_forgotten_connections.html"],
    [1, "The Funeral of Sgt. Tyler", "tyler_funeral.html"],
    [1, "Mr. Jeston Homfray and The Old Worse and Worse", "jeston_homfray.html"],
    [1, "Old Cradley", "old_cradley.html"],
    [1, "Two Old Cradley Mills", "two_old_cradley_mills.html"],
    [1, "Order and Disorder: Cradley and the Diamond Jubilee", "diamond_jubilee.html"],
    [1, "The 'Rockson' Motor-Cycle", "rockson.html"],
    [1, "Village Statesmen", "village_statesmen.html"],
    [1, "The Wandering Vicar of Cradley", "wandering_vicar.html"],

  [0, "Essays by Norman Bird", "essays_by_norman_bird.html"],
    [1, "On the Box", "bird_on_the_box.html"],
    [1, "Before the Conquest", "bird_before_the_conquest.html"],
    [1, "Cradley and the Civil War", "bird_civil_war.html"],
    [1, "Early non-conformity in Cradley, and John Wesley's Visit", "bird_wesley.html"],
    [1, "The Lords of Cradley Manor", "bird_lords.html"],
    [1, "The Mills on the Stour", "bird_mills_on_the_stour.html"],
    [1, "The Cradley Park Turnpike Road", "bird_cradley_turnpike.html"],

  [0, "Groups and societies", "groups_and_societies.html"],
    [1, "The Black Country Society", "the_black_country_society.html"],
    [1, "The B.M.S.G.H.", "bmsgh.html"],
    [1, "Cradley Day 2004", "cradley_day_2004.html"],
    [1, "Hop-picking", "hop_picking.html"],
    [1, "Cradley Then and Now", "cradley_then_and_now.html"],
    [1, "The Cradley Podging Ladies", "podging_ladies.html"],

  [0, "Guestbook", "guestbook_add.html"],
    
  [0, "History", "history.html"],
    [1, "A brief history of Cradley", "brief_history.html"],
    [1, "Collections for the history of Worcestershire (1781)", "nash.html"],
    [1, "Cradley Bag-puddings", "bag_puddings.html"],
    [1, "Cradley Common Fields", "common_fields.html"],
    [1, "Doin' a Bit of Washin'", "washing.html"],
    [1, "Golden Jubilee 2002", "jubilee_2002.html"],
    [1, "The James Scott Manuscript - A History of Cradley 1800-1826", "james_scott_manuscript.html"],
    [1, "Magna Britannia, Worcestershire (1721)", "magna_britannia_1721.html"],
    [1, "The Cradley Outrage of 1869", "outrage.html"],
    [1, "Peeping Tom of Cradley Town", "peeping_tom.html"],
    [1, "Return of Owners of Land (1873)", "landowners_1873.html"],
    [1, "The Pubs of Cradley", "pubs.html"],
    [1, "Stourbridge and its Vicinity (1832)", "stourbridge_vicinity.html"],
    [1, "Victoria History of the Counties of England", "victoria_county.html"],
    [1, "The Waggon and Horses", "waggon_and_horses.html"],
    [1, "A Water Famine in Cradley (1891)", "water_famine.html"],
    [1, "The Cradley Witch", "witch.html"],
    [1, "A Tuppence ha'penny token", "token.html"],

  [0, "Images of Cradley", "images_of_cradley.html"],
    [1, "Artwork by Arrowsmith", "arrowsmith.html"],
    [1, "Cradley portrait gallery", "portraits.html"],
    [1, "A photographic tour of Cradley", "cradley_tour.html"],
    [1, "Panorama", "panorama.html"],
    [1, "Scenes from old Cradley", "scenes_from_old_cradley.html"],
    [1, "Postcards from yesteryear", "postcards_from_yesteryear.html"],
    [1, "The view in 1959", "tower_1959.html"],

  [0, "Maps and places", "maps.html"],
    [1, "Cradley places", "cradley_places.html"],
    [1, "Cradley in 1307", "map_1307.html"],
    [1, "Cradley Spa", "spa.html"],
    [1, "16th century Worcestershire map", "map_1610.html"],
    [1, "1832 Dudley and environs map", "map_dudley_1832.html"],
    [1, "1840 Worcestershire map", "map_1840.html"],
    [1, "1876 Post Office map", "map_1876.html"],
    [1, "1888 Ordnance Survey", "map_ordnance_1888.html"],
    [1, "1888 Encyclopedia", "map_worcs_1888.html"],
    [1, "19th century transportation map", "map_transport.html"],
    [1, "Modern Ordnance Survey", "map_ordnance_modern.html"],
    [1, "Parish locator", "parishes.html"],
    [1, "Other map resources", "map_other.html"],

  [0, "Newspaper clippings", "newspapers.html"],
    [1, "Colliery accidents (1867-1875)", "newspaper_collieries.html"],
    [1, "Cradley Poor Relief Fund (1861)", "newspaper_poor_relief.html"],
    [1, "Delinquent clergyman (1844)", "newspaper_clergyman.html"],
    [1, "Diabolical outrage (1860)", "newspaper_outrage.html"],
    [1, "Disturbance in a Chapel (1889)", "newspaper_chapel.html"],
    [1, "May-Day celebrations (c. 1895)", "newspaper_mayday.html"],
    [1, "Railway accidents (1869-1879)", "newspaper_railway.html"],
    [1, "Service in Memory of the Late Mr Noah Hingley, J.P. (1877)", "newspaper_noah_hingley.html"],
    [1, "Shooting outrage (1889)", "newspaper_shooting.html"],
    [1, "Strike (1876)", "newspaper_strike.html"],

  [0, "Site map", "site_map.html"],

  [0, "What's new", "whats_new.html"],
    [1, "What's new in 2005", "whats_new_2005.html"],	
    [1, "What was new in 2004", "whats_new_2004.html"],
    [1, "What was new in 2003", "whats_new_2003.html"],
    [1, "What was new in 2002", "whats_new_2002.html"],
    [1, "What was new in 2001", "whats_new_2001.html"]
];


var gnMenuItems=menu.length;

function GetMenuItemParentMenu(title)
{
  // !!! problem with repeated (duplicate) pages - returns FIRST menu!
  // very inefficient - need to use indexes, not strings

  if (title != "") {
   for (var i=0; i<gnMenuItems; ++i) {      
     if (menu[i][0] == 0) 
         menuindex=i; 	
    if ( menu[i][1] == title) {	
      return menuindex;
    }
  }
}
   return -1; 
}

function GetMenuItemPath(title)
{
  var path="";
  var sFix=getPathFix();

  if (gsTitle != "Home") {
  path="&nbsp;-&nbsp" +title;
  var menuindex=GetMenuItemParentMenu(title);  
  if (menuindex != -1) {
    if (menu[menuindex][1] != title) {
      path ='&nbsp;-&nbsp;<A HREF="' + sFix + menu[menuindex][2] +'">' + menu[menuindex][1] +'</a>' + path;
    }
  }	  
  path='<A HREF="'+sFix+'home.html">HOME</A>'+path;
 }
  return path; 
}

function writeTitleBar()
{

  // !! BIG PROBLEM here
  // ... it gets confused with repeated (duplicate) pages, and so will switch the menu!
  // instead of gsTitle, pages need to report menu and item number

 var path=GetMenuItemPath(gsTitle);
  var sFix=getPathFix();

document.write(
  '<table border="0" cellspacing="0" cellpadding="0" width="100%" >'
  +'<tr>'
  +'<td width="98%" bgcolor="'+topc6+'" CLASS="toptiny">'+path+'</td>'
  +'<td bgcolor="'+topc6+'" align="right" valign="top" width="24"><img src="'+sFix+'images/tab_gr_end.gif" width="24" height="17" alt="">'
  +'</td></tr>'
  +'<tr><td bgcolor="'+topc7+'" colspan="2">'+spacer(2,2,sFix)+'</td><tr>'    
  +'</table>'
  );
}

function GetMenuItem(sPrompt,url,bIndent,sFix)
{
  if (window.location.protocol == "http:")  { 
   if ( url.indexOf(HTTPDomainSlash)==0) 
    url=url.substr(HTTPDomainSlash.length);
 }

  var tdclass= !bIndent ? "sidenav" : "sidenavindent";
  var linkclass="linkcolor";
  if (sPrompt=="Find") 
      return (writeFind());
   
  return (
  "<tr>"
  + '<td class ="' + tdclass + '">'
  + (sPrompt == "" ?  "&nbsp;" : '<A HREF="' + sFix+url+ '"class="'+linkclass+'">'+ sPrompt + '</A>')    
  + '</td></tr>'  
  + RuleRow(1,1,menuc1,sFix) 
  )

}

function writeSideNav()
{
  var sFix=getPathFix();
  var parenttitle="";
  var thismenu="";
  for (i=0; i<gnMenuItems; ++i) {      
    var title= menu[i][1];       	
    if ( menu[i][0] ==0) 
	thismenu=title;
	else {
	if ( title == gsTitle ) { 
          parenttitle= thismenu;
          break;   
    	}       
     }   
  }

  document.write('<table class="sidenav" width="'+menuwidth+'" border="0" cellspacing="0" cellpadding="0">');
  var currentparent="";
  for (var i=0; i<gnMenuItems; i++) {
    var title=menu[i][1];
    var url=menu[i][2];
    var isMenu=menu[i][0]==0;
    if (isMenu) 
      currentparent=title;
    if (isMenu || (currentparent == parenttitle) || (currentparent == gsTitle)) {
     document.write(GetMenuItem(title,url,!isMenu,sFix));      
   }   
  }

  document.write('</table>');

}

function writeFind()
{
  var s;
  var sIMGURL=getPathFix()+'images/sidenav_searchbutt.gif';
  s=
  "<TR><TD>"
  +'<FORM NAME="searchform" action="http://www.cradleylinks.com/cgi-bin/search.cgi" method="post">'
  +'<table cellspacing="0" cellpadding="0">'
  +"<TR><TD>&nbsp;</TD></TR>"
  +'<TR>'
  +'<TD class="sidenav"><A HREF="javascript:document.searchform.submit()" class="linkcolor">Search '+SiteName+'</A></TD>'
  +'</TR>'
 
  +'<tr><td CLASS="sidenav">'
  +'&nbsp;<input type="text" name="search" size="14" style="height: 16px; width: 100px; border-style: none; borderColor: #404040; font-family: Verdana, Helvetica, sans-serif; font-size: 10px;">'
  +'<input type="image" class="submit" src="'+sIMGURL
  +'" width="22" height="20" align="middle" alt="Search" name="image"><td>'
  +'</tr></table></FORM></td></tr>'
  ;	

  return s;
    
}

function writeTopNav()
{ 
  var s;  
  var t;

  s="&nbsp;";
  document.write('<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">');
  document.write('<TR><TD>',s,'</TD></TR>');
  document.write('</TABLE>');
}

function writeTopBanner()
{
  var s; 
  var sFix=getPathFix();
  
  s='<table border="0" cellpadding="0" cellspacing="0" width="100%">'
  +RuleRow(1,6,topc1,sFix)
  +RuleRow(1,1,topc2,sFix)    
  
  +'<tr><td align="center" valign="top" bgcolor="'+topbannerc1+'">'
  +'<a href="'+sFix+'index.html">'
  +'<img src="'+sFix+'images/topnav_header.gif" alt="'+SiteName+'" width="260" height="33" border="0">'
  +'</a>'	
  +'</td></tr>'

  +RuleRow(1,1,topc3,sFix)
  +RuleRow(1,6,topc4,sFix)
  +RuleRow(1,2,topc5,sFix)

  +"</table>\n";
  
  document.write(s);

}

function RuleRow(w,h,color,sFix)
{
 return ('<tr><td bgcolor="' + color+ '">' +spacer(w,h,sFix)+ '</td></tr>') ;
}

function writeFooter()
{
var sFix=getPathFix();

document.write(
'<img width="100%" height="2" src="'+sFix+'images/icons/white_dot.gif" alt="">'
+'<div class="copyright" valign="top">'+ copyright(sFix)+'</div>'
);

}

function copyright(sFix)
{
 return (
   "<BR><BR>"
   +'<B>'+SiteName+'</B> web site &copy; Copyright 2001, 2002, 2003, 2004, 2005<B>&nbsp;'+SiteName+"</B><BR>"
   +'<B>All rights reserved</B><BR><BR>'
   +'<FONT SIZE="-3">Content may include copyright material owned by third '
   +'parties which has been reproduced with their permission.<BR>'
   +'Please see our <A HREF="'+sFix+copyrightURL+'">Copyright and fair usage</a> page for further details.</FONT><P></P>'
 );
}

function OpenMe(arg, w, h) 
{
var i=1
myWindow=window.open("" + arg, i, "toolbar=no,resizable=yes,titlebar=false,status=no,scrollbars=auto,width="+(w)+",height="+(h), "blank");
i++;
}

function showImage(sImageURL,sCaption,iImageWidth,iImageHeight) 
{
var s;
var maxX = screen.availWidth-60;
var maxY = screen.availHeight-60;

var winWidth=iImageWidth+60;
if (winWidth>maxX) winWidth=maxX;

var winHeight=iImageHeight+110;
if (winHeight>maxY) winHeight=maxY;

var wLeft;
wLeft=(screen.availWidth/2)-(winWidth/2);
var wTop;
wTop=(screen.availHeight/2)-(winHeight/2);

    lrgewin = window.open("about:blank",
                          "",
                          "scrollbars=yes,left="+wLeft+",top="+wTop+",height="+winHeight+ ",width="+winWidth
                          );

var z=new String(top.location.href); 
gsDir="";
if (z.indexOf("printable")>=0) {
  //sImageURL="../"+sImageURL;
  gsDir="../";
}

    //gsImageURL = gsDir+sImageURL;
    gsImageURL = sImageURL;
    gsImageCaption = sCaption;
    gsiImageWidth=iImageWidth;
    gsiImageHeight=iImageHeight;
    setTimeout('doupdate('+iImageWidth+')',500);
}

function doupdate(imagewidth) {
    var s;

    var bigimg=gsDir+"images/"+gsImageURL;
    doc = lrgewin.document;
    doc.open('text/html');
    s="<HTML><HEAD>\n";
    s+="<TITLE>Enlarged Image</TITLE>\n";
    s+='<LINK REL="stylesheet" HREF="css/cradley_links.css">';   
    s+='</HEAD>';
    s+='<BODY bgcolor="black">';
    s+='<div class="enlargedlinks" style="text-align:left;">';
    s+='<a href="javascript:window.close();"><font color="white">Close window</font></A>';
    s+='</div>';

// CONTAINER DIV
s+='<div class="imgcontainer">';

// IMAGE

	s+='<div class="imgdiv">';

	s+= '<IMG WIDTH="' + gsiImageWidth +'" HEIGHT="' +gsiImageHeight +'" '
    	+'SRC="' +gsDir+"images/"+gsImageURL+'" '  
    	+ '>';
	s+='</div>';

s+="<BR>";

// CAPTION
	s+='<div class="captiondiv" style="width:'+imagewidth+'">';
	s+=gsImageCaption;

	s+='</div>';
	
s+= '</BODY></HTML>';

doc.write(s); 
doc.close();
}

//receives JUST the filename.  Knows to tack on /original if iLargeWidth,iLargeHeight >0

function writeImage(sImageName,iWidth,iHeight,sCaption,iLargeWidth,iLargeHeight)
{
  var s;
  var s2;
  var s3;
  var sCaption2;
  var sDir="images/";
  var z=new String(top.location.href);

  if (z.indexOf("printable")>=0) 
  sDir="../"+sDir;
  
  // sCaption2=sCaption.replace(/'/g,"\\'");
  //sCaption2=sCaption2.replace(/&quot;/g,"\"");
     
  s2="";
  if (iLargeWidth>0) {
  //s3="Enlarge "+sCaption2+" to "+iLargeWidth+"x"+iLargeHeight;
  s3="Click to open enlarged image ("+iLargeWidth+"x"+iLargeHeight+" pixels) in new window";
  s2='<A HREF="javascript:showImage('+"'";
  s2+="original/"+sImageName+"',";
  s2+="'"+sCaption2+"',";
  s2+= iLargeWidth+","+iLargeHeight+")";
  //s2+='">';
  s2+='" ';
  s2+="onMouseOver=\"window.status="+"'"+ s3 +"'" +"; return true;\" ";
  s2+="onMouseout=\"window.status=' '\"";
  s2+=">";
  }


s="<CENTER>";
s+='<TABLE CLASS="image" BORDER="1"' + 'WIDTH='+(iWidth+10) + '>';
s+='<TR>';
s+='<TD COLSPAN="2">';
s+=s2;
s+="<IMG BORDER=\"0\" WIDTH="+iWidth+" HEIGHT="+iHeight +' SRC="'+sDir+sImageName+ '" ALT="'+sCaption+'">';
if (s2 != "") s+='</A>';
s+='</TD>';
s+='</TR>';

s+='<TR >';
s+='<TD CLASS="image">&nbsp;'+sCaption+'</TD>';
s+='<TD CLASS="image">'; 
if (s2 != "") s+=s2+'ENLARGE</A>';
s+='</TD>';
s+='</TR>';
s+='</TABLE>';

s+='</CENTER>';

document.write(s);
}

function getPathFix()
{
 var sFix="";
 var i;
 var n;

 if (window.location.protocol != "http:") { return ""; }

 n = (window.location.pathname.match(/\//g)).length; 

 for (i=0; i<n-1; ++i) sFix=sFix+"../";
 return sFix;
}

function spacer(w,h,sFix)
{
return ('<img width="'+w+'" height="' + h + '" src="' + sFix+ 'images/spacer.gif" alt="">')
}

function decodeHex(text)
{
  var i; 
  var s="";
  for (i=0; i<text.length/2; ++i) 
    s +="%"+text.substr(i*2,2);

  return unescape(s);
}

function emailCloak(s)
{
 s=decodeHex(s);
 location.href=s;
}

function switchView()
{
  var s=window.location.pathname;
  var sNewUrl;
  if (s.indexOf("threads.html") >=0) 
   sNewURL="maillist.html";
  else 
  if (s.indexOf("maillist.html") >=0 )
   sNewURL="threads.html";
  else return;
  location.href=sNewURL;  
}

function realplayer_audioclip(name,console)
{

if (window.location.protocol == "http:") {
  	n=name.length-3;
  	name=name.substring(0,n);
  	name="http://www.cradleylinks.com/media/"+name+".ram";
  }	
else 
name="media/"+name;
document.write('<EMBED SRC="'+name+'"' + 'CONSOLE="'+console+'"'+  ' AUTOSTART="FALSE" WIDTH=150 HEIGHT=30 CONTROLS="ControlPanel" CENTER=true>');
document.write('<BR><CENTER><FONT SIZE="-2">Audio clip</FONT></CENTER><BR><BR>');
}

function videoclip(dir,stream,download,bytes)
{
  
  document.write('<TABLE border="0">');
  document.write('<TR>');
  
  document.write('<TD>');
  //document.write('<IMG border="0" width="10" height="10" SRC="images/icons/video.gif">');  
  //document.write("&nbsp;");
  document.write('<A HREF="' + dir +"/"+stream + '">');
  document.write('play');
  document.write('</A>');

  document.write('</TD>');
  document.write('</TR>');

if (1) {
  document.write('<TR>');  
  document.write('<TD>');

  document.write('<A HREF="http://www.cradleylinks.com/cgi-bin/download.cgi?name='+download+'&dir='+dir+'">');
  
  document.write('download');
  document.write('</A>');
  document.write('&nbsp;('+bytes+'k)');

  document.write('</TD>');
  document.write('</TR>');
}
  document.write('</TABLE>');


}

function realplayer_videoclip(name,bytes)
{
  var stream;
  var download;
  download=name;
  if (window.location.protocol == "http:") {
  	n=name.length-3;
  	stream=name.substring(0,n)+".ram";
  } else 
   stream=name;
  videoclip("media",stream,download,bytes);  
}

function wmp_videoclip(name,bytes)
{

    var stream;
  var download;
  download=name;
  if (window.location.protocol == "http:") {
  	n=name.length-4;
  	stream=name.substring(0,n)+".asf";
  } else 
   stream=name;
  videoclip("media",stream,download,bytes);   

}


function mpg_videoclip(name,bytes)
{
  videoclip("media",name,name,bytes);
}


