window.thumbnails = {};
															thumbnails[1072802] = clik.newPhoto({"id":1072802,"src":"Dechevauxdebiosok1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1072802.html","width":130,"caption":"Manege de chevaux de bios<br>\r\n","height":95});
															thumbnails[1074282] = clik.newPhoto({"id":1074282,"src":"horse11.jpg","galleries_id":75499,"server_id":1,"link":"photo_1074282.html","width":130,"caption":"Urban Delights # 2<br>\r\n","height":86});
															thumbnails[7242765] = clik.newPhoto({"id":7242765,"src":"Redmist_thumb.jpg","galleries_id":74996,"server_id":1,"link":"photo_7242765.html","width":130,"caption":"Red Mist","height":178});
															thumbnails[1001377] = clik.newPhoto({"id":1001377,"src":"Noise1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001377.html","width":130,"caption":"Noise","height":98});
															thumbnails[1001515] = clik.newPhoto({"id":1001515,"src":"Legacy20031.jpg","galleries_id":75102,"server_id":1,"link":"photo_1001515.html","width":130,"caption":"Legacy 2003","height":173});
															thumbnails[1183490] = clik.newPhoto({"id":1183490,"src":"small painting VI.jpg","galleries_id":74996,"server_id":1,"link":"photo_1183490.html","width":130,"caption":"Micro-Painting VI","height":190});
															thumbnails[1001360] = clik.newPhoto({"id":1001360,"src":"Peace1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001360.html","width":130,"caption":"Peace","height":98});
															thumbnails[1001531] = clik.newPhoto({"id":1001531,"src":"61.jpg","galleries_id":75102,"server_id":1,"link":"photo_1001531.html","width":130,"caption":"Shire Hall Gallery","height":98});
															thumbnails[1183476] = clik.newPhoto({"id":1183476,"src":"micropaintingIII1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1183476.html","width":130,"caption":"Micro Painting III","height":185});
															thumbnails[8578171] = clik.newPhoto({"id":8578171,"src":"abandonedhotel_thumb.jpg","galleries_id":388648,"server_id":38,"link":"photo_8578171.html","width":130,"caption":"Abandoned Hotel","height":180});
															thumbnails[8578170] = clik.newPhoto({"id":8578170,"src":"Twoflags_thumb.jpg","galleries_id":388648,"server_id":38,"link":"photo_8578170.html","width":130,"caption":"Two Flags","height":171});
															thumbnails[1001367] = clik.newPhoto({"id":1001367,"src":"Quiet1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001367.html","width":130,"caption":"Quiet","height":98});
															thumbnails[1001535] = clik.newPhoto({"id":1001535,"src":"MOTHERI20021.jpg","galleries_id":75102,"server_id":1,"link":"photo_1001535.html","width":130,"caption":"Mother","height":94});
															thumbnails[1183575] = clik.newPhoto({"id":1183575,"src":"Carosello(LittleWar)1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1183575.html","width":130,"caption":"Carosello (Little War)","height":101});
															thumbnails[8101129] = clik.newPhoto({"id":8101129,"src":"planners_dream_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_8101129.html","width":130,"caption":"Planners Dream","height":98});
															thumbnails[8101141] = clik.newPhoto({"id":8101141,"src":"red_white_and_blue_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_8101141.html","width":130,"caption":"Red, White and Blue","height":183});
															thumbnails[1001410] = clik.newPhoto({"id":1001410,"src":"scancharl.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001410.html","width":130,"caption":"Scan Charl (+UV)","height":98});
															thumbnails[1026574] = clik.newPhoto({"id":1026574,"src":"Gone20021.jpg","galleries_id":75102,"server_id":1,"link":"photo_1026574.html","width":130,"caption":"Gone 2002","height":88});
															thumbnails[1183475] = clik.newPhoto({"id":1183475,"src":"threeprints1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1183475.html","width":130,"caption":"Three prints","height":98});
															thumbnails[1435230] = clik.newPhoto({"id":1435230,"src":"99 heads1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1435230.html","width":130,"caption":"99 Physiognomical Equine Studies","height":89});
															thumbnails[1541181] = clik.newPhoto({"id":1541181,"src":"lost_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_1541181.html","width":130,"caption":"Folly","height":98});
															thumbnails[1435273] = clik.newPhoto({"id":1435273,"src":"tower_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_1435273.html","width":130,"caption":"Tower","height":99});
															thumbnails[1001422] = clik.newPhoto({"id":1001422,"src":"scandan.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001422.html","width":130,"caption":"Scan Dan (+ UV)","height":98});
															thumbnails[1072743] = clik.newPhoto({"id":1072743,"src":"hazyskies1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1072743.html","width":130,"caption":"Soft Target","height":173});
															thumbnails[1183481] = clik.newPhoto({"id":1183481,"src":"FireI1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1183481.html","width":130,"caption":"Fire I","height":184});
															thumbnails[1349509] = clik.newPhoto({"id":1349509,"src":"Blackdaisy31.jpg","galleries_id":75102,"server_id":1,"link":"photo_1349509.html","width":130,"caption":"Madre   <br>\r\n","height":96});
															thumbnails[1541194] = clik.newPhoto({"id":1541194,"src":"trixieetc1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1541194.html","width":130,"caption":"Trixie, Dobbin, Charly, Shamus, Snowball and Harry. ","height":28});
															thumbnails[7242184] = clik.newPhoto({"id":7242184,"src":"clearing_thumb.jpg","galleries_id":388648,"server_id":38,"link":"photo_7242184.html","width":130,"caption":"Clearing ","height":96});
															thumbnails[7242187] = clik.newPhoto({"id":7242187,"src":"clearing2_thumb.jpg","galleries_id":388648,"server_id":38,"link":"photo_7242187.html","width":130,"caption":"Clearing #II","height":96});
															thumbnails[7745258] = clik.newPhoto({"id":7745258,"src":"Blue_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7745258.html","width":130,"caption":"Blue","height":173});
															thumbnails[1001310] = clik.newPhoto({"id":1001310,"src":"seenoevilhearnoevilspeaknoevil1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001310.html","width":130,"caption":"See No Evil, Hear No Evil, Speak No Evil ","height":98});
															thumbnails[1008655] = clik.newPhoto({"id":1008655,"src":"VOID20021.jpg","galleries_id":75102,"server_id":1,"link":"photo_1008655.html","width":130,"caption":"Void","height":191});
															thumbnails[1183586] = clik.newPhoto({"id":1183586,"src":"Urbanmyth1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1183586.html","width":130,"caption":"Urban Myth","height":42});
															thumbnails[7242179] = clik.newPhoto({"id":7242179,"src":"escape_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7242179.html","width":130,"caption":"Escape#I","height":97});
															thumbnails[7242181] = clik.newPhoto({"id":7242181,"src":"escape2_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7242181.html","width":130,"caption":"Escape #II","height":96});
															thumbnails[7242147] = clik.newPhoto({"id":7242147,"src":"inthetrees_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7242147.html","width":130,"caption":"In The Trees","height":187});
															thumbnails[1001198] = clik.newPhoto({"id":1001198,"src":"identity1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001198.html","width":130,"caption":"The Good","height":173});
															thumbnails[1026575] = clik.newPhoto({"id":1026575,"src":"Madre20023.jpg","galleries_id":75102,"server_id":1,"link":"photo_1026575.html","width":130,"caption":"Madre 2002","height":98});
															thumbnails[1072721] = clik.newPhoto({"id":1072721,"src":"FireI2007ok1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1072721.html","width":130,"caption":"Fire II ","height":173});
															thumbnails[1435309] = clik.newPhoto({"id":1435309,"src":"charly1.jpg","galleries_id":75499,"server_id":1,"link":"photo_1435309.html","width":130,"caption":"Charly","height":64});
															thumbnails[7242141] = clik.newPhoto({"id":7242141,"src":"Departure_5ECA0019-1EC9-DFB6-09079C02E3BF3BC2_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7242141.html","width":130,"caption":"Departure","height":98});
															thumbnails[7242202] = clik.newPhoto({"id":7242202,"src":"untitled_thumb.jpg","galleries_id":388648,"server_id":1,"link":"photo_7242202.html","width":130,"caption":"Untitled","height":97});
															thumbnails[1001273] = clik.newPhoto({"id":1001273,"src":"Intheschemeofthings1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001273.html","width":130,"caption":"In The Scheme of Things","height":173});
															thumbnails[1026577] = clik.newPhoto({"id":1026577,"src":"Daisychaindetail1.jpg","galleries_id":75102,"server_id":1,"link":"photo_1026577.html","width":130,"caption":"Daisy Chain (detail)","height":86});
															thumbnails[1072748] = clik.newPhoto({"id":1072748,"src":"splitskies1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1072748.html","width":130,"caption":"Split Skies","height":173});
															thumbnails[999837] = clik.newPhoto({"id":999837,"src":"Nebula13.jpg","galleries_id":74996,"server_id":1,"link":"photo_999837.html","width":130,"caption":"Nebula I","height":173});
															thumbnails[1001181] = clik.newPhoto({"id":1001181,"src":"monobaby1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001181.html","width":130,"caption":"After Mercurio   <br>\r\n","height":173});
															thumbnails[1026661] = clik.newPhoto({"id":1026661,"src":"redphylotaxi3.jpg","galleries_id":75102,"server_id":1,"link":"photo_1026661.html","width":130,"caption":"Curves (Red)","height":98});
															thumbnails[1435311] = clik.newPhoto({"id":1435311,"src":"childsplay21.jpg","galleries_id":75499,"server_id":1,"link":"photo_1435311.html","width":130,"caption":"Childsplay # 2","height":248});
															thumbnails[1000209] = clik.newPhoto({"id":1000209,"src":"Nebula35.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000209.html","width":130,"caption":"Nebula III","height":173});
															thumbnails[1349495] = clik.newPhoto({"id":1349495,"src":"inutero1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1349495.html","width":130,"caption":"De Formato Foetu # 1","height":217});
															thumbnails[1000268] = clik.newPhoto({"id":1000268,"src":"Crosshair1.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000268.html","width":130,"caption":"Crosshair","height":173});
															thumbnails[1001174] = clik.newPhoto({"id":1001174,"src":"redbaby1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001174.html","width":130,"caption":"","height":173});
															thumbnails[1000344] = clik.newPhoto({"id":1000344,"src":"603.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000344.html","width":130,"caption":"Target I","height":173});
															thumbnails[1001155] = clik.newPhoto({"id":1001155,"src":"Deformatofeotu1.jpg","galleries_id":75018,"server_id":1,"link":"photo_1001155.html","width":130,"caption":"De Formato Feotu","height":173});
															thumbnails[1000318] = clik.newPhoto({"id":1000318,"src":"622.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000318.html","width":130,"caption":"Target II","height":173});
															thumbnails[1000259] = clik.newPhoto({"id":1000259,"src":"471.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000259.html","width":130,"caption":"Untitled (Nebula)","height":174});
															thumbnails[1000418] = clik.newPhoto({"id":1000418,"src":"nebulousnebulae4.jpg","galleries_id":74996,"server_id":1,"link":"photo_1000418.html","width":130,"caption":"Nebulous Nebulae 1-15","height":173});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[388648] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Work","link":"gallery_388648.html","maxRecords":0.0,"photoIDs":[8578171.0,8578170.0,8101129.0,8101141.0,1541181.0,1435273.0,7242184.0,7242187.0,7745258.0,7242179.0,7242181.0,7242147.0,7242141.0,7242202.0],"skipIndex":0,"section_code":"gallery","featured_images":1541181.0,"id":388648,"singleSection":false});				  						galleries[74996] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Macrocosm Microcosm","link":"gallery_74996.html","maxRecords":0.0,"photoIDs":[7242765.0,1183490.0,1183476.0,1183475.0,1072743.0,1183481.0,1072721.0,1072748.0,999837.0,1000209.0,1000268.0,1000344.0,1000318.0,1000259.0,1000418.0],"skipIndex":0,"section_code":"gallery","featured_images":1000268.0,"id":74996,"singleSection":false});				  						galleries[75018] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Life","link":"gallery_75018.html","maxRecords":0.0,"photoIDs":[1001377.0,1001360.0,1001367.0,1001410.0,1001422.0,1001310.0,1001198.0,1001273.0,1001181.0,1349495.0,1001174.0,1001155.0],"skipIndex":0,"section_code":"gallery","featured_images":1001377.0,"id":75018,"singleSection":false});				  						galleries[75102] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Daisies","link":"gallery_75102.html","maxRecords":0.0,"photoIDs":[1001515.0,1001531.0,1001535.0,1026574.0,1349509.0,1008655.0,1026575.0,1026577.0,1026661.0],"skipIndex":0,"section_code":"gallery","featured_images":1001535.0,"id":75102,"singleSection":false});				  						galleries[75499] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Archives","link":"gallery_75499.html","maxRecords":0.0,"photoIDs":[1072802.0,1074282.0,1183575.0,1435230.0,1541194.0,1183586.0,1435309.0,1435311.0],"skipIndex":0,"section_code":"gallery","featured_images":1072802.0,"id":75499,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7242184';
imageSets[2] = '1072802,1001377,1001535,1541181,1000268';
imageSets[3] = '8578171,8578170,8101141,8101129,7745258,7242765,7242202,7242187,7242184,7242181,7242179,7242147,7242141,1541194,1541181,1435311,1435309,1435273,1435230,1349509,1349495,1183586,1183575,1183490,1183481,1183476,1183475,1074282,1072802,1072748,1072743,1072721,1026661,1026577,1026575,1026574,1008655,1001535,1001531,1001515,1001422,1001410,1001377,1001367,1001360,1001310,1001273,1001198,1001181,1001174';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/angelamaloney/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/angelamaloney/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'section484361.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 && 'section484361' != '') {
					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 = 'Angela Maloney: ' + 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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<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;
	}
}

			

