window.thumbnails = {};
															thumbnails[4723322] = clik.newPhoto({"id":4723322,"src":"glimpsed_03_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4723763] = clik.newPhoto({"id":4723763,"src":"glimpsed_08_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":97});
															thumbnails[4723814] = clik.newPhoto({"id":4723814,"src":"un_certainties_05_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4735953] = clik.newPhoto({"id":4735953,"src":"glimpsed_06jpg_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4736607] = clik.newPhoto({"id":4736607,"src":"site_works_07_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"ref un\/certainties 58","height":98});
															thumbnails[4736611] = clik.newPhoto({"id":4736611,"src":"glimpsed_04_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4746878] = clik.newPhoto({"id":4746878,"src":"un_certainties_07jpg_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4747770] = clik.newPhoto({"id":4747770,"src":"glimpsed_021_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4763485] = clik.newPhoto({"id":4763485,"src":"un_certainties_04_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4763859] = clik.newPhoto({"id":4763859,"src":"glimpsed_09_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4771833] = clik.newPhoto({"id":4771833,"src":"un_certainties_011_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4871806] = clik.newPhoto({"id":4871806,"src":"un_certainties_57_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4871887] = clik.newPhoto({"id":4871887,"src":"un_certainties_063_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":97});
															thumbnails[8188830] = clik.newPhoto({"id":8188830,"src":"defences_202_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":202.0,"height":98});
															thumbnails[4915690] = clik.newPhoto({"id":4915690,"src":"glimpsed_07a_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4747590] = clik.newPhoto({"id":4747590,"src":"street_level_01_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4771826] = clik.newPhoto({"id":4771826,"src":"street_level_02_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":97});
															thumbnails[4736640] = clik.newPhoto({"id":4736640,"src":"streetlevel_03_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4763495] = clik.newPhoto({"id":4763495,"src":"street_level_04_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4747622] = clik.newPhoto({"id":4747622,"src":"streetlevel_05_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4861575] = clik.newPhoto({"id":4861575,"src":"street_level_06_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":97});
															thumbnails[4736651] = clik.newPhoto({"id":4736651,"src":"streetlevel_07_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4771838] = clik.newPhoto({"id":4771838,"src":"street_level_08_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5315373] = clik.newPhoto({"id":5315373,"src":"streetlevel_09_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4723292] = clik.newPhoto({"id":4723292,"src":"inside_out-19_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_4723292.html","width":130,"caption":"","height":97});
															thumbnails[4723769] = clik.newPhoto({"id":4723769,"src":"inside_out_12_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_4723769.html","width":130,"caption":"","height":88});
															thumbnails[7285747] = clik.newPhoto({"id":7285747,"src":"inside_out_161_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_7285747.html","width":130,"caption":"inside_out 13","height":98});
															thumbnails[8609265] = clik.newPhoto({"id":8609265,"src":"inside_out_14_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_8609265.html","width":130,"caption":"","height":96});
															thumbnails[8609266] = clik.newPhoto({"id":8609266,"src":"inside_out_15_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_8609266.html","width":130,"caption":"","height":96});
															thumbnails[8609267] = clik.newPhoto({"id":8609267,"src":"inside_out_16_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_8609267.html","width":130,"caption":"","height":96});
															thumbnails[4736657] = clik.newPhoto({"id":4736657,"src":"inside_out_17_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_4736657.html","width":130,"caption":"","height":95});
															thumbnails[4861569] = clik.newPhoto({"id":4861569,"src":"inside_out_11_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_4861569.html","width":130,"caption":"","height":97});
															thumbnails[8609295] = clik.newPhoto({"id":8609295,"src":"inside_out_18_thumb.jpg","galleries_id":271259,"server_id":18,"link":"photo_8609295.html","width":130,"caption":"","height":99});
															thumbnails[8188810] = clik.newPhoto({"id":8188810,"src":"defences_200_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188810.html","width":130,"caption":200.0,"height":98});
															thumbnails[8189281] = clik.newPhoto({"id":8189281,"src":"defences_201_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8189281.html","width":130,"caption":201.0,"height":97});
															thumbnails[8188852] = clik.newPhoto({"id":8188852,"src":"defences_203_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188852.html","width":130,"caption":"defences_203","height":95});
															thumbnails[8188859] = clik.newPhoto({"id":8188859,"src":"defences_204_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188859.html","width":130,"caption":204.0,"height":98});
															thumbnails[8188862] = clik.newPhoto({"id":8188862,"src":"defences_205_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188862.html","width":130,"caption":205.0,"height":96});
															thumbnails[8188895] = clik.newPhoto({"id":8188895,"src":"defences_209_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188895.html","width":130,"caption":206.0,"height":99});
															thumbnails[8188893] = clik.newPhoto({"id":8188893,"src":"defences_208_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8188893.html","width":130,"caption":208.0,"height":97});
															thumbnails[8189293] = clik.newPhoto({"id":8189293,"src":"defences_209_58E692E7-1EC9-D45B-1CCAAEC380502412_thumb.jpg","galleries_id":437121,"server_id":18,"link":"photo_8189293.html","width":130,"caption":209.0,"height":98});
															thumbnails[8632766] = clik.newPhoto({"id":8632766,"src":"veiled_410_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_8632766.html","width":130,"caption":"","height":98});
															thumbnails[8632792] = clik.newPhoto({"id":8632792,"src":"veiled_420_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_8632792.html","width":130,"caption":"","height":97});
															thumbnails[8632793] = clik.newPhoto({"id":8632793,"src":"veiled_430_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_8632793.html","width":130,"caption":"","height":98});
															thumbnails[8632797] = clik.newPhoto({"id":8632797,"src":"veiled_440_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_8632797.html","width":130,"caption":"","height":97});
															thumbnails[4747650] = clik.newPhoto({"id":4747650,"src":"veiled_450_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_4747650.html","width":130,"caption":"","height":98});
															thumbnails[4872030] = clik.newPhoto({"id":4872030,"src":"veiled_460_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_4872030.html","width":130,"caption":"","height":97});
															thumbnails[4778876] = clik.newPhoto({"id":4778876,"src":"veiled_4901_thumb.jpg","galleries_id":271263,"server_id":18,"link":"photo_4778876.html","width":130,"caption":"","height":97});
															thumbnails[8639189] = clik.newPhoto({"id":8639189,"src":"enfolded_710a_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_8639189.html","width":130,"caption":"","height":98});
															thumbnails[7360906] = clik.newPhoto({"id":7360906,"src":"enfolded_720_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7360906.html","width":130,"caption":"enfolded_720","height":98});
															thumbnails[7361164] = clik.newPhoto({"id":7361164,"src":"enfolded_729_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7361164.html","width":130,"caption":"enfolded_729","height":97});
															thumbnails[7360910] = clik.newPhoto({"id":7360910,"src":"enfolded_721_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7360910.html","width":130,"caption":"enfolded_730","height":98});
															thumbnails[7360944] = clik.newPhoto({"id":7360944,"src":"enfolded_722_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7360944.html","width":130,"caption":"enfolded_722","height":100});
															thumbnails[7360997] = clik.newPhoto({"id":7360997,"src":"enfolded_750_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7360997.html","width":130,"caption":"enfolded_750","height":97});
															thumbnails[7361079] = clik.newPhoto({"id":7361079,"src":"enfolded_725_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7361079.html","width":130,"caption":"enfolded_760","height":101});
															thumbnails[7361081] = clik.newPhoto({"id":7361081,"src":"enfolded_726_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7361081.html","width":130,"caption":"enfolded_770","height":98});
															thumbnails[7361126] = clik.newPhoto({"id":7361126,"src":"enfolded_727_thumb.jpg","galleries_id":398299,"server_id":18,"link":"photo_7361126.html","width":130,"caption":"enfolded_780","height":98});
															thumbnails[7299875] = clik.newPhoto({"id":7299875,"src":"holding_on_80_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299875.html","width":130,"caption":"","height":97});
															thumbnails[7299880] = clik.newPhoto({"id":7299880,"src":"holding_on_81_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299880.html","width":130,"caption":"","height":98});
															thumbnails[7299897] = clik.newPhoto({"id":7299897,"src":"holding_on_82_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299897.html","width":130,"caption":"","height":98});
															thumbnails[7299906] = clik.newPhoto({"id":7299906,"src":"holding_on_83_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299906.html","width":130,"caption":"","height":98});
															thumbnails[7299909] = clik.newPhoto({"id":7299909,"src":"holding_on_84_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299909.html","width":130,"caption":"","height":98});
															thumbnails[7299915] = clik.newPhoto({"id":7299915,"src":"holding_on_85_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299915.html","width":130,"caption":"","height":98});
															thumbnails[7299920] = clik.newPhoto({"id":7299920,"src":"holding_on_86_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299920.html","width":130,"caption":"","height":96});
															thumbnails[7299940] = clik.newPhoto({"id":7299940,"src":"holding_on_87_thumb.jpg","galleries_id":394911,"server_id":18,"link":"photo_7299940.html","width":130,"caption":"","height":99});
															thumbnails[7301018] = clik.newPhoto({"id":7301018,"src":"site_works_900_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301018.html","width":130,"caption":"","height":100});
															thumbnails[7301030] = clik.newPhoto({"id":7301030,"src":"site_works_901_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301030.html","width":130,"caption":"","height":99});
															thumbnails[7301044] = clik.newPhoto({"id":7301044,"src":"site_works_902_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301044.html","width":130,"caption":"","height":92});
															thumbnails[7654657] = clik.newPhoto({"id":7654657,"src":"site_works_908_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7654657.html","width":130,"caption":"","height":98});
															thumbnails[7301051] = clik.newPhoto({"id":7301051,"src":"site_works_904_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301051.html","width":130,"caption":"","height":98});
															thumbnails[7301055] = clik.newPhoto({"id":7301055,"src":"site_works_905_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301055.html","width":130,"caption":"","height":98});
															thumbnails[7301066] = clik.newPhoto({"id":7301066,"src":"site_works_906_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301066.html","width":130,"caption":"","height":97});
															thumbnails[7301097] = clik.newPhoto({"id":7301097,"src":"site_works_907_thumb.jpg","galleries_id":394952,"server_id":18,"link":"photo_7301097.html","width":130,"caption":"","height":99});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[271259] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"inside out","link":"gallery_271259.html","maxRecords":0.0,"photoIDs":[4723292.0,4723769.0,7285747.0,8609265.0,8609266.0,8609267.0,4736657.0,4861569.0,8609295.0],"skipIndex":0,"section_code":"gallery","featured_images":"8609295,8609267,7285747,4861569,4736657,4723769,4723292","id":271259,"singleSection":false});				  						galleries[271263] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"veiled","link":"gallery_271263.html","maxRecords":0.0,"photoIDs":[8632766.0,8632792.0,8632793.0,8632797.0,4747650.0,4872030.0,4778876.0],"skipIndex":0,"section_code":"gallery","featured_images":"8632797,8632766,4872030,4778876,4747650","id":271263,"singleSection":false});				  						galleries[437121] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"defences","link":"gallery_437121.html","maxRecords":0.0,"photoIDs":[8188810.0,8189281.0,8188852.0,8188859.0,8188862.0,8188895.0,8188893.0,8189293.0],"skipIndex":0,"section_code":"gallery","featured_images":"8188895,8188852","id":437121,"singleSection":false});				  						galleries[398299] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"enfolded","link":"gallery_398299.html","maxRecords":0.0,"photoIDs":[8639189.0,7360906.0,7361164.0,7360910.0,7360944.0,7360997.0,7361079.0,7361081.0,7361126.0],"skipIndex":0,"section_code":"gallery","featured_images":"7361164,7361126,7361081,7361079","id":398299,"singleSection":false});				  						galleries[394911] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"holding_on","link":"gallery_394911.html","maxRecords":0.0,"photoIDs":[7299875.0,7299880.0,7299897.0,7299906.0,7299909.0,7299915.0,7299920.0,7299940.0],"skipIndex":0,"section_code":"gallery","featured_images":"7299940,7299920,7299915,7299897,7299875","id":394911,"singleSection":false});				  						galleries[394952] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"site works","link":"gallery_394952.html","maxRecords":0.0,"photoIDs":[7301018.0,7301030.0,7301044.0,7654657.0,7301051.0,7301055.0,7301066.0,7301097.0],"skipIndex":0,"section_code":"gallery","featured_images":"7301055,7301051","id":394952,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[239982] = '8609265,8609266';
imageSets[1] = '4871806,4763485,4735953,4723322,4723292,4723769,8609267,8188859,8188895,8632797,4747650,4872030,7299920,7299940';
imageSets[2] = '4871806,4763859,4763485,4746878,4736607,4723814,4723292,4723769,7285747,8609267,4736657,4861569,8609295,4915690,4763495,4747622,4771838,8188852,8188895,8632766,8632797,4747650,4872030,4778876,7361164,7361079,7361081,7361126,7299875,7299897,7299915,7299920,7299940,7301051,7301055';
imageSets[3] = '8639189,8632797,8632793,8632792,8632766,8609295,8609267,8609266,8609265,8189293,8189281,8188895,8188893,8188862,8188859,8188852,8188830,8188810,7654657,7361164,7361126,7361081,7361079,7360997,7360944,7360910,7360906,7301097,7301066,7301055,7301051,7301044,7301030,7301018,7299940,7299920,7299915,7299909,7299906,7299897,7299880,7299875,7285747,5315373,4915690,4872030,4871887,4871806,4861575,4861569';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/krystinastima/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/krystinastima/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 = 'krystina stimakovits  |  P H O T O G R A P H Y: ' + 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;
	}
}

			

