window.thumbnails = new Object();
												thumbnails[7786857] = new thumbnail(7786857,'','Bat-signal','BATsignal_thumb.jpg',130, 198,15,'#');
												thumbnails[7786858] = new thumbnail(7786858,'','Bat Signal coloured','Bat_signal_colour_thumb.jpg',130, 198,15,'#');
												thumbnails[7786862] = new thumbnail(7786862,'','Bat-signal','BATsignal1_thumb.jpg',130, 198,15,'#');
												thumbnails[983420] = new thumbnail(983420,'73841','Ice - Currently for sale via The Gallery on the Green.','Ice_thumb.jpg',130, 199,15,'photo_983420.html');
												thumbnails[3533984] = new thumbnail(3533984,'73837','Badlad','BADLADs-Charger_thumb.jpg',130, 85,15,'photo_3533984.html');
												thumbnails[3533985] = new thumbnail(3533985,'214482','Elephant','Elephant_thumb.jpg',130, 154,15,'photo_3533985.html');
												thumbnails[3533988] = new thumbnail(3533988,'73840','Four to Doomsday','four-to-Doomsday_thumb.jpg',130, 91,15,'photo_3533988.html');
												thumbnails[3533989] = new thumbnail(3533989,'73841','Lucifer Box','JSS-Lucifer_thumb.jpg',130, 185,15,'photo_3533989.html');
												thumbnails[3533992] = new thumbnail(3533992,'214482','Kitty','Kitty-Ds_thumb.jpg',130, 160,15,'photo_3533992.html');
												thumbnails[3533993] = new thumbnail(3533993,'214482','Kitty Wireframe','low_poly_kitty_wireframe_thumb.jpg',130, 169,15,'photo_3533993.html');
												thumbnails[3533994] = new thumbnail(3533994,'73842','Tardis Interior Concept ','new_tardis_interior_thumb.jpg',130, 74,15,'photo_3533994.html');
												thumbnails[3533996] = new thumbnail(3533996,'73840','Series 4','NEW-SERIES-4-a_thumb.jpg',130, 91,15,'photo_3533996.html');
												thumbnails[3534002] = new thumbnail(3534002,'214481','Book','PAGE_thumb.jpg',130, 178,15,'photo_3534002.html');
												thumbnails[3534006] = new thumbnail(3534006,'73840','SJA','SJA_thumb.jpg',130, 91,15,'photo_3534006.html');
												thumbnails[3534007] = new thumbnail(3534007,'73838','Tank Girl','tankg_thumb.jpg',130, 173,15,'photo_3534007.html');
												thumbnails[3534013] = new thumbnail(3534013,'73838','Tank Girl Sketch','tanky_thumb.jpg',130, 173,15,'photo_3534013.html');
												thumbnails[3534033] = new thumbnail(3534033,'73839','batman','batman_thumb.jpg',130, 197,15,'photo_3534033.html');
												thumbnails[3534034] = new thumbnail(3534034,'73839','dredd','dredd_thumb.jpg',130, 170,15,'photo_3534034.html');
												thumbnails[3534035] = new thumbnail(3534035,'73837','alpha dredd','alpha-dredd_thumb.jpg',130, 169,15,'photo_3534035.html');
												thumbnails[3534037] = new thumbnail(3534037,'73837','mean angel','mean-machine_thumb.jpg',130, 171,15,'photo_3534037.html');
												thumbnails[3775863] = new thumbnail(3775863,'73837','Hammer time','wolf_thumb.jpg',130, 190,15,'photo_3775863.html');
												thumbnails[3775877] = new thumbnail(3775877,'73837','Dredd head tread','tread_thumb.jpg',130, 194,15,'photo_3775877.html');
												thumbnails[3775890] = new thumbnail(3775890,'73839','Stronty shoot-out','shootout_thumb.jpg',130, 189,15,'photo_3775890.html');
												thumbnails[3775894] = new thumbnail(3775894,'73837','from the shadows','shadow_thumb.jpg',130, 191,15,'photo_3775894.html');
												thumbnails[3775909] = new thumbnail(3775909,'73839','Rassilon','rassilon_thumb.jpg',130, 189,15,'photo_3775909.html');
												thumbnails[3775913] = new thumbnail(3775913,'73839','part inked','part-inked_thumb.jpg',130, 179,15,'photo_3775913.html');
												thumbnails[3775921] = new thumbnail(3775921,'73837','Judge Death','judge-death_thumb.jpg',130, 186,15,'photo_3775921.html');
												thumbnails[3775925] = new thumbnail(3775925,'73842','Animated Strontium Dog Character','Johnny_Alpha_animated_thumb.jpg',130, 231,15,'photo_3775925.html');
												thumbnails[3775928] = new thumbnail(3775928,'73841','Jagged','Jagged_Alliance_thumb.jpg',130, 117,15,'photo_3775928.html');
												thumbnails[3775932] = new thumbnail(3775932,'73840','Image of Fendahl','Image-of-the-Fendahl_thumb.jpg',130, 91,15,'photo_3775932.html');
												thumbnails[3775945] = new thumbnail(3775945,'73838','Female Robin','female-robin_thumb.jpg',130, 179,15,'photo_3775945.html');
												thumbnails[3927188] = new thumbnail(3927188,'73837','Jack Staff','jack_staff_thumb.jpg',130, 201,15,'photo_3927188.html');
												thumbnails[3927193] = new thumbnail(3927193,'73838','2000AD cover rough','Rough_stronty_cover_thumb.jpg',130, 174,15,'photo_3927193.html');
												thumbnails[3927196] = new thumbnail(3927196,'73842','Ice Warrior','ice_warrior_thumb.jpg',130, 174,15,'photo_3927196.html');
												thumbnails[4365405] = new thumbnail(4365405,'214481','Pity the gelth','Pity_the_gelth_thumb.jpg',130, 178,15,'photo_4365405.html');
												thumbnails[4365464] = new thumbnail(4365464,'214481','Haunted','haunted_thumb.jpg',130, 178,15,'photo_4365464.html');
												thumbnails[4365465] = new thumbnail(4365465,'214481','Hot eye','hot_eyes_thumb.jpg',130, 178,15,'photo_4365465.html');
												thumbnails[4365467] = new thumbnail(4365467,'214481','Join us','join_us_thumb.jpg',130, 178,15,'photo_4365467.html');
												thumbnails[4365468] = new thumbnail(4365468,'214481','skulls','skulls_thumb.jpg',130, 178,15,'photo_4365468.html');
												thumbnails[5094277] = new thumbnail(5094277,'73841','First CD of the new Tom Baker audio plays','1_Stuff-of-nightmares1_thumb.jpg',130, 130,15,'photo_5094277.html');
												thumbnails[5094289] = new thumbnail(5094289,'73841','Dead shoes (second CD)','2_deadshoes_thumb.jpg',130, 130,15,'photo_5094289.html');
												thumbnails[5094292] = new thumbnail(5094292,'73841','Cicus of Doom (third CD)','3_Circus-of-Doom_thumb.jpg',130, 130,15,'photo_5094292.html');
												thumbnails[5094297] = new thumbnail(5094297,'73841','Sting in the Tale (4th CD)','4_A_Sting_In_The_Tail1_thumb.jpg',130, 130,15,'photo_5094297.html');
												thumbnails[5094298] = new thumbnail(5094298,'73841','Hive of Horror (5th CD)','5_Hive_of_Horror_thumb.jpg',130, 130,15,'photo_5094298.html');
												thumbnails[5094303] = new thumbnail(5094303,'73841','Latest Adam F CD cover','Adam-F_thumb.jpg',130, 130,15,'photo_5094303.html');
												thumbnails[5094305] = new thumbnail(5094305,'73839','Alpha fire','Alpha-fire_thumb.jpg',130, 170,15,'photo_5094305.html');
												thumbnails[5094310] = new thumbnail(5094310,'73839','Spidey','spidey-lighter-bg_thumb.jpg',130, 184,15,'photo_5094310.html');
												thumbnails[5094311] = new thumbnail(5094311,'73841','The Trudy\'s latest album Cover','the-Trudy-cover_thumb.jpg',130, 129,15,'photo_5094311.html');
												thumbnails[5094312] = new thumbnail(5094312,'73841','Comission for Johnathan Ross','rossy_thumb.jpg',130, 130,15,'photo_5094312.html');
												thumbnails[5094313] = new thumbnail(5094313,'214481','Torchwood: Stakes on a Plane','Stakes-on-a-plane-torchwoo_thumb.jpg',130, 92,15,'photo_5094313.html');
												thumbnails[5094316] = new thumbnail(5094316,'73842','New Dalek design','NEW-DALEK-design_thumb.jpg',130, 143,15,'photo_5094316.html');
												thumbnails[5094320] = new thumbnail(5094320,'73842','New Dalek design scale','NEW-DALEK-scale_thumb.jpg',130, 79,15,'photo_5094320.html');
												thumbnails[5118717] = new thumbnail(5118717,'73838','Hulk rough colour','hulk-rough-colour_thumb.jpg',130, 78,15,'photo_5118717.html');
												thumbnails[5123344] = new thumbnail(5123344,'73838','The Punisher','punisher_thumb.jpg',130, 194,15,'photo_5123344.html');
												thumbnails[5165751] = new thumbnail(5165751,'73838','Iron fist redesign- Rough colour','Iron-Fist_thumb.jpg',130, 178,15,'photo_5165751.html');
												thumbnails[5166390] = new thumbnail(5166390,'73838','Another Iron Fist composition','Iron-Fist-2_thumb.jpg',130, 133,15,'photo_5166390.html');
												thumbnails[5356067] = new thumbnail(5356067,'73837','SKaro\'s Finest','IDW-WHO-COVER_thumb.jpg',130, 203,15,'photo_5356067.html');
												thumbnails[5356073] = new thumbnail(5356073,'73839','THOR NY','Thor_thumb.jpg',130, 197,15,'photo_5356073.html');
												thumbnails[5356076] = new thumbnail(5356076,'73839','Ock and Spidey rough','spidey-page_thumb.jpg',130, 201,15,'photo_5356076.html');
												thumbnails[7786837] = new thumbnail(7786837,'73839','Western','2000ad_1678_thumb.jpg',130, 170,15,'photo_7786837.html');
												thumbnails[7786851] = new thumbnail(7786851,'73839','Rain','2000ad_1681_thumb.jpg',130, 170,15,'photo_7786851.html');
												thumbnails[7786852] = new thumbnail(7786852,'73839','Alpha skull','2000ad_1689_thumb.jpg',130, 172,15,'photo_7786852.html');
												thumbnails[7786853] = new thumbnail(7786853,'73839','2000ad crew','2000ad_poster_thumb.jpg',130, 85,15,'photo_7786853.html');
												thumbnails[7786855] = new thumbnail(7786855,'73839','Apathy','Apathy_thumb.jpg',130, 170,15,'photo_7786855.html');
												thumbnails[7786860] = new thumbnail(7786860,'73839','council of five','Council_of_five_thumb.jpg',130, 170,15,'photo_7786860.html');
												thumbnails[7786864] = new thumbnail(7786864,'73839','Bat-signal coloured','Bat_signal_colour1_thumb.jpg',130, 198,15,'photo_7786864.html');
												thumbnails[7786866] = new thumbnail(7786866,'73839','Bat-Signal','BATsignal2_thumb.jpg',130, 198,15,'photo_7786866.html');
												thumbnails[7786867] = new thumbnail(7786867,'73839','Damnation Revist','DM_revist_thumb.jpg',130, 170,15,'photo_7786867.html');
												thumbnails[7786891] = new thumbnail(7786891,'73839','Megacity riot','Dredd_riot_thumb.jpg',130, 170,15,'photo_7786891.html');
												thumbnails[7786895] = new thumbnail(7786895,'73838','Fury','Fury_thumb.jpg',130, 166,15,'photo_7786895.html');
												thumbnails[7786897] = new thumbnail(7786897,'73838','Hulk','hulk_thumb.jpg',130, 112,15,'photo_7786897.html');
												thumbnails[7786898] = new thumbnail(7786898,'73838','mean Machine','Mean_angel_copy_thumb.jpg',130, 174,15,'photo_7786898.html');
												thumbnails[7786900] = new thumbnail(7786900,'73838','mean too','MMANGEL_copy_thumb.jpg',130, 183,15,'photo_7786900.html');
												thumbnails[7786902] = new thumbnail(7786902,'73839','Night stick','Megazine_299_thumb.jpg',130, 171,15,'photo_7786902.html');
												thumbnails[7786903] = new thumbnail(7786903,'73838','Moon Knight','Moon_knight_thumb.jpg',130, 178,15,'photo_7786903.html');
												thumbnails[7786906] = new thumbnail(7786906,'73838','Punisher guns','punisher_guns_thumb.jpg',130, 185,15,'photo_7786906.html');
												thumbnails[7786908] = new thumbnail(7786908,'73838','Tank cover','Tank_cover_thumb.jpg',130, 179,15,'photo_7786908.html');
												thumbnails[7786909] = new thumbnail(7786909,'73838','Booga etal','tank_thumb.jpg',130, 187,15,'photo_7786909.html');
												thumbnails[7786910] = new thumbnail(7786910,'73839','Wolvie 1','Wolvie1_thumb.jpg',130, 184,15,'photo_7786910.html');
												thumbnails[7786912] = new thumbnail(7786912,'73839','Wolvie 2','Wolvie2_thumb.jpg',130, 184,15,'photo_7786912.html');
												thumbnails[7786931] = new thumbnail(7786931,'73839','Lawmaster','lawmaster_thumb.jpg',130, 172,15,'photo_7786931.html');
												thumbnails[7786953] = new thumbnail(7786953,'73838','Capt America','capt_America_thumb.jpg',130, 158,15,'photo_7786953.html');
												thumbnails[7787032] = new thumbnail(7787032,'73839','Resyk death','Dredd_resyk_death1_thumb.jpg',130, 171,15,'photo_7787032.html');
												thumbnails[7787040] = new thumbnail(7787040,'73839','Damnation Station','DMpage56_thumb.jpg',130, 171,15,'photo_7787040.html');
												thumbnails[7787043] = new thumbnail(7787043,'73839','Dredd Interview','Dredd_interview1_thumb.jpg',130, 171,15,'photo_7787043.html');
												thumbnails[7787049] = new thumbnail(7787049,'73839','Sniper','Dredd_sniper1_thumb.jpg',130, 171,15,'photo_7787049.html');
												thumbnails[7787165] = new thumbnail(7787165,'73838','Anderson and Death','Anderson_death_thumb.jpg',130, 186,15,'photo_7787165.html');
												thumbnails[7787173] = new thumbnail(7787173,'73838','Hershey','Hershey_sketch_thumb.jpg',130, 185,15,'photo_7787173.html');
												thumbnails[7787176] = new thumbnail(7787176,'73840','The Rani','Time_Rani_layers_thumb.jpg',130, 91,15,'photo_7787176.html');
												thumbnails[7787178] = new thumbnail(7787178,'73840','Mutants','Mutants_layers_thumb.jpg',130, 91,15,'photo_7787178.html');
												thumbnails[7787179] = new thumbnail(7787179,'73840','Revist','Revist_boxset_layers_thumb.jpg',130, 91,15,'photo_7787179.html');
												thumbnails[7787184] = new thumbnail(7787184,'73840','Matt Smith','Series_5_boxset_rough_thumb.jpg',130, 91,15,'photo_7787184.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[214481] = new gallery(214481,'5094313,4365468,4365467,4365465,4365464,4365405,3534002','Books and Graphic Novels','gallery',[3534002,4365405,4365464,4365465,4365467,4365468,5094313],0, 0, '', 'gallery_214481.html',0,0);
				  					galleries[214482] = new gallery(214482,'3533992','CGI','gallery',[3533985,3533992,3533993],0, 0, '', 'gallery_214482.html',0,0);
				  					galleries[73839] = new gallery(73839,'3534033','Comics','gallery',[3534033,3534034,3775890,3775909,3775913,5094305,5094310,5356073,5356076,7786837,7786851,7786852,7786853,7786855,7786860,7786864,7786866,7786867,7786891,7786902,7786910,7786912,7786931,7787032,7787040,7787043,7787049],0, 0, '', 'gallery_73839.html',0,0);
				  					galleries[73842] = new gallery(73842,'3533994','Concept Art','gallery',[3533994,3775925,3927196,5094316,5094320],0, 0, '', 'gallery_73842.html',0,0);
				  					galleries[73840] = new gallery(73840,'7787184,7787179,7787178,7787176,3775932,3534006,3533996,3533988','Doctor Who ','gallery',[3533988,3533996,3534006,3775932,7787176,7787178,7787179,7787184],0, 0, '', 'gallery_73840.html',0,0);
				  					galleries[73841] = new gallery(73841,'5094312,5094311,5094303,5094298,5094297,5094292,5094289,5094277,3775928,3533989','Misc Commissions','gallery',[983420,3533989,3775928,5094277,5094289,5094292,5094297,5094298,5094303,5094311,5094312],0, 0, '', 'gallery_73841.html',0,0);
				  					galleries[73838] = new gallery(73838,'7787173,7787165,7786953,7786909,7786908,7786906,7786903,7786900,7786898,7786897','Sketch Book','gallery',[3534007,3534013,3775945,3927193,5118717,5123344,5165751,5166390,7786895,7786897,7786898,7786900,7786903,7786906,7786908,7786909,7786953,7787165,7787173],0, 0, '', 'gallery_73838.html',0,0);
				  					galleries[73837] = new gallery(73837,'5356067,3927188,3775921,3775894,3775877,3775863,3534037,3534035,3533984','Posters','gallery',[3533984,3534035,3534037,3775863,3775877,3775894,3775921,3927188,5356067],0, 0, '', 'gallery_73837.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7787184,7787179,7787178,7787176,7787173,7787165,7787049,7787043,7787040,7787032,7786953,7786931,7786912,7786910,7786909,7786908,7786906,7786903,7786902,7786900,7786898,7786897,7786895,7786891,7786867,7786866,7786864,7786862,7786860,7786858,7786857,7786855,7786853,7786852,7786851,7786837,5356076,5356073,5356067,5166390,5165751,5123344,5118717,5094320,5094316,5094313,5094312,5094311,5094310,5094305';
imageSets[2] = '3534033,3533994,3533992';
imageSets[3] = '7787184,7787179,7787178,7787176,7787173,7787165,7787049,7787043,7787040,7787032,7786953,7786931,7786912,7786910,7786909,7786908,7786906,7786903,7786902,7786900,7786898,7786897,7786895,7786891,7786867,7786866,7786864,7786862,7786860,7786858,7786857,7786855,7786853,7786852,7786851,7786837,5356076,5356073,5356067,5166390,5165751,5123344,5118717,5094320,5094316,5094313,5094312,5094311,5094310,5094305';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Willsher/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Willsher/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Willsher/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Willsher/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Willsher/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Willsher/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Ben Willsher Graphics and Imaging: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Title </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Artist </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

