window.thumbnails = {};
															thumbnails[6937096] = clik.newPhoto({"id":6937096,"src":"01-Crane-Engine-Behind--Roa_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937096.html","width":130,"caption":"1st  'Open' Projected digital images","height":86});
															thumbnails[4686461] = clik.newPhoto({"id":4686461,"src":"01_And_Baby_makes_4_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686461.html","width":130,"caption":"And Baby Makes Four","height":85});
															thumbnails[7403151] = clik.newPhoto({"id":7403151,"src":"01_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403151.html","width":130,"caption":"1st 'Flora & Fauna' Prints and Projected digital","height":98});
															thumbnails[7403176] = clik.newPhoto({"id":7403176,"src":"011_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403176.html","width":130,"caption":"1st 'Open' Panel of three PDI","height":98});
															thumbnails[6937141] = clik.newPhoto({"id":6937141,"src":"02-September-Mist---Ken-Bry_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937141.html","width":130,"caption":"2nd 'Open' Projected digital images","height":86});
															thumbnails[7403178] = clik.newPhoto({"id":7403178,"src":"02_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403178.html","width":130,"caption":"2nd 'Open' Panel of three PDI","height":98});
															thumbnails[6937155] = clik.newPhoto({"id":6937155,"src":"03-Whitethroat-With-Insect-_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937155.html","width":130,"caption":"3rd 'Open' Projected digital images","height":98});
															thumbnails[4686494] = clik.newPhoto({"id":4686494,"src":"03_Sobriety_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686494.html","width":130,"caption":"Sobriety","height":98});
															thumbnails[7403179] = clik.newPhoto({"id":7403179,"src":"03_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403179.html","width":130,"caption":"3rd 'Open' Panel of three PDI","height":114});
															thumbnails[4686496] = clik.newPhoto({"id":4686496,"src":"04_Roughting_Linn_waterfall_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686496.html","width":130,"caption":"Roughting Linn Waterfall ","height":182});
															thumbnails[4686497] = clik.newPhoto({"id":4686497,"src":"05__Bristol_Cathedral_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686497.html","width":130,"caption":"Bristol Cathedral ","height":188});
															thumbnails[4686498] = clik.newPhoto({"id":4686498,"src":"06_Pink_Slippers_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686498.html","width":130,"caption":"Pink Slippers ","height":131});
															thumbnails[4686717] = clik.newPhoto({"id":4686717,"src":"09_Down_Hill_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686717.html","width":130,"caption":"Down Hill","height":86});
															thumbnails[4686720] = clik.newPhoto({"id":4686720,"src":"10_Lone_tree_on_Eagle__Ridge_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686720.html","width":130,"caption":"Lone Tree on Eagle Rock","height":87});
															thumbnails[4686725] = clik.newPhoto({"id":4686725,"src":"12__Millbrook_Chapel_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686725.html","width":130,"caption":"Millbrook Chapel","height":98});
															thumbnails[4686728] = clik.newPhoto({"id":4686728,"src":"14__Pod_racer_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686728.html","width":130,"caption":"Pod Racer","height":46});
															thumbnails[4686729] = clik.newPhoto({"id":4686729,"src":"15_Alpine_Landscape_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686729.html","width":130,"caption":"Alpine Landscape","height":81});
															thumbnails[4686733] = clik.newPhoto({"id":4686733,"src":"16_Deperdussin_1910_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686733.html","width":130,"caption":"Deperdussin 1910","height":48});
															thumbnails[4686750] = clik.newPhoto({"id":4686750,"src":"17__Turbine_Hall_Tate_Modern_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686750.html","width":130,"caption":"Turbine Hall, Tate Modern","height":161});
															thumbnails[4686761] = clik.newPhoto({"id":4686761,"src":"19_A_Word_thumb.jpg","galleries_id":269697,"server_id":5,"link":"photo_4686761.html","width":130,"caption":"A Word!","height":89});
															thumbnails[5632098] = clik.newPhoto({"id":5632098,"src":"1st_Crown_of_Thorns2_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5632098.html","width":130,"caption":"Crown of Thorns","height":98});
															thumbnails[6937053] = clik.newPhoto({"id":6937053,"src":"2-Shakespears-Birthplace-J_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937053.html","width":130,"caption":"PRINT Taken on the club outing","height":262});
															thumbnails[7403155] = clik.newPhoto({"id":7403155,"src":"2_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403155.html","width":130,"caption":"2nd 'Flora & Fauna' Prints and Projected digital","height":98});
															thumbnails[5632109] = clik.newPhoto({"id":5632109,"src":"2nd_Remembering_my_past2_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5632109.html","width":130,"caption":"Remembering my past","height":87});
															thumbnails[7403160] = clik.newPhoto({"id":7403160,"src":"3_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403160.html","width":130,"caption":"3rd 'Flora & Fauna' Prints and Projected digital","height":87});
															thumbnails[5632121] = clik.newPhoto({"id":5632121,"src":"3rd__Juvenile_Kingfisher_thumb.JPG","galleries_id":334253,"server_id":5,"link":"photo_5632121.html","width":130,"caption":"Juvenile Kingfisher","height":98});
															thumbnails[5193612] = clik.newPhoto({"id":5193612,"src":"a-bath-fit-for-a-princess_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5193612.html","width":130,"caption":"A Bath fit for a Princess","height":98});
															thumbnails[5193618] = clik.newPhoto({"id":5193618,"src":"black-bearded-lizard_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5193618.html","width":130,"caption":"Black Bearded Lizard","height":193});
															thumbnails[5204408] = clik.newPhoto({"id":5204408,"src":"Captivated_by_the_Past_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5204408.html","width":130,"caption":"Captivated By The Past","height":348});
															thumbnails[5204479] = clik.newPhoto({"id":5204479,"src":"Chapel-Magdalen-College_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5204479.html","width":130,"caption":"Chapel, Magdalen College Oxford","height":96});
															thumbnails[6937160] = clik.newPhoto({"id":6937160,"src":"Com--St-MichaelS-Mount-Mar_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937160.html","width":130,"caption":"Commended 'Open' Projected digital images","height":156});
															thumbnails[6937159] = clik.newPhoto({"id":6937159,"src":"Com-Battle-Tank-Gary-Baker_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937159.html","width":130,"caption":"Commended 'Open' Projected digital images","height":98});
															thumbnails[6937162] = clik.newPhoto({"id":6937162,"src":"Com-Grand-Canal-Cindy-Lea_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937162.html","width":130,"caption":"Commended 'Open' Projected digital images","height":97});
															thumbnails[6937163] = clik.newPhoto({"id":6937163,"src":"Com-Low-Greg-Covington-Tide_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937163.html","width":130,"caption":"Commended 'Open' Projected digital images","height":48});
															thumbnails[6937165] = clik.newPhoto({"id":6937165,"src":"Com-Passing-Storm-Irene-Fro_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937165.html","width":130,"caption":"Commended 'Open' Projected digital images","height":98});
															thumbnails[6937167] = clik.newPhoto({"id":6937167,"src":"Com-Running-HardDavid-Coop_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937167.html","width":130,"caption":"Commended 'Open' Projected digital images","height":87});
															thumbnails[6937168] = clik.newPhoto({"id":6937168,"src":"Com-Small-Clawed-Otters-Ron_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937168.html","width":130,"caption":"Commended 'Open' Projected digital images","height":120});
															thumbnails[5015987] = clik.newPhoto({"id":5015987,"src":"GB_oxford_1_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5015987.html","width":130,"caption":"","height":98});
															thumbnails[5015990] = clik.newPhoto({"id":5015990,"src":"gb_oxford_2_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5015990.html","width":130,"caption":"","height":98});
															thumbnails[5015992] = clik.newPhoto({"id":5015992,"src":"gb_oxford_3_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5015992.html","width":130,"caption":"","height":98});
															thumbnails[5015993] = clik.newPhoto({"id":5015993,"src":"gboxford_4_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5015993.html","width":130,"caption":"","height":98});
															thumbnails[6937169] = clik.newPhoto({"id":6937169,"src":"HC--Cleveden-Pier-Peter-Hyd_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937169.html","width":130,"caption":"Highly Commended 'Open' Projected digital images","height":66});
															thumbnails[6937170] = clik.newPhoto({"id":6937170,"src":"HC--Notting-Hill-2010---Red_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937170.html","width":130,"caption":"Highly Commended 'Open' Projected digital images","height":101});
															thumbnails[6937449] = clik.newPhoto({"id":6937449,"src":"HC-Railway-Child-Kim-Davies_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937449.html","width":130,"caption":"Highly Commended Taken on the club outing","height":98});
															thumbnails[6937171] = clik.newPhoto({"id":6937171,"src":"HC-View-From-TegS-Nose-Jos_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937171.html","width":130,"caption":"Highly Commended 'Open' Projected digital images","height":98});
															thumbnails[7403162] = clik.newPhoto({"id":7403162,"src":"hc1_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403162.html","width":130,"caption":"Highly Commended 'Flora & Fauna' Prints and Projected digital","height":108});
															thumbnails[7403180] = clik.newPhoto({"id":7403180,"src":"hc11_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403180.html","width":130,"caption":"Highly Commended 'Open' Panel of three PDI","height":98});
															thumbnails[7403163] = clik.newPhoto({"id":7403163,"src":"hc2_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403163.html","width":130,"caption":"Highly Commended 'Flora & Fauna' Prints and Projected digital","height":117});
															thumbnails[7403182] = clik.newPhoto({"id":7403182,"src":"hc21_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403182.html","width":130,"caption":"Highly Commended 'Open' Panel of three PDI","height":98});
															thumbnails[7403161] = clik.newPhoto({"id":7403161,"src":"hc3_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403161.html","width":130,"caption":"Highly Commended 'Flora & Fauna' Prints and Projected digital","height":150});
															thumbnails[7403183] = clik.newPhoto({"id":7403183,"src":"hc31_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_7403183.html","width":130,"caption":"Highly Commended 'Open' Panel of three PDI","height":94});
															thumbnails[5016026] = clik.newPhoto({"id":5016026,"src":"jc1_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5016026.html","width":130,"caption":"","height":98});
															thumbnails[5016028] = clik.newPhoto({"id":5016028,"src":"jc2_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5016028.html","width":130,"caption":"","height":96});
															thumbnails[5016034] = clik.newPhoto({"id":5016034,"src":"jc3_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5016034.html","width":130,"caption":"","height":98});
															thumbnails[5016035] = clik.newPhoto({"id":5016035,"src":"jc4_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5016035.html","width":130,"caption":"","height":84});
															thumbnails[5193620] = clik.newPhoto({"id":5193620,"src":"prayer-meeting_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5193620.html","width":130,"caption":"Prayer Meeting","height":73});
															thumbnails[5632151] = clik.newPhoto({"id":5632151,"src":"Prayer_Flags_Thimpu_Bhutan_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5632151.html","width":130,"caption":"Prayer Flags - Thimpu,Bhutan","height":82});
															thumbnails[6937046] = clik.newPhoto({"id":6937046,"src":"RFW-All-The-Worlds-A-Stage-_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937046.html","width":130,"caption":"DIGITAL Taken on the club outing","height":98});
															thumbnails[6937039] = clik.newPhoto({"id":6937039,"src":"RFW-SILVER-MAN-MAKING-UP-Va_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937039.html","width":130,"caption":"DIGITAL ENTRY Taken on the club outing","height":88});
															thumbnails[6937047] = clik.newPhoto({"id":6937047,"src":"RFW-The-Garrick-Inn--Harva_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937047.html","width":130,"caption":"DIGITAL Taken on the club outing","height":98});
															thumbnails[6937050] = clik.newPhoto({"id":6937050,"src":"RFW-Water-Reflections-Jose-_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937050.html","width":130,"caption":"DIGITAL Taken on the club outing","height":98});
															thumbnails[5669502] = clik.newPhoto({"id":5669502,"src":"Seahouses_shore_study1_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5669502.html","width":130,"caption":"Seahouses, Northumberland ","height":132});
															thumbnails[6937054] = clik.newPhoto({"id":6937054,"src":"Shakespears-Birthplace-Joh_thumb.jpg","galleries_id":442216,"server_id":5,"link":"photo_6937054.html","width":130,"caption":"PRINT Taken on the club outing","height":91});
															thumbnails[5193822] = clik.newPhoto({"id":5193822,"src":"stairway-to-1_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5193822.html","width":130,"caption":"Stairway to....","height":82});
															thumbnails[5632150] = clik.newPhoto({"id":5632150,"src":"Victoria_Memorial_Kolkata_thumb.jpg","galleries_id":334253,"server_id":5,"link":"photo_5632150.html","width":130,"caption":"Victoria Memorial -  Kolkata","height":60});
															thumbnails[8238451] = clik.newPhoto({"id":8238451,"src":"committee_2011_thumb.jpg","galleries_id":438918,"server_id":5,"link":"photo_8238451.html","width":130,"caption":"","height":77});
															thumbnails[8316004] = clik.newPhoto({"id":8316004,"src":"Exhb_2011_Poster-3_thumb.jpg","galleries_id":442222,"server_id":5,"link":"photo_8316004.html","width":130,"caption":"","height":190});
															thumbnails[8558571] = clik.newPhoto({"id":8558571,"src":"PastelsandMore1_thumb.jpg","galleries_id":442222,"server_id":5,"link":"photo_8558571.html","width":130,"caption":"","height":181});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[438918] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Club committee 2011\/2012","link":"section210346.html","maxRecords":0.0,"photoIDs":[8238451.0],"skipIndex":0,"section_code":"section210346","featured_images":8238451.0,"id":438918,"singleSection":true});				  						galleries[442222] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"TEMP GALLERY","link":"section531508.html","maxRecords":0.0,"photoIDs":[8316004.0,8558571.0],"skipIndex":0,"section_code":"section531508","featured_images":"8558571,8316004","id":442222,"singleSection":true});				  						galleries[269697] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2008\/2009","link":"gallery_269697.html","maxRecords":0.0,"photoIDs":[4686461.0,4686494.0,4686496.0,4686497.0,4686498.0,4686717.0,4686720.0,4686725.0,4686728.0,4686729.0,4686733.0,4686750.0,4686761.0],"skipIndex":0,"section_code":"gallery","featured_images":"4686761,4686750,4686733,4686729,4686728,4686725,4686720,4686717,4686498,4686497","id":269697,"singleSection":false});				  						galleries[334253] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2009\/2010","link":"gallery_334253.html","maxRecords":0.0,"photoIDs":[5632098.0,5632109.0,5632121.0,5193612.0,5193618.0,5204408.0,5204479.0,5015987.0,5015990.0,5015992.0,5015993.0,5016026.0,5016028.0,5016034.0,5016035.0,5193620.0,5632151.0,5669502.0,5193822.0,5632150.0],"skipIndex":0,"section_code":"gallery","featured_images":"5669502,5632151,5632150,5632121,5632109,5632098,5204479,5204408,5193822,5193620","id":334253,"singleSection":false});				  						galleries[442216] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2010\/2011","link":"gallery_442216.html","maxRecords":0.0,"photoIDs":[6937096.0,7403151.0,7403176.0,6937141.0,7403178.0,6937155.0,7403179.0,6937053.0,7403155.0,7403160.0,6937160.0,6937159.0,6937162.0,6937163.0,6937165.0,6937167.0,6937168.0,6937169.0,6937170.0,6937449.0,6937171.0,7403162.0,7403180.0,7403163.0,7403182.0,7403161.0,7403183.0,6937046.0,6937039.0,6937047.0,6937050.0,6937054.0],"skipIndex":0,"section_code":"gallery","featured_images":"7403183,7403182,7403180,7403179,7403178,7403176,7403163,7403162,7403161,7403160","id":442216,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6937096,7403151,7403176,6937141,7403178,6937053,6937160,6937163,6937165,6937169,6937171,7403163';
imageSets[3] = '8558571,8316004,8238451,7403183,7403182,7403180,7403179,7403178,7403176,7403163,7403162,7403161,7403160,7403155,7403151,6937449,6937171,6937170,6937169,6937168,6937167,6937165,6937163,6937162,6937160,6937159,6937155,6937141,6937096,6937054,6937053,6937050,6937047,6937046,6937039,5669502,5632151,5632150,5632121,5632109,5632098,5204479,5204408,5193822,5193620,5193618,5193612,5016035,5016034,5016028';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/shillington/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/shillington/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/shillington/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 = 'Shillington & District Camera Club: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

