window.thumbnails = {};
															thumbnails[874672] = clik.newPhoto({"id":874672,"src":"wedding image 3_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[874696] = clik.newPhoto({"id":874696,"src":"main home page 2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":96});
															thumbnails[874726] = clik.newPhoto({"id":874726,"src":"wedding image 11_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":169});
															thumbnails[875127] = clik.newPhoto({"id":875127,"src":"wedding image 151_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":169});
															thumbnails[1356296] = clik.newPhoto({"id":1356296,"src":"2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":78});
															thumbnails[1356325] = clik.newPhoto({"id":1356325,"src":"3 v2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":78});
															thumbnails[1532652] = clik.newPhoto({"id":1532652,"src":"jerrie_paul_090 v2 7002_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":185});
															thumbnails[1533090] = clik.newPhoto({"id":1533090,"src":"andrea_david144 _thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1533129] = clik.newPhoto({"id":1533129,"src":"mell_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":175});
															thumbnails[1883792] = clik.newPhoto({"id":1883792,"src":"FASHION PHOTOSHOOT card copy_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":91});
															thumbnails[2821880] = clik.newPhoto({"id":2821880,"src":"main home page 1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":96});
															thumbnails[2821958] = clik.newPhoto({"id":2821958,"src":"main home page 5_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":96});
															thumbnails[2822794] = clik.newPhoto({"id":2822794,"src":"main image 1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2822805] = clik.newPhoto({"id":2822805,"src":"running kids _thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2822822] = clik.newPhoto({"id":2822822,"src":"main dan-and-boys _thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2822841] = clik.newPhoto({"id":2822841,"src":"wedding image 1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2822844] = clik.newPhoto({"id":2822844,"src":"wedding image 7_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2822868] = clik.newPhoto({"id":2822868,"src":"jerrie_paul_138 in a spin_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2823441] = clik.newPhoto({"id":2823441,"src":"jerrie_paul_028 main 1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2823465] = clik.newPhoto({"id":2823465,"src":"louise-image-1-main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2823466] = clik.newPhoto({"id":2823466,"src":"louise-image-2-main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2823484] = clik.newPhoto({"id":2823484,"src":"zoe_james023 main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2823580] = clik.newPhoto({"id":2823580,"src":"rachel_drew277 main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[2870118] = clik.newPhoto({"id":2870118,"src":"main home page 6_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":95});
															thumbnails[3400980] = clik.newPhoto({"id":3400980,"src":"main home page tenplate 2_ 22_09_2009 copy1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3400987] = clik.newPhoto({"id":3400987,"src":"image-3-main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3400991] = clik.newPhoto({"id":3400991,"src":"main-home-page-tenplate-1_-22_09_2009_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":96});
															thumbnails[4258446] = clik.newPhoto({"id":4258446,"src":"running-kids_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":101});
															thumbnails[4258459] = clik.newPhoto({"id":4258459,"src":"running-kids1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":101});
															thumbnails[4814158] = clik.newPhoto({"id":4814158,"src":"main-boards-front-black1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5385293] = clik.newPhoto({"id":5385293,"src":"0012_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5392029] = clik.newPhoto({"id":5392029,"src":"001_1424_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Commercial Shoot","height":130});
															thumbnails[5392141] = clik.newPhoto({"id":5392141,"src":"001_1428_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Commercial Shoot","height":130});
															thumbnails[5392144] = clik.newPhoto({"id":5392144,"src":"001_1432_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Commercial Shoot","height":130});
															thumbnails[5560268] = clik.newPhoto({"id":5560268,"src":"PSmith_100210_1073-retochimage-2-6_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Fashion & Beauty Shoot","height":130});
															thumbnails[5560288] = clik.newPhoto({"id":5560288,"src":"PSmith_100210_1117-retochimage-7_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Fashion & Beauty Shoot","height":130});
															thumbnails[5560308] = clik.newPhoto({"id":5560308,"src":"PSmith_100216_6187-4_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Fashion & Beauty Shoot","height":130});
															thumbnails[5560360] = clik.newPhoto({"id":5560360,"src":"PSmith_100216_6246-5_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Fashion & Beauty Shoot","height":130});
															thumbnails[5560391] = clik.newPhoto({"id":5560391,"src":"PSmith_100216_6131-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Fashion & Beauty Shoot","height":130});
															thumbnails[5560642] = clik.newPhoto({"id":5560642,"src":"PSmith_090422_4554-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":130});
															thumbnails[5560653] = clik.newPhoto({"id":5560653,"src":"PSmith_090714_2-38-retochimage-retochimage-retochimage-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":125});
															thumbnails[5560659] = clik.newPhoto({"id":5560659,"src":"PSmith_090716_0204-retochimage-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":130});
															thumbnails[5560663] = clik.newPhoto({"id":5560663,"src":"PSmith_090805_0332-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":130});
															thumbnails[5560710] = clik.newPhoto({"id":5560710,"src":"PSmith_091030_5590-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":130});
															thumbnails[5560717] = clik.newPhoto({"id":5560717,"src":"PSmith_091115_0477-retochimage-retochimage-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoot","height":130});
															thumbnails[5561195] = clik.newPhoto({"id":5561195,"src":"PSmith_091115_0504-retochimage-1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Family Matters Photoshoots","height":130});
															thumbnails[5598490] = clik.newPhoto({"id":5598490,"src":"zoe_james203-10_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5598497] = clik.newPhoto({"id":5598497,"src":"zoe_james048_v1-2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5598500] = clik.newPhoto({"id":5598500,"src":"zoe_james124-8_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3400984] = clik.newPhoto({"id":3400984,"src":"image-2-main_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[874707] = clik.newPhoto({"id":874707,"src":"wedding image 6_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":169});
															thumbnails[874727] = clik.newPhoto({"id":874727,"src":"main image 2 _thumb.jpg","galleries_id":123039,"server_id":1,"link":"photo_874727.html","width":130,"caption":"Click On My IMAGE","height":170});
															thumbnails[79498] = clik.newPhoto({"id":79498,"src":"hevnely-medows-1_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_79498.html","width":130,"caption":"\"Heavenly Meadows\"","height":130});
															thumbnails[80092] = clik.newPhoto({"id":80092,"src":"lake-reflaction_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_80092.html","width":130,"caption":"\"Lake Reflection\"","height":107});
															thumbnails[80094] = clik.newPhoto({"id":80094,"src":"nwe-ten-plate1_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_80094.html","width":130,"caption":"\"Meet me at the Bridge\" ","height":130});
															thumbnails[80110] = clik.newPhoto({"id":80110,"src":"tumble-wood_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_80110.html","width":130,"caption":"\"Tumble Wood\"","height":130});
															thumbnails[80111] = clik.newPhoto({"id":80111,"src":"the-ride_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_80111.html","width":130,"caption":"\"The Ride\"","height":130});
															thumbnails[80112] = clik.newPhoto({"id":80112,"src":"dancing-tree_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_80112.html","width":130,"caption":"\"Dancing Tree\"","height":130});
															thumbnails[80125] = clik.newPhoto({"id":80125,"src":"brock-down-truck_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_80125.html","width":130,"caption":"\"Abandoned Truck\"","height":130});
															thumbnails[80128] = clik.newPhoto({"id":80128,"src":"water-stone_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_80128.html","width":130,"caption":"\"Water Stone\"","height":130});
															thumbnails[80130] = clik.newPhoto({"id":80130,"src":"rolling-waves_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_80130.html","width":130,"caption":"\"Rolling Waves\"","height":85});
															thumbnails[80133] = clik.newPhoto({"id":80133,"src":"splash_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_80133.html","width":130,"caption":"\"Splash\"","height":130});
															thumbnails[725828] = clik.newPhoto({"id":725828,"src":"image 4 17x17 copy copy_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_725828.html","width":130,"caption":"","height":134});
															thumbnails[725829] = clik.newPhoto({"id":725829,"src":"image 5 17x17 copy copy_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_725829.html","width":130,"caption":"","height":134});
															thumbnails[725830] = clik.newPhoto({"id":725830,"src":"image 6 17x17 copy copy_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_725830.html","width":130,"caption":"","height":134});
															thumbnails[876045] = clik.newPhoto({"id":876045,"src":"infra red hut tone_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_876045.html","width":130,"caption":"","height":69});
															thumbnails[1533326] = clik.newPhoto({"id":1533326,"src":"browm landscape tone1_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_1533326.html","width":130,"caption":"","height":87});
															thumbnails[1830224] = clik.newPhoto({"id":1830224,"src":"mono crome image_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_1830224.html","width":130,"caption":"","height":130});
															thumbnails[1830243] = clik.newPhoto({"id":1830243,"src":"porto zoro image_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_1830243.html","width":130,"caption":"","height":130});
															thumbnails[1830296] = clik.newPhoto({"id":1830296,"src":"infrared image for web_thumb.jpg","galleries_id":7552,"server_id":1,"link":"photo_1830296.html","width":130,"caption":"","height":130});
															thumbnails[2821882] = clik.newPhoto({"id":2821882,"src":"main home page 3_thumb.jpg","galleries_id":7553,"server_id":1,"link":"photo_2821882.html","width":130,"caption":"","height":96});
															thumbnails[2821883] = clik.newPhoto({"id":2821883,"src":"main home page 4_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_2821883.html","width":130,"caption":"","height":96});
															thumbnails[5393479] = clik.newPhoto({"id":5393479,"src":"001-4_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5393479.html","width":130,"caption":"Copper Sea <br>\r\n","height":130});
															thumbnails[5393550] = clik.newPhoto({"id":5393550,"src":"001-5_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5393550.html","width":130,"caption":"Velvet Sunrise","height":130});
															thumbnails[5598516] = clik.newPhoto({"id":5598516,"src":"misty_mountians_30x155-1_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598516.html","width":130,"caption":"Misty Rocks","height":130});
															thumbnails[5598525] = clik.newPhoto({"id":5598525,"src":"rocks_1_with_sharp-2_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598525.html","width":130,"caption":"Rocks","height":130});
															thumbnails[5598536] = clik.newPhoto({"id":5598536,"src":"water_colours-1_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598536.html","width":130,"caption":"Water Colours","height":130});
															thumbnails[5598546] = clik.newPhoto({"id":5598546,"src":"water_tress-1_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598546.html","width":130,"caption":"Hope Island","height":130});
															thumbnails[5598903] = clik.newPhoto({"id":5598903,"src":"big_bear_lake-1_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598903.html","width":130,"caption":"Big Bear Lake","height":130});
															thumbnails[5598929] = clik.newPhoto({"id":5598929,"src":"pierring_48x38cm-1_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598929.html","width":130,"caption":"Pierring","height":130});
															thumbnails[5598934] = clik.newPhoto({"id":5598934,"src":"setting-1-2_thumb.jpg","galleries_id":7551,"server_id":1,"link":"photo_5598934.html","width":130,"caption":"Setting","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[123039] = clik.newGallery({"parentGallery":"","usePopups":false,"title":" Paul smith Photographer","link":"section160887.html","maxRecords":0.0,"photoIDs":[874727.0],"skipIndex":0,"section_code":"section160887","featured_images":874727.0,"id":123039,"singleSection":true});				  						galleries[7551] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"COLOUR  IMAGES ","link":"gallery_7551.html","maxRecords":0.0,"photoIDs":[80130.0,80133.0,1830243.0,2821883.0,5393479.0,5393550.0,5598516.0,5598525.0,5598536.0,5598546.0,5598903.0,5598929.0,5598934.0],"skipIndex":0,"section_code":"gallery","featured_images":"5393550,1830243","id":7551,"singleSection":false});				  						galleries[7553] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"MONOCHROME IMAGES","link":"gallery_7553.html","maxRecords":0.0,"photoIDs":[80111.0,80125.0,80128.0,725828.0,725829.0,725830.0,1533326.0,1830224.0,2821882.0],"skipIndex":0,"section_code":"gallery","featured_images":1830224.0,"id":7553,"singleSection":false});				  						galleries[7552] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"INFRARED IMAGES","link":"gallery_7552.html","maxRecords":0.0,"photoIDs":[79498.0,80092.0,80094.0,80110.0,80112.0,876045.0,1830296.0],"skipIndex":0,"section_code":"gallery","featured_images":1830296.0,"id":7552,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5385293,4814158,2870118,2823580,2823466,2821958,2821883,2821882';
imageSets[2] = '5393550,5385293,3400980,2823465,2822794,1830296,1830243,1830224';
imageSets[3] = '5598934,5598929,5598903,5598546,5598536,5598525,5598516,5598500,5598497,5598490,5561195,5560717,5560710,5560663,5560659,5560653,5560642,5560391,5560360,5560308,5560288,5560268,5393550,5393479,5392144,5392141,5392029,5385293,4814158,4258459,4258446,3400991,3400987,3400984,3400980,2870118,2823580,2823484,2823466,2823465,2823441,2822868,2822844,2822841,2822822,2822805,2822794,2821958,2821883,2821882';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/paulsmith/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/paulsmith/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 += 'section160887.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 && 'section160887' != '') {
					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 = ' Paul Smith Fine Art and Wedding 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>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="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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="paulsmith.photography@ntlworld.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="paulsmith.photography@ntlworld.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

