window.thumbnails = {};
															thumbnails[4425055] = clik.newPhoto({"id":4425055,"src":"japage3_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":78});
															thumbnails[3997971] = clik.newPhoto({"id":3997971,"src":"VLBrush_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_3997971.html","width":130,"caption":"Blue Vase (29cm x 22cm)","height":179});
															thumbnails[3998335] = clik.newPhoto({"id":3998335,"src":"328GTS_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3998335.html","width":130,"caption":"Ferrari 328GTS (NFS)","height":95});
															thumbnails[3999552] = clik.newPhoto({"id":3999552,"src":"bottles0509a_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_3999552.html","width":130,"caption":"Bottles (20cm x 28cm)","height":179});
															thumbnails[3999566] = clik.newPhoto({"id":3999566,"src":"Hiroshima1_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_3999566.html","width":130,"caption":"Hiroshima (37cm x 44cm)","height":194});
															thumbnails[3999575] = clik.newPhoto({"id":3999575,"src":"bottles0509_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_3999575.html","width":130,"caption":"3 Bottles (27cm x 32cm)","height":174});
															thumbnails[3999613] = clik.newPhoto({"id":3999613,"src":"F40_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999613.html","width":130,"caption":"F40 (45cm x 35cm)","height":88});
															thumbnails[3999616] = clik.newPhoto({"id":3999616,"src":"ferrari_rear_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999616.html","width":130,"caption":"F1 Ferrari (45cm x 36cm)","height":194});
															thumbnails[3999623] = clik.newPhoto({"id":3999623,"src":"schumibarri02a_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999623.html","width":130,"caption":"Schumacher Barrichello (28cm x 18cm)","height":74});
															thumbnails[3999628] = clik.newPhoto({"id":3999628,"src":"schumi_monaco_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999628.html","width":130,"caption":"Schumi @ Monaco (27cm x 19cm)","height":88});
															thumbnails[3999649] = clik.newPhoto({"id":3999649,"src":"victory_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999649.html","width":130,"caption":"Victory (29cm x 15cm)","height":70});
															thumbnails[3999664] = clik.newPhoto({"id":3999664,"src":"helicopter05021_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999664.html","width":130,"caption":"RAF Helicopter (35cm x 45cm)","height":194});
															thumbnails[3999667] = clik.newPhoto({"id":3999667,"src":"hamilton0501a1_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999667.html","width":130,"caption":"Lewis Hamilton 2008 (29cm x 21cm)","height":92});
															thumbnails[3999677] = clik.newPhoto({"id":3999677,"src":"schumi04a1_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999677.html","width":130,"caption":"Schumi @Monaco 2 (29cm x 21cm)","height":84});
															thumbnails[3999694] = clik.newPhoto({"id":3999694,"src":"coulthard20002_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_3999694.html","width":130,"caption":"Coulthard McClaren 2000","height":87});
															thumbnails[4003105] = clik.newPhoto({"id":4003105,"src":"5lemons_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003105.html","width":130,"caption":"5 Lemons (31cm x 25cm)","height":101});
															thumbnails[4003114] = clik.newPhoto({"id":4003114,"src":"beermug1_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003114.html","width":130,"caption":"Beer Mug (24cm x 31cm)","height":179});
															thumbnails[4003116] = clik.newPhoto({"id":4003116,"src":"provencal-jug_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003116.html","width":130,"caption":"Provencal Jug (26cm x 21cm)","height":106});
															thumbnails[4003117] = clik.newPhoto({"id":4003117,"src":"5lemons2_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003117.html","width":130,"caption":"Five Lemons & Brush (33cm x 24cm)","height":94});
															thumbnails[4003118] = clik.newPhoto({"id":4003118,"src":"sunsetpansies1_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003118.html","width":130,"caption":"French Sunset (26cm x 19cm)","height":182});
															thumbnails[4003121] = clik.newPhoto({"id":4003121,"src":"5lemons3_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003121.html","width":130,"caption":"Five Lemons & Vase (31cm x 25cm)","height":101});
															thumbnails[4003122] = clik.newPhoto({"id":4003122,"src":"lemons_lilies_chair_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003122.html","width":130,"caption":"Lemons, Lilies & Chair (27cm x 34cm)","height":176});
															thumbnails[4003123] = clik.newPhoto({"id":4003123,"src":"blv0501a_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003123.html","width":130,"caption":"Perfume, Lemons & Vase (28cm x 38cm)","height":168});
															thumbnails[4003124] = clik.newPhoto({"id":4003124,"src":"eggcup_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003124.html","width":130,"caption":"Eggcup & Fruit","height":164});
															thumbnails[4003125] = clik.newPhoto({"id":4003125,"src":"vl0502a_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003125.html","width":130,"caption":"Two Vases, Two Lemons","height":153});
															thumbnails[4003126] = clik.newPhoto({"id":4003126,"src":"lemons_Lilies_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4003126.html","width":130,"caption":"Lilies, Lemons & Blue Lime","height":76});
															thumbnails[4003128] = clik.newPhoto({"id":4003128,"src":"iron_gateSOLD_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003128.html","width":130,"caption":"The Secret Garden (19cm x 27cm)","height":182});
															thumbnails[4003129] = clik.newPhoto({"id":4003129,"src":"bridge_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003129.html","width":130,"caption":"Dusk (28cm x 16cm)","height":82});
															thumbnails[4003130] = clik.newPhoto({"id":4003130,"src":"bridge0512_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003130.html","width":130,"caption":"Bridge at Dusk (20cm x 16cm)","height":85});
															thumbnails[4003131] = clik.newPhoto({"id":4003131,"src":"gate2a_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003131.html","width":130,"caption":"Spanish Garden (14cm x 21cm)","height":211});
															thumbnails[4003132] = clik.newPhoto({"id":4003132,"src":"tsukishima_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003132.html","width":130,"caption":"The Old Factory, Tokyo (47cm x 33cm)","height":82});
															thumbnails[4003133] = clik.newPhoto({"id":4003133,"src":"kachidoki_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003133.html","width":130,"caption":"Kachidoki Bridge, Tokyo (43cm x 36cm)","height":88});
															thumbnails[4003134] = clik.newPhoto({"id":4003134,"src":"bridge2_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003134.html","width":130,"caption":"Dusk on the River (22cm x 18cm)","height":106});
															thumbnails[4003135] = clik.newPhoto({"id":4003135,"src":"cliff_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003135.html","width":130,"caption":"The Cliff (24cm x 36cm)","height":200});
															thumbnails[4003136] = clik.newPhoto({"id":4003136,"src":"purple_bridge_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003136.html","width":130,"caption":"Tranquil Moment (22cm x 16cm)","height":84});
															thumbnails[4003137] = clik.newPhoto({"id":4003137,"src":"french_bridges1_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4003137.html","width":130,"caption":"French Bridges (17cm x 23cm)","height":180});
															thumbnails[4014722] = clik.newPhoto({"id":4014722,"src":"vase06011_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4014722.html","width":130,"caption":"One Vase Two Lemons (24cm x 31cm)","height":167});
															thumbnails[4014749] = clik.newPhoto({"id":4014749,"src":"button09_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4014749.html","width":130,"caption":"Jenson Button 2009 (29cm x 18cm)","height":80});
															thumbnails[4015178] = clik.newPhoto({"id":4015178,"src":"frentzen_05021_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4015178.html","width":130,"caption":"Frentzen, Williams (31cm x25cm)","height":88});
															thumbnails[4116425] = clik.newPhoto({"id":4116425,"src":"Untitled-blue_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4116425.html","width":130,"caption":"Untitled (29cm x 21cm)","height":85});
															thumbnails[4116437] = clik.newPhoto({"id":4116437,"src":"alonso2009_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4116437.html","width":130,"caption":"Alonso 2005(43cm x 28cm)","height":85});
															thumbnails[4167965] = clik.newPhoto({"id":4167965,"src":"raikkonen07_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4167965.html","width":130,"caption":"Kimi Raikkonen 2007 (45cm x 26cm)","height":74});
															thumbnails[4182536] = clik.newPhoto({"id":4182536,"src":"maltese-harbour_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4182536.html","width":130,"caption":"Maltese Harbour 21cm x27cm","height":172});
															thumbnails[4203237] = clik.newPhoto({"id":4203237,"src":"alonso2005_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4203237.html","width":130,"caption":"Alonso F1 Champion 2005 (31cm x 21cm)","height":77});
															thumbnails[4203266] = clik.newPhoto({"id":4203266,"src":"alonso2006_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_4203266.html","width":130,"caption":"Alonso F1 Champion 2006 (42cm x 27cm)","height":65});
															thumbnails[4216885] = clik.newPhoto({"id":4216885,"src":"mustardtin_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4216885.html","width":130,"caption":"The Mustard Tin (33cm x 27cm)","height":110});
															thumbnails[4316394] = clik.newPhoto({"id":4316394,"src":"muddyfield_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4316394.html","width":130,"caption":"The Muddy Field (24cm x 20cm)","height":162});
															thumbnails[4316395] = clik.newPhoto({"id":4316395,"src":"ornageslemons_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4316395.html","width":130,"caption":"Oranges and Lemons (42cm x 30cm)","height":88});
															thumbnails[4390705] = clik.newPhoto({"id":4390705,"src":"mustardlennon_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4390705.html","width":130,"caption":"Still Life with John Lennon Candle (36cm x 28cm)","height":100});
															thumbnails[4390793] = clik.newPhoto({"id":4390793,"src":"summerfield_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4390793.html","width":130,"caption":"Summer Field (24cm x 26cm)","height":162});
															thumbnails[4390833] = clik.newPhoto({"id":4390833,"src":"chair_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4390833.html","width":130,"caption":"The Chair (15cm x 22cm)","height":184});
															thumbnails[4578112] = clik.newPhoto({"id":4578112,"src":"summer_walk_thumb.jpg","galleries_id":241760,"server_id":15,"link":"photo_4578112.html","width":130,"caption":"Summer Walk (23cm x 17cm)","height":189});
															thumbnails[4578120] = clik.newPhoto({"id":4578120,"src":"tullamorelennon_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4578120.html","width":130,"caption":"Whiskey in the Jar (38cm x 25cm)","height":87});
															thumbnails[4578121] = clik.newPhoto({"id":4578121,"src":"uisge_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4578121.html","width":130,"caption":"Baby Elephant & friends (33cm x 29cm)","height":112});
															thumbnails[4743280] = clik.newPhoto({"id":4743280,"src":"burningman_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4743280.html","width":130,"caption":"Burning Man (31cm x 21cm)","height":186});
															thumbnails[4771870] = clik.newPhoto({"id":4771870,"src":"mustardkiwi2_thumb.jpg","galleries_id":241683,"server_id":15,"link":"photo_4771870.html","width":130,"caption":"The Mustard Tin and Kiwis (30cm x 22cm)","height":95});
															thumbnails[4771973] = clik.newPhoto({"id":4771973,"src":"chateau2sold_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4771973.html","width":130,"caption":"Wine bottles (16cm x 22cm)","height":165});
															thumbnails[4772005] = clik.newPhoto({"id":4772005,"src":"chateaux2_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4772005.html","width":130,"caption":"Bottles (16cm x 22cm)","height":172});
															thumbnails[4772039] = clik.newPhoto({"id":4772039,"src":"greenbottles_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4772039.html","width":130,"caption":"Green Bottles (16cm x 22cm)","height":180});
															thumbnails[4866684] = clik.newPhoto({"id":4866684,"src":"purplebots_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_4866684.html","width":130,"caption":"Bottles in Purple (17cm x 22cm)","height":154});
															thumbnails[5481729] = clik.newPhoto({"id":5481729,"src":"button2010_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_5481729.html","width":130,"caption":"Jenson Button F1 World Champion 2009 (48cm x 27cm)","height":77});
															thumbnails[5513870] = clik.newPhoto({"id":5513870,"src":"red72_thumb.jpg","galleries_id":241682,"server_id":15,"link":"photo_5513870.html","width":130,"caption":"Untitled in Red 20cm x 25cm","height":159});
															thumbnails[7249239] = clik.newPhoto({"id":7249239,"src":"massa09_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_7249239.html","width":130,"caption":"Felipe Massa 2009 (48cm x 27cm)","height":73});
															thumbnails[7280289] = clik.newPhoto({"id":7280289,"src":"alonsoitaly10_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_7280289.html","width":130,"caption":"Alonso Italy (40cm x 33cm)","height":154});
															thumbnails[7280292] = clik.newPhoto({"id":7280292,"src":"schumimonaco_thumb.jpg","galleries_id":241761,"server_id":15,"link":"photo_7280292.html","width":130,"caption":"Schumacher @ Monaco (48cm x 32cm)","height":90});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[241760] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscape","link":"gallery_241760.html","maxRecords":0.0,"photoIDs":[4003128.0,4003129.0,4003130.0,4003131.0,4003132.0,4003133.0,4003134.0,4003135.0,4003136.0,4003137.0,4182536.0,4316394.0,4390793.0,4578112.0],"skipIndex":0,"section_code":"gallery","featured_images":"4578112,4390793,4316394,4182536,4003137,4003136,4003135,4003134,4003133,4003132","id":241760,"singleSection":false});				  						galleries[241761] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Motor Racing","link":"gallery_241761.html","maxRecords":0.0,"photoIDs":[3998335.0,3999613.0,3999616.0,3999623.0,3999628.0,3999649.0,3999664.0,3999667.0,3999677.0,3999694.0,4014749.0,4015178.0,4116437.0,4167965.0,4203237.0,4203266.0,5481729.0,7249239.0,7280289.0,7280292.0],"skipIndex":0,"section_code":"gallery","featured_images":"7280292,7280289,7249239,5481729,4203266,4203237,4167965,4116437,4015178,4014749","id":241761,"singleSection":false});				  						galleries[241682] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"gallery_241682.html","maxRecords":0.0,"photoIDs":[3999552.0,3999566.0,3999575.0,4116425.0,4390833.0,4743280.0,4771973.0,4772005.0,4772039.0,4866684.0,5513870.0],"skipIndex":0,"section_code":"gallery","featured_images":3999552.0,"id":241682,"singleSection":false});				  						galleries[241683] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Still Life","link":"gallery_241683.html","maxRecords":0.0,"photoIDs":[3997971.0,4003105.0,4003114.0,4003116.0,4003117.0,4003118.0,4003121.0,4003122.0,4003123.0,4003124.0,4003125.0,4003126.0,4014722.0,4216885.0,4316395.0,4390705.0,4578120.0,4578121.0,4771870.0],"skipIndex":0,"section_code":"gallery","featured_images":"4771870,4578121,4578120,4390705,4316395,4216885,4014722,4003126,4003125,4003124","id":241683,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3997971';
imageSets[2] = '3999552';
imageSets[3] = '7280292,7280289,7249239,5513870,5481729,4866684,4772039,4772005,4771973,4771870,4743280,4578121,4578120,4578112,4425055,4390833,4390793,4390705,4316395,4316394,4216885,4203266,4203237,4182536,4167965,4116437,4116425,4015178,4014749,4014722,4003137,4003136,4003135,4003134,4003133,4003132,4003131,4003130,4003129,4003128,4003126,4003125,4003124,4003123,4003122,4003121,4003118,4003117,4003116,4003114';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/nickkane/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/nickkane/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/nickkane/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/nickkane/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/nickkane/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/nickkane/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/nickkane/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'NKPaintings: ' + 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>';
	}
				
	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="NICKKANE">';
			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({					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;
	}
}

			

