var heading = new Array();

var titles = [
// cottages
[100,"Alice Cottage kitchen"],
[101,"Alice Cottage twin bedroom"],
[102,"Alice Cottage sitting room"],
[103,"Mad Hatter 2 bunk bedroom"],
[104,"Mad Hatter 2 Kitchen"],
[105,"Mad Hatter 2 front  double bedroom"],
[106,"Carroll House sitting room"],
[107,"Carroll House bedroom"],
[108,"Carroll House upstairs bedroom"],
// rooms
[200,"Triumph Bed"],
[201,"Mad Hatter 4 bedroom"],
[202,"Tea ~ Coffee ~ Biscuits"],
[203,"Grifter Room"],
[204,"Triumph Room"],
[205,"Quiet country lanes"],
[206,"Riverside rest"],
[207,"Forest Views"],
[208,"Treckking in the forest"],
[209,"Tranquil river rest"],
[210,"Ponies grazing"],
[211,"Enjoying the woods"],
// other
[300,"Penny Farthing Lounge"],
[301,"Duchess Front"],
[303,"Carroll Patio"],
[304,"Yum yum!"],
[305,"Hotel Entrance"],
[306,"The Hotel"],
[307,"Tarts Court"],
[308,"Busy on our WIFI"],
[309,"Lazing in our garden"],
[310,"Parking for all!"],
[311,"Hotel Bar"],
// local
[400,"Stags in the woods"],
[401,"Cricket in the sun"],
[402,"Pony Trecking"],
[403,"Donkey"],
[404,"Thatched cottages"],
[405,"Pigs foraging"],
[406,"Tarts Court 3 Kitchenette"],
[407,"Golf"],
[408,"Yeeee Ha!"],
[409,"Tarts Court 3 fridge/kettle/toaster/microwave"],
[410,"Walking in the forest"],
[411,"The river Avon"]
];

// globals:
var timerid = 0;

// show the picture in a window.
function pic( img_index)
{
	var nm = "Penny Farthing Hotel";
	for( var i=0; i<titles.length; i++ ) {
		if( titles[i][0] == img_index ) {
			nm = titles[i][1];
		}
	}
	output_window(nm,img_index);
}

function output_window(title,ind)
{
	win = window.open('','mywindow', 'width=620,height=480');
	win.document.open();
	win.document.write('<?xml version="1.0" encoding="iso-8859-1"?>');
	win.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
	win.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
	win.document.write('<head><title>The Pennyfarthing Gallery</title>');
	win.document.write('<link href="/css/pfh.css" rel="stylesheet" type="text/css" />');
	win.document.write('<link href="/css/pfg.css" rel="stylesheet" type="text/css" />');
	win.document.write('<script language="javascript" type="text/javascript" src="/gallery.js" defer></script>');
	win.document.write('</head>');
	win.document.write('<body><div id="gallery2"><div id="blubar">'+title+'</div>');
	win.document.write('<img src="/img/g/'+ind+'.jpg" width="600" height="399" /></div>');
	win.document.write('<div id="gal_bttn"><a href="javascript:prev('+ind+');"><img src="/img/g/back_bttn.gif" /></a>');
	win.document.write('<a href="javascript:window.close();"><img src="/img/g/close_bttn.gif" /></a>');
	win.document.write('<a href="javascript:next('+ind+');"><img src="/img/g/fwd_bttn.gif" /></a></div>');
	win.document.write('</body></html>');
	win.document.close();
}

function play( img_index )
{
	timerid = setTimeout( "next(img_index)",7500);
}

function next( ind ) 
{
	var pos = 0;
	for( var i=0; i<titles.length; i++ ) {
		if( titles[i][0] == ind ) {
			pos = i;
		}
	}
	pos++;
	if( pos >= titles.length )
		pos = 0;
	pic(titles[pos][0]);
	clearTimeout( timerid );
}


function prev( ind )
{
	var pos = 0;
	for( var i=0; i<titles.length; i++ ) {
		if( titles[i][0] == ind ) {
			pos = i;
		}
	}
	pos--;
	if( pos < 0 )
		pos = (titles.length-1);
	pic(titles[pos][0]);
	clearTimeout( timerid );
}


