window.thumbnails = {};
															thumbnails[3154596] = clik.newPhoto({"id":3154596,"src":"Heleen_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":168});
															thumbnails[834846] = clik.newPhoto({"id":834846,"src":"_DSC0596A6_thumb.jpg","galleries_id":68044,"server_id":18,"link":"photo_834846.html","width":130,"caption":"Philippines","height":109});
															thumbnails[834892] = clik.newPhoto({"id":834892,"src":"_DSC0584A1_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_834892.html","width":130,"caption":"India","height":110});
															thumbnails[834901] = clik.newPhoto({"id":834901,"src":"_DSC0583A1_thumb.jpg","galleries_id":68044,"server_id":18,"link":"photo_834901.html","width":130,"caption":"Myanmar","height":155});
															thumbnails[834910] = clik.newPhoto({"id":834910,"src":"_DSC0574A1_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_834910.html","width":130,"caption":"Nepal","height":154});
															thumbnails[834934] = clik.newPhoto({"id":834934,"src":"_DSC0595A1_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_834934.html","width":130,"caption":"Kyrgyzstan","height":109});
															thumbnails[834949] = clik.newPhoto({"id":834949,"src":"_DSC0594A1_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_834949.html","width":130,"caption":"Afghanistan","height":155});
															thumbnails[834953] = clik.newPhoto({"id":834953,"src":"_DSC0564A1_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_834953.html","width":130,"caption":"India 2","height":157});
															thumbnails[841208] = clik.newPhoto({"id":841208,"src":"_DSC0578A1_thumb.jpg","galleries_id":64065,"server_id":18,"link":"photo_841208.html","width":130,"caption":"Thailand 1","height":154});
															thumbnails[841209] = clik.newPhoto({"id":841209,"src":"_DSC0579A1_thumb.jpg","galleries_id":64065,"server_id":18,"link":"photo_841209.html","width":130,"caption":"Thailand 2","height":155});
															thumbnails[841210] = clik.newPhoto({"id":841210,"src":"_DSC0580A1_thumb.jpg","galleries_id":64065,"server_id":18,"link":"photo_841210.html","width":130,"caption":"Thailand 3","height":155});
															thumbnails[841211] = clik.newPhoto({"id":841211,"src":"_DSC0581A1_thumb.jpg","galleries_id":64065,"server_id":18,"link":"photo_841211.html","width":130,"caption":"Thailand 4","height":152});
															thumbnails[841212] = clik.newPhoto({"id":841212,"src":"_DSC0582A1_thumb.jpg","galleries_id":64065,"server_id":18,"link":"photo_841212.html","width":130,"caption":"Thailand 5","height":154});
															thumbnails[841215] = clik.newPhoto({"id":841215,"src":"_DSC0573A1_thumb.jpg","galleries_id":64264,"server_id":18,"link":"photo_841215.html","width":130,"caption":"Albania","height":156});
															thumbnails[841221] = clik.newPhoto({"id":841221,"src":"_DSC0586A1_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_841221.html","width":130,"caption":"Yemen","height":109});
															thumbnails[841227] = clik.newPhoto({"id":841227,"src":"_DSC0577A1_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_841227.html","width":130,"caption":"Egypt","height":154});
															thumbnails[841232] = clik.newPhoto({"id":841232,"src":"_DSC0565A4_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_841232.html","width":130,"caption":"Uganda","height":155});
															thumbnails[841289] = clik.newPhoto({"id":841289,"src":"_DSC0585A1_thumb.jpg","galleries_id":64074,"server_id":18,"link":"photo_841289.html","width":130,"caption":"Peru","height":110});
															thumbnails[880762] = clik.newPhoto({"id":880762,"src":"_DSC0599A_thumb.jpg","galleries_id":64264,"server_id":18,"link":"photo_880762.html","width":130,"caption":"Germany","height":109});
															thumbnails[880764] = clik.newPhoto({"id":880764,"src":"_DSC0600A_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_880764.html","width":130,"caption":"Togo","height":154});
															thumbnails[1259636] = clik.newPhoto({"id":1259636,"src":"Buthani_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_1259636.html","width":130,"caption":"Buthan","height":155});
															thumbnails[1259638] = clik.newPhoto({"id":1259638,"src":"Ethiopiei_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_1259638.html","width":130,"caption":"Ethiopia","height":158});
															thumbnails[1591456] = clik.newPhoto({"id":1591456,"src":"Israel1i_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_1591456.html","width":130,"caption":"Israel 1","height":156});
															thumbnails[1591462] = clik.newPhoto({"id":1591462,"src":"Israel2i_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_1591462.html","width":130,"caption":"Israel 2","height":157});
															thumbnails[1591467] = clik.newPhoto({"id":1591467,"src":"Israel3i_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_1591467.html","width":130,"caption":"Israel 3","height":157});
															thumbnails[1591481] = clik.newPhoto({"id":1591481,"src":"Israel4i_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_1591481.html","width":130,"caption":"Israel 4","height":156});
															thumbnails[1920086] = clik.newPhoto({"id":1920086,"src":"NamibiaX_thumb.JPG","galleries_id":64057,"server_id":18,"link":"photo_1920086.html","width":130,"caption":"Namibia","height":158});
															thumbnails[1956625] = clik.newPhoto({"id":1956625,"src":"India 3X_thumb.JPG","galleries_id":64064,"server_id":18,"link":"photo_1956625.html","width":130,"caption":"India 3","height":110});
															thumbnails[2052688] = clik.newPhoto({"id":2052688,"src":"Nepal 2X_thumb.JPG","galleries_id":64064,"server_id":18,"link":"photo_2052688.html","width":130,"caption":"Nepal 2","height":159});
															thumbnails[2427833] = clik.newPhoto({"id":2427833,"src":"Nel Velema_thumb.jpg","galleries_id":64264,"server_id":18,"link":"photo_2427833.html","width":130,"caption":"Netherlands 5","height":154});
															thumbnails[2659989] = clik.newPhoto({"id":2659989,"src":"Ben Velema_thumb.JPG","galleries_id":64264,"server_id":18,"link":"photo_2659989.html","width":130,"caption":"Netherlands 6","height":157});
															thumbnails[2904296] = clik.newPhoto({"id":2904296,"src":"Dik Busselmann_thumb.JPG","galleries_id":64264,"server_id":18,"link":"photo_2904296.html","width":129,"caption":"Netherlands 7","height":160});
															thumbnails[2904304] = clik.newPhoto({"id":2904304,"src":"Sientje Kamphuizen_thumb.JPG","galleries_id":64264,"server_id":18,"link":"photo_2904304.html","width":129,"caption":"Netherlands 8","height":160});
															thumbnails[3360635] = clik.newPhoto({"id":3360635,"src":"Eritrea_thumb.JPG","galleries_id":64057,"server_id":18,"link":"photo_3360635.html","width":130,"caption":"Eritrea","height":108});
															thumbnails[3689415] = clik.newPhoto({"id":3689415,"src":"Marcelle_thumb.JPG","galleries_id":64264,"server_id":18,"link":"photo_3689415.html","width":130,"caption":"Corsica","height":157});
															thumbnails[3861726] = clik.newPhoto({"id":3861726,"src":"Mother_Delfina_thumb.JPG","galleries_id":64264,"server_id":18,"link":"photo_3861726.html","width":130,"caption":"Portugal","height":163});
															thumbnails[3933090] = clik.newPhoto({"id":3933090,"src":"Jamaica_2_thumb.JPG","galleries_id":64074,"server_id":18,"link":"photo_3933090.html","width":130,"caption":"Jamaica 2","height":157});
															thumbnails[5066606] = clik.newPhoto({"id":5066606,"src":"Equador_thumb.jpg","galleries_id":64074,"server_id":18,"link":"photo_5066606.html","width":130,"caption":"Ecuador","height":112});
															thumbnails[5255772] = clik.newPhoto({"id":5255772,"src":"Ghana_klein_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_5255772.html","width":130,"caption":"Ghana","height":108});
															thumbnails[5438400] = clik.newPhoto({"id":5438400,"src":"Cuba_klein_thumb.jpg","galleries_id":64074,"server_id":18,"link":"photo_5438400.html","width":130,"caption":"Cuba","height":109});
															thumbnails[5625947] = clik.newPhoto({"id":5625947,"src":"Turkije_klein_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_5625947.html","width":130,"caption":"Turkey","height":156});
															thumbnails[5728749] = clik.newPhoto({"id":5728749,"src":"Burkina_Faso_i_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_5728749.html","width":130,"caption":"Burkina Faso","height":157});
															thumbnails[6008075] = clik.newPhoto({"id":6008075,"src":"Uzbekistan_k_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_6008075.html","width":130,"caption":"Uzbekistan","height":108});
															thumbnails[6827587] = clik.newPhoto({"id":6827587,"src":"Senegal_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_6827587.html","width":130,"caption":"Senegal","height":109});
															thumbnails[6960769] = clik.newPhoto({"id":6960769,"src":"Namibia_2_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_6960769.html","width":130,"caption":"Namibia 2","height":156});
															thumbnails[7047580] = clik.newPhoto({"id":7047580,"src":"Nepal_3_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_7047580.html","width":130,"caption":"Nepal 3","height":109});
															thumbnails[7047585] = clik.newPhoto({"id":7047585,"src":"Sri_Lanka_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_7047585.html","width":130,"caption":"Sri Lanka","height":156});
															thumbnails[7366127] = clik.newPhoto({"id":7366127,"src":"Vietnam_klein_thumb.jpg","galleries_id":68044,"server_id":18,"link":"photo_7366127.html","width":130,"caption":"Vietnam","height":107});
															thumbnails[7366133] = clik.newPhoto({"id":7366133,"src":"India_4_klein_thumb.jpg","galleries_id":64064,"server_id":18,"link":"photo_7366133.html","width":130,"caption":"India 4","height":109});
															thumbnails[7512226] = clik.newPhoto({"id":7512226,"src":"Dik_Busselmann_klein_thumb.jpg","galleries_id":64264,"server_id":18,"link":"photo_7512226.html","width":130,"caption":"Netherlands 10","height":166});
															thumbnails[7661684] = clik.newPhoto({"id":7661684,"src":"Algerije_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_7661684.html","width":130,"caption":"Algeria","height":109});
															thumbnails[7752746] = clik.newPhoto({"id":7752746,"src":"Benin_klein_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_7752746.html","width":130,"caption":"Benin","height":157});
															thumbnails[7858207] = clik.newPhoto({"id":7858207,"src":"Bolivia_klein_thumb.jpg","galleries_id":64074,"server_id":18,"link":"photo_7858207.html","width":130,"caption":"Bolivia","height":107});
															thumbnails[8016798] = clik.newPhoto({"id":8016798,"src":"Indonesia_klein_thumb.jpg","galleries_id":68044,"server_id":18,"link":"photo_8016798.html","width":130,"caption":"Indonesia","height":159});
															thumbnails[8325018] = clik.newPhoto({"id":8325018,"src":"Madagaskar_klein_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_8325018.html","width":130,"caption":"Madagascar","height":157});
															thumbnails[8472630] = clik.newPhoto({"id":8472630,"src":"Israel_5_klein_thumb.jpg","galleries_id":64260,"server_id":18,"link":"photo_8472630.html","width":130,"caption":"Israel 5","height":108});
															thumbnails[8582643] = clik.newPhoto({"id":8582643,"src":"Morocco_klein_thumb.jpg","galleries_id":64057,"server_id":18,"link":"photo_8582643.html","width":130,"caption":"Morocco","height":109});
															thumbnails[8988803] = clik.newPhoto({"id":8988803,"src":"Kenia_klein_thumb.jpeg","galleries_id":64057,"server_id":18,"link":"photo_8988803.html","width":130,"caption":"Kenya","height":157});
															thumbnails[1591638] = clik.newPhoto({"id":1591638,"src":"_DSC0587A_thumb.jpg","galleries_id":64264,"server_id":18,"link":"photo_1591638.html","width":130,"caption":"Netherlands 2","height":156});
															thumbnails[1920079] = clik.newPhoto({"id":1920079,"src":"ChinaX_thumb.JPG","galleries_id":68044,"server_id":18,"link":"photo_1920079.html","width":130,"caption":"China","height":109});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[68043] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Asia","link":"gallery_68043.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"8016798,7366133,841210","id":68043,"singleSection":false});				  						galleries[64064] = clik.newGallery({"parentGallery":68043,"usePopups":false,"title":"Central & South Asia","link":"gallery_64064.html","maxRecords":0.0,"photoIDs":[834892.0,834910.0,834934.0,834953.0,1259636.0,1956625.0,2052688.0,6008075.0,7047580.0,7047585.0,7366133.0],"skipIndex":0,"section_code":"gallery","featured_images":7366133.0,"id":64064,"singleSection":false});				  						galleries[68044] = clik.newGallery({"parentGallery":68043,"usePopups":false,"title":"South East Asia","link":"gallery_68044.html","maxRecords":0.0,"photoIDs":[834846.0,834901.0,7366127.0,8016798.0,1920079.0],"skipIndex":0,"section_code":"gallery","featured_images":8016798.0,"id":68044,"singleSection":false});				  						galleries[64065] = clik.newGallery({"parentGallery":68043,"usePopups":false,"title":"Thailand","link":"gallery_64065.html","maxRecords":0.0,"photoIDs":[841208.0,841209.0,841210.0,841211.0,841212.0],"skipIndex":0,"section_code":"gallery","featured_images":841210.0,"id":64065,"singleSection":false});				  						galleries[64264] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Europe","link":"gallery_64264.html","maxRecords":0.0,"photoIDs":[841215.0,880762.0,2427833.0,2659989.0,2904296.0,2904304.0,3689415.0,3861726.0,7512226.0,1591638.0],"skipIndex":0,"section_code":"gallery","featured_images":2904304.0,"id":64264,"singleSection":false});				  						galleries[64260] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Middle-East","link":"gallery_64260.html","maxRecords":0.0,"photoIDs":[834949.0,841221.0,841227.0,1591456.0,1591462.0,1591467.0,1591481.0,5625947.0,8472630.0],"skipIndex":0,"section_code":"gallery","featured_images":5625947.0,"id":64260,"singleSection":false});				  						galleries[64057] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Africa","link":"gallery_64057.html","maxRecords":0.0,"photoIDs":[841232.0,880764.0,1259638.0,1920086.0,3360635.0,5255772.0,5728749.0,6827587.0,6960769.0,7661684.0,7752746.0,8325018.0,8582643.0,8988803.0],"skipIndex":0,"section_code":"gallery","featured_images":8325018.0,"id":64057,"singleSection":false});				  						galleries[64074] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Central & South America","link":"gallery_64074.html","maxRecords":0.0,"photoIDs":[841289.0,3933090.0,5066606.0,5438400.0,7858207.0],"skipIndex":0,"section_code":"gallery","featured_images":3933090.0,"id":64074,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8988803';
imageSets[2] = '8325018,8016798,7366133,5625947,3933090,2904304,841210';
imageSets[3] = '8988803,8582643,8472630,8325018,8016798,7858207,7752746,7661684,7512226,7366133,7366127,7047585,7047580,6960769,6827587,6008075,5728749,5625947,5438400,5255772,5066606,3933090,3861726,3689415,3360635,3154596,2904304,2904296,2659989,2427833,2052688,1956625,1920086,1920079,1591638,1591481,1591467,1591462,1591456,1259638,1259636,880764,880762,841289,841232,841227,841221,841215,841212,841211';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/HeleenVelema/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/HeleenVelema/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 = 'Beautiful People: ' + 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;
	}
}

			

