window.thumbnails = {};
															thumbnails[1756327] = clik.newPhoto({"id":1756327,"src":"air2_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1756327.html","width":130,"caption":"","height":85});
															thumbnails[1756336] = clik.newPhoto({"id":1756336,"src":"air1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1756336.html","width":130,"caption":"","height":87});
															thumbnails[1756358] = clik.newPhoto({"id":1756358,"src":"p12_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1756358.html","width":130,"caption":"","height":88});
															thumbnails[1756697] = clik.newPhoto({"id":1756697,"src":"ny_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_1756697.html","width":130,"caption":"","height":86});
															thumbnails[1768448] = clik.newPhoto({"id":1768448,"src":"DSC_0606_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1768448.html","width":130,"caption":"","height":90});
															thumbnails[1772857] = clik.newPhoto({"id":1772857,"src":"new1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1772857.html","width":130,"caption":"","height":91});
															thumbnails[1772866] = clik.newPhoto({"id":1772866,"src":"new2_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1772866.html","width":130,"caption":"","height":86});
															thumbnails[1772904] = clik.newPhoto({"id":1772904,"src":"new3_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_1772904.html","width":130,"caption":"","height":88});
															thumbnails[1772928] = clik.newPhoto({"id":1772928,"src":"new5_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1772928.html","width":130,"caption":"","height":87});
															thumbnails[1772930] = clik.newPhoto({"id":1772930,"src":"new6_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_1772930.html","width":130,"caption":"","height":50});
															thumbnails[1772933] = clik.newPhoto({"id":1772933,"src":"new7_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1772933.html","width":130,"caption":"","height":89});
															thumbnails[1772934] = clik.newPhoto({"id":1772934,"src":"new8_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_1772934.html","width":130,"caption":"","height":189});
															thumbnails[2022276] = clik.newPhoto({"id":2022276,"src":"andrew_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2022276.html","width":130,"caption":"","height":86});
															thumbnails[2022282] = clik.newPhoto({"id":2022282,"src":"dog_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2022282.html","width":130,"caption":"","height":86});
															thumbnails[2022289] = clik.newPhoto({"id":2022289,"src":"boris1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2022289.html","width":130,"caption":"","height":87});
															thumbnails[2022298] = clik.newPhoto({"id":2022298,"src":"DSC_0041_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2022298.html","width":130,"caption":"","height":86});
															thumbnails[2022471] = clik.newPhoto({"id":2022471,"src":"DSC_0335_thumb.jpg","galleries_id":267814,"server_id":18,"link":"photo_2022471.html","width":130,"caption":"","height":86});
															thumbnails[2022661] = clik.newPhoto({"id":2022661,"src":"080791d2_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2022661.html","width":130,"caption":"","height":87});
															thumbnails[2061055] = clik.newPhoto({"id":2061055,"src":"pra8_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_2061055.html","width":130,"caption":"","height":60});
															thumbnails[2061078] = clik.newPhoto({"id":2061078,"src":"pra11_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_2061078.html","width":130,"caption":"","height":92});
															thumbnails[2061094] = clik.newPhoto({"id":2061094,"src":"pra12_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_2061094.html","width":130,"caption":"","height":98});
															thumbnails[2113770] = clik.newPhoto({"id":2113770,"src":"maid1_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2113770.html","width":130,"caption":"","height":92});
															thumbnails[2433804] = clik.newPhoto({"id":2433804,"src":"DSC_01044_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2433804.html","width":130,"caption":"","height":189});
															thumbnails[2433806] = clik.newPhoto({"id":2433806,"src":"DSC_07521_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2433806.html","width":130,"caption":"","height":152});
															thumbnails[2433814] = clik.newPhoto({"id":2433814,"src":"DSC_07403_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2433814.html","width":130,"caption":"","height":196});
															thumbnails[2433823] = clik.newPhoto({"id":2433823,"src":"DSC_0159_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2433823.html","width":130,"caption":"","height":138});
															thumbnails[2433835] = clik.newPhoto({"id":2433835,"src":"DSC_02511_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2433835.html","width":130,"caption":"","height":95});
															thumbnails[2433841] = clik.newPhoto({"id":2433841,"src":"btfc61_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2433841.html","width":130,"caption":"","height":158});
															thumbnails[2433843] = clik.newPhoto({"id":2433843,"src":"DSC_18551_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2433843.html","width":130,"caption":"","height":146});
															thumbnails[2867612] = clik.newPhoto({"id":2867612,"src":"light1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2867612.html","width":130,"caption":"","height":70});
															thumbnails[2867646] = clik.newPhoto({"id":2867646,"src":"crick1_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_2867646.html","width":130,"caption":"","height":157});
															thumbnails[2867744] = clik.newPhoto({"id":2867744,"src":"fest1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2867744.html","width":129,"caption":"","height":86});
															thumbnails[2867745] = clik.newPhoto({"id":2867745,"src":"fest2_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2867745.html","width":129,"caption":"","height":168});
															thumbnails[2867747] = clik.newPhoto({"id":2867747,"src":"fest4_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_2867747.html","width":129,"caption":"","height":152});
															thumbnails[3004849] = clik.newPhoto({"id":3004849,"src":"foot14_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3004849.html","width":130,"caption":"","height":98});
															thumbnails[3004877] = clik.newPhoto({"id":3004877,"src":"gol1_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3004877.html","width":130,"caption":"","height":183});
															thumbnails[3004884] = clik.newPhoto({"id":3004884,"src":"golf041_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3004884.html","width":130,"caption":"","height":159});
															thumbnails[3004936] = clik.newPhoto({"id":3004936,"src":"cop_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3004936.html","width":130,"caption":"","height":79});
															thumbnails[3010612] = clik.newPhoto({"id":3010612,"src":"circ_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3010612.html","width":130,"caption":"","height":89});
															thumbnails[3010631] = clik.newPhoto({"id":3010631,"src":"rug_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3010631.html","width":130,"caption":"","height":107});
															thumbnails[3087028] = clik.newPhoto({"id":3087028,"src":"pete2_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3087028.html","width":130,"caption":"","height":177});
															thumbnails[3135185] = clik.newPhoto({"id":3135185,"src":"norweb_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3135185.html","width":130,"caption":"","height":95});
															thumbnails[3135473] = clik.newPhoto({"id":3135473,"src":"barcweb_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_3135473.html","width":130,"caption":"","height":172});
															thumbnails[3258126] = clik.newPhoto({"id":3258126,"src":"Image2_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3258126.html","width":130,"caption":"","height":94});
															thumbnails[3258129] = clik.newPhoto({"id":3258129,"src":"Image7_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_3258129.html","width":130,"caption":"","height":67});
															thumbnails[3258144] = clik.newPhoto({"id":3258144,"src":"paris12_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_3258144.html","width":130,"caption":"","height":280});
															thumbnails[3278081] = clik.newPhoto({"id":3278081,"src":"carol25_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3278081.html","width":130,"caption":"","height":86});
															thumbnails[3400239] = clik.newPhoto({"id":3400239,"src":"hock_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3400239.html","width":130,"caption":"","height":92});
															thumbnails[3400724] = clik.newPhoto({"id":3400724,"src":"chinese1_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3400724.html","width":130,"caption":"","height":86});
															thumbnails[3404571] = clik.newPhoto({"id":3404571,"src":"DSC_0095_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3404571.html","width":130,"caption":"","height":96});
															thumbnails[3404585] = clik.newPhoto({"id":3404585,"src":"084414c_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3404585.html","width":130,"caption":"","height":155});
															thumbnails[3404592] = clik.newPhoto({"id":3404592,"src":"080030e_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3404592.html","width":130,"caption":"","height":180});
															thumbnails[3404632] = clik.newPhoto({"id":3404632,"src":"DSC_0244_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3404632.html","width":130,"caption":"","height":98});
															thumbnails[3404658] = clik.newPhoto({"id":3404658,"src":"DSC_0541_thumb.JPG","galleries_id":135598,"server_id":18,"link":"photo_3404658.html","width":130,"caption":"","height":133});
															thumbnails[3404685] = clik.newPhoto({"id":3404685,"src":"DSC_0014_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3404685.html","width":130,"caption":"","height":85});
															thumbnails[3404800] = clik.newPhoto({"id":3404800,"src":"DSC_0414_thumb.JPG","galleries_id":135554,"server_id":18,"link":"photo_3404800.html","width":130,"caption":"","height":89});
															thumbnails[3404838] = clik.newPhoto({"id":3404838,"src":"DSC_0031_thumb.JPG","galleries_id":135554,"server_id":18,"link":"photo_3404838.html","width":130,"caption":"","height":191});
															thumbnails[3407348] = clik.newPhoto({"id":3407348,"src":"DSC_0042_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3407348.html","width":130,"caption":"","height":166});
															thumbnails[3407351] = clik.newPhoto({"id":3407351,"src":"DSC_0011_thumb.JPG","galleries_id":135598,"server_id":18,"link":"photo_3407351.html","width":130,"caption":"","height":128});
															thumbnails[3407353] = clik.newPhoto({"id":3407353,"src":"DSC_0124_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3407353.html","width":130,"caption":"","height":89});
															thumbnails[3407357] = clik.newPhoto({"id":3407357,"src":"DSC_0598_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3407357.html","width":130,"caption":"","height":142});
															thumbnails[3408015] = clik.newPhoto({"id":3408015,"src":"DSC_0046_thumb.JPG","galleries_id":135554,"server_id":18,"link":"photo_3408015.html","width":130,"caption":"","height":185});
															thumbnails[3408018] = clik.newPhoto({"id":3408018,"src":"DSC_0089_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3408018.html","width":130,"caption":"","height":102});
															thumbnails[3452178] = clik.newPhoto({"id":3452178,"src":"band_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_3452178.html","width":130,"caption":"","height":91});
															thumbnails[3657702] = clik.newPhoto({"id":3657702,"src":"runnerweb_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_3657702.html","width":130,"caption":"","height":153});
															thumbnails[4058184] = clik.newPhoto({"id":4058184,"src":"carweb_thumb.jpg","galleries_id":135554,"server_id":18,"link":"photo_4058184.html","width":130,"caption":"","height":87});
															thumbnails[4058194] = clik.newPhoto({"id":4058194,"src":"franceweb_thumb.jpg","galleries_id":140688,"server_id":18,"link":"photo_4058194.html","width":130,"caption":"","height":58});
															thumbnails[4641786] = clik.newPhoto({"id":4641786,"src":"KP2_0083web_thumb.jpg","galleries_id":267814,"server_id":18,"link":"photo_4641786.html","width":130,"caption":"","height":83});
															thumbnails[4774700] = clik.newPhoto({"id":4774700,"src":"spweb1_thumb.jpg","galleries_id":135598,"server_id":18,"link":"photo_4774700.html","width":130,"caption":"","height":68});
															thumbnails[5450283] = clik.newPhoto({"id":5450283,"src":"KP1_3697_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450283.html","width":130,"caption":"","height":90});
															thumbnails[5450315] = clik.newPhoto({"id":5450315,"src":"KP1_3755_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450315.html","width":130,"caption":"","height":85});
															thumbnails[5450318] = clik.newPhoto({"id":5450318,"src":"KP1_3600_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450318.html","width":130,"caption":"","height":87});
															thumbnails[5450393] = clik.newPhoto({"id":5450393,"src":"KP1_0326_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450393.html","width":130,"caption":"","height":90});
															thumbnails[5450398] = clik.newPhoto({"id":5450398,"src":"KP1_2893_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450398.html","width":130,"caption":"","height":169});
															thumbnails[5450400] = clik.newPhoto({"id":5450400,"src":"KP1_1363_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450400.html","width":130,"caption":"","height":85});
															thumbnails[5450412] = clik.newPhoto({"id":5450412,"src":"Heathrow031_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450412.html","width":130,"caption":"","height":94});
															thumbnails[5450670] = clik.newPhoto({"id":5450670,"src":"KP1_0574_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450670.html","width":130,"caption":"","height":81});
															thumbnails[5450694] = clik.newPhoto({"id":5450694,"src":"KP1_0735_thumb.jpg","galleries_id":308214,"server_id":18,"link":"photo_5450694.html","width":130,"caption":"","height":90});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[140688] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Places","link":"gallery_140688.html","maxRecords":0.0,"photoIDs":[1756697.0,1772904.0,1772930.0,2061055.0,2061078.0,2061094.0,3135473.0,3258129.0,3258144.0,4058194.0],"skipIndex":0,"section_code":"gallery","featured_images":"4058194,3258144,3258129,3135473,2061094,2061078,2061055,1772930,1772904,1756697","id":140688,"singleSection":false});				  						galleries[308214] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PR and Corporate","link":"gallery_308214.html","maxRecords":0.0,"photoIDs":[5450283.0,5450315.0,5450318.0,5450393.0,5450398.0,5450400.0,5450412.0,5450670.0,5450694.0],"skipIndex":0,"section_code":"gallery","featured_images":5450283.0,"id":308214,"singleSection":false});				  						galleries[135554] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Press","link":"gallery_135554.html","maxRecords":0.0,"photoIDs":[1756327.0,1756336.0,1756358.0,1768448.0,1772857.0,1772866.0,1772928.0,1772933.0,1772934.0,2022276.0,2022282.0,2022289.0,2022298.0,2022661.0,2433804.0,2433806.0,2433814.0,2867612.0,2867744.0,2867745.0,2867747.0,3010612.0,3087028.0,3135185.0,3278081.0,3400724.0,3404685.0,3404800.0,3404838.0,3408015.0,3452178.0,4058184.0],"skipIndex":0,"section_code":"gallery","featured_images":"3404685,3400724,3135185","id":135554,"singleSection":false});				  						galleries[135598] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sport","link":"gallery_135598.html","maxRecords":0.0,"photoIDs":[2113770.0,2433823.0,2433835.0,2433841.0,2433843.0,2867646.0,3004849.0,3004877.0,3004884.0,3004936.0,3010631.0,3258126.0,3400239.0,3404571.0,3404585.0,3404592.0,3404632.0,3404658.0,3407348.0,3407351.0,3407353.0,3407357.0,3408018.0,3657702.0,4774700.0],"skipIndex":0,"section_code":"gallery","featured_images":"3400239,2867646","id":135598,"singleSection":false});				  						galleries[267814] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_267814.html","maxRecords":0.0,"photoIDs":[2022471.0,4641786.0],"skipIndex":0,"section_code":"gallery","featured_images":"4641786,2022471","id":267814,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3400724';
imageSets[2] = '5450283,3404685,3400724,3400239,3135185,2867646';
imageSets[3] = '5450694,5450670,5450412,5450400,5450398,5450393,5450318,5450315,5450283,4774700,4641786,4058194,4058184,3657702,3452178,3408018,3408015,3407357,3407353,3407351,3407348,3404838,3404800,3404685,3404658,3404632,3404592,3404585,3404571,3400724,3400239,3278081,3258144,3258129,3258126,3135473,3135185,3087028,3010631,3010612,3004936,3004884,3004877,3004849,2867747,2867745,2867744,2867646,2867612,2433843';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kpoolman/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/kpoolman/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Kevin Poolman 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="KPOOLMAN">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

