window.thumbnails = {};
															thumbnails[8291956] = clik.newPhoto({"id":8291956,"src":"seeing_logo123456_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":160,"caption":"","height":42});
															thumbnails[8304059] = clik.newPhoto({"id":8304059,"src":"Pumpkins_IMG_0510_thumb.jpg","galleries_id":441257,"server_id":5,"link":"photo_8304059.html","width":128,"caption":"","height":170});
															thumbnails[8821641] = clik.newPhoto({"id":8821641,"src":"Fishing_Hut_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8821641.html","width":160,"caption":"","height":120});
															thumbnails[8297496] = clik.newPhoto({"id":8297496,"src":"Millenium_Bridge_and_St_Pauls_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8297496.html","width":160,"caption":"","height":120});
															thumbnails[8293064] = clik.newPhoto({"id":8293064,"src":"WSBK_2011_thumb.jpg","galleries_id":201350,"server_id":5,"link":"photo_8293064.html","width":160,"caption":"","height":120});
															thumbnails[8292797] = clik.newPhoto({"id":8292797,"src":"Blue_Wood1_thumb.jpg","galleries_id":441257,"server_id":5,"link":"photo_8292797.html","width":160,"caption":"","height":120});
															thumbnails[8821468] = clik.newPhoto({"id":8821468,"src":"Bamburgh_Sunrise_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8821468.html","width":160,"caption":"","height":120});
															thumbnails[8821525] = clik.newPhoto({"id":8821525,"src":"Arc_of_Canoes_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8821525.html","width":160,"caption":"","height":94});
															thumbnails[8297607] = clik.newPhoto({"id":8297607,"src":"Halfords_Tour_Race_01_thumb.jpg","galleries_id":201350,"server_id":5,"link":"photo_8297607.html","width":160,"caption":"","height":120});
															thumbnails[8292810] = clik.newPhoto({"id":8292810,"src":"Abstract_Trees_thumb.jpg","galleries_id":441257,"server_id":5,"link":"photo_8292810.html","width":160,"caption":"","height":120});
															thumbnails[8821528] = clik.newPhoto({"id":8821528,"src":"Dunstanburgh_Castle_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8821528.html","width":160,"caption":"","height":120});
															thumbnails[8292925] = clik.newPhoto({"id":8292925,"src":"WSBK_Suzuki_2011_thumb.jpg","galleries_id":201350,"server_id":5,"link":"photo_8292925.html","width":160,"caption":"","height":120});
															thumbnails[8297698] = clik.newPhoto({"id":8297698,"src":"Swan_On_River_Wey_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8297698.html","width":160,"caption":"","height":67});
															thumbnails[8304108] = clik.newPhoto({"id":8304108,"src":"Rust_and_Stone_IMG_0909_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8304108.html","width":160,"caption":"","height":120});
															thumbnails[8292923] = clik.newPhoto({"id":8292923,"src":"London_Docklands_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8292923.html","width":160,"caption":"","height":120});
															thumbnails[8293193] = clik.newPhoto({"id":8293193,"src":"Lake_Vyrnwy_Sunset12_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8293193.html","width":160,"caption":"","height":120});
															thumbnails[8304613] = clik.newPhoto({"id":8304613,"src":"Rocks_and_Sea_IMG_1010_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8304613.html","width":160,"caption":"","height":120});
															thumbnails[8292921] = clik.newPhoto({"id":8292921,"src":"Orchid_Interior_thumb.jpg","galleries_id":441257,"server_id":5,"link":"photo_8292921.html","width":128,"caption":"","height":170});
															thumbnails[8420604] = clik.newPhoto({"id":8420604,"src":"Grasses_IMG_1637_thumb.jpg","galleries_id":441257,"server_id":5,"link":"photo_8420604.html","width":128,"caption":"","height":170});
															thumbnails[8292912] = clik.newPhoto({"id":8292912,"src":"Groins_at_Exmouth_1_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8292912.html","width":128,"caption":"","height":170});
															thumbnails[8293075] = clik.newPhoto({"id":8293075,"src":"Beach_Avenue_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8293075.html","width":160,"caption":"","height":106});
															thumbnails[8304782] = clik.newPhoto({"id":8304782,"src":"Stream_over_rock_IMG_1509_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8304782.html","width":128,"caption":"","height":170});
															thumbnails[8304659] = clik.newPhoto({"id":8304659,"src":"Frozen_Squabmoor_IMG_1018_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8304659.html","width":160,"caption":"","height":72});
															thumbnails[8387753] = clik.newPhoto({"id":8387753,"src":"Water_Lily_01_IMG_1652_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8387753.html","width":128,"caption":"","height":170});
															thumbnails[8293948] = clik.newPhoto({"id":8293948,"src":"Exmouth_Sea_Front_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8293948.html","width":128,"caption":"","height":170});
															thumbnails[8292965] = clik.newPhoto({"id":8292965,"src":"Leaf_and_Water_thumb.jpg","galleries_id":187376,"server_id":5,"link":"photo_8292965.html","width":160,"caption":"","height":120});
															thumbnails[8297570] = clik.newPhoto({"id":8297570,"src":"Misty_Winter_Morning_Horsell_Common_IMG_0650_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8297570.html","width":128,"caption":"","height":170});
															thumbnails[8292782] = clik.newPhoto({"id":8292782,"src":"Boats_Lake_Vyrnwy_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8292782.html","width":160,"caption":"","height":120});
															thumbnails[8293160] = clik.newPhoto({"id":8293160,"src":"Lake_Vyrnwy_evening12_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8293160.html","width":160,"caption":"","height":120});
															thumbnails[8293347] = clik.newPhoto({"id":8293347,"src":"Topsham_Boats_thumb.jpg","galleries_id":187375,"server_id":5,"link":"photo_8293347.html","width":112,"caption":"","height":170});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[187375] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Landscapes","link":"section231979_187375.html","maxRecords":0.0,"photoIDs":[8297496.0,8821468.0,8821528.0,8292923.0,8293193.0,8293075.0,8304659.0,8293948.0,8297570.0,8292782.0,8293160.0,8293347.0],"skipIndex":0,"section_code":"section231979","featured_images":"8821468,8297496,8293193,8293160,8292923,8292782","id":187375,"singleSection":false});				  						galleries[187376] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Inner landscapes","link":"section231979_187376.html","maxRecords":0.0,"photoIDs":[8821641.0,8821525.0,8297698.0,8304108.0,8304613.0,8292912.0,8304782.0,8387753.0,8292965.0],"skipIndex":0,"section_code":"section231979","featured_images":"8304613,8304108,8292965","id":187376,"singleSection":false});				  						galleries[441257] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Abstracts and details","link":"section231979_441257.html","maxRecords":0.0,"photoIDs":[8304059.0,8292797.0,8292810.0,8292921.0,8420604.0],"skipIndex":0,"section_code":"section231979","featured_images":8292797.0,"id":441257,"singleSection":false});				  						galleries[201350] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Miscellaneous","link":"section231979_201350.html","maxRecords":0.0,"photoIDs":[8293064.0,8297607.0,8292925.0],"skipIndex":0,"section_code":"section231979","featured_images":"8297607,8292925","id":201350,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8297496,8821468,8304108,8293075,8292965,8293160';
imageSets[2] = '8297496,8292797,8821468,8297607,8292925,8304108,8292923,8304613,8293193,8292965,8292782,8293160';
imageSets[3] = '8297607';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/petercook80/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/petercook80/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/petercook80/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 || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'section231979.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 && 'section231979' != '') {
					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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Landscape Photography by Peter Cook: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

