window.thumbnails = {};
															thumbnails[4335802] = clik.newPhoto({"id":4335802,"src":"471_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"#47","height":130});
															thumbnails[4335806] = clik.newPhoto({"id":4335806,"src":"861_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 86","height":130});
															thumbnails[4335933] = clik.newPhoto({"id":4335933,"src":"921_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 92","height":130});
															thumbnails[4335938] = clik.newPhoto({"id":4335938,"src":"931_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 93","height":130});
															thumbnails[4335959] = clik.newPhoto({"id":4335959,"src":"110_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 110","height":130});
															thumbnails[4336039] = clik.newPhoto({"id":4336039,"src":"1151_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 115","height":130});
															thumbnails[4336053] = clik.newPhoto({"id":4336053,"src":"1181_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 118","height":130});
															thumbnails[4336062] = clik.newPhoto({"id":4336062,"src":"120_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 120","height":130});
															thumbnails[4486703] = clik.newPhoto({"id":4486703,"src":"112_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 112","height":130});
															thumbnails[6449839] = clik.newPhoto({"id":6449839,"src":"_193_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 193","height":87});
															thumbnails[4329317] = clik.newPhoto({"id":4329317,"src":"4_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 4","height":130});
															thumbnails[4329324] = clik.newPhoto({"id":4329324,"src":"41_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"#4","height":130});
															thumbnails[6449945] = clik.newPhoto({"id":6449945,"src":"_201_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 201","height":130});
															thumbnails[6449948] = clik.newPhoto({"id":6449948,"src":"_204_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"# 204","height":92});
															thumbnails[4335736] = clik.newPhoto({"id":4335736,"src":"1451_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4335736.html","width":130,"caption":"#145","height":130});
															thumbnails[4335738] = clik.newPhoto({"id":4335738,"src":"1461_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4335738.html","width":130,"caption":"#146","height":130});
															thumbnails[4335805] = clik.newPhoto({"id":4335805,"src":"841_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_4335805.html","width":130,"caption":"#84","height":130});
															thumbnails[4335808] = clik.newPhoto({"id":4335808,"src":"881_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_4335808.html","width":130,"caption":"# 88","height":130});
															thumbnails[4335813] = clik.newPhoto({"id":4335813,"src":"911_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_4335813.html","width":130,"caption":"#91","height":130});
															thumbnails[4335949] = clik.newPhoto({"id":4335949,"src":"108_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4335949.html","width":130,"caption":"#108","height":130});
															thumbnails[4335965] = clik.newPhoto({"id":4335965,"src":"1111_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_4335965.html","width":130,"caption":"# 111","height":130});
															thumbnails[4336058] = clik.newPhoto({"id":4336058,"src":"119_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_4336058.html","width":130,"caption":"# 119","height":130});
															thumbnails[4336067] = clik.newPhoto({"id":4336067,"src":"1251_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4336067.html","width":130,"caption":"# 125","height":130});
															thumbnails[4336071] = clik.newPhoto({"id":4336071,"src":"1371_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4336071.html","width":130,"caption":"# 137","height":130});
															thumbnails[4336075] = clik.newPhoto({"id":4336075,"src":"1501_thumb.jpg","galleries_id":254945,"server_id":15,"link":"photo_4336075.html","width":130,"caption":"# 150","height":130});
															thumbnails[5612170] = clik.newPhoto({"id":5612170,"src":"Construction_01_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612170.html","width":130,"caption":"Construction 01","height":130});
															thumbnails[5612176] = clik.newPhoto({"id":5612176,"src":"Construction_02_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612176.html","width":130,"caption":"Construction 02","height":130});
															thumbnails[5612180] = clik.newPhoto({"id":5612180,"src":"Lines_01_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612180.html","width":130,"caption":"Lines 01","height":130});
															thumbnails[5612182] = clik.newPhoto({"id":5612182,"src":"Lines_02_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612182.html","width":130,"caption":"Lines 02","height":130});
															thumbnails[5612185] = clik.newPhoto({"id":5612185,"src":"Lines_03__thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612185.html","width":130,"caption":"Lines 03","height":130});
															thumbnails[5612189] = clik.newPhoto({"id":5612189,"src":"Lines_04_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612189.html","width":130,"caption":"Lines 04","height":130});
															thumbnails[5612228] = clik.newPhoto({"id":5612228,"src":"Lines_05_thumb.jpg","galleries_id":318226,"server_id":15,"link":"photo_5612228.html","width":130,"caption":"Lines 05","height":130});
															thumbnails[6425631] = clik.newPhoto({"id":6425631,"src":"_2271_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_6425631.html","width":130,"caption":"# 227","height":130});
															thumbnails[6449734] = clik.newPhoto({"id":6449734,"src":"_230_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_6449734.html","width":130,"caption":"# 230","height":130});
															thumbnails[6449735] = clik.newPhoto({"id":6449735,"src":"_235_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_6449735.html","width":130,"caption":"# 235","height":130});
															thumbnails[7239023] = clik.newPhoto({"id":7239023,"src":"_282_thumb.jpg","galleries_id":255192,"server_id":15,"link":"photo_7239023.html","width":130,"caption":"# 288","height":130});
															thumbnails[4335509] = clik.newPhoto({"id":4335509,"src":"130_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335509.html","width":130,"caption":"# 130","height":130});
															thumbnails[5561771] = clik.newPhoto({"id":5561771,"src":"NY011_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561771.html","width":130,"caption":"NY 01","height":130});
															thumbnails[4335661] = clik.newPhoto({"id":4335661,"src":"139_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335661.html","width":130,"caption":"#139","height":130});
															thumbnails[4335732] = clik.newPhoto({"id":4335732,"src":"144_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335732.html","width":130,"caption":"#144","height":130});
															thumbnails[5561766] = clik.newPhoto({"id":5561766,"src":"NY02_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561766.html","width":130,"caption":"NY 02","height":130});
															thumbnails[4335953] = clik.newPhoto({"id":4335953,"src":"109_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335953.html","width":130,"caption":"# 109","height":130});
															thumbnails[5561773] = clik.newPhoto({"id":5561773,"src":"NY03_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561773.html","width":130,"caption":"NY 03","height":130});
															thumbnails[4335725] = clik.newPhoto({"id":4335725,"src":"1411_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335725.html","width":130,"caption":"#141","height":130});
															thumbnails[5470514] = clik.newPhoto({"id":5470514,"src":"_165_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5470514.html","width":130,"caption":"# 165","height":130});
															thumbnails[5561774] = clik.newPhoto({"id":5561774,"src":"NY04_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561774.html","width":130,"caption":"NY 04","height":130});
															thumbnails[4335794] = clik.newPhoto({"id":4335794,"src":"4123_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335794.html","width":130,"caption":"# 4","height":130});
															thumbnails[4335742] = clik.newPhoto({"id":4335742,"src":"31_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335742.html","width":130,"caption":"#3","height":130});
															thumbnails[5561776] = clik.newPhoto({"id":5561776,"src":"NY05_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561776.html","width":130,"caption":"NY 05","height":130});
															thumbnails[5470541] = clik.newPhoto({"id":5470541,"src":"_159_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5470541.html","width":130,"caption":"# 159","height":128});
															thumbnails[5470527] = clik.newPhoto({"id":5470527,"src":"_166_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5470527.html","width":130,"caption":"# 166","height":130});
															thumbnails[5561777] = clik.newPhoto({"id":5561777,"src":"NY06_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561777.html","width":130,"caption":"NY 06","height":130});
															thumbnails[5470528] = clik.newPhoto({"id":5470528,"src":"_186_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5470528.html","width":130,"caption":"# 186","height":130});
															thumbnails[5561779] = clik.newPhoto({"id":5561779,"src":"NY07_thumb.jpg","galleries_id":315474,"server_id":15,"link":"photo_5561779.html","width":130,"caption":"NY o7","height":130});
															thumbnails[5720353] = clik.newPhoto({"id":5720353,"src":"_213_-_B_-_400_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5720353.html","width":130,"caption":"# 213 - B","height":130});
															thumbnails[5720216] = clik.newPhoto({"id":5720216,"src":"_215_-_400_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_5720216.html","width":130,"caption":"# 215","height":130});
															thumbnails[6425749] = clik.newPhoto({"id":6425749,"src":"_219_-_eks_01_-_web_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_6425749.html","width":130,"caption":"# 219","height":130});
															thumbnails[8810710] = clik.newPhoto({"id":8810710,"src":"_306_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_8810710.html","width":130,"caption":"# 306","height":130});
															thumbnails[7269145] = clik.newPhoto({"id":7269145,"src":"_285_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_7269145.html","width":130,"caption":"# 285","height":130});
															thumbnails[4335719] = clik.newPhoto({"id":4335719,"src":"1401_thumb.jpg","galleries_id":254944,"server_id":15,"link":"photo_4335719.html","width":130,"caption":"#140","height":130});
															thumbnails[6189247] = clik.newPhoto({"id":6189247,"src":"_221_-_B_-_SP_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_6189247.html","width":130,"caption":"# 221 - B","height":78});
															thumbnails[7879767] = clik.newPhoto({"id":7879767,"src":"_288_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_7879767.html","width":130,"caption":"# 288","height":87});
															thumbnails[7879774] = clik.newPhoto({"id":7879774,"src":"_287_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_7879774.html","width":130,"caption":"# 287","height":88});
															thumbnails[7879787] = clik.newPhoto({"id":7879787,"src":"_156__thumb.jpg","galleries_id":425277,"server_id":15,"link":"photo_7879787.html","width":130,"caption":"# 156","height":130});
															thumbnails[6189195] = clik.newPhoto({"id":6189195,"src":"_169_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_6189195.html","width":130,"caption":"# 169","height":81});
															thumbnails[8728068] = clik.newPhoto({"id":8728068,"src":"_316_thumb.jpg","galleries_id":459986,"server_id":15,"link":"photo_8728068.html","width":130,"caption":"# 316; Lookouts 1","height":92});
															thumbnails[6189210] = clik.newPhoto({"id":6189210,"src":"_212_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_6189210.html","width":130,"caption":"# 212","height":83});
															thumbnails[6449907] = clik.newPhoto({"id":6449907,"src":"_202_thumb.jpg","galleries_id":355877,"server_id":15,"link":"photo_6449907.html","width":130,"caption":"# 202","height":129});
															thumbnails[8728070] = clik.newPhoto({"id":8728070,"src":"_304_thumb.jpg","galleries_id":459986,"server_id":15,"link":"photo_8728070.html","width":130,"caption":"# 304; Lookouts 2","height":87});
															thumbnails[6449908] = clik.newPhoto({"id":6449908,"src":"_231_thumb.jpg","galleries_id":355877,"server_id":15,"link":"photo_6449908.html","width":130,"caption":"# 231","height":104});
															thumbnails[6189378] = clik.newPhoto({"id":6189378,"src":"_216_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_6189378.html","width":130,"caption":"# 216","height":87});
															thumbnails[6449909] = clik.newPhoto({"id":6449909,"src":"_232_thumb.jpg","galleries_id":355877,"server_id":15,"link":"photo_6449909.html","width":130,"caption":"# 232","height":98});
															thumbnails[6449943] = clik.newPhoto({"id":6449943,"src":"_233_thumb.jpg","galleries_id":355877,"server_id":15,"link":"photo_6449943.html","width":130,"caption":"# 233","height":87});
															thumbnails[6461501] = clik.newPhoto({"id":6461501,"src":"_236_thumb.jpg","galleries_id":345587,"server_id":15,"link":"photo_6461501.html","width":130,"caption":"# 236","height":87});
															thumbnails[6449944] = clik.newPhoto({"id":6449944,"src":"_234_thumb.jpg","galleries_id":355877,"server_id":15,"link":"photo_6449944.html","width":130,"caption":"# 234","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[255192] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes 1","link":"section412885_255192.html","maxRecords":0.0,"photoIDs":[4335805.0,4335808.0,4335813.0,4335965.0,4336058.0,6425631.0,6449734.0,6449735.0,7239023.0],"skipIndex":0,"section_code":"section412885","featured_images":4335805.0,"id":255192,"singleSection":false});				  						galleries[459986] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lookouts","link":"section412886_459986.html","maxRecords":0.0,"photoIDs":[8728068.0,8728070.0],"skipIndex":0,"section_code":"section412886","featured_images":8728068.0,"id":459986,"singleSection":false});				  						galleries[425277] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Places","link":"section412886_425277.html","maxRecords":0.0,"photoIDs":[7879787.0],"skipIndex":0,"section_code":"section412886","featured_images":7879787.0,"id":425277,"singleSection":false});				  						galleries[345587] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flatscapes","link":"section412886_345587.html","maxRecords":0.0,"photoIDs":[6189247.0,7879767.0,7879774.0,6189195.0,6189210.0,6189378.0,6461501.0],"skipIndex":0,"section_code":"section412886","featured_images":"7879774,7879767,6461501,6189378,6189247,6189210,6189195","id":345587,"singleSection":false});				  						galleries[254944] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes 1","link":"section412885_254944.html","maxRecords":0.0,"photoIDs":[4335509.0,4335661.0,4335732.0,4335953.0,4335725.0,5470514.0,4335794.0,4335742.0,5470541.0,5470527.0,5470528.0,5720353.0,5720216.0,6425749.0,8810710.0,7269145.0,4335719.0],"skipIndex":0,"section_code":"section412885","featured_images":5470514.0,"id":254944,"singleSection":false});				  						galleries[254945] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes 2","link":"section412885_254945.html","maxRecords":0.0,"photoIDs":[4335736.0,4335738.0,4335949.0,4336067.0,4336071.0,4336075.0],"skipIndex":0,"section_code":"section412885","featured_images":4336071.0,"id":254945,"singleSection":false});				  						galleries[355877] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"White buildings","link":"section412886_355877.html","maxRecords":0.0,"photoIDs":[6449907.0,6449908.0,6449909.0,6449943.0,6449944.0],"skipIndex":0,"section_code":"section412886","featured_images":6449907.0,"id":355877,"singleSection":false});				  						galleries[315474] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New York","link":"section412885_315474.html","maxRecords":0.0,"photoIDs":[5561771.0,5561766.0,5561773.0,5561774.0,5561776.0,5561777.0,5561779.0],"skipIndex":0,"section_code":"section412885","featured_images":5561766.0,"id":315474,"singleSection":false});				  						galleries[318226] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Graphics","link":"section412885_318226.html","maxRecords":0.0,"photoIDs":[5612170.0,5612176.0,5612180.0,5612182.0,5612185.0,5612189.0,5612228.0],"skipIndex":0,"section_code":"section412885","featured_images":5612176.0,"id":318226,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4329324';
imageSets[2] = '5612176,4336071,4335805,8728068,6449907,5561766,5470514';
imageSets[3] = '6189247';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/larsfich/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/larsfich/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/larsfich/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 += 'section412885.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 && 'section412885' != '') {
					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 = 'LARS BRORSON FICH   photography: ' + 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;
	}
}

			

