window.thumbnails = {};
															thumbnails[4228242] = clik.newPhoto({"id":4228242,"src":"sign_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[4228300] = clik.newPhoto({"id":4228300,"src":"new1_yaz1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1708755] = clik.newPhoto({"id":1708755,"src":"wedding web_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_1708755.html","width":130,"caption":"","height":195});
															thumbnails[2093229] = clik.newPhoto({"id":2093229,"src":"IMG_46471_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2093229.html","width":130,"caption":"","height":195});
															thumbnails[2093230] = clik.newPhoto({"id":2093230,"src":"wedding_2_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2093230.html","width":130,"caption":"","height":195});
															thumbnails[2093232] = clik.newPhoto({"id":2093232,"src":"wedding_71_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2093232.html","width":130,"caption":"","height":195});
															thumbnails[2093234] = clik.newPhoto({"id":2093234,"src":"wedding_76_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2093234.html","width":130,"caption":"","height":195});
															thumbnails[2093237] = clik.newPhoto({"id":2093237,"src":"wedding_83_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2093237.html","width":130,"caption":"","height":195});
															thumbnails[2371054] = clik.newPhoto({"id":2371054,"src":"151 sepia_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2371054.html","width":130,"caption":"","height":195});
															thumbnails[2371061] = clik.newPhoto({"id":2371061,"src":"Copy of 187cropped1_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2371061.html","width":130,"caption":"","height":195});
															thumbnails[2371063] = clik.newPhoto({"id":2371063,"src":"403 b&w2_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_2371063.html","width":130,"caption":"","height":195});
															thumbnails[2504958] = clik.newPhoto({"id":2504958,"src":"lighting_thumb.jpg","galleries_id":160632,"server_id":1,"link":"photo_2504958.html","width":130,"caption":"","height":184});
															thumbnails[2723890] = clik.newPhoto({"id":2723890,"src":"web_thumb.jpg","galleries_id":171369,"server_id":1,"link":"photo_2723890.html","width":130,"caption":"","height":195});
															thumbnails[3176768] = clik.newPhoto({"id":3176768,"src":"sepia hand bab1_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3176768.html","width":130,"caption":"","height":87});
															thumbnails[3176791] = clik.newPhoto({"id":3176791,"src":"06newweb1_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3176791.html","width":130,"caption":"","height":195});
															thumbnails[3176801] = clik.newPhoto({"id":3176801,"src":"15newweb2_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3176801.html","width":130,"caption":"","height":163});
															thumbnails[3176803] = clik.newPhoto({"id":3176803,"src":"14newweb2_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3176803.html","width":130,"caption":"","height":163});
															thumbnails[3710415] = clik.newPhoto({"id":3710415,"src":"IMG_8466_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3710415.html","width":130,"caption":"","height":195});
															thumbnails[3710417] = clik.newPhoto({"id":3710417,"src":"IMG_8428_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3710417.html","width":130,"caption":"","height":195});
															thumbnails[3710418] = clik.newPhoto({"id":3710418,"src":"IMG_8461_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_3710418.html","width":130,"caption":"","height":195});
															thumbnails[4971705] = clik.newPhoto({"id":4971705,"src":"039_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_4971705.html","width":130,"caption":"","height":87});
															thumbnails[4971713] = clik.newPhoto({"id":4971713,"src":"0241_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_4971713.html","width":130,"caption":"","height":195});
															thumbnails[4971714] = clik.newPhoto({"id":4971714,"src":"0341_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_4971714.html","width":130,"caption":"","height":195});
															thumbnails[4971716] = clik.newPhoto({"id":4971716,"src":"0371_thumb.jpg","galleries_id":139087,"server_id":1,"link":"photo_4971716.html","width":130,"caption":"","height":195});
															thumbnails[7206702] = clik.newPhoto({"id":7206702,"src":"lola_nappie346_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_7206702.html","width":130,"caption":"","height":195});
															thumbnails[7206739] = clik.newPhoto({"id":7206739,"src":"lola_face1_thumb.jpg","galleries_id":194395,"server_id":1,"link":"photo_7206739.html","width":130,"caption":"","height":87});
															thumbnails[8320138] = clik.newPhoto({"id":8320138,"src":"IMGweb_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320138.html","width":130,"caption":"","height":87});
															thumbnails[8320194] = clik.newPhoto({"id":8320194,"src":"cd_coverweb_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320194.html","width":130,"caption":"","height":130});
															thumbnails[8320204] = clik.newPhoto({"id":8320204,"src":"IMG_0788web_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320204.html","width":130,"caption":"","height":195});
															thumbnails[8320219] = clik.newPhoto({"id":8320219,"src":"nicweb1_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320219.html","width":130,"caption":"","height":195});
															thumbnails[8320294] = clik.newPhoto({"id":8320294,"src":"last_lookweb1_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320294.html","width":130,"caption":"","height":195});
															thumbnails[8320304] = clik.newPhoto({"id":8320304,"src":"hairweb_thumb.jpg","galleries_id":139087,"server_id":37,"link":"photo_8320304.html","width":130,"caption":"","height":195});
															thumbnails[2071080] = clik.newPhoto({"id":2071080,"src":"web6_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071080.html","width":130,"caption":"","height":184});
															thumbnails[2071086] = clik.newPhoto({"id":2071086,"src":"web51_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071086.html","width":130,"caption":"","height":184});
															thumbnails[2071088] = clik.newPhoto({"id":2071088,"src":"web41_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071088.html","width":130,"caption":"","height":184});
															thumbnails[2071091] = clik.newPhoto({"id":2071091,"src":"web11_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071091.html","width":130,"caption":"","height":195});
															thumbnails[2071097] = clik.newPhoto({"id":2071097,"src":"web21_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071097.html","width":130,"caption":"","height":195});
															thumbnails[2071100] = clik.newPhoto({"id":2071100,"src":"web31_thumb.jpg","galleries_id":138228,"server_id":1,"link":"photo_2071100.html","width":130,"caption":"","height":184});
															thumbnails[2093104] = clik.newPhoto({"id":2093104,"src":"quackers_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093104.html","width":130,"caption":"","height":87});
															thumbnails[2093105] = clik.newPhoto({"id":2093105,"src":"piggies_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093105.html","width":130,"caption":"","height":87});
															thumbnails[2093107] = clik.newPhoto({"id":2093107,"src":"lamb_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093107.html","width":130,"caption":"","height":87});
															thumbnails[2093113] = clik.newPhoto({"id":2093113,"src":"hens_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093113.html","width":130,"caption":"","height":87});
															thumbnails[2093114] = clik.newPhoto({"id":2093114,"src":"fishy_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093114.html","width":130,"caption":"","height":85});
															thumbnails[2093116] = clik.newPhoto({"id":2093116,"src":"cows_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093116.html","width":130,"caption":"","height":87});
															thumbnails[2093117] = clik.newPhoto({"id":2093117,"src":"bun_thumb.jpg","galleries_id":139596,"server_id":1,"link":"photo_2093117.html","width":130,"caption":"","height":87});
															thumbnails[2093246] = clik.newPhoto({"id":2093246,"src":"tia copy web_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2093246.html","width":130,"caption":"","height":195});
															thumbnails[2098978] = clik.newPhoto({"id":2098978,"src":"jens dogs_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2098978.html","width":130,"caption":"","height":195});
															thumbnails[2098979] = clik.newPhoto({"id":2098979,"src":"mel_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2098979.html","width":130,"caption":"","height":195});
															thumbnails[2216182] = clik.newPhoto({"id":2216182,"src":"047_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2216182.html","width":130,"caption":"","height":195});
															thumbnails[2216183] = clik.newPhoto({"id":2216183,"src":"028_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2216183.html","width":130,"caption":"","height":195});
															thumbnails[2216185] = clik.newPhoto({"id":2216185,"src":"042_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2216185.html","width":130,"caption":"","height":172});
															thumbnails[2222382] = clik.newPhoto({"id":2222382,"src":"0132_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2222382.html","width":130,"caption":"","height":174});
															thumbnails[2222419] = clik.newPhoto({"id":2222419,"src":"rspca kit_thumb.jpg","galleries_id":146618,"server_id":1,"link":"photo_2222419.html","width":130,"caption":"","height":88});
															thumbnails[2222420] = clik.newPhoto({"id":2222420,"src":"mancoon_thumb.jpg","galleries_id":146618,"server_id":1,"link":"photo_2222420.html","width":130,"caption":"","height":203});
															thumbnails[2222423] = clik.newPhoto({"id":2222423,"src":"lilly_thumb.jpg","galleries_id":146618,"server_id":1,"link":"photo_2222423.html","width":130,"caption":"","height":183});
															thumbnails[2222431] = clik.newPhoto({"id":2222431,"src":"daisy x_thumb.jpg","galleries_id":146618,"server_id":1,"link":"photo_2222431.html","width":130,"caption":"","height":196});
															thumbnails[2479105] = clik.newPhoto({"id":2479105,"src":"gallop_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2479105.html","width":130,"caption":"","height":87});
															thumbnails[2479108] = clik.newPhoto({"id":2479108,"src":"spoty web_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2479108.html","width":130,"caption":"","height":195});
															thumbnails[2479183] = clik.newPhoto({"id":2479183,"src":"ellas foal_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2479183.html","width":130,"caption":"","height":87});
															thumbnails[2504120] = clik.newPhoto({"id":2504120,"src":"coloured foal copy_thumb.jpg","galleries_id":159284,"server_id":1,"link":"photo_2504120.html","width":130,"caption":"","height":173});
															thumbnails[2504224] = clik.newPhoto({"id":2504224,"src":"ears_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2504224.html","width":130,"caption":"","height":195});
															thumbnails[2504228] = clik.newPhoto({"id":2504228,"src":"pug_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2504228.html","width":130,"caption":"","height":195});
															thumbnails[2504231] = clik.newPhoto({"id":2504231,"src":"Tilly edit_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2504231.html","width":130,"caption":"","height":195});
															thumbnails[2504543] = clik.newPhoto({"id":2504543,"src":"sepia web nu_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2504543.html","width":130,"caption":"","height":87});
															thumbnails[3710124] = clik.newPhoto({"id":3710124,"src":"07frankie_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_3710124.html","width":130,"caption":"","height":182});
															thumbnails[3710134] = clik.newPhoto({"id":3710134,"src":"21frankie1_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_3710134.html","width":130,"caption":"","height":162});
															thumbnails[3710135] = clik.newPhoto({"id":3710135,"src":"35frankie1_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_3710135.html","width":130,"caption":"","height":182});
															thumbnails[3710141] = clik.newPhoto({"id":3710141,"src":"karen_dogs_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_3710141.html","width":130,"caption":"","height":60});
															thumbnails[7450889] = clik.newPhoto({"id":7450889,"src":"carrie_n_dogsweb_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_7450889.html","width":130,"caption":"","height":195});
															thumbnails[2098975] = clik.newPhoto({"id":2098975,"src":"x3 new_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2098975.html","width":130,"caption":"","height":92});
															thumbnails[2098982] = clik.newPhoto({"id":2098982,"src":"017edited_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2098982.html","width":130,"caption":"","height":195});
															thumbnails[2098983] = clik.newPhoto({"id":2098983,"src":"3 edited_thumb.jpg","galleries_id":146612,"server_id":1,"link":"photo_2098983.html","width":130,"caption":"","height":195});
															thumbnails[2093247] = clik.newPhoto({"id":2093247,"src":"kiss web_thumb.jpg","galleries_id":139090,"server_id":1,"link":"photo_2093247.html","width":130,"caption":"","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[146618] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cats","link":"gallery_146618.html","maxRecords":0.0,"photoIDs":[2222419.0,2222420.0,2222423.0,2222431.0],"skipIndex":0,"section_code":"gallery","featured_images":2222419.0,"id":146618,"singleSection":false});				  						galleries[160632] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"D-Lite System","link":"section203049_160632.html","maxRecords":0.0,"photoIDs":[2504958.0],"skipIndex":0,"section_code":"section203049","featured_images":2504958.0,"id":160632,"singleSection":false});				  						galleries[146612] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Dogs","link":"gallery_146612.html","maxRecords":0.0,"photoIDs":[2098978.0,2216182.0,2216183.0,2216185.0,2222382.0,2504224.0,2504228.0,2504231.0,2504543.0,3710124.0,3710134.0,3710135.0,3710141.0,7450889.0,2098975.0,2098982.0,2098983.0],"skipIndex":0,"section_code":"gallery","featured_images":2216185.0,"id":146612,"singleSection":false});				  						galleries[194395] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Families & Baby","link":"section203049_194395.html","maxRecords":0.0,"photoIDs":[3176768.0,3176791.0,3176801.0,3176803.0,3710415.0,3710417.0,3710418.0,7206702.0,7206739.0],"skipIndex":0,"section_code":"section203049","featured_images":"7206739,7206702,3710418,3710417,3710415,3176803,3176801,3176791,3176768","id":194395,"singleSection":false});				  						galleries[159284] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Horses","link":"gallery_159284.html","maxRecords":0.0,"photoIDs":[2093246.0,2098979.0,2479105.0,2479108.0,2479183.0,2504120.0],"skipIndex":0,"section_code":"gallery","featured_images":"2504120,2479183,2479108,2479105,2098979,2093246","id":159284,"singleSection":false});				  						galleries[139596] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Personal Project","link":"gallery_139596.html","maxRecords":0.0,"photoIDs":[2093104.0,2093105.0,2093107.0,2093113.0,2093114.0,2093116.0,2093117.0],"skipIndex":0,"section_code":"gallery","featured_images":"2093117,2093116,2093114,2093113,2093107,2093105,2093104","id":139596,"singleSection":false});				  						galleries[139090] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pet Photography Service","link":"section179497.html","maxRecords":0.0,"photoIDs":[2093247.0],"skipIndex":0,"section_code":"section179497","featured_images":2093247.0,"id":139090,"singleSection":true});				  						galleries[171369] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"photo parties","link":"section203049_171369.html","maxRecords":0.0,"photoIDs":[2723890.0],"skipIndex":0,"section_code":"section203049","featured_images":2723890.0,"id":171369,"singleSection":false});				  						galleries[138228] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pointer sisters","link":"gallery_138228.html","maxRecords":0.0,"photoIDs":[2071080.0,2071086.0,2071088.0,2071091.0,2071097.0,2071100.0],"skipIndex":0,"section_code":"gallery","featured_images":"2071100,2071097,2071091,2071088,2071086,2071080","id":138228,"singleSection":false});				  						galleries[139087] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding\/Events","link":"section203049_139087.html","maxRecords":0.0,"photoIDs":[1708755.0,2093229.0,2093230.0,2093232.0,2093234.0,2093237.0,2371054.0,2371061.0,2371063.0,4971705.0,4971713.0,4971714.0,4971716.0,8320138.0,8320194.0,8320204.0,8320219.0,8320294.0,8320304.0],"skipIndex":0,"section_code":"section203049","featured_images":"4971705,1708755","id":139087,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4971705,4228300,3710141,3176768,2504543,2098975';
imageSets[2] = '4971705,2723890,2222419,2216185,1708755';
imageSets[3] = '4971705';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/keren/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/keren/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/keren/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/keren/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/keren/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/keren/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/keren/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 += 'section203049.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 && 'section203049' != '') {
					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 = 'Keren Marie : ' + 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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

