window.thumbnails = new Object();
												thumbnails[5014004] = new thumbnail(5014004,'','','3141492450_fa47ef79ec1_thumb.jpg',130, 86,5,'#');
												thumbnails[5014006] = new thumbnail(5014006,'','','hi-2_thumb.jpg',130, 17,5,'#');
												thumbnails[5083134] = new thumbnail(5083134,'','','leaf-star-1-sm_thumb.jpg',130, 128,5,'#');
												thumbnails[5083135] = new thumbnail(5083135,'','','leaf-star-sm-2_thumb.jpg',130, 128,5,'#');
												thumbnails[5083136] = new thumbnail(5083136,'','','leaf-star-sm-3_thumb.jpg',130, 128,5,'#');
												thumbnails[5083137] = new thumbnail(5083137,'','','leaf-star-sm-4_thumb.jpg',130, 128,5,'#');
												thumbnails[5083142] = new thumbnail(5083142,'','','leaf-star-sm-5_thumb.jpg',130, 128,5,'#');
												thumbnails[5083148] = new thumbnail(5083148,'','','Lets-make-a-leaf-star1_thumb.jpg',130, 22,5,'#');
												thumbnails[5084423] = new thumbnail(5084423,'','','20090918-_MG_9154-1-2_thumb.jpg',130, 124,5,'#');
												thumbnails[5084427] = new thumbnail(5084427,'','','20090918-_MG_9179-2-2_thumb.jpg',130, 134,5,'#');
												thumbnails[5084507] = new thumbnail(5084507,'','','Lets-pretend-we-are-ducks1_thumb.jpg',130, 16,5,'#');
												thumbnails[5084513] = new thumbnail(5084513,'','','20091108-_MG_9387-2_thumb.jpg',130, 89,5,'#');
												thumbnails[5084517] = new thumbnail(5084517,'','','20091108-_MG_9384-1-4_thumb.jpg',130, 195,5,'#');
												thumbnails[5101445] = new thumbnail(5101445,'','','Lets-make-a-leaf-stack_thumb.jpg',130, 22,5,'#');
												thumbnails[5101446] = new thumbnail(5101446,'','','lets-make-flowers_thumb.jpg',130, 22,5,'#');
												thumbnails[5101450] = new thumbnail(5101450,'','','Lets-make-insects_thumb.jpg',130, 22,5,'#');
												thumbnails[5101451] = new thumbnail(5101451,'','','Lets-write-our-names_thumb.jpg',130, 17,5,'#');
												thumbnails[5101456] = new thumbnail(5101456,'','','Lets-make-circles_thumb.jpg',130, 22,5,'#');
												thumbnails[5101458] = new thumbnail(5101458,'','','Lets-make-faces_thumb.jpg',130, 22,5,'#');
												thumbnails[5101460] = new thumbnail(5101460,'','','Lets-collect-coloured-pebb_thumb.jpg',130, 17,5,'#');
												thumbnails[5101463] = new thumbnail(5101463,'','','Lets-collect-coloured-leav_thumb.jpg',130, 17,5,'#');
												thumbnails[5101465] = new thumbnail(5101465,'','','Lets-learn-about-trees1_thumb.jpg',130, 17,5,'#');
												thumbnails[5101468] = new thumbnail(5101468,'','','Lets-look-at-flowers_thumb.jpg',130, 17,5,'#');
												thumbnails[5101487] = new thumbnail(5101487,'','','Lets-make-sea-creatures1_thumb.jpg',130, 16,5,'#');
												thumbnails[5101493] = new thumbnail(5101493,'','','Lets-make-pebble-footprints1_thumb.jpg',130, 16,5,'#');
												thumbnails[5101499] = new thumbnail(5101499,'','','Lets-make-floating-boats_thumb.jpg',130, 17,5,'#');
												thumbnails[5105849] = new thumbnail(5105849,'','','Lets-make-a-wheel1_thumb.jpg',130, 16,5,'#');
												thumbnails[5105851] = new thumbnail(5105851,'','','Lets-make-a-crocodile1_thumb.jpg',130, 16,5,'#');
												thumbnails[5105852] = new thumbnail(5105852,'','','Lets-make-dinosaur-footpri1_thumb.jpg',130, 16,5,'#');
												thumbnails[5105932] = new thumbnail(5105932,'','','20091115-_MG_0112-3_thumb.jpg',130, 87,5,'#');
												thumbnails[5105933] = new thumbnail(5105933,'','','20091115-_MG_0121-4_thumb.jpg',130, 87,5,'#');
												thumbnails[5105935] = new thumbnail(5105935,'','','20091115-_MG_0131-5_thumb.jpg',130, 87,5,'#');
												thumbnails[5105936] = new thumbnail(5105936,'','','20091115-_MG_0140-6_thumb.jpg',130, 117,5,'#');
												thumbnails[5105937] = new thumbnail(5105937,'','','20091115-_MG_0143-7_thumb.jpg',130, 87,5,'#');
												thumbnails[5105939] = new thumbnail(5105939,'','','20091115-_MG_0160-10_thumb.jpg',130, 90,5,'#');
												thumbnails[5105941] = new thumbnail(5105941,'','','20091115-_MG_0171-12_thumb.jpg',130, 87,5,'#');
												thumbnails[5105942] = new thumbnail(5105942,'','','20091115-_MG_0189-13_thumb.jpg',130, 122,5,'#');
												thumbnails[5105943] = new thumbnail(5105943,'','','20091115-_MG_0200-15_thumb.jpg',130, 195,5,'#');
												thumbnails[5105944] = new thumbnail(5105944,'','','20091115-_MG_0208-16_thumb.jpg',130, 195,5,'#');
												thumbnails[5105946] = new thumbnail(5105946,'','','20091115-_MG_0225-18_thumb.jpg',130, 195,5,'#');
												thumbnails[5105948] = new thumbnail(5105948,'','','3980052723_c1c761958d_m_thumb.jpg',130, 215,5,'#');
												thumbnails[5105949] = new thumbnail(5105949,'','','20091115-_MG_0276-19_thumb.jpg',130, 87,5,'#');
												thumbnails[5105950] = new thumbnail(5105950,'','','20091115-_MG_0280-20_thumb.jpg',130, 87,5,'#');
												thumbnails[5105951] = new thumbnail(5105951,'','','20091115-_MG_0286-21_thumb.jpg',130, 89,5,'#');
												thumbnails[5105952] = new thumbnail(5105952,'','','20091115-_MG_0296-22_thumb.jpg',130, 244,5,'#');
												thumbnails[5105953] = new thumbnail(5105953,'','','20091115-_MG_0328-23_thumb.jpg',130, 195,5,'#');
												thumbnails[5105954] = new thumbnail(5105954,'','','20091115-_MG_0331-24_thumb.jpg',130, 146,5,'#');
												thumbnails[5105955] = new thumbnail(5105955,'','','20091115-_MG_0340-25_thumb.jpg',130, 163,5,'#');
												thumbnails[5105956] = new thumbnail(5105956,'','','20091115-_MG_0386-27_thumb.jpg',130, 87,5,'#');
												thumbnails[5113961] = new thumbnail(5113961,'','','4110196340_30161cec42_o_thumb.jpg',130, 195,5,'#');
												thumbnails[5113991] = new thumbnail(5113991,'','','4109433103_f6dfa41f70_o_thumb.jpg',130, 109,5,'#');
												thumbnails[5114153] = new thumbnail(5114153,'','','4110201254_09f465672d_o_thumb.jpg',130, 87,5,'#');
												thumbnails[5124397] = new thumbnail(5124397,'','','20090502-_MG_4725-31_thumb.jpg',130, 195,5,'#');
												thumbnails[5124399] = new thumbnail(5124399,'','','20090802-_MG_3799-17_thumb.jpg',130, 184,5,'#');
												thumbnails[5124532] = new thumbnail(5124532,'','','4-colour-sun-wheel_thumb.jpg',130, 87,5,'#');
												thumbnails[5124766] = new thumbnail(5124766,'','','circle1_thumb.jpg',130, 127,5,'#');
												thumbnails[5124838] = new thumbnail(5124838,'','','20090802-_MG_3869-87_thumb.jpg',130, 87,5,'#');
												thumbnails[5124840] = new thumbnail(5124840,'','','land-art_thumb.jpg',130, 87,5,'#');
												thumbnails[5124882] = new thumbnail(5124882,'','','20090315-_MG_0936-23_thumb.jpg',130, 87,5,'#');
												thumbnails[5124890] = new thumbnail(5124890,'','','traffic-lights_thumb.jpg',130, 90,5,'#');
												thumbnails[5124892] = new thumbnail(5124892,'','','4085984929_4e95e588e1_thumb.jpg',130, 92,5,'#');
												thumbnails[5127495] = new thumbnail(5127495,'','','3297965826_eec604d9e7_thumb.jpg',130, 87,5,'#');
												thumbnails[5127496] = new thumbnail(5127496,'','','3913099178_6ca05a91bf_thumb.jpg',130, 212,5,'#');
												thumbnails[5127498] = new thumbnail(5127498,'','','3910662568_34e2a5ae9d_thumb.jpg',130, 88,5,'#');
												thumbnails[5127635] = new thumbnail(5127635,'','','20090802-_MG_3789-7_thumb.jpg',130, 87,5,'#');
												thumbnails[5128629] = new thumbnail(5128629,'','','20090315-_MG_0887-18_thumb.jpg',130, 195,5,'#');
												thumbnails[5128650] = new thumbnail(5128650,'','','20090705-_MG_2065-44_thumb.jpg',130, 87,5,'#');
												thumbnails[5129827] = new thumbnail(5129827,'','','20090318-IMG_8970-26_thumb.jpg',130, 84,5,'#');
												thumbnails[5129828] = new thumbnail(5129828,'','','20090621-_MG_0978-30_thumb.jpg',130, 201,5,'#');
												thumbnails[5129830] = new thumbnail(5129830,'','','20090712-_MG_2452-32_thumb.jpg',130, 87,5,'#');
												thumbnails[5129857] = new thumbnail(5129857,'','','20090802-_MG_3850-2_thumb.jpg',130, 149,5,'#');
												thumbnails[5129858] = new thumbnail(5129858,'','','20090802-_MG_3894-5_thumb.jpg',130, 87,5,'#');
												thumbnails[5129859] = new thumbnail(5129859,'','','20090802-_MG_3860-3_thumb.jpg',130, 87,5,'#');
												thumbnails[5129860] = new thumbnail(5129860,'','','20090828-_MG_4686-33_thumb.jpg',130, 90,5,'#');
												thumbnails[5129861] = new thumbnail(5129861,'','','20090915-_MG_9069-34_thumb.jpg',130, 88,5,'#');
												thumbnails[5129862] = new thumbnail(5129862,'','','eaf-strpe_thumb.jpg',130, 195,5,'#');
												thumbnails[5129863] = new thumbnail(5129863,'','','20090918-_MG_9156-6_thumb.jpg',130, 94,5,'#');
												thumbnails[5129865] = new thumbnail(5129865,'','','20090918-_MG_9192-7_thumb.jpg',130, 105,5,'#');
												thumbnails[5129867] = new thumbnail(5129867,'','','20090918-_MG_9202-9_thumb.jpg',130, 195,5,'#');
												thumbnails[5129868] = new thumbnail(5129868,'','','20090920-_MG_9417-10_thumb.jpg',130, 89,5,'#');
												thumbnails[5129884] = new thumbnail(5129884,'','','20091024-_MG_2990-13_thumb.jpg',130, 87,5,'#');
												thumbnails[5129965] = new thumbnail(5129965,'','','20090802-_MG_3808-1_thumb.jpg',130, 98,5,'#');
												thumbnails[5129966] = new thumbnail(5129966,'','','20090802-_MG_3796-1_thumb.jpg',130, 298,5,'#');
												thumbnails[5129970] = new thumbnail(5129970,'','','20091024-_MG_3008-1_thumb.jpg',130, 95,5,'#');
												thumbnails[5129972] = new thumbnail(5129972,'','','20091028-_MG_3234-14_thumb.jpg',130, 195,5,'#');
												thumbnails[5129975] = new thumbnail(5129975,'','','20091028-_MG_3247-15_thumb.jpg',130, 147,5,'#');
												thumbnails[5129976] = new thumbnail(5129976,'','','20091028-_MG_3256-17_thumb.jpg',130, 87,5,'#');
												thumbnails[5129980] = new thumbnail(5129980,'','','20091028-_MG_3265-18_thumb.jpg',130, 234,5,'#');
												thumbnails[5129981] = new thumbnail(5129981,'','','20091028-_MG_3311-19_thumb.jpg',130, 115,5,'#');
												thumbnails[5129982] = new thumbnail(5129982,'','','20091028-_MG_3344-20_thumb.jpg',130, 68,5,'#');
												thumbnails[5129984] = new thumbnail(5129984,'','','CRW_6146-24_thumb.jpg',130, 144,5,'#');
												thumbnails[5129985] = new thumbnail(5129985,'','','20091115-_MG_0260-36_thumb.jpg',130, 357,5,'#');
												thumbnails[5129986] = new thumbnail(5129986,'','','IMG_6282-22_thumb.jpg',130, 41,5,'#');
												thumbnails[5129987] = new thumbnail(5129987,'','','IMG_7134-23_thumb.jpg',130, 195,5,'#');
												thumbnails[5129989] = new thumbnail(5129989,'','','IMG_5506-21_thumb.jpg',130, 136,5,'#');
												thumbnails[5130637] = new thumbnail(5130637,'','<br>\r\n','Lets-make-people_thumb.jpg',130, 22,5,'#');
												thumbnails[5249817] = new thumbnail(5249817,'','','20091213-20091213-_MG_0312_thumb.jpg',130, 212,5,'#');
												thumbnails[5249818] = new thumbnail(5249818,'','','20091213-20091213-_MG_0315_thumb.jpg',130, 212,5,'#');
												thumbnails[5249819] = new thumbnail(5249819,'','','20091213-20091213-_MG_0309_thumb.jpg',130, 212,5,'#');
												thumbnails[5249822] = new thumbnail(5249822,'','','20091213-20091213-_MG_0374_thumb.jpg',130, 129,5,'#');
												thumbnails[5249824] = new thumbnail(5249824,'','','20091213-20091213-_MG_0340_thumb.jpg',130, 90,5,'#');
												thumbnails[5249828] = new thumbnail(5249828,'','','20091213-20091213-_MG_0365_thumb.jpg',130, 93,5,'#');
												thumbnails[5249830] = new thumbnail(5249830,'','','20091213-20091213-_MG_0334_thumb.jpg',130, 93,5,'#');
												thumbnails[5249831] = new thumbnail(5249831,'','','20091213-20091213-IMG_9382_thumb.jpg',130, 199,5,'#');
												thumbnails[5249832] = new thumbnail(5249832,'','','20091213-20091213-IMG_9370_thumb.jpg',130, 183,5,'#');
												thumbnails[5249834] = new thumbnail(5249834,'','','20091213-20091213-IMG_9368_thumb.jpg',130, 195,5,'#');
												thumbnails[5249836] = new thumbnail(5249836,'','','20091213-20091213-IMG_9359_thumb.jpg',130, 188,5,'#');
												thumbnails[5249838] = new thumbnail(5249838,'','','20091213-20091213-_MG_0392_thumb.jpg',130, 87,5,'#');
												thumbnails[5249839] = new thumbnail(5249839,'','','20091213-20091213-_MG_0389_thumb.jpg',130, 87,5,'#');
												thumbnails[5249842] = new thumbnail(5249842,'','','20091213-20091213-_MG_0353_thumb.jpg',130, 129,5,'#');
												thumbnails[5249898] = new thumbnail(5249898,'','','Lets-make-spirals_8E8A1F00-1D09-001F-99F9A90B00C3F1B2_thumb.jpg',130, 22,5,'#');
												thumbnails[5249973] = new thumbnail(5249973,'','','Lets-make-grass-knot-faces_thumb.jpg',130, 22,5,'#');
												thumbnails[5249976] = new thumbnail(5249976,'','','Lets-make-frosty-leaf-towe_thumb.jpg',130, 22,5,'#');
												thumbnails[5249992] = new thumbnail(5249992,'','','Lets-make-a-leaf-tree_thumb.jpg',130, 22,5,'#');
												thumbnails[7822114] = new thumbnail(7822114,'','','Hi-and-welcom-banner-1_thumb.jpg',130, 87,5,'#');
												thumbnails[7822118] = new thumbnail(7822118,'','','Hi-and-welcom-banner-2_thumb.jpg',130, 87,5,'#');
												thumbnails[7822120] = new thumbnail(7822120,'','','Hi-and-welcom-banner-3_thumb.jpg',130, 87,5,'#');
												thumbnails[7822139] = new thumbnail(7822139,'','','Hi-and-welcom-banner-4_thumb.jpg',130, 87,5,'#');
												thumbnails[7822180] = new thumbnail(7822180,'','','Hi-and-welcom-banner-5_thumb.jpg',130, 87,5,'#');
												thumbnails[7823158] = new thumbnail(7823158,'','','20090918-20090918-_MG_9135_thumb.jpg',130, 87,5,'#');
												thumbnails[7823159] = new thumbnail(7823159,'','','20091115-20091115-_MG_0386_thumb.jpg',130, 87,5,'#');
												thumbnails[7823161] = new thumbnail(7823161,'','','20100417-20100417-_MG_0134_thumb.jpg',130, 87,5,'#');
												thumbnails[5013849] = new thumbnail(5013849,'','','sen-star_thumb.jpg',130, 86,5,'#');
												thumbnails[7823162] = new thumbnail(7823162,'','','20090802-_MG_3809-2_thumb.jpg',130, 87,5,'#');
												thumbnails[7823168] = new thumbnail(7823168,'','','20090918-20090918-_MG_9268_thumb.jpg',130, 87,5,'#');
												thumbnails[7823176] = new thumbnail(7823176,'','','20101010-20101010-_MG_1207_thumb.jpg',130, 87,5,'#');
												thumbnails[7823178] = new thumbnail(7823178,'','','20091028-_MG_3322-1_thumb.jpg',130, 87,5,'#');
												thumbnails[5013806] = new thumbnail(5013806,'','','Logo-lafk-square-small_thumb.jpg',130, 136,5,'#');
												thumbnails[5012173] = new thumbnail(5012173,'','','20090802-_MG_3822-40_thumb.jpg',130, 87,5,'#');
												thumbnails[5013936] = new thumbnail(5013936,'','','landartfor-kids_thumb.jpg',130, 80,5,'#');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7823178,7823176,7823168,7823162,7823161,7823159,7823158,7822180,7822139,7822120,7822118,7822114';
imageSets[3] = '7823178,7823176,7823168,7823162,7823161,7823159,7823158,7822180,7822139,7822120,7822118,7822114,5249992,5249976,5249973,5249898,5249842,5249839,5249838,5249836,5249834,5249832,5249831,5249830,5249828,5249824,5249822,5249819,5249818,5249817,5130637,5129989,5129987,5129986,5129985,5129984,5129982,5129981,5129980,5129976,5129975,5129972,5129970,5129966,5129965,5129884,5129868,5129867,5129865,5129863';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lafk/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lafk/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lafk/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lafk/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lafk/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lafk/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 += '.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 && '' != '') {
					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 = 'Land Art for Kids: ' + 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>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </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;
	}
}

			

