window.thumbnails = {};
															thumbnails[5303190] = clik.newPhoto({"id":5303190,"src":"Revelation_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Revelation","height":164});
															thumbnails[5854402] = clik.newPhoto({"id":5854402,"src":"Monolith_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Monolith","height":171});
															thumbnails[6241355] = clik.newPhoto({"id":6241355,"src":"Signals_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Signals","height":103});
															thumbnails[6435679] = clik.newPhoto({"id":6435679,"src":"Taken_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Taken","height":99});
															thumbnails[6643503] = clik.newPhoto({"id":6643503,"src":"Grapes-_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Grapes","height":171});
															thumbnails[7659198] = clik.newPhoto({"id":7659198,"src":"Kraken-_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":99});
															thumbnails[8108607] = clik.newPhoto({"id":8108607,"src":"Caleta_negra_psg_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":177});
															thumbnails[6381990] = clik.newPhoto({"id":6381990,"src":"----------2_thumb.jpg","galleries_id":352995,"server_id":15,"link":"photo_6381990.html","width":130,"caption":"","height":43});
															thumbnails[4159491] = clik.newPhoto({"id":4159491,"src":"As_median_A3_PSg-1_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4159491.html","width":130,"caption":"SS. American Star. #1 . ","height":102});
															thumbnails[4203535] = clik.newPhoto({"id":4203535,"src":"Lobos_rainbowA3_psg-10_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203535.html","width":130,"caption":"Los Lobos","height":99});
															thumbnails[5035675] = clik.newPhoto({"id":5035675,"src":"The_Ancient1_thumb.jpg","galleries_id":285035,"server_id":15,"link":"photo_5035675.html","width":130,"caption":"The Ancient<br>\r\n","height":169});
															thumbnails[5035779] = clik.newPhoto({"id":5035779,"src":"Steps_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035779.html","width":130,"caption":"Steps","height":170});
															thumbnails[6763813] = clik.newPhoto({"id":6763813,"src":"Tindaya_Blues_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763813.html","width":130,"caption":"Tindaya Blues","height":99});
															thumbnails[8108637] = clik.newPhoto({"id":8108637,"src":"Stasis-0001_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108637.html","width":130,"caption":"Bajamar","height":177});
															thumbnails[4203538] = clik.newPhoto({"id":4203538,"src":"as_glow_psg-11_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203538.html","width":130,"caption":"SS. American Star. #4.","height":102});
															thumbnails[5035654] = clik.newPhoto({"id":5035654,"src":"Gnome1_thumb.jpg","galleries_id":285035,"server_id":15,"link":"photo_5035654.html","width":130,"caption":"Gnome","height":169});
															thumbnails[5035738] = clik.newPhoto({"id":5035738,"src":"Infinity_Pool_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_5035738.html","width":130,"caption":"Infinity Pool","height":162});
															thumbnails[5035783] = clik.newPhoto({"id":5035783,"src":"Pool_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035783.html","width":130,"caption":"Pool","height":169});
															thumbnails[6763815] = clik.newPhoto({"id":6763815,"src":"Luz_Bailando_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763815.html","width":130,"caption":"Luz Bailando","height":172});
															thumbnails[8108646] = clik.newPhoto({"id":8108646,"src":"Vorticies-0015_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108646.html","width":130,"caption":"Vortices","height":177});
															thumbnails[4203539] = clik.newPhoto({"id":4203539,"src":"Heavens_Gate_A3_Psg-12_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203539.html","width":130,"caption":"Heavens Gate","height":104});
															thumbnails[4203555] = clik.newPhoto({"id":4203555,"src":"Stripped_psg-1-19_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_4203555.html","width":130,"caption":"Stripped","height":101});
															thumbnails[5035669] = clik.newPhoto({"id":5035669,"src":"Still_Ill1_thumb.jpg","galleries_id":285035,"server_id":15,"link":"photo_5035669.html","width":130,"caption":"Still Ill","height":167});
															thumbnails[5035742] = clik.newPhoto({"id":5035742,"src":"Wheeker_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_5035742.html","width":130,"caption":"Wheeker","height":162});
															thumbnails[6763819] = clik.newPhoto({"id":6763819,"src":"Quicksand_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763819.html","width":130,"caption":"Quicksand","height":171});
															thumbnails[8108644] = clik.newPhoto({"id":8108644,"src":"Tindaya-0089_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108644.html","width":130,"caption":"Tindaya","height":177});
															thumbnails[4203445] = clik.newPhoto({"id":4203445,"src":"American_Star_new_A4_Psg-4_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4203445.html","width":130,"caption":"SS. American Star. #2.","height":101});
															thumbnails[4203545] = clik.newPhoto({"id":4203545,"src":"F_Psg-13_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203545.html","width":130,"caption":"The Journey Home","height":104});
															thumbnails[4203557] = clik.newPhoto({"id":4203557,"src":"step_revisted_A3__Psg-20_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_4203557.html","width":130,"caption":"Millenia","height":99});
															thumbnails[5035652] = clik.newPhoto({"id":5035652,"src":"Cadena_Perpetua1_thumb.jpg","galleries_id":285035,"server_id":15,"link":"photo_5035652.html","width":130,"caption":"Cadena Perpetua","height":169});
															thumbnails[6763822] = clik.newPhoto({"id":6763822,"src":"The_Crucible_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763822.html","width":130,"caption":"The Crucible","height":170});
															thumbnails[8108639] = clik.newPhoto({"id":8108639,"src":"Step_Right_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108639.html","width":130,"caption":"Ritmo","height":177});
															thumbnails[4203450] = clik.newPhoto({"id":4203450,"src":"Stepbeach_glow_A3_psg-5_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4203450.html","width":130,"caption":"Step Beach","height":99});
															thumbnails[4203548] = clik.newPhoto({"id":4203548,"src":"new_psg-151_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203548.html","width":130,"caption":"El Cotillo","height":101});
															thumbnails[4203558] = clik.newPhoto({"id":4203558,"src":"Aguas_verdes_psg_cc_copy-21_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_4203558.html","width":130,"caption":"Lighting the Cloth","height":100});
															thumbnails[6763824] = clik.newPhoto({"id":6763824,"src":"Ajouré_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763824.html","width":130,"caption":"Ajouré","height":172});
															thumbnails[8108627] = clik.newPhoto({"id":8108627,"src":"Phi_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108627.html","width":130,"caption":"Phi","height":177});
															thumbnails[4203547] = clik.newPhoto({"id":4203547,"src":"Wraiths_A3_psg-14_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4203547.html","width":130,"caption":"Wraiths","height":102});
															thumbnails[5035746] = clik.newPhoto({"id":5035746,"src":"Mused_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_5035746.html","width":130,"caption":"Mused","height":164});
															thumbnails[5035797] = clik.newPhoto({"id":5035797,"src":"Teardrop_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035797.html","width":130,"caption":"Teardrop","height":170});
															thumbnails[6763826] = clik.newPhoto({"id":6763826,"src":"Genesis_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763826.html","width":130,"caption":"Genesis","height":170});
															thumbnails[8108610] = clik.newPhoto({"id":8108610,"src":"Float-Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108610.html","width":130,"caption":"Ondular","height":177});
															thumbnails[4203455] = clik.newPhoto({"id":4203455,"src":"Cotillo_Lighthouse_Psg-7_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4203455.html","width":130,"caption":"El Cotillo Lighthouse","height":101});
															thumbnails[4203560] = clik.newPhoto({"id":4203560,"src":"step_seaweed_2_psg-23_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_4203560.html","width":130,"caption":"Pods","height":101});
															thumbnails[5035764] = clik.newPhoto({"id":5035764,"src":"Birds_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_5035764.html","width":130,"caption":"Birds","height":169});
															thumbnails[6763830] = clik.newPhoto({"id":6763830,"src":"Los_Lagos_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763830.html","width":130,"caption":"Los Lagos","height":171});
															thumbnails[8108623] = clik.newPhoto({"id":8108623,"src":"Jewel-0024_Psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108623.html","width":130,"caption":"Bijou","height":96});
															thumbnails[4203459] = clik.newPhoto({"id":4203459,"src":"Fire_and_ice_A3_PSG-8_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4203459.html","width":130,"caption":"Fire and Ice","height":99});
															thumbnails[4951234] = clik.newPhoto({"id":4951234,"src":"whosthedaddy1_thumb.jpg","galleries_id":129037,"server_id":15,"link":"photo_4951234.html","width":130,"caption":"Who´s the Daddy.<br>\r\n","height":108});
															thumbnails[5035799] = clik.newPhoto({"id":5035799,"src":"Ornate_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035799.html","width":130,"caption":"Ornate","height":172});
															thumbnails[6763831] = clik.newPhoto({"id":6763831,"src":"Still_Life_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763831.html","width":130,"caption":"Still Life","height":172});
															thumbnails[8108632] = clik.newPhoto({"id":8108632,"src":"Shimmer-0070_psg_thumb.jpg","galleries_id":434051,"server_id":15,"link":"photo_8108632.html","width":130,"caption":"Unity","height":96});
															thumbnails[4203463] = clik.newPhoto({"id":4203463,"src":"AS_SWELL_A3_PSG_-9_thumb.jpg","galleries_id":18386,"server_id":15,"link":"photo_4203463.html","width":130,"caption":"SS. American Star. #3.","height":101});
															thumbnails[4203563] = clik.newPhoto({"id":4203563,"src":"swirl_psg-25_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_4203563.html","width":130,"caption":"Untitled","height":100});
															thumbnails[6763833] = clik.newPhoto({"id":6763833,"src":"Mejillónes_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763833.html","width":130,"caption":"Mejillónes","height":99});
															thumbnails[5035801] = clik.newPhoto({"id":5035801,"src":"Cerebral_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035801.html","width":130,"caption":"Cerebral","height":171});
															thumbnails[6763836] = clik.newPhoto({"id":6763836,"src":"Soñar_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763836.html","width":130,"caption":"Soñar","height":171});
															thumbnails[5035804] = clik.newPhoto({"id":5035804,"src":"Nada_Mas_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035804.html","width":130,"caption":"Nada Mas","height":172});
															thumbnails[6763840] = clik.newPhoto({"id":6763840,"src":"Space_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763840.html","width":130,"caption":"Space","height":171});
															thumbnails[5035808] = clik.newPhoto({"id":5035808,"src":"Narcissi_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035808.html","width":130,"caption":"Narcissi","height":169});
															thumbnails[6763842] = clik.newPhoto({"id":6763842,"src":"Ahí_thumb.jpg","galleries_id":368281,"server_id":15,"link":"photo_6763842.html","width":130,"caption":"Ahí","height":97});
															thumbnails[5035810] = clik.newPhoto({"id":5035810,"src":"Adrift_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035810.html","width":130,"caption":"Adrift","height":169});
															thumbnails[5035814] = clik.newPhoto({"id":5035814,"src":"Elemental_thumb.jpg","galleries_id":18643,"server_id":15,"link":"photo_5035814.html","width":130,"caption":"Elemental","height":176});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[18386] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes Winter 2004 - 2005","link":"gallery_18386.html","maxRecords":0.0,"photoIDs":[4159491.0,5035738.0,5035742.0,4203445.0,4203450.0,5035746.0,4203455.0,4203459.0,4203463.0],"skipIndex":0,"section_code":"gallery","featured_images":"5035746,5035742,5035738,4203463,4203459,4203455,4203450,4203445,4159491","id":18386,"singleSection":false});				  						galleries[129037] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes 2006 - 2007","link":"gallery_129037.html","maxRecords":0.0,"photoIDs":[4203535.0,4203538.0,4203539.0,4203545.0,4203548.0,4203547.0,5035764.0,4951234.0],"skipIndex":0,"section_code":"gallery","featured_images":"5035764,4951234,4203548,4203547,4203545,4203539,4203538,4203535","id":129037,"singleSection":false});				  						galleries[18643] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes 2008 - 2009","link":"gallery_18643.html","maxRecords":0.0,"photoIDs":[5035779.0,5035783.0,4203555.0,4203557.0,4203558.0,5035797.0,4203560.0,5035799.0,4203563.0,5035801.0,5035804.0,5035808.0,5035810.0,5035814.0],"skipIndex":0,"section_code":"gallery","featured_images":"5035814,5035810,5035808,5035804,5035801,5035799,5035797,5035783,5035779,4203563","id":18643,"singleSection":false});				  						galleries[368281] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes winter 2009-2010","link":"gallery_368281.html","maxRecords":0.0,"photoIDs":[6763813.0,6763815.0,6763819.0,6763822.0,6763824.0,6763826.0,6763830.0,6763831.0,6763833.0,6763836.0,6763840.0,6763842.0],"skipIndex":0,"section_code":"gallery","featured_images":"6763842,6763840,6763836,6763833,6763831,6763830,6763826,6763824,6763822,6763819","id":368281,"singleSection":false});				  						galleries[434051] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes winter 2010-2011","link":"gallery_434051.html","maxRecords":0.0,"photoIDs":[8108637.0,8108646.0,8108644.0,8108639.0,8108627.0,8108610.0,8108623.0,8108632.0],"skipIndex":0,"section_code":"gallery","featured_images":"8108646,8108644,8108639,8108637,8108632,8108627,8108623,8108610","id":434051,"singleSection":false});				  						galleries[285035] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fuerte Rocks","link":"gallery_285035.html","maxRecords":0.0,"photoIDs":[5035675.0,5035654.0,5035669.0,5035652.0],"skipIndex":0,"section_code":"gallery","featured_images":"5035675,5035669,5035654,5035652","id":285035,"singleSection":false});				  						galleries[352995] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"  ","link":"gallery_352995.html","maxRecords":0.0,"photoIDs":[6381990.0],"skipIndex":0,"section_code":"gallery","featured_images":6381990.0,"id":352995,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8108607,7659198';
imageSets[3] = '4951234,4203563,4203560,4203558,4203557,4203555,4203548,4203547,4203545,4203539,4203538,4203535,4203463,4203459,4203455,4203450,4203445,4159491';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bemac/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bemac/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bemac/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bemac/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bemac/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bemac/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bemac/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 = 'Daisychained-Photography.com: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &euro;' + (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>Your choices for this photograph :- </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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="daisychained-photography@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="EUR">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="daisychained-photography@hotmail.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

