window.thumbnails = new Object();
												thumbnails[1732486] = new thumbnail(1732486,'','','cecilsharpposter_thumb.jpg',130, 168,1,'							photo_1732486.html');
												thumbnails[2146518] = new thumbnail(2146518,'','Stevenage Sword personnel 1978','bs_stevenage_sword_characters_1978_thumb.jpg',130, 130,1,'							photo_2146518.html');
												thumbnails[1732728] = new thumbnail(1732728,'116422','Wokko on May morning','01_bs_wokko_ickwell_may_day_thumb.jpg',130, 195,1,'							photo_1732728.html');
												thumbnails[1734433] = new thumbnail(1734433,'116422','Ickwell Maypole','02_bs_maypole_ickwell_thumb.jpg',130, 195,1,'							photo_1734433.html');
												thumbnails[1733020] = new thumbnail(1733020,'116422','May Carol','03_bs_mum_johnstone_ickwell_thumb.jpg',130, 87,1,'							photo_1733020.html');
												thumbnails[1732819] = new thumbnail(1732819,'116422','May Morning sunrise<br>\r\n','04_bs_the_rose_ickwell_thumb.jpg',130, 87,1,'							photo_1732819.html');
												thumbnails[1734604] = new thumbnail(1734604,'116422','Ickwell May Day','05_bs_country_dancing_ickwell_thumb.jpg',130, 87,1,'							photo_1734604.html');
												thumbnails[1734500] = new thumbnail(1734500,'116422','Ickwell May Cake<br>\r\n','06_bs_may_cake_ickwell_thumb.jpg',130, 87,1,'							photo_1734500.html');
												thumbnails[1732985] = new thumbnail(1732985,'116422','Three Fools','07_bs_three_fools_ickwell_thumb.jpg',130, 87,1,'							photo_1732985.html');
												thumbnails[1734849] = new thumbnail(1734849,'116422','Morris Bells','08_bs_bells_thumb.jpg',130, 195,1,'							photo_1734849.html');
												thumbnails[1732823] = new thumbnail(1732823,'116422','Sunday church procession','09_bs_church_procession_thaxted_thumb.jpg',130, 87,1,'							photo_1732823.html');
												thumbnails[1738536] = new thumbnail(1738536,'116422','Sunday mass','10_bs_thaxted_church_thumb.jpg',130, 195,1,'							photo_1738536.html');
												thumbnails[1732817] = new thumbnail(1732817,'116422','Garland Dance','11_bs_hoop_dance_thaxted_thumb.jpg',130, 87,1,'							photo_1732817.html');
												thumbnails[1738532] = new thumbnail(1738532,'116422','Margaret Hunter & Morris Sunderland','12_bs_margaret_morris_thumb.jpg',130, 195,1,'							photo_1738532.html');
												thumbnails[1735910] = new thumbnail(1735910,'116422','Thaxted church','13_bs_thaxted_church_thumb.jpg',130, 195,1,'							photo_1735910.html');
												thumbnails[1735947] = new thumbnail(1735947,'116422','Thaxted couple','14_bs_thaxted_couple_thumb.jpg',130, 87,1,'							photo_1735947.html');
												thumbnails[1758834] = new thumbnail(1758834,'116422','Offley Morris','15_bs_knebworth_offley_thumb.jpg',130, 195,1,'							photo_1758834.html');
												thumbnails[1737743] = new thumbnail(1737743,'116422','Morris and Deer','16_bs_offley_deer_thumb.jpg',130, 87,1,'							photo_1737743.html');
												thumbnails[1735632] = new thumbnail(1735632,'116422','Bacup','17_bs_bacup2_thumb.jpg',130, 195,1,'							photo_1735632.html');
												thumbnails[1735534] = new thumbnail(1735534,'116422','The Nutters','18_bs_bacup_thumb.jpg',130, 87,1,'							photo_1735534.html');
												thumbnails[1735630] = new thumbnail(1735630,'116422','Coco-nuts','19_bs_bacup_thumb.jpg',130, 195,1,'							photo_1735630.html');
												thumbnails[1735537] = new thumbnail(1735537,'116422','Silver badge','20_bs_badge_thumb.jpg',130, 195,1,'							photo_1735537.html');
												thumbnails[1738682] = new thumbnail(1738682,'116422','Abbots Bromley','21_bs_characters_abbots_bromley_thumb.jpg',130, 195,1,'							photo_1738682.html');
												thumbnails[1738177] = new thumbnail(1738177,'116422','Horndancers procession','22_bs_procession_abbots_bromley_thumb.jpg',130, 87,1,'							photo_1738177.html');
												thumbnails[1738688] = new thumbnail(1738688,'116422','Abbots Bromley Horndance','23_bs_abbots_bromley_horndance_thumb.jpg',130, 195,1,'							photo_1738688.html');
												thumbnails[1738174] = new thumbnail(1738174,'116422','Lady Bagot','24_bs_lady_bagot_abbots_bromley_thumb.jpg',130, 87,1,'							photo_1738174.html');
												thumbnails[1732418] = new thumbnail(1732418,'116422','Abbots Bromley Jester','25_bs_jester_abbots_bromley_thumb.jpg',130, 87,1,'							photo_1732418.html');
												thumbnails[1738053] = new thumbnail(1738053,'116422','Street dance','26_bs_street_abbots_bromley_thumb.jpg',130, 87,1,'							photo_1738053.html');
												thumbnails[1738518] = new thumbnail(1738518,'116422','Clog dancer','27_bs_clog_bumpstead_thumb.jpg',130, 195,1,'							photo_1738518.html');
												thumbnails[1734250] = new thumbnail(1734250,'116422','John O\'Gaunt','28_bs_john_o\'gaunt_finchingfield_thumb.jpg',130, 195,1,'							photo_1734250.html');
												thumbnails[1737031] = new thumbnail(1737031,'116422','Thaxted leap','29_bs_thaxted_leap_thumb.jpg',130, 195,1,'							photo_1737031.html');
												thumbnails[1738526] = new thumbnail(1738526,'116422','Procession at Thaxted','30_bs_procession_thaxted_thumb.jpg',130, 195,1,'							photo_1738526.html');
												thumbnails[1758714] = new thumbnail(1758714,'116422','Lord Conyers','31_bs_conyers_thaxted_thumb.jpg',130, 87,1,'							photo_1758714.html');
												thumbnails[1738411] = new thumbnail(1738411,'116422','Massed dancing','32_bs_massed_thaxted_thumb.jpg',130, 87,1,'							photo_1738411.html');
												thumbnails[1735539] = new thumbnail(1735539,'116422','Dancer\'s clogs','33_bs_clogs_thumb.jpg',130, 195,1,'							photo_1735539.html');
												thumbnails[1735541] = new thumbnail(1735541,'116422','Thaxted banner','34_bs_thaxted_banner_thumb.jpg',130, 195,1,'							photo_1735541.html');
												thumbnails[1732726] = new thumbnail(1732726,'116422','Bath City Morris','35_bs_cecil_sharp_house_thumb.jpg',130, 195,1,'							photo_1732726.html');
												thumbnails[1738059] = new thumbnail(1738059,'116422','Retired dancer','36_bs_geoff_lester_thumb.jpg',130, 87,1,'							photo_1738059.html');
												thumbnails[1734252] = new thumbnail(1734252,'116422','Young dancers','37_bs_young_dancers_thumb.jpg',130, 87,1,'							photo_1734252.html');
												thumbnails[1732714] = new thumbnail(1732714,'116422','Cecil Sharp House','38_bs_cecil_sharp_house_thumb.jpg',130, 87,1,'							photo_1732714.html');
												thumbnails[1738060] = new thumbnail(1738060,'116422','Morris baby','39_bs_baby_thumb.jpg',130, 87,1,'							photo_1738060.html');
												thumbnails[1733017] = new thumbnail(1733017,'116422','Bonny Green Garters','40_bs_bonny_green_garters_thaxted_thumb.jpg',130, 190,1,'							photo_1733017.html');
												thumbnails[1732635] = new thumbnail(1732635,'116437','Bill Tidy drew the cartoon','billtidycartoon_thumb.jpg',130, 254,1,'							photo_1732635.html');
												thumbnails[1732637] = new thumbnail(1732637,'116437','Observer Magazine','Observer_Magazine_thumb.jpg',130, 86,1,'							photo_1732637.html');
												thumbnails[1739230] = new thumbnail(1739230,'116437','Hertfordshire Countryside','hertscountrysidejune1978p_thumb.jpg',130, 90,1,'							photo_1739230.html');
												thumbnails[1736238] = new thumbnail(1736238,'116437','One Man\'s Morris on tour','OMM on tour 02_thumb.jpg',130, 51,1,'							photo_1736238.html');
												thumbnails[1733175] = new thumbnail(1733175,'116462','Morris Sunderland with Thaxted Morris 1976','101_bs_thaxted_morris_1976_thumb.jpg',130, 130,1,'							photo_1733175.html');
												thumbnails[1752159] = new thumbnail(1752159,'116462','Bampton Morris, Oxfordshire, Whit Monday 1979','bs_bampton_whit_monday_thumb.jpg',130, 87,1,'							photo_1752159.html');
												thumbnails[1752161] = new thumbnail(1752161,'116462','Bampton Morris, Whit Monday 1979','bs_bampton_morris_whit_monday_thumb.jpg',130, 195,1,'							photo_1752161.html');
												thumbnails[1752167] = new thumbnail(1752167,'116462','Padstow Oss dance, Cornwall, May Day 1979','bs_padstow_oss_dance_thumb.jpg',130, 87,1,'							photo_1752167.html');
												thumbnails[1752177] = new thumbnail(1752177,'116462','Padstow Oss, May Day 1979','bs_padstow_oss_thumb.jpg',130, 87,1,'							photo_1752177.html');
												thumbnails[1738685] = new thumbnail(1738685,'116462','Sword Dance 1977','31_bs_black_cap_thaxted_thumb.jpg',130, 87,1,'							photo_1738685.html');
												thumbnails[1759012] = new thumbnail(1759012,'116462','Offley Ring Meeting 1978','bs_ashwell_ring_thumb.jpg',130, 87,1,'							photo_1759012.html');
												thumbnails[1737754] = new thumbnail(1737754,'116462','Knebworth House 1975','15_bs_offley_knebworth_thumb.jpg',130, 87,1,'							photo_1737754.html');
												thumbnails[1759364] = new thumbnail(1759364,'116462','Morris Sunderland 1976','bs_morris_london_thumb.jpg',130, 87,1,'							photo_1759364.html');
												thumbnails[1759415] = new thumbnail(1759415,'116462','Thaxted night 1977','bs_night_thaxted_thumb.jpg',130, 195,1,'							photo_1759415.html');
												thumbnails[2146449] = new thumbnail(2146449,'116462','Morris Sunderland','111_bs_morris_sunderland_1978_thumb.jpg',130, 130,1,'							photo_2146449.html');
												thumbnails[2146451] = new thumbnail(2146451,'116462','Stevenage Sword','bs_stevenage_sword_tat_suits_1978_thumb.jpg',130, 130,1,'							photo_2146451.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  	  					galleries[116422] = new gallery(116422,'1732714','One Man\'s Morris ','gallery',[1732728,1734433,1733020,1732819,1734604,1734500,1732985,1734849,1732823,1738536,1732817,1738532,1735910,1735947,1758834,1737743,1735632,1735534,1735630,1735537,1738682,1738177,1738688,1738174,1732418,1738053,1738518,1734250,1737031,1738526,1758714,1738411,1735539,1735541,1732726,1738059,1734252,1732714,1738060,1733017],0, 0, '', '																																																																																														gallery.html',0,1);
				  	  					galleries[116437] = new gallery(116437,'1732635','Cuttings','section152368',[1732635,1732637,1739230,1736238],0, 0, '', '																																																																																														section152368.html',0,1);
				  	  					galleries[116462] = new gallery(116462,'2146451,2146449,1759415,1759364,1759012,1752177,1752167,1752161,1752159,1738685','Extras','section152373',[1733175,1752159,1752161,1752167,1752177,1738685,1759012,1737754,1759364,1759415,2146449,2146451],0, 0, '', '																																																																																														section152373.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1737743,1735534,1732817,1732418';
imageSets[2] = '1732714,1732635';
imageSets[3] = '1737743,1735534';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/billsmith/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/billsmith/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/billsmith/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/billsmith/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/billsmith/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/billsmith/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('');
		if (!basic) {
	img.src = photos[imageID].src;
	img.width = photos[imageID].width;
	img.height = photos[imageID].height;
  img.parentNode.title = img.alt = photos[imageID].caption;
	}
	else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
				
	}
			}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}
