window.thumbnails = {};
															thumbnails[5058368] = clik.newPhoto({"id":5058368,"src":"AIP10_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5058368.html","width":130,"caption":"Mini     Waterfalls","height":130});
															thumbnails[5236500] = clik.newPhoto({"id":5236500,"src":"AIP57_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5236500.html","width":130,"caption":"","height":104});
															thumbnails[5238258] = clik.newPhoto({"id":5238258,"src":"59aa_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5238258.html","width":130,"caption":"","height":104});
															thumbnails[5248377] = clik.newPhoto({"id":5248377,"src":"AIP60_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5248377.html","width":130,"caption":"","height":104});
															thumbnails[5248380] = clik.newPhoto({"id":5248380,"src":"AIP55T_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5248380.html","width":130,"caption":"","height":130});
															thumbnails[5248383] = clik.newPhoto({"id":5248383,"src":"56T_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5248383.html","width":130,"caption":"","height":130});
															thumbnails[5248392] = clik.newPhoto({"id":5248392,"src":"AIP61_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5248392.html","width":130,"caption":"","height":130});
															thumbnails[5248402] = clik.newPhoto({"id":5248402,"src":"AIP62_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5248402.html","width":130,"caption":"","height":115});
															thumbnails[5262452] = clik.newPhoto({"id":5262452,"src":"68t_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5262452.html","width":130,"caption":"","height":130});
															thumbnails[5270838] = clik.newPhoto({"id":5270838,"src":"70t_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5270838.html","width":130,"caption":"","height":130});
															thumbnails[5270887] = clik.newPhoto({"id":5270887,"src":"AIP69TT_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5270887.html","width":130,"caption":"","height":130});
															thumbnails[5279108] = clik.newPhoto({"id":5279108,"src":"AIP71T_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5279108.html","width":130,"caption":"","height":130});
															thumbnails[5960170] = clik.newPhoto({"id":5960170,"src":"AIP113_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5960170.html","width":130,"caption":"","height":130});
															thumbnails[5962705] = clik.newPhoto({"id":5962705,"src":"AIP_116_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5962705.html","width":130,"caption":"","height":130});
															thumbnails[5962761] = clik.newPhoto({"id":5962761,"src":"AIP117T_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5962761.html","width":130,"caption":"","height":130});
															thumbnails[6007690] = clik.newPhoto({"id":6007690,"src":"AIP_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_6007690.html","width":130,"caption":"","height":130});
															thumbnails[6012971] = clik.newPhoto({"id":6012971,"src":"154_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_6012971.html","width":130,"caption":"","height":130});
															thumbnails[6057071] = clik.newPhoto({"id":6057071,"src":"AIP162T_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6057071.html","width":130,"caption":"","height":78});
															thumbnails[6059968] = clik.newPhoto({"id":6059968,"src":"AIP168T_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6059968.html","width":130,"caption":"","height":69});
															thumbnails[6070646] = clik.newPhoto({"id":6070646,"src":"AIP171_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_6070646.html","width":130,"caption":"","height":130});
															thumbnails[6081137] = clik.newPhoto({"id":6081137,"src":"AIP170_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_6081137.html","width":130,"caption":"","height":130});
															thumbnails[6081481] = clik.newPhoto({"id":6081481,"src":"AIP174_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_6081481.html","width":130,"caption":"","height":130});
															thumbnails[6081639] = clik.newPhoto({"id":6081639,"src":"AIP175_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_6081639.html","width":130,"caption":"","height":130});
															thumbnails[6090078] = clik.newPhoto({"id":6090078,"src":"AIP177_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_6090078.html","width":130,"caption":"","height":130});
															thumbnails[6090223] = clik.newPhoto({"id":6090223,"src":"AIP178_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_6090223.html","width":130,"caption":"","height":130});
															thumbnails[6093053] = clik.newPhoto({"id":6093053,"src":"AIP180_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6093053.html","width":130,"caption":"","height":78});
															thumbnails[6537679] = clik.newPhoto({"id":6537679,"src":"aip190_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6537679.html","width":130,"caption":"","height":71});
															thumbnails[7045242] = clik.newPhoto({"id":7045242,"src":"tintenclean_3_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7045242.html","width":130,"caption":"","height":130});
															thumbnails[7083210] = clik.newPhoto({"id":7083210,"src":"INT170T1_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7083210.html","width":130,"caption":"","height":130});
															thumbnails[7086145] = clik.newPhoto({"id":7086145,"src":"int172T_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7086145.html","width":130,"caption":"","height":130});
															thumbnails[7232952] = clik.newPhoto({"id":7232952,"src":"aip250t_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7232952.html","width":130,"caption":"","height":130});
															thumbnails[7242656] = clik.newPhoto({"id":7242656,"src":"256T_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_7242656.html","width":130,"caption":"","height":130});
															thumbnails[7353203] = clik.newPhoto({"id":7353203,"src":"INTT184_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7353203.html","width":130,"caption":"","height":130});
															thumbnails[7458161] = clik.newPhoto({"id":7458161,"src":"INTT2001_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7458161.html","width":130,"caption":"","height":130});
															thumbnails[7458167] = clik.newPhoto({"id":7458167,"src":"INT2011_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7458167.html","width":130,"caption":"","height":130});
															thumbnails[7458303] = clik.newPhoto({"id":7458303,"src":"INTT202_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7458303.html","width":130,"caption":"","height":130});
															thumbnails[7458371] = clik.newPhoto({"id":7458371,"src":"INTt2032_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7458371.html","width":130,"caption":"","height":130});
															thumbnails[7459555] = clik.newPhoto({"id":7459555,"src":"INTt204_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7459555.html","width":130,"caption":"","height":130});
															thumbnails[7626041] = clik.newPhoto({"id":7626041,"src":"INTT206_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7626041.html","width":130,"caption":"","height":130});
															thumbnails[7654830] = clik.newPhoto({"id":7654830,"src":"INT209T_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_7654830.html","width":130,"caption":"","height":130});
															thumbnails[8654843] = clik.newPhoto({"id":8654843,"src":"AIP164-Edit-Edit3_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_8654843.html","width":130,"caption":"","height":130});
															thumbnails[8849379] = clik.newPhoto({"id":8849379,"src":"INT350T_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_8849379.html","width":130,"caption":"","height":130});
															thumbnails[8852867] = clik.newPhoto({"id":8852867,"src":"301T_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_8852867.html","width":130,"caption":"","height":130});
															thumbnails[5056441] = clik.newPhoto({"id":5056441,"src":"aip23_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5056441.html","width":130,"caption":"The Jetty","height":130});
															thumbnails[5056645] = clik.newPhoto({"id":5056645,"src":"AIOP11_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5056645.html","width":130,"caption":"","height":130});
															thumbnails[5056680] = clik.newPhoto({"id":5056680,"src":"AIP0511_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5056680.html","width":130,"caption":" Sunrise  at  Southerndown","height":130});
															thumbnails[5056820] = clik.newPhoto({"id":5056820,"src":"AIP071_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5056820.html","width":130,"caption":"  The   Rocks","height":130});
															thumbnails[5057262] = clik.newPhoto({"id":5057262,"src":"AIP26_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5057262.html","width":130,"caption":"","height":130});
															thumbnails[5058375] = clik.newPhoto({"id":5058375,"src":"AIP12_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5058375.html","width":130,"caption":"","height":130});
															thumbnails[5058737] = clik.newPhoto({"id":5058737,"src":"AIP17_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5058737.html","width":130,"caption":"Fontygary   Slabs","height":130});
															thumbnails[5207007] = clik.newPhoto({"id":5207007,"src":"36_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5207007.html","width":130,"caption":"Sandbanks","height":130});
															thumbnails[5209183] = clik.newPhoto({"id":5209183,"src":"AIP16_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5209183.html","width":130,"caption":"Southerndown AT Sunset","height":130});
															thumbnails[5221283] = clik.newPhoto({"id":5221283,"src":"37_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5221283.html","width":130,"caption":"","height":130});
															thumbnails[5221467] = clik.newPhoto({"id":5221467,"src":"AIP41_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5221467.html","width":130,"caption":"","height":130});
															thumbnails[5225910] = clik.newPhoto({"id":5225910,"src":"AIP45_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5225910.html","width":130,"caption":"","height":130});
															thumbnails[5236515] = clik.newPhoto({"id":5236515,"src":"AIP58_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5236515.html","width":130,"caption":"","height":130});
															thumbnails[5565674] = clik.newPhoto({"id":5565674,"src":"web_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5565674.html","width":130,"caption":"","height":130});
															thumbnails[5590786] = clik.newPhoto({"id":5590786,"src":"mmfc5169-Edit-int_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5590786.html","width":130,"caption":"","height":130});
															thumbnails[5757744] = clik.newPhoto({"id":5757744,"src":"10_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5757744.html","width":130,"caption":"","height":130});
															thumbnails[5757747] = clik.newPhoto({"id":5757747,"src":"13_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5757747.html","width":130,"caption":"","height":130});
															thumbnails[5757751] = clik.newPhoto({"id":5757751,"src":"12_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5757751.html","width":130,"caption":"","height":130});
															thumbnails[5764196] = clik.newPhoto({"id":5764196,"src":"aip90_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5764196.html","width":130,"caption":"","height":130});
															thumbnails[5056664] = clik.newPhoto({"id":5056664,"src":"AP27_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5056664.html","width":130,"caption":"","height":130});
															thumbnails[5056837] = clik.newPhoto({"id":5056837,"src":"AIP18_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5056837.html","width":130,"caption":" Loook   There's  Old  Harry  Rocks","height":104});
															thumbnails[5057022] = clik.newPhoto({"id":5057022,"src":"AIP21_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5057022.html","width":130,"caption":"  Bamburgh   from  Afar  ","height":108});
															thumbnails[5058430] = clik.newPhoto({"id":5058430,"src":"aip014_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5058430.html","width":130,"caption":"","height":108});
															thumbnails[5060094] = clik.newPhoto({"id":5060094,"src":"aip22jpg_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5060094.html","width":130,"caption":"Loook   There's   Dunstanburgh","height":104});
															thumbnails[5062204] = clik.newPhoto({"id":5062204,"src":"AIP012_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5062204.html","width":130,"caption":"","height":104});
															thumbnails[5207032] = clik.newPhoto({"id":5207032,"src":"AIP38_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5207032.html","width":130,"caption":"","height":94});
															thumbnails[5209245] = clik.newPhoto({"id":5209245,"src":"AIP20_thumb.jpg","galleries_id":286097,"server_id":5,"link":"photo_5209245.html","width":130,"caption":"The  Jetty","height":104});
															thumbnails[5221344] = clik.newPhoto({"id":5221344,"src":"AIP38_6F19DB2A-1D09-001F-99813C9D41E756AA_thumb.jpg","galleries_id":286096,"server_id":5,"link":"photo_5221344.html","width":130,"caption":"","height":104});
															thumbnails[6011576] = clik.newPhoto({"id":6011576,"src":"AIP153_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6011576.html","width":130,"caption":"","height":82});
															thumbnails[6013082] = clik.newPhoto({"id":6013082,"src":"AIP156_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6013082.html","width":130,"caption":"","height":78});
															thumbnails[6054408] = clik.newPhoto({"id":6054408,"src":"AIP-160_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6054408.html","width":130,"caption":"","height":78});
															thumbnails[6056955] = clik.newPhoto({"id":6056955,"src":"AIP161T_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6056955.html","width":130,"caption":"","height":78});
															thumbnails[6093286] = clik.newPhoto({"id":6093286,"src":"AIP182t_thumb.jpg","galleries_id":338356,"server_id":5,"link":"photo_6093286.html","width":130,"caption":"","height":78});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[286096] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Gallery 1","link":"gallery_286096.html","maxRecords":0.0,"photoIDs":[5058368.0,5248380.0,5248383.0,5248392.0,5248402.0,5262452.0,5270838.0,5270887.0,5279108.0,5962705.0,5962761.0,6007690.0,6070646.0,6081481.0,7242656.0,5056441.0,5056680.0,5056820.0,5057262.0,5058375.0,5058737.0,5207007.0,5209183.0,5221283.0,5221467.0,5225910.0,5236515.0,5565674.0,5590786.0,5764196.0,5056664.0,5058430.0,5207032.0,5221344.0],"skipIndex":0,"section_code":"gallery","featured_images":5056441.0,"id":286096,"singleSection":false});				  						galleries[286097] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Gallery 2","link":"gallery_286097.html","maxRecords":0.0,"photoIDs":[5236500.0,5238258.0,5248377.0,5960170.0,6012971.0,6081137.0,6081639.0,6090078.0,6090223.0,7045242.0,7083210.0,7086145.0,7232952.0,7353203.0,7458161.0,7458167.0,7458303.0,7458371.0,7459555.0,7626041.0,7654830.0,8654843.0,8849379.0,8852867.0,5056645.0,5757744.0,5757747.0,5757751.0,5056837.0,5057022.0,5060094.0,5062204.0,5209245.0],"skipIndex":0,"section_code":"gallery","featured_images":"8852867,8849379,8654843,7654830,7626041,7459555,7458371,7458303,7458167,7458161","id":286097,"singleSection":false});				  						galleries[338356] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Gallery  3","link":"gallery_338356.html","maxRecords":0.0,"photoIDs":[6057071.0,6059968.0,6093053.0,6537679.0,6011576.0,6013082.0,6054408.0,6056955.0,6093286.0],"skipIndex":0,"section_code":"gallery","featured_images":"6537679,6093286,6093053,6059968,6057071,6056955,6054408,6013082,6011576","id":338356,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8852867,8849379,8654843,7654830,7626041,7459555,7458371,7458303,7458167,7458161,7353203,7242656,7232952,7086145,7083210,7045242,6537679,6093286,6093053,6090223,6090078,6081639,6081481,6081137,6070646,6059968,6057071,6056955,6054408,6013082,6012971,6011576,6007690,5962761,5962705,5960170,5764196,5757751,5757747,5757744,5590786,5565674,5279108,5270887,5270838,5262452,5248402,5248392,5248383,5248380';
imageSets[2] = '5056441';
imageSets[3] = '8852867,8849379,8654843,7654830,7626041,7459555,7458371,7458303,7458167,7458161,7353203,7242656,7232952,7086145,7083210,7045242,6537679,6093286,6093053,6090223,6090078,6081639,6081481,6081137,6070646,6059968,6057071,6056955,6054408,6013082,6012971,6011576,6007690,5962761,5962705,5960170,5764196,5757751,5757747,5757744,5590786,5565674,5279108,5270887,5270838,5262452,5248402,5248392,5248383,5248380';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/PANTHONISZ/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/PANTHONISZ/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 = 'ANTHONISZ-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>PATRICK  .  ANTHONISZ </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="PANTHONISZ">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

