window.thumbnails = {};
															thumbnails[3849995] = clik.newPhoto({"id":3849995,"src":"eusapia_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3849995.html","width":130,"caption":"Eusapia 154 x 154 cm","height":129});
															thumbnails[4046051] = clik.newPhoto({"id":4046051,"src":"profile_shot_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":110});
															thumbnails[4046182] = clik.newPhoto({"id":4046182,"src":"profile_shot_small_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":100});
															thumbnails[4286957] = clik.newPhoto({"id":4286957,"src":"mute_small_crop_thumb.jpg","galleries_id":253056,"server_id":15,"link":"photo_4286957.html","width":130,"caption":"Mute - Oil on paper - 51 x 60 cm","height":107});
															thumbnails[4312613] = clik.newPhoto({"id":4312613,"src":"outpost_1_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Outpost 1 - 62 x 46 cm - Oil on Canvas","height":98});
															thumbnails[4460130] = clik.newPhoto({"id":4460130,"src":"outpost_212_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_4460130.html","width":130,"caption":"Outpost 2 72 x 51 cm","height":181});
															thumbnails[4554863] = clik.newPhoto({"id":4554863,"src":"dead_centre_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Dead Centre 80 x 60 cm","height":98});
															thumbnails[5365333] = clik.newPhoto({"id":5365333,"src":"arc_80_x_60_cm1_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_5365333.html","width":130,"caption":"Arc 60 x 80","height":98});
															thumbnails[5832695] = clik.newPhoto({"id":5832695,"src":"DSCF0544_thumb.JPG","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5966584] = clik.newPhoto({"id":5966584,"src":"rsa_install_1_small_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6575126] = clik.newPhoto({"id":6575126,"src":"1_st_peters_seminary_-_wilderness_-_145_x_120_cm_-_oil_on_canvas_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_6575126.html","width":130,"caption":"","height":108});
															thumbnails[8782173] = clik.newPhoto({"id":8782173,"src":"Monologue_Corridor_130_x_170_cm_-_oil_on_canvas_-_20111_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782173.html","width":130,"caption":"Monologue\/Corridor, 130 x 170 cm, Oil on canvas","height":99});
															thumbnails[8782176] = clik.newPhoto({"id":8782176,"src":"sway_120_x150_cm_-_oil_on_canvas-_2011_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782176.html","width":130,"caption":"Sway, 120 x 150 cm, Oil on canvas","height":104});
															thumbnails[8782178] = clik.newPhoto({"id":8782178,"src":"The_Limits_-_150_x_190_cm_-_Oil_on_canvas_-_2011_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782178.html","width":130,"caption":"The Limits, 150 x 190 cm, Oil on canvas","height":103});
															thumbnails[8788233] = clik.newPhoto({"id":8788233,"src":"The_MArgins_evite_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":81});
															thumbnails[4069099] = clik.newPhoto({"id":4069099,"src":"quartermile_through_trees_80_x_60_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Quartermile Through Trees  80 x 60 cm","height":101});
															thumbnails[5938265] = clik.newPhoto({"id":5938265,"src":"1__st_peters_seminary_-_drift_170_x_130_cm_oil_on_canvas_2010_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_5938265.html","width":130,"caption":"","height":99});
															thumbnails[8658146] = clik.newPhoto({"id":8658146,"src":"Monologue_Corridor_130_x_170_cm_-_oil_on_canvas_-_2011_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":99});
															thumbnails[5703813] = clik.newPhoto({"id":5703813,"src":"1___st_peters_seminary-_vault_183_x_152_cm_-_oil_on_canvas_-_2010_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_5703813.html","width":130,"caption":"","height":108});
															thumbnails[8658263] = clik.newPhoto({"id":8658263,"src":"the_hacienda_150__x_120_c__m_-_Oil_on_canvas_-_2011_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":162});
															thumbnails[8782177] = clik.newPhoto({"id":8782177,"src":"the_hacienda_150__x_120_c_m_-_oil_on_canvas_-_2011_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782177.html","width":130,"caption":"The Hacienda, 150 x 120 cm, Oil on canvas","height":163});
															thumbnails[5938257] = clik.newPhoto({"id":5938257,"src":"1__st_peters_seminary_-_stray_160_x_130_cm_Oil_on_canvas_over_panel_2010_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_5938257.html","width":130,"caption":"","height":106});
															thumbnails[8782171] = clik.newPhoto({"id":8782171,"src":"Light_Dome_-_150_x_190_cm_-_oil_on_canvas_-_2011_copy_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782171.html","width":130,"caption":"Light Dome\/Memory Card Error, 150 x 190 cm, Oil on canvas","height":103});
															thumbnails[5938328] = clik.newPhoto({"id":5938328,"src":"vision_of_ruinruin_of_vision_2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":48});
															thumbnails[7359892] = clik.newPhoto({"id":7359892,"src":"stray_detail_small1_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":150});
															thumbnails[8658152] = clik.newPhoto({"id":8658152,"src":"sway_120_x150_cm_-_oil_on_canvas-_2011_2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":104});
															thumbnails[7359745] = clik.newPhoto({"id":7359745,"src":"st_peters_seminary_-_merge_145_x_115_cm_2011_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_7359745.html","width":130,"caption":"","height":167});
															thumbnails[8803181] = clik.newPhoto({"id":8803181,"src":"Seminary_Study_60_x_50_cm_-_oil_on_canvas_-_2011_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_8803181.html","width":130,"caption":"","height":104});
															thumbnails[7359858] = clik.newPhoto({"id":7359858,"src":"merge_2_detail_small_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":168});
															thumbnails[6575133] = clik.newPhoto({"id":6575133,"src":"st_peters_seminary_-_wilderness_night_-_80_x_60_cm_oil_on_canvas_2010_thumb.JPG","galleries_id":323118,"server_id":15,"link":"photo_6575133.html","width":130,"caption":"","height":97});
															thumbnails[8782166] = clik.newPhoto({"id":8782166,"src":"51_study_-_60_x_40_cm_-_acrylic_on_paper_2011_2_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782166.html","width":130,"caption":"51 Study, 60 x 40 cm, Acrylic on paper","height":171});
															thumbnails[5966626] = clik.newPhoto({"id":5966626,"src":"rsa_install_2_small_thumb.jpg","galleries_id":323118,"server_id":15,"link":"photo_5966626.html","width":130,"caption":"","height":98});
															thumbnails[8782170] = clik.newPhoto({"id":8782170,"src":"dome_study_5_2_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782170.html","width":130,"caption":"Dome Study, 40 x 60 cm, Acrylic and ink on paper","height":93});
															thumbnails[8782180] = clik.newPhoto({"id":8782180,"src":"white_tree_study_-_40_x_60_cm_-_ink_on_paper_2_thumb.jpg","galleries_id":462513,"server_id":15,"link":"photo_8782180.html","width":130,"caption":"White Tree, 40 x 60 cm, Ink on Paper ","height":100});
															thumbnails[8782183] = clik.newPhoto({"id":8782183,"src":"half_light_study_60_x_40_cm_acrylic_on_paper_2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Half light, 60 x 40 cm, Acrylic and ink on paper","height":183});
															thumbnails[3789710] = clik.newPhoto({"id":3789710,"src":"loch_house_183_x_152_cm_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789710.html","width":130,"caption":"Loch House - Oil on Canvas 152 x 183 cm","height":108});
															thumbnails[3789773] = clik.newPhoto({"id":3789773,"src":"tin_hut_in_the_woods_new_102_x_76_cm_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789773.html","width":130,"caption":"Tin Hut in the Woods - Oil on canvas 102 x 76 cm","height":173});
															thumbnails[3789823] = clik.newPhoto({"id":3789823,"src":"bingo_107_x_51_cm_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Bingo - 107 x 51 cm","height":63});
															thumbnails[3789732] = clik.newPhoto({"id":3789732,"src":"wasteland_model_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789732.html","width":130,"caption":"Wasteland Model - Oil on Canvas 60 x 80 cm","height":98});
															thumbnails[3789741] = clik.newPhoto({"id":3789741,"src":"wasteland_double_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789741.html","width":130,"caption":"Wasteland Double - Oil on canvas 183 x 152 cm","height":108});
															thumbnails[3789714] = clik.newPhoto({"id":3789714,"src":"Ruin_of_the_Present_small_thumb.JPG","galleries_id":231013,"server_id":15,"link":"photo_3789714.html","width":130,"caption":"Ruin of the Present - Oil on Canvas 147.5 x 185 cm","height":99});
															thumbnails[3789768] = clik.newPhoto({"id":3789768,"src":"dislocation_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789768.html","width":130,"caption":"Dislocation - Oil on board 101 x 127 cm","height":105});
															thumbnails[3789720] = clik.newPhoto({"id":3789720,"src":"Atopos_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789720.html","width":130,"caption":"Atopos - Oil on Canvas 137 x 185 cm","height":99});
															thumbnails[3789849] = clik.newPhoto({"id":3789849,"src":"doorway_117_x_91_cm_small_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Doorway - Oil on board 117 x 91 cm","height":166});
															thumbnails[3789793] = clik.newPhoto({"id":3789793,"src":"Broken_Wall_152_x_122_cm_small_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789793.html","width":130,"caption":"Broken Wall - Oil on board 152 x 122 cm","height":105});
															thumbnails[3789863] = clik.newPhoto({"id":3789863,"src":"Static_100_x_80_rerun_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_3789863.html","width":130,"caption":"Static - Oil on canvas 100 x 80.5 cm ","height":163});
															thumbnails[3789819] = clik.newPhoto({"id":3789819,"src":"island_thumb.jpg","galleries_id":253056,"server_id":15,"link":"photo_3789819.html","width":130,"caption":"Island - Acrylic on paper 100 x 140 cm","height":91});
															thumbnails[5703932] = clik.newPhoto({"id":5703932,"src":"paintings_at_rsa_1_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_5703932.html","width":130,"caption":"RSA installation shot","height":86});
															thumbnails[5703933] = clik.newPhoto({"id":5703933,"src":"paintings_at_rsa_2_thumb.jpg","galleries_id":231013,"server_id":15,"link":"photo_5703933.html","width":130,"caption":"RSA installation shot","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[462513] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Margins","link":"gallery_462513.html","maxRecords":0.0,"photoIDs":[8782173.0,8782176.0,8782178.0,8782177.0,8782171.0,8782166.0,8782170.0,8782180.0],"skipIndex":0,"section_code":"gallery","featured_images":"8782180,8782178,8782177,8782176,8782173,8782171,8782170,8782166","id":462513,"singleSection":false});				  						galleries[323118] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"St Peters Seminary- Form in Flux","link":"gallery_323118.html","maxRecords":0.0,"photoIDs":[6575126.0,5938265.0,5703813.0,5938257.0,7359745.0,8803181.0,6575133.0,5966626.0],"skipIndex":0,"section_code":"gallery","featured_images":"8803181,7359745,6575133,6575126,5966626,5938265,5938257,5703813","id":323118,"singleSection":false});				  						galleries[231013] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"An Archeology of the Present","link":"gallery_231013.html","maxRecords":0.0,"photoIDs":[3849995.0,4460130.0,5365333.0,3789710.0,3789773.0,3789732.0,3789741.0,3789714.0,3789768.0,3789720.0,3789793.0,3789863.0,5703932.0,5703933.0],"skipIndex":0,"section_code":"gallery","featured_images":"4460130,3789710","id":231013,"singleSection":false});				  						galleries[253056] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Works on paper","link":"gallery_253056.html","maxRecords":0.0,"photoIDs":[4286957.0,3789819.0],"skipIndex":0,"section_code":"gallery","featured_images":"4286957,3789819","id":253056,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8658146';
imageSets[2] = '4460130,3789710';
imageSets[3] = '8803181,8788233,8782183,8782180,8782178,8782177,8782176,8782173,8782171,8782170,8782166,8658263,8658152,8658146,7359892,7359858,7359745,6575133,6575126,5966626,5966584,5938328,5938265,5938257,5832695,5703933,5703932,5703813,5365333,4554863,4460130,4312613,4286957,4069099,4046182,4046051,3849995,3789863,3789849,3789823,3789819,3789793,3789773,3789768,3789741,3789732,3789720,3789714,3789710';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rmzbrown/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rmzbrown/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 = 'Ross M Brown : ' + 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;
	}
}

			