/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
  var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
		if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
    
  updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
  var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
      op = $.extend({},defaults,options),
      html = '', temp = '',
      photoId = op.nextPhoto.id,
      photoCaption = op.nextPhoto.caption,
      photoSrc = op.nextPhoto.src;
		
		if (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    if (op.$photo.length > 0) {
      html = $('<img/>',{
        'class': 'mainphoto photo',
        src: photoSrc,
        id: 'mainPic',
        name: 'mainPic',
        width: op.nextPhoto.width,
        height: op.nextPhoto.height,
        alt: photoCaption,
        css: op.css || {}
      });
      if (op.href) {
      	if (op.href.match(/<a/)) {
      	  html = $(op.href).append(html);
      	} else {
		  html = $('<a/>', {
			href: op.href,
			title: photoCaption
		  }).append(html);
	    }
      } else {
      	html = $('<a/>', {
			title: photoCaption
		  }).append(html);
      }
      if (op.speed == 0) {        op.$photo.html(html);        if (op.onBefore) {          op.onBefore.apply(op.$photo);        }        if (op.onAfter) {          op.onAfter.apply(op.$photo);        }      } else {        op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){            if (op.onAfter) {		    op.onAfter.apply(this);          }		  clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'One Man\'s Morris: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 				&pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>PRINTS AVAILABLE</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

