window.thumbnails = {};
															thumbnails[7363854] = clik.newPhoto({"id":7363854,"src":"LogoGSCS300x300px_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7363988] = clik.newPhoto({"id":7363988,"src":"GSCSOpen2010-Edit_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":77});
															thumbnails[6293424] = clik.newPhoto({"id":6293424,"src":"35684_131006573597625_10000_thumb.jpg","galleries_id":275826,"server_id":18,"link":"photo_6293424.html","width":130,"caption":"Carrick","height":98});
															thumbnails[6427590] = clik.newPhoto({"id":6427590,"src":"S1051088_thumb.jpg","galleries_id":275826,"server_id":18,"link":"photo_6427590.html","width":130,"caption":"Beattie<br>\r\n","height":98});
															thumbnails[6788845] = clik.newPhoto({"id":6788845,"src":"storm7months_thumb.jpg","galleries_id":275826,"server_id":18,"link":"photo_6788845.html","width":130,"caption":"Storm","height":87});
															thumbnails[6869945] = clik.newPhoto({"id":6869945,"src":"_ORK2758Cl_thumb.jpg","galleries_id":275826,"server_id":18,"link":"photo_6869945.html","width":130,"caption":"","height":86});
															thumbnails[8347213] = clik.newPhoto({"id":8347213,"src":"DSC_1991_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347213.html","width":130,"caption":"Centenary Pill Box","height":86});
															thumbnails[8347242] = clik.newPhoto({"id":8347242,"src":"DSC_1994_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347242.html","width":130,"caption":"Pewter Ring Brooch","height":86});
															thumbnails[8347259] = clik.newPhoto({"id":8347259,"src":"DSC_1995_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347259.html","width":130,"caption":"Letter Rack","height":86});
															thumbnails[8347260] = clik.newPhoto({"id":8347260,"src":"DSC_1996_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347260.html","width":130,"caption":"Letter Rack","height":86});
															thumbnails[8347262] = clik.newPhoto({"id":8347262,"src":"DSC_1997_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347262.html","width":130,"caption":"Cards","height":86});
															thumbnails[8347263] = clik.newPhoto({"id":8347263,"src":"DSC_2001_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347263.html","width":130,"caption":"Cards","height":86});
															thumbnails[8347264] = clik.newPhoto({"id":8347264,"src":"DSC_2002_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347264.html","width":130,"caption":"Cards","height":86});
															thumbnails[8347265] = clik.newPhoto({"id":8347265,"src":"DSC_2004_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347265.html","width":130,"caption":"Spoon","height":195});
															thumbnails[8347266] = clik.newPhoto({"id":8347266,"src":"DSC_2006_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347266.html","width":130,"caption":"Pen","height":86});
															thumbnails[8347268] = clik.newPhoto({"id":8347268,"src":"DSC_2007_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347268.html","width":130,"caption":"Pin","height":86});
															thumbnails[8347269] = clik.newPhoto({"id":8347269,"src":"DSC_2009_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347269.html","width":130,"caption":"Brooch","height":86});
															thumbnails[8347270] = clik.newPhoto({"id":8347270,"src":"DSC_2010_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347270.html","width":130,"caption":"Gordon Model","height":86});
															thumbnails[8347271] = clik.newPhoto({"id":8347271,"src":"DSC_2011_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347271.html","width":130,"caption":"Car Sticker","height":86});
															thumbnails[8347272] = clik.newPhoto({"id":8347272,"src":"DSC_2014_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347272.html","width":130,"caption":"Round Brooch","height":86});
															thumbnails[8347273] = clik.newPhoto({"id":8347273,"src":"DSC_2015_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347273.html","width":130,"caption":"Key Ring","height":86});
															thumbnails[8347281] = clik.newPhoto({"id":8347281,"src":"DSC_2016_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347281.html","width":130,"caption":"Ring Card Holder","height":86});
															thumbnails[8347308] = clik.newPhoto({"id":8347308,"src":"DSC_2017_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347308.html","width":130,"caption":"Ring Card Holders - Gordon Body Silver and Gold","height":86});
															thumbnails[8347331] = clik.newPhoto({"id":8347331,"src":"DSC_2018_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347331.html","width":130,"caption":"Credit Card Holder","height":86});
															thumbnails[8347332] = clik.newPhoto({"id":8347332,"src":"DSC_2019_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347332.html","width":130,"caption":"Zip Pull","height":86});
															thumbnails[8347333] = clik.newPhoto({"id":8347333,"src":"DSC_2020_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347333.html","width":130,"caption":"Picture Frames, Landscape and Portrait Orientation","height":86});
															thumbnails[8347334] = clik.newPhoto({"id":8347334,"src":"DSC_2021_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347334.html","width":130,"caption":"","height":86});
															thumbnails[8347336] = clik.newPhoto({"id":8347336,"src":"DSC_2022_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347336.html","width":130,"caption":"","height":86});
															thumbnails[8347337] = clik.newPhoto({"id":8347337,"src":"DSC_2023_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347337.html","width":130,"caption":"","height":86});
															thumbnails[8347338] = clik.newPhoto({"id":8347338,"src":"DSC_2024_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347338.html","width":130,"caption":"","height":195});
															thumbnails[8347339] = clik.newPhoto({"id":8347339,"src":"DSC_2025_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347339.html","width":130,"caption":"","height":86});
															thumbnails[8347342] = clik.newPhoto({"id":8347342,"src":"DSC_2026_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347342.html","width":130,"caption":"","height":86});
															thumbnails[8347343] = clik.newPhoto({"id":8347343,"src":"DSC_2027_thumb.jpg","galleries_id":443586,"server_id":18,"link":"photo_8347343.html","width":130,"caption":"","height":86});
															thumbnails[8774300] = clik.newPhoto({"id":8774300,"src":"GSCS_Open_show_Nov11_0051_thumb.JPG","galleries_id":275826,"server_id":18,"link":"photo_8774300.html","width":130,"caption":"Open Show Winners 2011","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[443586] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"gordon merchandise","link":"gallery_443586.html","maxRecords":0.0,"photoIDs":[8347213.0,8347242.0,8347259.0,8347260.0,8347262.0,8347263.0,8347264.0,8347265.0,8347266.0,8347268.0,8347269.0,8347270.0,8347271.0,8347272.0,8347273.0,8347281.0,8347308.0,8347331.0,8347332.0,8347333.0,8347334.0,8347336.0,8347337.0,8347338.0,8347339.0,8347342.0,8347343.0],"skipIndex":0,"section_code":"gallery","featured_images":"8347343,8347342,8347339,8347338,8347337,8347336,8347334,8347333,8347332,8347331","id":443586,"singleSection":false});				  						galleries[275826] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"gordon gallery","link":"gallery_275826.html","maxRecords":0.0,"photoIDs":[6293424.0,6427590.0,6788845.0,6869945.0,8774300.0],"skipIndex":0,"section_code":"gallery","featured_images":"8774300,6869945,6788845,6427590,6293424","id":275826,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6869945,6788845,6427590,6293424';
imageSets[3] = '8774300,8347343,8347342,8347339,8347338,8347337,8347336,8347334,8347333,8347332,8347331,8347308,8347281,8347273,8347272,8347271,8347270,8347269,8347268,8347266,8347265,8347264,8347263,8347262,8347260,8347259,8347242,8347213,7363988,7363854,6869945,6788845,6427590,6293424';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/thegscs/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/thegscs/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/thegscs/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 += '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:'',$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 = 'The Gordon Setter Club Of Scotland: ' + 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;
	}
}

			

