window.thumbnails = {};
															thumbnails[929607] = clik.newPhoto({"id":929607,"src":"IMG_4356 copy_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_929607.html","width":130,"caption":"","height":87});
															thumbnails[1210510] = clik.newPhoto({"id":1210510,"src":"IMG_5846_thumb.jpg","galleries_id":61522,"server_id":18,"link":"photo_1210510.html","width":130,"caption":"","height":91});
															thumbnails[1316609] = clik.newPhoto({"id":1316609,"src":"IMG_6458_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_1316609.html","width":130,"caption":"","height":87});
															thumbnails[1316610] = clik.newPhoto({"id":1316610,"src":"IMG_6231_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_1316610.html","width":130,"caption":"","height":87});
															thumbnails[7795255] = clik.newPhoto({"id":7795255,"src":"02_crop_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_7795255.html","width":130,"caption":"","height":185});
															thumbnails[7795272] = clik.newPhoto({"id":7795272,"src":"IMG_2256_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_7795272.html","width":130,"caption":"","height":175});
															thumbnails[7795296] = clik.newPhoto({"id":7795296,"src":"037_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_7795296.html","width":130,"caption":"","height":195});
															thumbnails[7795297] = clik.newPhoto({"id":7795297,"src":"046_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_7795297.html","width":130,"caption":"","height":96});
															thumbnails[7795300] = clik.newPhoto({"id":7795300,"src":"055_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_7795300.html","width":130,"caption":"","height":195});
															thumbnails[7795301] = clik.newPhoto({"id":7795301,"src":"089_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_7795301.html","width":130,"caption":"","height":87});
															thumbnails[7795304] = clik.newPhoto({"id":7795304,"src":"102_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_7795304.html","width":130,"caption":"","height":195});
															thumbnails[7795319] = clik.newPhoto({"id":7795319,"src":"133_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_7795319.html","width":130,"caption":"","height":87});
															thumbnails[7795332] = clik.newPhoto({"id":7795332,"src":"IMG_1526_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_7795332.html","width":130,"caption":"","height":86});
															thumbnails[7810695] = clik.newPhoto({"id":7810695,"src":"IMG_0450_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810695.html","width":130,"caption":"","height":98});
															thumbnails[7810736] = clik.newPhoto({"id":7810736,"src":"IMG_0810_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810736.html","width":130,"caption":"","height":186});
															thumbnails[7810819] = clik.newPhoto({"id":7810819,"src":"IMG_2827_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810819.html","width":130,"caption":"","height":83});
															thumbnails[7810820] = clik.newPhoto({"id":7810820,"src":"IMG_8474_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810820.html","width":130,"caption":"","height":89});
															thumbnails[7810822] = clik.newPhoto({"id":7810822,"src":"IMG_8502_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810822.html","width":130,"caption":"","height":92});
															thumbnails[7810827] = clik.newPhoto({"id":7810827,"src":"IMG_9375_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_7810827.html","width":130,"caption":"","height":87});
															thumbnails[7812142] = clik.newPhoto({"id":7812142,"src":"IMG_0681_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_7812142.html","width":130,"caption":"","height":100});
															thumbnails[8507293] = clik.newPhoto({"id":8507293,"src":"IMG_0945_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_8507293.html","width":130,"caption":"","height":253});
															thumbnails[8507300] = clik.newPhoto({"id":8507300,"src":"IMG_1022_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_8507300.html","width":130,"caption":"","height":161});
															thumbnails[8507308] = clik.newPhoto({"id":8507308,"src":"IMG_4423_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_8507308.html","width":130,"caption":"","height":86});
															thumbnails[1009843] = clik.newPhoto({"id":1009843,"src":"IMG_4683_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_1009843.html","width":130,"caption":"","height":198});
															thumbnails[1493405] = clik.newPhoto({"id":1493405,"src":"CC_thumb.JPG","galleries_id":18655,"server_id":18,"link":"photo_1493405.html","width":130,"caption":"","height":87});
															thumbnails[2911359] = clik.newPhoto({"id":2911359,"src":"IMG_0727_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_2911359.html","width":130,"caption":"","height":195});
															thumbnails[3137535] = clik.newPhoto({"id":3137535,"src":"IMG_3952 copy_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_3137535.html","width":130,"caption":"","height":171});
															thumbnails[3137537] = clik.newPhoto({"id":3137537,"src":"IMG_4141 copy_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_3137537.html","width":130,"caption":"","height":87});
															thumbnails[3137545] = clik.newPhoto({"id":3137545,"src":"IMG_44021_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_3137545.html","width":130,"caption":"","height":178});
															thumbnails[3137547] = clik.newPhoto({"id":3137547,"src":"IMG_44281_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_3137547.html","width":130,"caption":"","height":165});
															thumbnails[5332699] = clik.newPhoto({"id":5332699,"src":"crimbo_1_wp_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_5332699.html","width":130,"caption":"","height":180});
															thumbnails[5333223] = clik.newPhoto({"id":5333223,"src":"laura1_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_5333223.html","width":130,"caption":"","height":200});
															thumbnails[5333365] = clik.newPhoto({"id":5333365,"src":"IMG_5071_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_5333365.html","width":130,"caption":"","height":211});
															thumbnails[8507206] = clik.newPhoto({"id":8507206,"src":"IMG_4729_thumb.JPG","galleries_id":18655,"server_id":18,"link":"photo_8507206.html","width":130,"caption":"","height":82});
															thumbnails[8507275] = clik.newPhoto({"id":8507275,"src":"06_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_8507275.html","width":130,"caption":"","height":195});
															thumbnails[1493414] = clik.newPhoto({"id":1493414,"src":"CM_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_1493414.html","width":130,"caption":"","height":195});
															thumbnails[1493417] = clik.newPhoto({"id":1493417,"src":"Cm Chair_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_1493417.html","width":130,"caption":"","height":87});
															thumbnails[2910638] = clik.newPhoto({"id":2910638,"src":"IMG_6407_thumb.jpg","galleries_id":38698,"server_id":18,"link":"photo_2910638.html","width":130,"caption":"","height":163});
															thumbnails[5333227] = clik.newPhoto({"id":5333227,"src":"zo2_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_5333227.html","width":130,"caption":"","height":195});
															thumbnails[8507214] = clik.newPhoto({"id":8507214,"src":"IMG_4597_thumb.JPG","galleries_id":18655,"server_id":18,"link":"photo_8507214.html","width":130,"caption":"","height":129});
															thumbnails[2911507] = clik.newPhoto({"id":2911507,"src":"46addacb7c5fe_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_2911507.html","width":130,"caption":"","height":195});
															thumbnails[2911535] = clik.newPhoto({"id":2911535,"src":"47064f3731aad_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_2911535.html","width":130,"caption":"","height":134});
															thumbnails[3137529] = clik.newPhoto({"id":3137529,"src":"IMG_3917 copy_thumb.jpg","galleries_id":18655,"server_id":18,"link":"photo_3137529.html","width":130,"caption":"","height":224});
															thumbnails[5332647] = clik.newPhoto({"id":5332647,"src":"web1_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_5332647.html","width":130,"caption":"","height":83});
															thumbnails[2910624] = clik.newPhoto({"id":2910624,"src":"IMG_3454_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_2910624.html","width":130,"caption":"","height":92});
															thumbnails[2911509] = clik.newPhoto({"id":2911509,"src":"46addb6f844d5_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_2911509.html","width":130,"caption":"","height":195});
															thumbnails[1009845] = clik.newPhoto({"id":1009845,"src":"IMG_4690_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_1009845.html","width":130,"caption":"","height":195});
															thumbnails[2910667] = clik.newPhoto({"id":2910667,"src":"IMG_1763_1_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_2910667.html","width":130,"caption":"","height":204});
															thumbnails[2911405] = clik.newPhoto({"id":2911405,"src":"IMG_2226_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_2911405.html","width":130,"caption":"","height":195});
															thumbnails[5332642] = clik.newPhoto({"id":5332642,"src":"89_b__w_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_5332642.html","width":130,"caption":"","height":201});
															thumbnails[5333369] = clik.newPhoto({"id":5333369,"src":"gs_thumb.JPG","galleries_id":18654,"server_id":18,"link":"photo_5333369.html","width":130,"caption":"","height":177});
															thumbnails[2911373] = clik.newPhoto({"id":2911373,"src":"IMG_2183_thumb.JPG","galleries_id":18655,"server_id":18,"link":"photo_2911373.html","width":130,"caption":"","height":251});
															thumbnails[2910653] = clik.newPhoto({"id":2910653,"src":"IMG_5581_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_2910653.html","width":130,"caption":"","height":199});
															thumbnails[2911429] = clik.newPhoto({"id":2911429,"src":"IMG_2255 copy_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_2911429.html","width":130,"caption":"","height":114});
															thumbnails[5333257] = clik.newPhoto({"id":5333257,"src":"zo_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_5333257.html","width":130,"caption":"","height":125});
															thumbnails[842835] = clik.newPhoto({"id":842835,"src":"025_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842835.html","width":130,"caption":"","height":195});
															thumbnails[842967] = clik.newPhoto({"id":842967,"src":"101_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842967.html","width":130,"caption":"","height":195});
															thumbnails[843103] = clik.newPhoto({"id":843103,"src":"103_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_843103.html","width":130,"caption":"","height":195});
															thumbnails[5333256] = clik.newPhoto({"id":5333256,"src":"laura2_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_5333256.html","width":130,"caption":"","height":168});
															thumbnails[842901] = clik.newPhoto({"id":842901,"src":"20_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842901.html","width":130,"caption":"","height":195});
															thumbnails[842968] = clik.newPhoto({"id":842968,"src":"201_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842968.html","width":130,"caption":"","height":195});
															thumbnails[843086] = clik.newPhoto({"id":843086,"src":"202_thumb.JPG","galleries_id":18655,"server_id":18,"link":"photo_843086.html","width":130,"caption":"","height":87});
															thumbnails[842935] = clik.newPhoto({"id":842935,"src":"30_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842935.html","width":130,"caption":"","height":195});
															thumbnails[842969] = clik.newPhoto({"id":842969,"src":"301_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842969.html","width":130,"caption":"","height":195});
															thumbnails[843087] = clik.newPhoto({"id":843087,"src":"302_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_843087.html","width":130,"caption":"","height":87});
															thumbnails[843105] = clik.newPhoto({"id":843105,"src":"303_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_843105.html","width":130,"caption":"","height":195});
															thumbnails[844179] = clik.newPhoto({"id":844179,"src":"305_thumb.jpg","galleries_id":18654,"server_id":18,"link":"photo_844179.html","width":130,"caption":"","height":195});
															thumbnails[842937] = clik.newPhoto({"id":842937,"src":"50_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842937.html","width":130,"caption":"","height":96});
															thumbnails[1009841] = clik.newPhoto({"id":1009841,"src":"IMG_4676_thumb.JPG","galleries_id":61522,"server_id":18,"link":"photo_1009841.html","width":130,"caption":"","height":195});
															thumbnails[842938] = clik.newPhoto({"id":842938,"src":"60_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842938.html","width":130,"caption":"","height":95});
															thumbnails[842972] = clik.newPhoto({"id":842972,"src":"601_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842972.html","width":130,"caption":"","height":87});
															thumbnails[843109] = clik.newPhoto({"id":843109,"src":"603_thumb.jpg","galleries_id":38697,"server_id":18,"link":"photo_843109.html","width":130,"caption":"","height":87});
															thumbnails[842973] = clik.newPhoto({"id":842973,"src":"701_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842973.html","width":130,"caption":"","height":195});
															thumbnails[842941] = clik.newPhoto({"id":842941,"src":"80_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842941.html","width":130,"caption":"","height":195});
															thumbnails[843092] = clik.newPhoto({"id":843092,"src":"802_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_843092.html","width":130,"caption":"","height":195});
															thumbnails[842942] = clik.newPhoto({"id":842942,"src":"90_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842942.html","width":130,"caption":"","height":181});
															thumbnails[842975] = clik.newPhoto({"id":842975,"src":"901_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842975.html","width":130,"caption":"","height":178});
															thumbnails[842976] = clik.newPhoto({"id":842976,"src":"1001_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842976.html","width":130,"caption":"","height":87});
															thumbnails[843120] = clik.newPhoto({"id":843120,"src":"1003_thumb.JPG","galleries_id":38697,"server_id":18,"link":"photo_843120.html","width":130,"caption":"","height":195});
															thumbnails[842945] = clik.newPhoto({"id":842945,"src":"110_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842945.html","width":130,"caption":"","height":195});
															thumbnails[842977] = clik.newPhoto({"id":842977,"src":"1101_thumb.JPG","galleries_id":38698,"server_id":18,"link":"photo_842977.html","width":130,"caption":"","height":145});
															thumbnails[842951] = clik.newPhoto({"id":842951,"src":"150_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842951.html","width":130,"caption":"","height":87});
															thumbnails[842954] = clik.newPhoto({"id":842954,"src":"160_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842954.html","width":130,"caption":"","height":195});
															thumbnails[842965] = clik.newPhoto({"id":842965,"src":"180_thumb.JPG","galleries_id":18653,"server_id":18,"link":"photo_842965.html","width":130,"caption":"","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[18653] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_18653.html","maxRecords":0.0,"photoIDs":[1316609.0,7795296.0,7795297.0,7795300.0,7795301.0,7795304.0,5332647.0,2910624.0,5332642.0,842835.0,842901.0,842935.0,842937.0,842938.0,842941.0,842942.0,842945.0,842951.0,842954.0,842965.0],"skipIndex":0,"section_code":"gallery","featured_images":"2910624,842835","id":18653,"singleSection":false});				  						galleries[38698] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings 2","link":"gallery_38698.html","maxRecords":0.0,"photoIDs":[7795319.0,7795332.0,2910638.0,2910653.0,842967.0,842968.0,842969.0,842972.0,842973.0,842975.0,842976.0,842977.0],"skipIndex":0,"section_code":"gallery","featured_images":842967.0,"id":38698,"singleSection":false});				  						galleries[18655] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits ","link":"gallery_18655.html","maxRecords":0.0,"photoIDs":[929607.0,1316610.0,7812142.0,1493405.0,3137535.0,3137537.0,5333223.0,8507206.0,1493414.0,1493417.0,5333227.0,8507214.0,2911535.0,3137529.0,2911373.0,843086.0],"skipIndex":0,"section_code":"gallery","featured_images":"2911535,2911373","id":18655,"singleSection":false});				  						galleries[38697] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits 2","link":"gallery_38697.html","maxRecords":0.0,"photoIDs":[2911507.0,2911509.0,2911405.0,2911429.0,5333257.0,843103.0,5333256.0,843087.0,843105.0,843109.0,843092.0,843120.0],"skipIndex":0,"section_code":"gallery","featured_images":2911405.0,"id":38697,"singleSection":false});				  						galleries[18654] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Family Portraits","link":"gallery_18654.html","maxRecords":0.0,"photoIDs":[7810695.0,7810736.0,7810819.0,7810820.0,7810822.0,7810827.0,8507308.0,2911359.0,3137545.0,3137547.0,5333369.0,844179.0],"skipIndex":0,"section_code":"gallery","featured_images":"3137547,3137545,844179","id":18654,"singleSection":false});				  						galleries[61522] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pregnancy & Babies","link":"gallery_61522.html","maxRecords":0.0,"photoIDs":[1210510.0,7795255.0,7795272.0,8507293.0,8507300.0,1009843.0,5332699.0,5333365.0,8507275.0,1009845.0,2910667.0,1009841.0],"skipIndex":0,"section_code":"gallery","featured_images":5333365.0,"id":61522,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5332647,1493417,929607';
imageSets[2] = '5333365,3137547,3137545,2911535,2911405,2911373,2910624,844179,842967,842835';
imageSets[3] = '8507308,8507300,8507293,8507275,8507214,8507206,7812142,7810827,7810822,7810820,7810819,7810736,7810695,7795332,7795319,7795304,7795301,7795300,7795297,7795296,7795272,7795255,5333369,5333365,5333257,5333256,5333227,5333223,5332699,5332647,5332642,3137547,3137545,3137537,3137535,3137529,2911535,2911509,2911507,2911429,2911405,2911373,2911359,2910667,2910653,2910638,2910624,1493417,1493414,1493405';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/loader95/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/loader95/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/loader95/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/loader95/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/loader95/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/loader95/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/loader95/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 = 'Eden Bailey 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.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;
	}
}

			

