window.thumbnails = {};
															thumbnails[4878023] = clik.newPhoto({"id":4878023,"src":"G_G_Logo_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":162});
															thumbnails[4976898] = clik.newPhoto({"id":4976898,"src":"IMG_3000_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Brighton Pride","height":173});
															thumbnails[5205104] = clik.newPhoto({"id":5205104,"src":"Kiltied_with_Pride_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_5205104.html","width":130,"caption":"Kilted with Pride","height":89});
															thumbnails[4878037] = clik.newPhoto({"id":4878037,"src":"GGs_action_demo_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4878037.html","width":130,"caption":"Dancing  'J B Milne' ","height":87});
															thumbnails[5007354] = clik.newPhoto({"id":5007354,"src":"Gay_Geilidh_08-1_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5007354.html","width":130,"caption":" 'Geilidh' 2008","height":98});
															thumbnails[5527760] = clik.newPhoto({"id":5527760,"src":"DSC_0058_thumb.jpeg","galleries_id":313147,"server_id":18,"link":"photo_5527760.html","width":130,"caption":"a first time dancer partnered by Adrian","height":99});
															thumbnails[5594996] = clik.newPhoto({"id":5594996,"src":"IMG_7592_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594996.html","width":130,"caption":"Ame Lame the host of 'Duckie'","height":173});
															thumbnails[6539522] = clik.newPhoto({"id":6539522,"src":"4834159318_c1fb7d08c8_thumb.jpg","galleries_id":359299,"server_id":18,"link":"photo_6539522.html","width":130,"caption":"The Gay Gordons' Piper London Pride 2010 ","height":164});
															thumbnails[7327082] = clik.newPhoto({"id":7327082,"src":"ISLINGTON_15_thumb.jpg","galleries_id":396450,"server_id":18,"link":"photo_7327082.html","width":130,"caption":"Glassworks Islington.","height":86});
															thumbnails[7850045] = clik.newPhoto({"id":7850045,"src":"Group-2c_thumb.jpeg","galleries_id":281376,"server_id":18,"link":"photo_7850045.html","width":130,"caption":"Laurieston Dance Week 2011","height":94});
															thumbnails[5201870] = clik.newPhoto({"id":5201870,"src":"RS01_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5201870.html","width":130,"caption":"Geilidh 2009","height":91});
															thumbnails[5527773] = clik.newPhoto({"id":5527773,"src":"DSC_0060_2_thumb.jpg","galleries_id":313147,"server_id":18,"link":"photo_5527773.html","width":130,"caption":"Turning under arm in the Gay Gordons.","height":93});
															thumbnails[5594923] = clik.newPhoto({"id":5594923,"src":"GGs_February_2010_003_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594923.html","width":130,"caption":"Arthur , Piper to The Gay Gordons","height":173});
															thumbnails[6060173] = clik.newPhoto({"id":6060173,"src":"L2010_thumb.jpg","galleries_id":281376,"server_id":18,"link":"photo_6060173.html","width":130,"caption":"Laurieston Dance Week 2010","height":98});
															thumbnails[6310841] = clik.newPhoto({"id":6310841,"src":"Pride10_thumb.jpg","galleries_id":359299,"server_id":18,"link":"photo_6310841.html","width":130,"caption":"London Pride 2010","height":98});
															thumbnails[7327083] = clik.newPhoto({"id":7327083,"src":"ISLINGTON_2_thumb.jpg","galleries_id":396450,"server_id":18,"link":"photo_7327083.html","width":130,"caption":" ","height":87});
															thumbnails[4890806] = clik.newPhoto({"id":4890806,"src":"LauriestonWeb_thumb.jpg","galleries_id":281376,"server_id":18,"link":"photo_4890806.html","width":130,"caption":"Lauriesron Week May 2009","height":89});
															thumbnails[4991286] = clik.newPhoto({"id":4991286,"src":"AdamsParty_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4991286.html","width":130,"caption":"Thames Riverboat Ceilidh","height":98});
															thumbnails[5007355] = clik.newPhoto({"id":5007355,"src":"dance_in_park_09-1_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_5007355.html","width":130,"caption":"Pic-nic in the Park with RSCDS London","height":94});
															thumbnails[5201874] = clik.newPhoto({"id":5201874,"src":"RS02_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5201874.html","width":130,"caption":2009.0,"height":90});
															thumbnails[5527770] = clik.newPhoto({"id":5527770,"src":"DSC_0056_2_thumb.jpg","galleries_id":313147,"server_id":18,"link":"photo_5527770.html","width":130,"caption":"Roy dancing with a new partner","height":98});
															thumbnails[5594998] = clik.newPhoto({"id":5594998,"src":"IMG_7631_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594998.html","width":130,"caption":"Roy dancing the Highland Fling","height":195});
															thumbnails[6539523] = clik.newPhoto({"id":6539523,"src":"4834160496_957f559263_thumb.jpg","galleries_id":359299,"server_id":18,"link":"photo_6539523.html","width":130,"caption":"London Pride 2010","height":184});
															thumbnails[7327086] = clik.newPhoto({"id":7327086,"src":"ISLINGTON_3_thumb.jpg","galleries_id":396450,"server_id":18,"link":"photo_7327086.html","width":130,"caption":"Piping the Haggis","height":195});
															thumbnails[5039245] = clik.newPhoto({"id":5039245,"src":"Roy_GGs_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_5039245.html","width":130,"caption":"London Pride 2009","height":87});
															thumbnails[5201945] = clik.newPhoto({"id":5201945,"src":"RS04_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5201945.html","width":130,"caption":2009.0,"height":98});
															thumbnails[5594798] = clik.newPhoto({"id":5594798,"src":"DSC_0019_thumb.jpg","galleries_id":313147,"server_id":18,"link":"photo_5594798.html","width":130,"caption":"Intermediate class 4 hands across","height":84});
															thumbnails[5594927] = clik.newPhoto({"id":5594927,"src":"GGs_February_2010_005_2_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594927.html","width":130,"caption":"Highland Schottische opening of the performance","height":98});
															thumbnails[6060334] = clik.newPhoto({"id":6060334,"src":"medfire_thumb.jpg","galleries_id":281376,"server_id":18,"link":"photo_6060334.html","width":130,"caption":"Around the campfire 2010","height":87});
															thumbnails[6285230] = clik.newPhoto({"id":6285230,"src":"IMG_1055_thumb.jpg","galleries_id":359299,"server_id":18,"link":"photo_6285230.html","width":130,"caption":"London Pride 2010","height":97});
															thumbnails[4890809] = clik.newPhoto({"id":4890809,"src":"demoWebedit_thumb.jpg","galleries_id":281376,"server_id":18,"link":"photo_4890809.html","width":130,"caption":"Laurieston 2009 Cabaret Night demo team ","height":98});
															thumbnails[4976894] = clik.newPhoto({"id":4976894,"src":"IMG_3001_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4976894.html","width":130,"caption":"Brighton Pride","height":98});
															thumbnails[5147145] = clik.newPhoto({"id":5147145,"src":"PICT1434_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5147145.html","width":130,"caption":2009.0,"height":98});
															thumbnails[5594803] = clik.newPhoto({"id":5594803,"src":"DSC_0026_thumb.jpg","galleries_id":313147,"server_id":18,"link":"photo_5594803.html","width":130,"caption":"Highland Fling Class","height":87});
															thumbnails[5594940] = clik.newPhoto({"id":5594940,"src":"IMG_7659_2_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594940.html","width":130,"caption":"A Grand Chain","height":87});
															thumbnails[4976899] = clik.newPhoto({"id":4976899,"src":"IMG_3002_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4976899.html","width":130,"caption":"Brighton Pride","height":98});
															thumbnails[5201883] = clik.newPhoto({"id":5201883,"src":"RS03_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_5201883.html","width":130,"caption":2009.0,"height":98});
															thumbnails[5594934] = clik.newPhoto({"id":5594934,"src":"IMG_7646_2_thumb.jpg","galleries_id":317279,"server_id":18,"link":"photo_5594934.html","width":130,"caption":"Six hands round in the Reel of the 51st Division","height":87});
															thumbnails[7105924] = clik.newPhoto({"id":7105924,"src":"551_n_thumb.jpg","galleries_id":293716,"server_id":18,"link":"photo_7105924.html","width":130,"caption":"5th Birthday 'Geilidh' 2010","height":98});
															thumbnails[4976892] = clik.newPhoto({"id":4976892,"src":"IMG_2728_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4976892.html","width":130,"caption":"Dancers at Rome Pride, Italy.","height":98});
															thumbnails[6342664] = clik.newPhoto({"id":6342664,"src":"walkers1_n_3_thumb.jpeg","galleries_id":278308,"server_id":18,"link":"photo_6342664.html","width":130,"caption":" Walk for Life","height":94});
															thumbnails[6138531] = clik.newPhoto({"id":6138531,"src":"29911_413785088374_650398374_4271409_4304719_n_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_6138531.html","width":130,"caption":"Dancing at Walk for Life.","height":98});
															thumbnails[4878059] = clik.newPhoto({"id":4878059,"src":"Picture_013_thumb.jpg","galleries_id":278308,"server_id":18,"link":"photo_4878059.html","width":130,"caption":"Cornwall Pride 2009","height":109});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[396450] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Glassworks Burns Supper","link":"gallery_396450.html","maxRecords":0.0,"photoIDs":[7327082.0,7327083.0,7327086.0],"skipIndex":0,"section_code":"gallery","featured_images":"7327086,7327083,7327082","id":396450,"singleSection":false});				  						galleries[278308] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"gallery_278308.html","maxRecords":0.0,"photoIDs":[5205104.0,4878037.0,4991286.0,5007355.0,5039245.0,4976894.0,4976899.0,4976892.0,6342664.0,6138531.0,4878059.0],"skipIndex":0,"section_code":"gallery","featured_images":4878037.0,"id":278308,"singleSection":false});				  						galleries[293716] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gay Gordons  'Geilidh' ","link":"gallery_293716.html","maxRecords":0.0,"photoIDs":[5007354.0,5201870.0,5201874.0,5201945.0,5147145.0,5201883.0,7105924.0],"skipIndex":0,"section_code":"gallery","featured_images":5201874.0,"id":293716,"singleSection":false});				  						galleries[313147] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Class nights","link":"gallery_313147.html","maxRecords":0.0,"photoIDs":[5527760.0,5527773.0,5527770.0,5594798.0,5594803.0],"skipIndex":0,"section_code":"gallery","featured_images":"5594803,5594798,5527773,5527770,5527760","id":313147,"singleSection":false});				  						galleries[281376] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Laurieston","link":"gallery_281376.html","maxRecords":0.0,"photoIDs":[7850045.0,6060173.0,4890806.0,6060334.0,4890809.0],"skipIndex":0,"section_code":"gallery","featured_images":7850045.0,"id":281376,"singleSection":false});				  						galleries[359299] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"London Gay Pride 2010","link":"gallery_359299.html","maxRecords":0.0,"photoIDs":[6539522.0,6310841.0,6539523.0,6285230.0],"skipIndex":0,"section_code":"gallery","featured_images":"6539523,6539522,6310841,6285230","id":359299,"singleSection":false});				  						galleries[317279] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"DUCKIE ","link":"gallery_317279.html","maxRecords":0.0,"photoIDs":[5594996.0,5594923.0,5594998.0,5594927.0,5594940.0,5594934.0],"skipIndex":0,"section_code":"gallery","featured_images":"5594998,5594996,5594940,5594934,5594927,5594923","id":317279,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5205104,4878023,7850045,6539522,4878037,6310841,5594934';
imageSets[2] = '7850045,4878037,5201874';
imageSets[3] = '7850045,6060173,4890806,6060334,4890809';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/strathspey/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/strathspey/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/strathspey/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 Gay Gordons: ' + 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;
	}
}

			

