window.thumbnails = {};
															thumbnails[7560635] = clik.newPhoto({"id":7560635,"src":"jsw_1015600032_033010786335107_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":195});
															thumbnails[7560637] = clik.newPhoto({"id":7560637,"src":"jsw_1015515765_033010786335015_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":195});
															thumbnails[1920278] = clik.newPhoto({"id":1920278,"src":"frankie -sci 12_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1920278.html","width":130,"caption":"","height":182});
															thumbnails[1920279] = clik.newPhoto({"id":1920279,"src":"frankie- me changed close up_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1920279.html","width":130,"caption":"","height":191});
															thumbnails[1920283] = clik.newPhoto({"id":1920283,"src":"NIKKI -SCI 2_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1920283.html","width":130,"caption":"","height":182});
															thumbnails[1920284] = clik.newPhoto({"id":1920284,"src":"brendon lyon_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_1920284.html","width":130,"caption":"","height":165});
															thumbnails[1920285] = clik.newPhoto({"id":1920285,"src":"wedding shoot_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_1920285.html","width":130,"caption":"","height":94});
															thumbnails[1920286] = clik.newPhoto({"id":1920286,"src":"wedding shoot_thumb.jpg 4.jpg","galleries_id":128792,"server_id":1,"link":"photo_1920286.html","width":130,"caption":"","height":185});
															thumbnails[1920287] = clik.newPhoto({"id":1920287,"src":"christine - ciaran whyte_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1920287.html","width":130,"caption":"","height":179});
															thumbnails[1920289] = clik.newPhoto({"id":1920289,"src":"jeannie - ciaran whyte 1_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1920289.html","width":130,"caption":"","height":180});
															thumbnails[1926814] = clik.newPhoto({"id":1926814,"src":"lyod - ciaran whyte_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_1926814.html","width":130,"caption":"","height":180});
															thumbnails[1926817] = clik.newPhoto({"id":1926817,"src":"lyod 2_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1926817.html","width":130,"caption":"","height":180});
															thumbnails[1926820] = clik.newPhoto({"id":1926820,"src":"jeannie - ciaran whyte 8_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1926820.html","width":130,"caption":"","height":178});
															thumbnails[1926846] = clik.newPhoto({"id":1926846,"src":"christine - ciaran whyte 4_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1926846.html","width":130,"caption":"","height":179});
															thumbnails[1926848] = clik.newPhoto({"id":1926848,"src":"9125643a6622426360l_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1926848.html","width":130,"caption":"","height":195});
															thumbnails[1926851] = clik.newPhoto({"id":1926851,"src":"jeannie - ciaran whyte 3_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1926851.html","width":130,"caption":"","height":179});
															thumbnails[1926853] = clik.newPhoto({"id":1926853,"src":"nikki - SCI1_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1926853.html","width":130,"caption":"","height":182});
															thumbnails[1926861] = clik.newPhoto({"id":1926861,"src":"nikki - ciaran whyte_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_1926861.html","width":130,"caption":"","height":178});
															thumbnails[1926871] = clik.newPhoto({"id":1926871,"src":"nikki_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_1926871.html","width":130,"caption":"","height":195});
															thumbnails[1926877] = clik.newPhoto({"id":1926877,"src":"SELINA- SCI 5_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_1926877.html","width":130,"caption":"","height":182});
															thumbnails[1926884] = clik.newPhoto({"id":1926884,"src":"SELINA -SCI 61_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_1926884.html","width":130,"caption":"","height":182});
															thumbnails[1926993] = clik.newPhoto({"id":1926993,"src":"morgan testing shoot- emily quinn_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1926993.html","width":130,"caption":"","height":195});
															thumbnails[1927008] = clik.newPhoto({"id":1927008,"src":"frankie scoot_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_1927008.html","width":130,"caption":"","height":116});
															thumbnails[1927009] = clik.newPhoto({"id":1927009,"src":"susan- david frain_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_1927009.html","width":130,"caption":"","height":107});
															thumbnails[1927010] = clik.newPhoto({"id":1927010,"src":"claire_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1927010.html","width":130,"caption":"","height":182});
															thumbnails[1927017] = clik.newPhoto({"id":1927017,"src":"SELINA- SCI 3_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1927017.html","width":130,"caption":"","height":182});
															thumbnails[1927020] = clik.newPhoto({"id":1927020,"src":"frankie - sci 111_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1927020.html","width":130,"caption":"","height":182});
															thumbnails[1927027] = clik.newPhoto({"id":1927027,"src":"claire- sci_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_1927027.html","width":130,"caption":"","height":182});
															thumbnails[1927082] = clik.newPhoto({"id":1927082,"src":"4lnjenny31_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_1927082.html","width":130,"caption":"","height":130});
															thumbnails[1940026] = clik.newPhoto({"id":1940026,"src":"SELINA SCI 1_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_1940026.html","width":130,"caption":"","height":182});
															thumbnails[2124537] = clik.newPhoto({"id":2124537,"src":"IMG_2927_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_2124537.html","width":130,"caption":"","height":195});
															thumbnails[2124651] = clik.newPhoto({"id":2124651,"src":"IMG_2593_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_2124651.html","width":130,"caption":"","height":195});
															thumbnails[2288021] = clik.newPhoto({"id":2288021,"src":"DSC_0128_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_2288021.html","width":130,"caption":"","height":193});
															thumbnails[2288060] = clik.newPhoto({"id":2288060,"src":"lorraine gilligan_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_2288060.html","width":130,"caption":"","height":93});
															thumbnails[2288087] = clik.newPhoto({"id":2288087,"src":"IMG_2897_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_2288087.html","width":130,"caption":"Short film, directed by Stephen Crilly <br>\r\nphotos courtesy of shane @ myspace.com\/howtofaketea","height":87});
															thumbnails[2288093] = clik.newPhoto({"id":2288093,"src":"IMG_3066_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_2288093.html","width":130,"caption":"Short horror film.<br>\r\nDirected by Stephen Crilly.<br>\r\nphotos courtesy of shane @ myspace.com\/howtofaketea","height":195});
															thumbnails[2288132] = clik.newPhoto({"id":2288132,"src":"DSC00104_thumb.JPG","galleries_id":150123,"server_id":1,"link":"photo_2288132.html","width":130,"caption":"applying makeup to actress Rachael Kavannagh(Fair City) for the short film \"talk of the town\" Directed by Damien De Burca","height":98});
															thumbnails[2398623] = clik.newPhoto({"id":2398623,"src":"kiss 3_thumb.jpg","galleries_id":155472,"server_id":1,"link":"photo_2398623.html","width":130,"caption":"","height":130});
															thumbnails[2398838] = clik.newPhoto({"id":2398838,"src":"kiss 5_thumb.jpg","galleries_id":155472,"server_id":1,"link":"photo_2398838.html","width":130,"caption":"","height":172});
															thumbnails[2398854] = clik.newPhoto({"id":2398854,"src":"kiss 8_thumb.jpg","galleries_id":155472,"server_id":1,"link":"photo_2398854.html","width":130,"caption":"","height":130});
															thumbnails[2398921] = clik.newPhoto({"id":2398921,"src":"kiss 11_thumb.jpg","galleries_id":155472,"server_id":1,"link":"photo_2398921.html","width":130,"caption":"","height":117});
															thumbnails[2398953] = clik.newPhoto({"id":2398953,"src":"kiss close up_thumb.jpg","galleries_id":155472,"server_id":1,"link":"photo_2398953.html","width":130,"caption":"","height":138});
															thumbnails[2782518] = clik.newPhoto({"id":2782518,"src":"lgilligan200708_0036_small_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_2782518.html","width":130,"caption":"","height":166});
															thumbnails[2782526] = clik.newPhoto({"id":2782526,"src":"lgilligan200708_0112_small_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_2782526.html","width":130,"caption":"","height":130});
															thumbnails[2782533] = clik.newPhoto({"id":2782533,"src":"cwhyte_080720_0078_alt_small_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_2782533.html","width":130,"caption":"","height":83});
															thumbnails[2782582] = clik.newPhoto({"id":2782582,"src":"fees wedding_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_2782582.html","width":130,"caption":"real brides","height":86});
															thumbnails[3001223] = clik.newPhoto({"id":3001223,"src":"_SC10023web_final_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_3001223.html","width":130,"caption":"","height":182});
															thumbnails[3227665] = clik.newPhoto({"id":3227665,"src":"_MG_9131_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_3227665.html","width":130,"caption":"","height":195});
															thumbnails[3227669] = clik.newPhoto({"id":3227669,"src":"_MG_9272_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_3227669.html","width":130,"caption":"","height":195});
															thumbnails[3227741] = clik.newPhoto({"id":3227741,"src":"IMG_0742_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_3227741.html","width":130,"caption":"","height":195});
															thumbnails[3227750] = clik.newPhoto({"id":3227750,"src":"IMG_4955_2_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_3227750.html","width":130,"caption":"","height":104});
															thumbnails[3227753] = clik.newPhoto({"id":3227753,"src":"IMG_0638_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_3227753.html","width":130,"caption":"","height":195});
															thumbnails[3261459] = clik.newPhoto({"id":3261459,"src":"emily_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_3261459.html","width":130,"caption":"","height":193});
															thumbnails[3261646] = clik.newPhoto({"id":3261646,"src":"n646725912_1667690_2531_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_3261646.html","width":130,"caption":"","height":98});
															thumbnails[3261654] = clik.newPhoto({"id":3261654,"src":"n646725912_1667565_9473_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_3261654.html","width":130,"caption":"Makeup for actor Jack Walsh for the Tv drama \"The house\"","height":98});
															thumbnails[4092357] = clik.newPhoto({"id":4092357,"src":"_MG_1356_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_4092357.html","width":130,"caption":"","height":195});
															thumbnails[4092360] = clik.newPhoto({"id":4092360,"src":"_MG_1148_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_4092360.html","width":130,"caption":"","height":195});
															thumbnails[4092440] = clik.newPhoto({"id":4092440,"src":"_MG_62041_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_4092440.html","width":130,"caption":"","height":195});
															thumbnails[4092452] = clik.newPhoto({"id":4092452,"src":"1_thumb.jpg","galleries_id":128777,"server_id":1,"link":"photo_4092452.html","width":130,"caption":"","height":87});
															thumbnails[4092459] = clik.newPhoto({"id":4092459,"src":"20090419_LisaC-146_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_4092459.html","width":130,"caption":"","height":196});
															thumbnails[4092463] = clik.newPhoto({"id":4092463,"src":"20081111-20081111_Rosie-237-Edit_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_4092463.html","width":130,"caption":"","height":87});
															thumbnails[4092471] = clik.newPhoto({"id":4092471,"src":"20081118-Rosie4panel2_thumb.jpg","galleries_id":128793,"server_id":1,"link":"photo_4092471.html","width":130,"caption":"","height":49});
															thumbnails[4092560] = clik.newPhoto({"id":4092560,"src":"jason_healy_14_thumb.JPG","galleries_id":128794,"server_id":1,"link":"photo_4092560.html","width":130,"caption":"Dance shoot for Jane shorthall dance students","height":195});
															thumbnails[4092567] = clik.newPhoto({"id":4092567,"src":"jason_healy_15_thumb.JPG","galleries_id":128794,"server_id":1,"link":"photo_4092567.html","width":130,"caption":"","height":196});
															thumbnails[5577755] = clik.newPhoto({"id":5577755,"src":"797402716_hQUYD-L_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577755.html","width":130,"caption":"","height":130});
															thumbnails[5577761] = clik.newPhoto({"id":5577761,"src":"797714075_HQA5y-XL_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577761.html","width":130,"caption":"","height":87});
															thumbnails[5577771] = clik.newPhoto({"id":5577771,"src":"797017437_ZMyaJ-L_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577771.html","width":130,"caption":"","height":87});
															thumbnails[5577787] = clik.newPhoto({"id":5577787,"src":"797402434_kc94T-L_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577787.html","width":130,"caption":"","height":195});
															thumbnails[5577804] = clik.newPhoto({"id":5577804,"src":"796356595_HHksT-XL1_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577804.html","width":130,"caption":"","height":195});
															thumbnails[5577860] = clik.newPhoto({"id":5577860,"src":"797402600_Qpveo-L_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_5577860.html","width":130,"caption":"","height":128});
															thumbnails[5630873] = clik.newPhoto({"id":5630873,"src":"Morgan_2319_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_5630873.html","width":130,"caption":"","height":87});
															thumbnails[5630878] = clik.newPhoto({"id":5630878,"src":"Morgan_2123_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_5630878.html","width":130,"caption":"me and all my makeup :)","height":196});
															thumbnails[5630890] = clik.newPhoto({"id":5630890,"src":"Morgan_2301_thumb.jpg","galleries_id":150123,"server_id":1,"link":"photo_5630890.html","width":130,"caption":"","height":87});
															thumbnails[5631011] = clik.newPhoto({"id":5631011,"src":"morgan_2500_copy_2copy_thumb.jpg","galleries_id":129245,"server_id":1,"link":"photo_5631011.html","width":130,"caption":"","height":99});
															thumbnails[5631025] = clik.newPhoto({"id":5631025,"src":"Fran_Byrne_Photography_0096_thumb.jpg","galleries_id":128794,"server_id":1,"link":"photo_5631025.html","width":130,"caption":"","height":153});
															thumbnails[6428566] = clik.newPhoto({"id":6428566,"src":"ro_wedding_thumb.jpg","galleries_id":128792,"server_id":1,"link":"photo_6428566.html","width":130,"caption":"","height":137});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[129245] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Beauty","link":"gallery_129245.html","maxRecords":0.0,"photoIDs":[1920279.0,1920287.0,1926820.0,1926846.0,1926848.0,1926861.0,2782518.0,3227665.0,3227669.0,3261459.0,4092440.0,5631011.0],"skipIndex":0,"section_code":"gallery","featured_images":"3227665,1920287","id":129245,"singleSection":false});				  						galleries[150123] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"behind the scenes ","link":"gallery_150123.html","maxRecords":0.0,"photoIDs":[2288087.0,2288093.0,2288132.0,3261646.0,3261654.0,5630873.0,5630878.0,5630890.0],"skipIndex":0,"section_code":"gallery","featured_images":3261654.0,"id":150123,"singleSection":false});				  						galleries[128792] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bridal","link":"gallery_128792.html","maxRecords":0.0,"photoIDs":[1920284.0,1920285.0,1920286.0,1926871.0,1926877.0,2782582.0,5577755.0,5577761.0,5577771.0,5577787.0,5577804.0,5577860.0,6428566.0],"skipIndex":0,"section_code":"gallery","featured_images":"5577761,1920286","id":128792,"singleSection":false});				  						galleries[128794] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"commercial","link":"gallery_128794.html","maxRecords":0.0,"photoIDs":[1926814.0,1926884.0,1927008.0,1927009.0,1927082.0,2288021.0,3227741.0,3227750.0,3227753.0,4092463.0,4092560.0,4092567.0,5631025.0],"skipIndex":0,"section_code":"gallery","featured_images":"4092560,1926814","id":128794,"singleSection":false});				  						galleries[155472] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Debs make over's","link":"gallery_155472.html","maxRecords":0.0,"photoIDs":[2398623.0,2398838.0,2398854.0,2398921.0,2398953.0],"skipIndex":0,"section_code":"gallery","featured_images":"2398953,2398921,2398854,2398838,2398623","id":155472,"singleSection":false});				  						galleries[128793] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"model portfolios","link":"gallery_128793.html","maxRecords":0.0,"photoIDs":[1920289.0,1926993.0,1927010.0,1927017.0,1927020.0,1940026.0,3001223.0,4092459.0,4092471.0],"skipIndex":0,"section_code":"gallery","featured_images":"4092471,1920289","id":128793,"singleSection":false});				  						galleries[128777] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fashion","link":"gallery_128777.html","maxRecords":0.0,"photoIDs":[1920278.0,1920283.0,1926817.0,1926851.0,1926853.0,1927027.0,2124537.0,2124651.0,2288060.0,2782526.0,2782533.0,4092357.0,4092360.0,4092452.0],"skipIndex":0,"section_code":"gallery","featured_images":"4092360,1920278","id":128777,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5577761,5577755,4092560,4092360,3227741,3227665,2782533,2782526,2782518,2124537,1927017,1920287,1920279';
imageSets[2] = '5577761,4092560,4092471,4092360,3261654,3227665,1926814,1920289,1920287,1920286,1920278';
imageSets[3] = '5577860,5577755';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sugarcubemakeup/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sugarcubemakeup/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 = 'Sugarcube Makeup: ' + 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;
	}
}

			

