window.thumbnails = {};
															thumbnails[7722995] = clik.newPhoto({"id":7722995,"src":"wendy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":81});
															thumbnails[7722996] = clik.newPhoto({"id":7722996,"src":"annie_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":103});
															thumbnails[7722997] = clik.newPhoto({"id":7722997,"src":"Ella_212_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":173});
															thumbnails[7722998] = clik.newPhoto({"id":7722998,"src":"Oliverandlily_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":82});
															thumbnails[7723003] = clik.newPhoto({"id":7723003,"src":"lily_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":117});
															thumbnails[7723005] = clik.newPhoto({"id":7723005,"src":"oliver_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":122});
															thumbnails[7723022] = clik.newPhoto({"id":7723022,"src":"Wendy_Broekx_and_Annie_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":205});
															thumbnails[7719510] = clik.newPhoto({"id":7719510,"src":"yelloweyedpenguin2_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719510.html","width":130,"caption":"","height":90});
															thumbnails[7719538] = clik.newPhoto({"id":7719538,"src":"Sweep_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719538.html","width":130,"caption":"","height":85});
															thumbnails[7719554] = clik.newPhoto({"id":7719554,"src":"wildhorses2_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719554.html","width":130,"caption":"","height":80});
															thumbnails[7719608] = clik.newPhoto({"id":7719608,"src":"Tongariro_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719608.html","width":130,"caption":"","height":85});
															thumbnails[7719639] = clik.newPhoto({"id":7719639,"src":"salvationjane_thumb.jpg","galleries_id":417824,"server_id":1,"link":"photo_7719639.html","width":130,"caption":"","height":87});
															thumbnails[7719714] = clik.newPhoto({"id":7719714,"src":"windowshopping_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719714.html","width":130,"caption":"","height":86});
															thumbnails[7719507] = clik.newPhoto({"id":7719507,"src":"yelloweyedpenguin_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719507.html","width":130,"caption":"","height":87});
															thumbnails[7719533] = clik.newPhoto({"id":7719533,"src":"Oscar_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719533.html","width":130,"caption":"","height":87});
															thumbnails[7719551] = clik.newPhoto({"id":7719551,"src":"wildhorses1_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719551.html","width":130,"caption":"","height":79});
															thumbnails[7719567] = clik.newPhoto({"id":7719567,"src":"magicalmountains_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719567.html","width":130,"caption":"","height":87});
															thumbnails[7719653] = clik.newPhoto({"id":7719653,"src":"wilddaisies_thumb.jpg","galleries_id":417824,"server_id":1,"link":"photo_7719653.html","width":130,"caption":"","height":83});
															thumbnails[7719711] = clik.newPhoto({"id":7719711,"src":"Malaysiachildren_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719711.html","width":130,"caption":"","height":86});
															thumbnails[7719502] = clik.newPhoto({"id":7719502,"src":"sealionyawning_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719502.html","width":130,"caption":"","height":87});
															thumbnails[7719524] = clik.newPhoto({"id":7719524,"src":"Miki_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719524.html","width":130,"caption":"","height":86});
															thumbnails[7719561] = clik.newPhoto({"id":7719561,"src":"enchantedforest_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719561.html","width":130,"caption":"","height":87});
															thumbnails[7719640] = clik.newPhoto({"id":7719640,"src":"Sunflower_thumb.jpg","galleries_id":417824,"server_id":1,"link":"photo_7719640.html","width":130,"caption":"","height":87});
															thumbnails[7719676] = clik.newPhoto({"id":7719676,"src":"guitar_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719676.html","width":130,"caption":"","height":87});
															thumbnails[7719484] = clik.newPhoto({"id":7719484,"src":"sealionontherun_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719484.html","width":130,"caption":"","height":87});
															thumbnails[7719520] = clik.newPhoto({"id":7719520,"src":"kelty_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719520.html","width":130,"caption":"","height":89});
															thumbnails[7719546] = clik.newPhoto({"id":7719546,"src":"wildhorse_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719546.html","width":130,"caption":"","height":92});
															thumbnails[7719558] = clik.newPhoto({"id":7719558,"src":"bealeyspurview_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719558.html","width":130,"caption":"","height":87});
															thumbnails[7719628] = clik.newPhoto({"id":7719628,"src":"ArumLily_thumb.jpg","galleries_id":417824,"server_id":1,"link":"photo_7719628.html","width":130,"caption":"","height":87});
															thumbnails[7719656] = clik.newPhoto({"id":7719656,"src":"cowboycampfire_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719656.html","width":130,"caption":"","height":87});
															thumbnails[7719472] = clik.newPhoto({"id":7719472,"src":"oystercatcher_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719472.html","width":130,"caption":"","height":81});
															thumbnails[7719518] = clik.newPhoto({"id":7719518,"src":"Jax_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719518.html","width":130,"caption":"","height":76});
															thumbnails[7719548] = clik.newPhoto({"id":7719548,"src":"wildhorse3_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719548.html","width":130,"caption":"","height":87});
															thumbnails[7719604] = clik.newPhoto({"id":7719604,"src":"snowriver_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719604.html","width":130,"caption":"","height":87});
															thumbnails[7719629] = clik.newPhoto({"id":7719629,"src":"frangipani_thumb.jpg","galleries_id":417824,"server_id":1,"link":"photo_7719629.html","width":130,"caption":"","height":195});
															thumbnails[7719677] = clik.newPhoto({"id":7719677,"src":"lisa2_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719677.html","width":130,"caption":"","height":88});
															thumbnails[7719456] = clik.newPhoto({"id":7719456,"src":"keaofthemountains_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719456.html","width":130,"caption":"","height":86});
															thumbnails[7719515] = clik.newPhoto({"id":7719515,"src":"Gus_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719515.html","width":130,"caption":"","height":87});
															thumbnails[7719544] = clik.newPhoto({"id":7719544,"src":"tassiehorses_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719544.html","width":130,"caption":"","height":82});
															thumbnails[7719602] = clik.newPhoto({"id":7719602,"src":"snowriders_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719602.html","width":130,"caption":"","height":84});
															thumbnails[7719679] = clik.newPhoto({"id":7719679,"src":"lisa8_thumb.jpg","galleries_id":417828,"server_id":1,"link":"photo_7719679.html","width":130,"caption":"","height":203});
															thumbnails[7719504] = clik.newPhoto({"id":7719504,"src":"trunksilhouette_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719504.html","width":130,"caption":"","height":80});
															thumbnails[7719536] = clik.newPhoto({"id":7719536,"src":"sam_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719536.html","width":130,"caption":"","height":88});
															thumbnails[7719542] = clik.newPhoto({"id":7719542,"src":"nosingaround_thumb.jpg","galleries_id":417826,"server_id":1,"link":"photo_7719542.html","width":130,"caption":"","height":87});
															thumbnails[7719565] = clik.newPhoto({"id":7719565,"src":"home_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719565.html","width":130,"caption":"","height":87});
															thumbnails[7719469] = clik.newPhoto({"id":7719469,"src":"orangutans_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719469.html","width":130,"caption":"","height":87});
															thumbnails[7719422] = clik.newPhoto({"id":7719422,"src":"Acrobat_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719422.html","width":130,"caption":"","height":82});
															thumbnails[7719521] = clik.newPhoto({"id":7719521,"src":"loungeroomleopard_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719521.html","width":130,"caption":"","height":84});
															thumbnails[7719600] = clik.newPhoto({"id":7719600,"src":"oldpickup_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719600.html","width":130,"caption":"","height":87});
															thumbnails[7719425] = clik.newPhoto({"id":7719425,"src":"bearbreakfast_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719425.html","width":130,"caption":"","height":84});
															thumbnails[7719514] = clik.newPhoto({"id":7719514,"src":"Brittany_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719514.html","width":130,"caption":"","height":85});
															thumbnails[7719568] = clik.newPhoto({"id":7719568,"src":"MandalayBeach_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719568.html","width":130,"caption":"","height":87});
															thumbnails[7719428] = clik.newPhoto({"id":7719428,"src":"bison_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719428.html","width":130,"caption":"","height":75});
															thumbnails[7719539] = clik.newPhoto({"id":7719539,"src":"Thomas_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719539.html","width":130,"caption":"","height":138});
															thumbnails[7719595] = clik.newPhoto({"id":7719595,"src":"MistyMountains_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719595.html","width":130,"caption":"","height":83});
															thumbnails[7719442] = clik.newPhoto({"id":7719442,"src":"hiding_ground__squirrel_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719442.html","width":130,"caption":"","height":86});
															thumbnails[7719527] = clik.newPhoto({"id":7719527,"src":"Munchee_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719527.html","width":130,"caption":"","height":184});
															thumbnails[7719597] = clik.newPhoto({"id":7719597,"src":"newmexico_thumb.jpg","galleries_id":417823,"server_id":1,"link":"photo_7719597.html","width":130,"caption":"","height":53});
															thumbnails[7719459] = clik.newPhoto({"id":7719459,"src":"marmot_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719459.html","width":130,"caption":"","height":81});
															thumbnails[7719437] = clik.newPhoto({"id":7719437,"src":"elk_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719437.html","width":130,"caption":"","height":98});
															thumbnails[7719436] = clik.newPhoto({"id":7719436,"src":"caribouherd_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719436.html","width":130,"caption":"","height":54});
															thumbnails[7719503] = clik.newPhoto({"id":7719503,"src":"ternsinflight_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719503.html","width":130,"caption":"","height":80});
															thumbnails[7719531] = clik.newPhoto({"id":7719531,"src":"onegiantleap3_thumb.jpg","galleries_id":417825,"server_id":1,"link":"photo_7719531.html","width":130,"caption":"","height":205});
															thumbnails[7719474] = clik.newPhoto({"id":7719474,"src":"pelican_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719474.html","width":130,"caption":"","height":87});
															thumbnails[7719453] = clik.newPhoto({"id":7719453,"src":"kangarooface_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719453.html","width":130,"caption":"","height":87});
															thumbnails[7719448] = clik.newPhoto({"id":7719448,"src":"ghostcrab_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719448.html","width":130,"caption":"","height":82});
															thumbnails[7719435] = clik.newPhoto({"id":7719435,"src":"blackcockatoo_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719435.html","width":130,"caption":"","height":87});
															thumbnails[7719440] = clik.newPhoto({"id":7719440,"src":"Flamingofrenzy_thumb.jpg","galleries_id":417822,"server_id":1,"link":"photo_7719440.html","width":130,"caption":"","height":80});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[417822] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Wildlife","link":"gallery_417822.html","maxRecords":0.0,"photoIDs":[7719510.0,7719507.0,7719502.0,7719484.0,7719472.0,7719456.0,7719504.0,7719469.0,7719422.0,7719425.0,7719428.0,7719442.0,7719459.0,7719437.0,7719436.0,7719503.0,7719474.0,7719453.0,7719448.0,7719435.0,7719440.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719456,7719453,7719442,7719428,7719422","id":417822,"singleSection":false});				  						galleries[417823] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Landscape","link":"gallery_417823.html","maxRecords":0.0,"photoIDs":[7719608.0,7719567.0,7719561.0,7719558.0,7719604.0,7719602.0,7719565.0,7719600.0,7719568.0,7719595.0,7719597.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719608,7719604,7719602,7719600,7719597,7719595,7719568,7719567,7719565,7719561","id":417823,"singleSection":false});				  						galleries[417824] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Flowers & Plants","link":"gallery_417824.html","maxRecords":0.0,"photoIDs":[7719639.0,7719653.0,7719640.0,7719628.0,7719629.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719653,7719640,7719639,7719629,7719628","id":417824,"singleSection":false});				  						galleries[417825] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Cats & Dogs","link":"gallery_417825.html","maxRecords":0.0,"photoIDs":[7719538.0,7719533.0,7719524.0,7719520.0,7719518.0,7719515.0,7719536.0,7719521.0,7719514.0,7719539.0,7719527.0,7719531.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719539,7719538,7719536,7719533,7719531,7719527,7719524,7719521,7719520,7719518","id":417825,"singleSection":false});				  						galleries[417826] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Horses","link":"gallery_417826.html","maxRecords":0.0,"photoIDs":[7719554.0,7719551.0,7719546.0,7719548.0,7719544.0,7719542.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719554,7719551,7719548,7719546,7719544,7719542","id":417826,"singleSection":false});				  						galleries[417828] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"People","link":"gallery_417828.html","maxRecords":0.0,"photoIDs":[7719714.0,7719711.0,7719676.0,7719656.0,7719677.0,7719679.0],"skipIndex":0,"section_code":"gallery","featured_images":"7719714,7719711,7719679,7719677,7719676,7719656","id":417828,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[241679] = '7723022,7723005,7723003,7722998,7722997,7722996,7722995';
imageSets[1] = '7719714,7719711,7719677,7719676,7719656,7719653,7719640,7719639,7719628,7719608,7719604,7719602,7719600,7719597,7719595,7719568,7719567,7719565,7719561,7719558,7719554,7719551,7719548,7719546,7719544,7719542,7719539,7719538,7719536,7719533,7719524,7719521,7719520,7719518,7719515,7719514,7719510,7719507,7719504,7719503,7719502,7719484,7719474,7719456,7719422';
imageSets[2] = '7719456,7719453,7719442,7719428,7719422';
imageSets[3] = '7719714,7719711,7719677,7719676,7719656,7719653,7719640,7719639,7719628,7719608,7719604,7719602,7719600,7719597,7719595,7719568,7719567,7719565,7719561,7719558,7719554,7719551,7719548,7719546,7719544,7719542,7719539,7719538,7719536,7719533,7719524,7719521,7719520,7719518,7719515,7719514,7719510,7719507,7719504,7719503,7719502,7719484,7719474';
imageSets[241680] = '7723022,7723005,7723003,7722998,7722997,7722996,7722995';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/wendyb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/wendyb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/wendyb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/wendyb/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/wendyb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/wendyb/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/wendyb/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 = 'photography by wendy broekx: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

