window.thumbnails = {};
															thumbnails[404808] = clik.newPhoto({"id":404808,"src":"CallaLiles_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_404808.html","width":130,"caption":"Calla Lilies","height":64});
															thumbnails[404817] = clik.newPhoto({"id":404817,"src":"Pavementvendors_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_404817.html","width":130,"caption":"Pavement vendors","height":80});
															thumbnails[404837] = clik.newPhoto({"id":404837,"src":"Thelookout_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_404837.html","width":130,"caption":"Brighton promenade","height":124});
															thumbnails[404840] = clik.newPhoto({"id":404840,"src":"Wintergrazing_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_404840.html","width":130,"caption":"Winter grazing, Richmond Park","height":81});
															thumbnails[418280] = clik.newPhoto({"id":418280,"src":"Mountain's edge_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_418280.html","width":130,"caption":"Mountain's edge","height":195});
															thumbnails[418292] = clik.newPhoto({"id":418292,"src":"Lingmala Falls_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_418292.html","width":130,"caption":"Rainbow","height":86});
															thumbnails[420533] = clik.newPhoto({"id":420533,"src":"Bleeding hearts_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_420533.html","width":130,"caption":"Bleeding hearts","height":124});
															thumbnails[420538] = clik.newPhoto({"id":420538,"src":"BofP_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_420538.html","width":130,"caption":"Bird of Paradise","height":86});
															thumbnails[420539] = clik.newPhoto({"id":420539,"src":"Fishing boat_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_420539.html","width":130,"caption":"Fishing boat","height":154});
															thumbnails[420541] = clik.newPhoto({"id":420541,"src":"Room with a view_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_420541.html","width":130,"caption":"Room with a view","height":81});
															thumbnails[420542] = clik.newPhoto({"id":420542,"src":"Cottage window_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_420542.html","width":130,"caption":"Cottage window","height":181});
															thumbnails[421717] = clik.newPhoto({"id":421717,"src":"Penponds_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_421717.html","width":130,"caption":"Winter sun","height":46});
															thumbnails[421737] = clik.newPhoto({"id":421737,"src":"ManRPark_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_421737.html","width":130,"caption":"Man among oaks","height":74});
															thumbnails[424112] = clik.newPhoto({"id":424112,"src":"Wash day_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_424112.html","width":130,"caption":"Peekaboo!","height":91});
															thumbnails[424117] = clik.newPhoto({"id":424117,"src":"Fisherman_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_424117.html","width":130,"caption":"The Fisherman","height":91});
															thumbnails[424120] = clik.newPhoto({"id":424120,"src":"Stag in mist Rich Park_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_424120.html","width":130,"caption":"Stag at dusk","height":82});
															thumbnails[424121] = clik.newPhoto({"id":424121,"src":"Reflecting palm_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_424121.html","width":130,"caption":"Palm reflections","height":89});
															thumbnails[431527] = clik.newPhoto({"id":431527,"src":"Dawn_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_431527.html","width":130,"caption":"Dawn","height":67});
															thumbnails[431529] = clik.newPhoto({"id":431529,"src":"Sunrise_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_431529.html","width":130,"caption":"Sunrise","height":68});
															thumbnails[431530] = clik.newPhoto({"id":431530,"src":"Parsee Point_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_431530.html","width":130,"caption":"Parsi Point","height":86});
															thumbnails[431531] = clik.newPhoto({"id":431531,"src":"Indian beauty_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_431531.html","width":130,"caption":"Indian beauty","height":236});
															thumbnails[431538] = clik.newPhoto({"id":431538,"src":"Circles_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_431538.html","width":130,"caption":"Circles","height":86});
															thumbnails[431539] = clik.newPhoto({"id":431539,"src":"Circles 2_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_431539.html","width":130,"caption":"Circles 2","height":87});
															thumbnails[431541] = clik.newPhoto({"id":431541,"src":"To infinity and beyond_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_431541.html","width":130,"caption":"To infinity and beyond","height":87});
															thumbnails[437785] = clik.newPhoto({"id":437785,"src":"Post Office_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_437785.html","width":130,"caption":"Window box","height":206});
															thumbnails[437798] = clik.newPhoto({"id":437798,"src":"Yellow poker_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_437798.html","width":130,"caption":"Flower patterns","height":196});
															thumbnails[437807] = clik.newPhoto({"id":437807,"src":"Canna leaf_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_437807.html","width":130,"caption":"Leaf patterns","height":87});
															thumbnails[439203] = clik.newPhoto({"id":439203,"src":"Autumn Afternoon_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_439203.html","width":130,"caption":"Autumn Afternoon","height":56});
															thumbnails[439206] = clik.newPhoto({"id":439206,"src":"Autumn Leaves_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_439206.html","width":130,"caption":"Autumn Leaves","height":86});
															thumbnails[439208] = clik.newPhoto({"id":439208,"src":"Wintergazing 2_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_439208.html","width":130,"caption":"Wintergrazing #2","height":81});
															thumbnails[439215] = clik.newPhoto({"id":439215,"src":"Winter Sun_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_439215.html","width":130,"caption":"Winter Sunset","height":137});
															thumbnails[439216] = clik.newPhoto({"id":439216,"src":"Winter Sunset_thumb.jpg","galleries_id":32499,"server_id":15,"link":"photo_439216.html","width":130,"caption":"Winter Sunset #2","height":86});
															thumbnails[439222] = clik.newPhoto({"id":439222,"src":"Himalayan Poppy_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_439222.html","width":130,"caption":"Himalayan Poppy","height":196});
															thumbnails[439225] = clik.newPhoto({"id":439225,"src":"Jasper_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_439225.html","width":130,"caption":"Jasper","height":86});
															thumbnails[439226] = clik.newPhoto({"id":439226,"src":"Jasper 21_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_439226.html","width":130,"caption":"Jasper #2","height":86});
															thumbnails[440976] = clik.newPhoto({"id":440976,"src":"Tahitian Palm_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_440976.html","width":130,"caption":"Sunlight on Palm","height":148});
															thumbnails[440982] = clik.newPhoto({"id":440982,"src":"Pink Zinnia_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_440982.html","width":130,"caption":"Pretty in pink","height":105});
															thumbnails[441005] = clik.newPhoto({"id":441005,"src":"Cabbage_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_441005.html","width":130,"caption":"Ornamental Kale","height":85});
															thumbnails[441008] = clik.newPhoto({"id":441008,"src":"Floral spray_thumb.jpg","galleries_id":32501,"server_id":15,"link":"photo_441008.html","width":130,"caption":"Floral spray","height":92});
															thumbnails[448496] = clik.newPhoto({"id":448496,"src":"Windmill_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_448496.html","width":130,"caption":"Windmill","height":202});
															thumbnails[7365419] = clik.newPhoto({"id":7365419,"src":"Gold_Koi_21_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_7365419.html","width":130,"caption":"Slow Motion","height":86});
															thumbnails[7365522] = clik.newPhoto({"id":7365522,"src":"Slow_Motion1_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_7365522.html","width":130,"caption":"Slow Motion 2","height":89});
															thumbnails[7400128] = clik.newPhoto({"id":7400128,"src":"Going_home_cp1_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_7400128.html","width":130,"caption":"Going home, Kerala","height":72});
															thumbnails[7400150] = clik.newPhoto({"id":7400150,"src":"sunset_on_foam_cp1234_thumb.jpg","galleries_id":400757,"server_id":15,"link":"photo_7400150.html","width":150,"caption":"Sunset on foam","height":91});
															thumbnails[7400240] = clik.newPhoto({"id":7400240,"src":"Abstract_seascape_cp_thumb.jpg","galleries_id":400757,"server_id":15,"link":"photo_7400240.html","width":150,"caption":"Abstract ","height":44});
															thumbnails[7400244] = clik.newPhoto({"id":7400244,"src":"Ghari_ghora_cp1_thumb.jpg","galleries_id":32502,"server_id":15,"link":"photo_7400244.html","width":150,"caption":"Ghora ghari, Panchgani","height":77});
															thumbnails[7400623] = clik.newPhoto({"id":7400623,"src":"Heads_or_Tails_cp_edited-1_thumb.jpg","galleries_id":400811,"server_id":15,"link":"photo_7400623.html","width":150,"caption":"Heads or Tails?","height":100});
															thumbnails[7400633] = clik.newPhoto({"id":7400633,"src":"Strawberry_Coast_cp12_thumb.jpg","galleries_id":400757,"server_id":15,"link":"photo_7400633.html","width":150,"caption":"Strawberry Coast, Hampshire","height":65});
															thumbnails[7400880] = clik.newPhoto({"id":7400880,"src":"clouds_cp12_thumb.jpg","galleries_id":400757,"server_id":15,"link":"photo_7400880.html","width":150,"caption":"Tropical Gold","height":82});
															thumbnails[7400884] = clik.newPhoto({"id":7400884,"src":"Solitude_cp2_thumb.jpg","galleries_id":400757,"server_id":15,"link":"photo_7400884.html","width":150,"caption":"Solitude","height":238});
															thumbnails[8611590] = clik.newPhoto({"id":8611590,"src":"Antlers_at_dawn_thumb.jpg","galleries_id":32499,"server_id":35,"link":"photo_8611590.html","width":150,"caption":"Antlers at dawn","height":84});
															thumbnails[8611593] = clik.newPhoto({"id":8611593,"src":"Autumn_Mist_thumb.jpg","galleries_id":32499,"server_id":35,"link":"photo_8611593.html","width":150,"caption":"Autumn","height":80});
															thumbnails[8611597] = clik.newPhoto({"id":8611597,"src":"Red_Deer_grazing_thumb.jpg","galleries_id":32499,"server_id":35,"link":"photo_8611597.html","width":150,"caption":"Red Deer grazing","height":77});
															thumbnails[8611598] = clik.newPhoto({"id":8611598,"src":"Deer_at_dusk_thumb.jpg","galleries_id":32499,"server_id":35,"link":"photo_8611598.html","width":150,"caption":"","height":75});
															thumbnails[404797] = clik.newPhoto({"id":404797,"src":"Boatonmillpond_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_404797.html","width":130,"caption":"Mill pond, Pakenham","height":83});
															thumbnails[437793] = clik.newPhoto({"id":437793,"src":"Woodbridge watermill_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_437793.html","width":130,"caption":"Water Mill","height":93});
															thumbnails[406501] = clik.newPhoto({"id":406501,"src":"Brighton3_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406501.html","width":130,"caption":"Three's a crowd","height":85});
															thumbnails[420544] = clik.newPhoto({"id":420544,"src":"Woodbridge_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_420544.html","width":130,"caption":"Splash of colour","height":81});
															thumbnails[406498] = clik.newPhoto({"id":406498,"src":"Brightonflight_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406498.html","width":130,"caption":"Flight","height":102});
															thumbnails[437774] = clik.newPhoto({"id":437774,"src":"Thatched cat_thumb.jpg","galleries_id":32504,"server_id":15,"link":"photo_437774.html","width":130,"caption":"Thatched Cat","height":87});
															thumbnails[406502] = clik.newPhoto({"id":406502,"src":"BrightonCol_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406502.html","width":130,"caption":"West Pier, Brighton","height":64});
															thumbnails[406503] = clik.newPhoto({"id":406503,"src":"BrightonSep_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406503.html","width":130,"caption":"Victorian ruins","height":93});
															thumbnails[406511] = clik.newPhoto({"id":406511,"src":"Lipstick_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406511.html","width":130,"caption":"Lipstick","height":85});
															thumbnails[406512] = clik.newPhoto({"id":406512,"src":"LipstickII_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406512.html","width":130,"caption":"Lipstick II","height":87});
															thumbnails[406517] = clik.newPhoto({"id":406517,"src":"Seaside_thumb.jpg","galleries_id":32505,"server_id":15,"link":"photo_406517.html","width":130,"caption":"At the seaside","height":45});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[32502] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Experience India","link":"gallery_32502.html","maxRecords":0.0,"photoIDs":[404817.0,418280.0,418292.0,420539.0,420541.0,424112.0,424117.0,424121.0,431527.0,431529.0,431530.0,431531.0,7400128.0,7400244.0],"skipIndex":0,"section_code":"gallery","featured_images":"7400244,7400128,431530,431527,424117,418292,404817","id":32502,"singleSection":false});				  						galleries[32501] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flora","link":"gallery_32501.html","maxRecords":0.0,"photoIDs":[404808.0,420533.0,420538.0,437798.0,437807.0,439222.0,440976.0,440982.0,441005.0,441008.0],"skipIndex":0,"section_code":"gallery","featured_images":"420538,420533","id":32501,"singleSection":false});				  						galleries[32505] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Graphics","link":"gallery_32505.html","maxRecords":0.0,"photoIDs":[404837.0,431538.0,431539.0,431541.0,439225.0,439226.0,7365419.0,7365522.0,406501.0,406498.0,406502.0,406503.0,406511.0,406512.0,406517.0],"skipIndex":0,"section_code":"gallery","featured_images":"7365419,404837","id":32505,"singleSection":false});				  						galleries[32499] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Richmond Park","link":"gallery_32499.html","maxRecords":0.0,"photoIDs":[404840.0,421717.0,421737.0,424120.0,439203.0,439206.0,439208.0,439215.0,439216.0,8611590.0,8611593.0,8611597.0,8611598.0],"skipIndex":0,"section_code":"gallery","featured_images":"8611598,8611593,439206,424120,421717,404840","id":32499,"singleSection":false});				  						galleries[400811] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Royal Photographic Society Int Print Exhibition","link":"gallery_400811.html","maxRecords":0.0,"photoIDs":[7400623.0],"skipIndex":0,"section_code":"gallery","featured_images":7400623.0,"id":400811,"singleSection":false});				  						galleries[400757] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes","link":"gallery_400757.html","maxRecords":0.0,"photoIDs":[7400150.0,7400240.0,7400633.0,7400880.0,7400884.0],"skipIndex":0,"section_code":"gallery","featured_images":"7400884,7400880,7400633,7400240,7400150","id":400757,"singleSection":false});				  						galleries[32504] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Suffolk in Summer","link":"gallery_32504.html","maxRecords":0.0,"photoIDs":[420542.0,437785.0,448496.0,404797.0,437793.0,420544.0,437774.0],"skipIndex":0,"section_code":"gallery","featured_images":404797.0,"id":32504,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7400633,7400623,7400244,7400150,7400128,7365419,431527,424120,420538,404840';
imageSets[2] = '8611598,8611593,7400884,7400880,7400633,7400623,7400244,7400240,7400150,7400128,7365419,439206,431530,431527,424120,424117,421717,420538,420533,418292,404840,404837,404817,404797';
imageSets[3] = '8611598,8611597,8611593,8611590,7400884,7400880,7400633,7400623,7400244,7400240,7400150,7400128,7365522,7365419,448496,441008,441005,440982,440976,439226,439225,439222,439216,439215,439208,439206,439203,437807,437798,437793,437785,437774,431541,431539,431538,431531,431530,431529,431527,424121,424120,424117,424112,421737,421717,420544,420542,420541,420539,420538';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/anitajalimages/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/anitajalimages/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 = 'Anita Jal Images LRPS: ' + 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({					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;
	}
}

			

