window.thumbnails = {};
															thumbnails[2189755] = clik.newPhoto({"id":2189755,"src":"shoudweb93_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189755.html","width":130,"caption":"","height":88});
															thumbnails[2189801] = clik.newPhoto({"id":2189801,"src":"shoudweb71_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189801.html","width":130,"caption":"","height":195});
															thumbnails[2189811] = clik.newPhoto({"id":2189811,"src":"shoudweb5_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189811.html","width":130,"caption":"","height":195});
															thumbnails[2189851] = clik.newPhoto({"id":2189851,"src":"shoudweb10_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189851.html","width":130,"caption":"","height":195});
															thumbnails[2189855] = clik.newPhoto({"id":2189855,"src":"shoudweb121_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189855.html","width":130,"caption":"","height":195});
															thumbnails[2189856] = clik.newPhoto({"id":2189856,"src":"shoudweb31_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189856.html","width":130,"caption":"","height":195});
															thumbnails[2189857] = clik.newPhoto({"id":2189857,"src":"shoudweb21_thumb.jpg","galleries_id":144947,"server_id":32,"link":"photo_2189857.html","width":130,"caption":"","height":195});
															thumbnails[2195851] = clik.newPhoto({"id":2195851,"src":"prognosis1_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195851.html","width":130,"caption":"","height":87});
															thumbnails[2195891] = clik.newPhoto({"id":2195891,"src":"prognosis 2_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195891.html","width":130,"caption":"","height":195});
															thumbnails[2195915] = clik.newPhoto({"id":2195915,"src":"prognosis3_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195915.html","width":130,"caption":"","height":195});
															thumbnails[2195917] = clik.newPhoto({"id":2195917,"src":"prognosis4_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195917.html","width":130,"caption":"","height":195});
															thumbnails[2195919] = clik.newPhoto({"id":2195919,"src":"prognosis5_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195919.html","width":130,"caption":"","height":195});
															thumbnails[2195926] = clik.newPhoto({"id":2195926,"src":"prognosis6_thumb.jpg","galleries_id":141339,"server_id":32,"link":"photo_2195926.html","width":130,"caption":"","height":195});
															thumbnails[2196098] = clik.newPhoto({"id":2196098,"src":"inloving30_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2196098.html","width":130,"caption":"","height":87});
															thumbnails[2201312] = clik.newPhoto({"id":2201312,"src":"inloving31_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2201312.html","width":130,"caption":"","height":195});
															thumbnails[2201331] = clik.newPhoto({"id":2201331,"src":"inloving32_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2201331.html","width":130,"caption":"","height":195});
															thumbnails[2201335] = clik.newPhoto({"id":2201335,"src":"inloving33_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2201335.html","width":130,"caption":"","height":195});
															thumbnails[2201346] = clik.newPhoto({"id":2201346,"src":"inloving34_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2201346.html","width":130,"caption":"","height":195});
															thumbnails[2201354] = clik.newPhoto({"id":2201354,"src":"inloving35_thumb.jpg","galleries_id":145287,"server_id":32,"link":"photo_2201354.html","width":130,"caption":"","height":195});
															thumbnails[2220284] = clik.newPhoto({"id":2220284,"src":"Resurection 0_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220284.html","width":130,"caption":"","height":87});
															thumbnails[2220285] = clik.newPhoto({"id":2220285,"src":"Resurection 1_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220285.html","width":130,"caption":"","height":195});
															thumbnails[2220286] = clik.newPhoto({"id":2220286,"src":"Resurection 2_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220286.html","width":130,"caption":"","height":195});
															thumbnails[2220288] = clik.newPhoto({"id":2220288,"src":"Resurection 3_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220288.html","width":130,"caption":"","height":195});
															thumbnails[2220289] = clik.newPhoto({"id":2220289,"src":"Resurection 4_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220289.html","width":130,"caption":"","height":195});
															thumbnails[2220291] = clik.newPhoto({"id":2220291,"src":"Resurection 5_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220291.html","width":130,"caption":"","height":195});
															thumbnails[2220319] = clik.newPhoto({"id":2220319,"src":"Resurection 6_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220319.html","width":130,"caption":"","height":195});
															thumbnails[2220321] = clik.newPhoto({"id":2220321,"src":"Resurection 7_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220321.html","width":130,"caption":"","height":195});
															thumbnails[2220324] = clik.newPhoto({"id":2220324,"src":"Resurection 8_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220324.html","width":130,"caption":"","height":195});
															thumbnails[2220332] = clik.newPhoto({"id":2220332,"src":"Resurection 9_thumb.jpg","galleries_id":146514,"server_id":32,"link":"photo_2220332.html","width":130,"caption":"","height":195});
															thumbnails[2225983] = clik.newPhoto({"id":2225983,"src":"5 photogram dresses2_thumb.jpg","galleries_id":146831,"server_id":32,"link":"photo_2225983.html","width":130,"caption":"","height":63});
															thumbnails[6904729] = clik.newPhoto({"id":6904729,"src":"dr2_thumb.jpg","galleries_id":374623,"server_id":32,"link":"photo_6904729.html","width":130,"caption":"","height":87});
															thumbnails[2225994] = clik.newPhoto({"id":2225994,"src":"photogram dress 2_thumb.jpg","galleries_id":146831,"server_id":32,"link":"photo_2225994.html","width":130,"caption":"","height":175});
															thumbnails[6904731] = clik.newPhoto({"id":6904731,"src":"dr_3a_thumb.jpg","galleries_id":374623,"server_id":32,"link":"photo_6904731.html","width":130,"caption":"","height":87});
															thumbnails[2226011] = clik.newPhoto({"id":2226011,"src":"photogram dress 3_thumb.jpg","galleries_id":146831,"server_id":32,"link":"photo_2226011.html","width":130,"caption":"","height":181});
															thumbnails[2226016] = clik.newPhoto({"id":2226016,"src":"photogram dress 4_thumb.jpg","galleries_id":146831,"server_id":32,"link":"photo_2226016.html","width":130,"caption":"","height":178});
															thumbnails[6904733] = clik.newPhoto({"id":6904733,"src":"shoes_port_thumb.jpg","galleries_id":374623,"server_id":32,"link":"photo_6904733.html","width":130,"caption":"","height":195});
															thumbnails[2226024] = clik.newPhoto({"id":2226024,"src":"photogram dress 5_thumb.jpg","galleries_id":146831,"server_id":32,"link":"photo_2226024.html","width":130,"caption":"","height":178});
															thumbnails[6904734] = clik.newPhoto({"id":6904734,"src":"dr_5_thumb.jpg","galleries_id":374623,"server_id":32,"link":"photo_6904734.html","width":130,"caption":"","height":87});
															thumbnails[6904735] = clik.newPhoto({"id":6904735,"src":"dr1_thumb.jpg","galleries_id":374623,"server_id":32,"link":"photo_6904735.html","width":130,"caption":"","height":87});
															thumbnails[6904193] = clik.newPhoto({"id":6904193,"src":"pic_wd1_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904193.html","width":130,"caption":"","height":195});
															thumbnails[6904243] = clik.newPhoto({"id":6904243,"src":"dress_1_detail_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904243.html","width":130,"caption":"","height":195});
															thumbnails[6904247] = clik.newPhoto({"id":6904247,"src":"pic_wd_2_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904247.html","width":130,"caption":"","height":195});
															thumbnails[6904252] = clik.newPhoto({"id":6904252,"src":"Dress_2_detail_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904252.html","width":130,"caption":"","height":195});
															thumbnails[6904724] = clik.newPhoto({"id":6904724,"src":"gloves__thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904724.html","width":130,"caption":"","height":87});
															thumbnails[6904276] = clik.newPhoto({"id":6904276,"src":"Gloves_Detail_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904276.html","width":130,"caption":"","height":195});
															thumbnails[6904282] = clik.newPhoto({"id":6904282,"src":"Flowers__thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904282.html","width":130,"caption":"","height":87});
															thumbnails[6904288] = clik.newPhoto({"id":6904288,"src":"Flowers_detail__thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904288.html","width":130,"caption":"","height":195});
															thumbnails[6904714] = clik.newPhoto({"id":6904714,"src":"shoes_1_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904714.html","width":130,"caption":"","height":195});
															thumbnails[6904300] = clik.newPhoto({"id":6904300,"src":"Shoes_detail_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904300.html","width":130,"caption":"","height":195});
															thumbnails[6904307] = clik.newPhoto({"id":6904307,"src":"pic_1_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904307.html","width":130,"caption":"","height":195});
															thumbnails[6904310] = clik.newPhoto({"id":6904310,"src":"pic_2_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904310.html","width":130,"caption":"","height":195});
															thumbnails[6904311] = clik.newPhoto({"id":6904311,"src":"pic_3_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904311.html","width":130,"caption":"","height":195});
															thumbnails[6904315] = clik.newPhoto({"id":6904315,"src":"pic_4_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904315.html","width":130,"caption":"","height":195});
															thumbnails[6904316] = clik.newPhoto({"id":6904316,"src":"pic_5copy_thumb.jpg","galleries_id":374622,"server_id":32,"link":"photo_6904316.html","width":130,"caption":"","height":195});
															thumbnails[8074783] = clik.newPhoto({"id":8074783,"src":"4_thumb.jpg","galleries_id":432643,"server_id":35,"link":"photo_8074783.html","width":130,"caption":"Collisions of Consciousness Video Still","height":122});
															thumbnails[8074779] = clik.newPhoto({"id":8074779,"src":"Helen_Postcard_thumb.jpg","galleries_id":432643,"server_id":35,"link":"photo_8074779.html","width":130,"caption":"Collisions of Consciousness Dress","height":180});
															thumbnails[8074782] = clik.newPhoto({"id":8074782,"src":"5_1_thumb.jpg","galleries_id":432643,"server_id":35,"link":"photo_8074782.html","width":130,"caption":"Collisions of Consciousness 1","height":123});
															thumbnails[8074776] = clik.newPhoto({"id":8074776,"src":"6_thumb.jpg","galleries_id":432643,"server_id":35,"link":"photo_8074776.html","width":130,"caption":"Collisions of Consciousness 2","height":168});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[144947] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Great Divide","link":"gallery_144947.html","maxRecords":0.0,"photoIDs":[2189755.0,2189801.0,2189811.0,2189851.0,2189855.0,2189856.0,2189857.0],"skipIndex":0,"section_code":"gallery","featured_images":"2189857,2189811","id":144947,"singleSection":false});				  						galleries[141339] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prognosis Confirmed","link":"gallery_141339.html","maxRecords":0.0,"photoIDs":[2195851.0,2195891.0,2195915.0,2195917.0,2195919.0,2195926.0],"skipIndex":0,"section_code":"gallery","featured_images":2195891.0,"id":141339,"singleSection":false});				  						galleries[145287] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"In Loving Memory","link":"gallery_145287.html","maxRecords":0.0,"photoIDs":[2196098.0,2201312.0,2201331.0,2201335.0,2201346.0,2201354.0],"skipIndex":0,"section_code":"gallery","featured_images":2201346.0,"id":145287,"singleSection":false});				  						galleries[146514] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Resurrection","link":"gallery_146514.html","maxRecords":0.0,"photoIDs":[2220284.0,2220285.0,2220286.0,2220288.0,2220289.0,2220291.0,2220319.0,2220321.0,2220324.0,2220332.0],"skipIndex":0,"section_code":"gallery","featured_images":2220289.0,"id":146514,"singleSection":false});				  						galleries[146831] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Remnants","link":"gallery_146831.html","maxRecords":0.0,"photoIDs":[2225983.0,2225994.0,2226011.0,2226016.0,2226024.0],"skipIndex":0,"section_code":"gallery","featured_images":2226024.0,"id":146831,"singleSection":false});				  						galleries[374623] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fading Memories","link":"gallery_374623.html","maxRecords":0.0,"photoIDs":[6904729.0,6904731.0,6904733.0,6904734.0,6904735.0],"skipIndex":0,"section_code":"gallery","featured_images":"6904733,6904729","id":374623,"singleSection":false});				  						galleries[374622] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"For King and Country","link":"gallery_374622.html","maxRecords":0.0,"photoIDs":[6904193.0,6904243.0,6904247.0,6904252.0,6904724.0,6904276.0,6904282.0,6904288.0,6904714.0,6904300.0,6904307.0,6904310.0,6904311.0,6904315.0,6904316.0],"skipIndex":0,"section_code":"gallery","featured_images":6904243.0,"id":374622,"singleSection":false});				  						galleries[432643] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Collisions of Consciousness ","link":"gallery_432643.html","maxRecords":0.0,"photoIDs":[8074783.0,8074779.0,8074782.0,8074776.0],"skipIndex":0,"section_code":"gallery","featured_images":"8074783,8074782,8074779,8074776","id":432643,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6904714,6904300,6904252,6904243,2226024,2220289,2201346,2189857,2189811';
imageSets[2] = '6904733,6904729,6904243,2226024,2220289,2201346,2195891,2189857,2189811';
imageSets[3] = '8074783,8074782,8074779,8074776,6904735,6904734,6904733,6904731,6904729,6904724,6904714,6904316,6904315,6904311,6904310,6904307,6904300,6904288,6904282,6904276,6904252,6904247,6904243,6904193,2226024,2226016,2226011,2225994,2225983,2220332,2220324,2220321,2220319,2220291,2220289,2220288,2220286,2220285,2220284,2201354,2201346,2201335,2201331,2201312,2196098,2195926,2195919,2195917,2195915,2195891';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/helenoleary/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/helenoleary/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 += '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 = 'Helen O\'Leary Artist: ' + 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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

