window.thumbnails = {};
thumbnails[8341890] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8341890,"server_id":31,"src":"chzoeAIP1_thumb.jpg","galleries_id":"","width":130});
thumbnails[8341893] = clik.newPhoto({"link":"#","caption":"","height":124,"id":8341893,"server_id":31,"src":"webflowerlion_thumb.jpg","galleries_id":"","width":130});
thumbnails[8341896] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8341896,"server_id":31,"src":"webgangfarm_thumb.jpg","galleries_id":"","width":130});
thumbnails[8921628] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8921628,"server_id":31,"src":"kidsweb_thumb.jpg","galleries_id":"","width":130});
thumbnails[7315035] = clik.newPhoto({"link":"photo_7315035.html","caption":"Chapter 5","height":87,"id":7315035,"server_id":31,"src":"Chapter_5_2_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[7332523] = clik.newPhoto({"link":"photo_7332523.html","caption":"'Chapter 2'","height":124,"id":7332523,"server_id":31,"src":"Chapter_2_2_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[7341457] = clik.newPhoto({"link":"photo_7341457.html","caption":"'Chapter 3'","height":130,"id":7341457,"server_id":31,"src":"webChapter_3_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[7341469] = clik.newPhoto({"link":"photo_7341469.html","caption":"'Chapter 7'","height":131,"id":7341469,"server_id":31,"src":"webChapter_7_3_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[7341526] = clik.newPhoto({"link":"photo_7341526.html","caption":"'Chapter 7'","height":130,"id":7341526,"server_id":31,"src":"webChapter_7_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[8099002] = clik.newPhoto({"link":"photo_8099002.html","caption":"Journey","height":130,"id":8099002,"server_id":31,"src":"journey_thumb.jpg","galleries_id":395681,"width":130});
thumbnails[8099003] = clik.newPhoto({"link":"photo_8099003.html","caption":"Untitled","height":129,"id":8099003,"server_id":31,"src":"Leyla_Folwell_2008_05_small_thumb.jpg","galleries_id":395681,"width":130});
thumbnails[9146822] = clik.newPhoto({"link":"photo_9146822.html","caption":"'Chapter 5'","height":131,"id":9146822,"server_id":31,"src":"Ch5for_web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[9147110] = clik.newPhoto({"link":"photo_9147110.html","caption":"'Chapter 3'","height":129,"id":9147110,"server_id":31,"src":"ch3web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[9147124] = clik.newPhoto({"link":"photo_9147124.html","caption":"'Chapter 1'","height":130,"id":9147124,"server_id":31,"src":"ch1web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[9147157] = clik.newPhoto({"link":"photo_9147157.html","caption":"'Chapter 8'","height":129,"id":9147157,"server_id":31,"src":"chp8web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[9147176] = clik.newPhoto({"link":"photo_9147176.html","caption":"","height":129,"id":9147176,"server_id":31,"src":"ch7web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[9147181] = clik.newPhoto({"link":"photo_9147181.html","caption":"","height":87,"id":9147181,"server_id":31,"src":"MARINE_UNI.web_1_thumb.jpg","galleries_id":395680,"width":130});
thumbnails[7340805] = clik.newPhoto({"link":"photo_7340805.html","caption":"tomatoes","height":130,"id":7340805,"server_id":31,"src":"webtomsonplate_thumb.jpg","galleries_id":430713,"width":130});
thumbnails[7341390] = clik.newPhoto({"link":"photo_7341390.html","caption":"Geoff's Boat","height":130,"id":7341390,"server_id":31,"src":"webgeoffsboat_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[7776231] = clik.newPhoto({"link":"photo_7776231.html","caption":"Neighbour","height":128,"id":7776231,"server_id":31,"src":"Neighbour_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[7776674] = clik.newPhoto({"link":"photo_7776674.html","caption":"Goose","height":125,"id":7776674,"server_id":31,"src":"goose_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[7776771] = clik.newPhoto({"link":"photo_7776771.html","caption":"100 years","height":131,"id":7776771,"server_id":31,"src":"100years_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[7776774] = clik.newPhoto({"link":"photo_7776774.html","caption":"Swift Horse","height":126,"id":7776774,"server_id":31,"src":"swift_horse_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[8614086] = clik.newPhoto({"link":"photo_8614086.html","caption":"Birds 1","height":130,"id":8614086,"server_id":31,"src":"2birds_thumb.jpg","galleries_id":397366,"width":130});
thumbnails[7543247] = clik.newPhoto({"link":"photo_7543247.html","caption":"Aura","height":129,"id":7543247,"server_id":31,"src":"Aura_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543492] = clik.newPhoto({"link":"photo_7543492.html","caption":"Cheer up Cherub!","height":128,"id":7543492,"server_id":31,"src":"Cherub_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543494] = clik.newPhoto({"link":"photo_7543494.html","caption":"Decending Ghost","height":130,"id":7543494,"server_id":31,"src":"Desendingghost_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543509] = clik.newPhoto({"link":"photo_7543509.html","caption":"Three Ghosts of the Past","height":131,"id":7543509,"server_id":31,"src":"3ghosts_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543512] = clik.newPhoto({"link":"photo_7543512.html","caption":"Rolling Stone","height":129,"id":7543512,"server_id":31,"src":"rollingstone_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543513] = clik.newPhoto({"link":"photo_7543513.html","caption":"Street Drawing","height":138,"id":7543513,"server_id":31,"src":"streetdrawing_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543515] = clik.newPhoto({"link":"photo_7543515.html","caption":"Red Light","height":130,"id":7543515,"server_id":31,"src":"redlight_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543516] = clik.newPhoto({"link":"photo_7543516.html","caption":"Cafe ","height":130,"id":7543516,"server_id":31,"src":"cafe_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543518] = clik.newPhoto({"link":"photo_7543518.html","caption":"Tourist Self Portrait","height":133,"id":7543518,"server_id":31,"src":"touristselfportrait_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543533] = clik.newPhoto({"link":"photo_7543533.html","caption":"Alice Through the Looking Glass","height":128,"id":7543533,"server_id":31,"src":"lookingglass_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543610] = clik.newPhoto({"link":"photo_7543610.html","caption":"Purple Room","height":129,"id":7543610,"server_id":31,"src":"purpledoors_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543612] = clik.newPhoto({"link":"photo_7543612.html","caption":"Porthole","height":131,"id":7543612,"server_id":31,"src":"porthole_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543614] = clik.newPhoto({"link":"photo_7543614.html","caption":"Paris 3","height":131,"id":7543614,"server_id":31,"src":"Paris3_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543616] = clik.newPhoto({"link":"photo_7543616.html","caption":"Paris 2","height":131,"id":7543616,"server_id":31,"src":"Paris2_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543617] = clik.newPhoto({"link":"photo_7543617.html","caption":"Paris 1","height":130,"id":7543617,"server_id":31,"src":"paris1_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543621] = clik.newPhoto({"link":"photo_7543621.html","caption":"Notre Dame Madame","height":131,"id":7543621,"server_id":31,"src":"NotreDame_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543623] = clik.newPhoto({"link":"photo_7543623.html","caption":"Ghosts","height":129,"id":7543623,"server_id":31,"src":"ghosts_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543624] = clik.newPhoto({"link":"photo_7543624.html","caption":"Past Echo","height":130,"id":7543624,"server_id":31,"src":"past_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543626] = clik.newPhoto({"link":"photo_7543626.html","caption":"Mona Lisa","height":133,"id":7543626,"server_id":31,"src":"MonaLisa_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[7543627] = clik.newPhoto({"link":"photo_7543627.html","caption":"M6","height":130,"id":7543627,"server_id":31,"src":"M6_thumb.JPG","galleries_id":398627,"width":130});
thumbnails[8099004] = clik.newPhoto({"link":"photo_8099004.html","caption":"Krishna's Door","height":130,"id":8099004,"server_id":31,"src":"krishnasdoor_thumb.JPG","galleries_id":430718,"width":130});
thumbnails[8099005] = clik.newPhoto({"link":"photo_8099005.html","caption":"Prayer Lion","height":129,"id":8099005,"server_id":31,"src":"prayerlion_thumb.JPG","galleries_id":430718,"width":130});
thumbnails[8781880] = clik.newPhoto({"link":"photo_8781880.html","caption":"Bird Meeting","height":131,"id":8781880,"server_id":31,"src":"birdmeeting_thumb.JPG","galleries_id":430718,"width":130});
thumbnails[8781882] = clik.newPhoto({"link":"photo_8781882.html","caption":"Rainbow Shop","height":130,"id":8781882,"server_id":31,"src":"rainbowshop_thumb.JPG","galleries_id":430718,"width":130});
thumbnails[8781936] = clik.newPhoto({"link":"photo_8781936.html","caption":"No.25","height":130,"id":8781936,"server_id":31,"src":"no.25_thumb.JPG","galleries_id":398627,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[430713] = clik.newGallery({"photoIDs":[7340805],"link":"section472313_430713.html","skipIndex":0,"section_code":"section472313","id":430713,"parentGallery":"","featured_images":7340805,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Home"});galleries[430718] = clik.newGallery({"photoIDs":[8099004,8099005,8781880,8781882],"link":"section470869_430718.html","skipIndex":0,"section_code":"section470869","id":430718,"parentGallery":"","featured_images":"8781882,8781880,8099005,8099004","maxRecords":0,"usePopups":false,"singleSection":false,"title":"India"});galleries[398627] = clik.newGallery({"photoIDs":[7543247,7543492,7543494,7543509,7543512,7543513,7543515,7543516,7543518,7543533,7543610,7543612,7543614,7543616,7543617,7543621,7543623,7543624,7543626,7543627,8781936],"link":"section470869_398627.html","skipIndex":0,"section_code":"section470869","id":398627,"parentGallery":"","featured_images":"8781936,7543627,7543626,7543624,7543623,7543621,7543617,7543616,7543614,7543612","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Paris"});galleries[395680] = clik.newGallery({"photoIDs":[7315035,7332523,7341457,7341469,7341526,9146822,9147110,9147124,9147157,9147176,9147181],"link":"gallery_395680.html","skipIndex":0,"section_code":"gallery","id":395680,"parentGallery":"","featured_images":"9147181,9147176,9147157,9147124,9147110,9146822,7341526,7341469,7341457,7332523","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Gallery 1"});galleries[397366] = clik.newGallery({"photoIDs":[7341390,7776231,7776674,7776771,7776774,8614086],"link":"section472313_397366.html","skipIndex":0,"section_code":"section472313","id":397366,"parentGallery":"","featured_images":"8614086,7776774,7776771,7776674,7776231,7341390","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Floating World"});galleries[395681] = clik.newGallery({"photoIDs":[8099002,8099003],"link":"gallery_395681.html","skipIndex":0,"section_code":"gallery","id":395681,"parentGallery":"","featured_images":"8099003,8099002","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Gallery 2"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '9147181,9147176,9147157,9147124,9147110,9146822,8921628,8781936,8781882,8781880,8614086,8341896,8341893,8341890,8099005,8099004,8099003,8099002,7776774,7776771,7776674,7776231,7543627,7543626,7543624,7543623,7543621,7543617,7543616,7543614,7543612,7543610,7543533,7543518,7543516,7543515,7543513,7543512,7543509,7543494,7543492,7543247,7341526,7341469,7341457,7341390,7340805,7332523,7315035';
imageSets[1] = '9147181';
imageSets[244382] = '8921628';
imageSets[243091] = '8781882,8781880';
imageSets[240709] = '8781936,7543627,7543626,7543624,7543623,7543621,7543617,7543616,7543614,7543612,7543610,7543533,7543518,7543516,7543515,7543513,7543512,7543509,7543494,7543492,7543247';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/leylafolwell/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/leylafolwell/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 = 'Leyla Folwell: ' + 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;
	}
}

		

