window.thumbnails = {};
															thumbnails[4878564] = clik.newPhoto({"id":4878564,"src":"IMG_5339_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4878564.html","width":130,"caption":"Pacific Road, Birkenhead","height":88});
															thumbnails[4878874] = clik.newPhoto({"id":4878874,"src":"1966_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878874.html","width":130,"caption":"1966 Hiawatha's Departure Rehearsals","height":91});
															thumbnails[4878917] = clik.newPhoto({"id":4878917,"src":"1967_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878917.html","width":130,"caption":"1967 -Merrie England","height":82});
															thumbnails[4878921] = clik.newPhoto({"id":4878921,"src":"1968a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878921.html","width":130,"caption":"1968 -Pirates of Penzance","height":104});
															thumbnails[4878922] = clik.newPhoto({"id":4878922,"src":"1968b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878922.html","width":130,"caption":"1968 -Pirates of Penzance","height":164});
															thumbnails[4878926] = clik.newPhoto({"id":4878926,"src":"1969_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878926.html","width":130,"caption":"1969 -Holland Tour","height":95});
															thumbnails[4878934] = clik.newPhoto({"id":4878934,"src":"1970_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878934.html","width":130,"caption":"1970 -Shackleton Children’s Homes Concert","height":96});
															thumbnails[4878936] = clik.newPhoto({"id":4878936,"src":"1971_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878936.html","width":130,"caption":"1971-The Mikado<br>\r\n","height":98});
															thumbnails[4878940] = clik.newPhoto({"id":4878940,"src":"1972a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878940.html","width":130,"caption":"1972-The Gondoliers","height":65});
															thumbnails[4878943] = clik.newPhoto({"id":4878943,"src":"1972b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878943.html","width":130,"caption":"1972-The Gondoliers","height":160});
															thumbnails[4878946] = clik.newPhoto({"id":4878946,"src":"1973_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878946.html","width":130,"caption":"1973-Recording for Radio 2","height":45});
															thumbnails[4878952] = clik.newPhoto({"id":4878952,"src":"1974_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878952.html","width":130,"caption":"1974-Carmen<br>\r\n","height":92});
															thumbnails[4878960] = clik.newPhoto({"id":4878960,"src":"1975a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878960.html","width":130,"caption":"1975 Songs from  the Shows<br>\r\n","height":102});
															thumbnails[4878961] = clik.newPhoto({"id":4878961,"src":"1975b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878961.html","width":130,"caption":"1975 Songs from  the Shows<br>\r\n","height":72});
															thumbnails[4878964] = clik.newPhoto({"id":4878964,"src":"1976a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878964.html","width":130,"caption":"1976 10th Anniversary ","height":140});
															thumbnails[4878971] = clik.newPhoto({"id":4878971,"src":"1976b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878971.html","width":130,"caption":"1976 Pirates of Penzance<br>\r\n","height":168});
															thumbnails[4878980] = clik.newPhoto({"id":4878980,"src":"1977_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878980.html","width":130,"caption":"1977 -Patience","height":94});
															thumbnails[4878982] = clik.newPhoto({"id":4878982,"src":"1978_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878982.html","width":130,"caption":"1978 -Iolanthe","height":108});
															thumbnails[4878985] = clik.newPhoto({"id":4878985,"src":"1978a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4878985.html","width":130,"caption":"1978 -Iolanthe","height":99});
															thumbnails[4879013] = clik.newPhoto({"id":4879013,"src":"1979_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879013.html","width":130,"caption":"1976 - Montreux International Music Festival","height":58});
															thumbnails[4879018] = clik.newPhoto({"id":4879018,"src":"1979a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879018.html","width":130,"caption":"1979  International Eisteddfod ","height":101});
															thumbnails[4879022] = clik.newPhoto({"id":4879022,"src":"1980_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879022.html","width":130,"caption":"1980 - Songs from the Show’s Rehearsals","height":70});
															thumbnails[4879029] = clik.newPhoto({"id":4879029,"src":"1980b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879029.html","width":130,"caption":"1980 - Songs from the Show’s Rehearsals","height":73});
															thumbnails[4879047] = clik.newPhoto({"id":4879047,"src":"1981b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879047.html","width":130,"caption":"1981 - Limberg, West Germany","height":103});
															thumbnails[4879053] = clik.newPhoto({"id":4879053,"src":"19821_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879053.html","width":130,"caption":"1982 - Finland<br>\r\n","height":105});
															thumbnails[4879054] = clik.newPhoto({"id":4879054,"src":"1982a_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879054.html","width":130,"caption":"1983 - Visitors from Nastola, Finland<br>\r\n","height":70});
															thumbnails[4879056] = clik.newPhoto({"id":4879056,"src":"1983_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879056.html","width":130,"caption":"1983 Visitors from Nastola, Finland<br>\r\n","height":75});
															thumbnails[4879060] = clik.newPhoto({"id":4879060,"src":"1984b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879060.html","width":130,"caption":"1984 Joseph and his Amazing Technicolor Dreamcoat ","height":241});
															thumbnails[4879063] = clik.newPhoto({"id":4879063,"src":"1984a1_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879063.html","width":130,"caption":"1984 Joseph and his Amazing Technicolor Dreamcoat ","height":67});
															thumbnails[4879068] = clik.newPhoto({"id":4879068,"src":"1986_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879068.html","width":130,"caption":"1986 Montreux  International Music Festival","height":51});
															thumbnails[4879071] = clik.newPhoto({"id":4879071,"src":"1987_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879071.html","width":130,"caption":"1987 - 21st Celebrations","height":80});
															thumbnails[4879072] = clik.newPhoto({"id":4879072,"src":"1987b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879072.html","width":130,"caption":"1987 - 21st Celebrations","height":69});
															thumbnails[4879075] = clik.newPhoto({"id":4879075,"src":"19881_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879075.html","width":130,"caption":"1988 - Canada","height":66});
															thumbnails[4879079] = clik.newPhoto({"id":4879079,"src":"1988b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879079.html","width":130,"caption":"1988 - Canada","height":81});
															thumbnails[4879086] = clik.newPhoto({"id":4879086,"src":"19891_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879086.html","width":130,"caption":"1989-Fashion Show","height":81});
															thumbnails[4879088] = clik.newPhoto({"id":4879088,"src":"1990_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879088.html","width":130,"caption":"1990 -United States of America","height":85});
															thumbnails[4879090] = clik.newPhoto({"id":4879090,"src":"1991_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879090.html","width":130,"caption":"1991 25th Anniversary<br>\r\n","height":68});
															thumbnails[4879100] = clik.newPhoto({"id":4879100,"src":"1992_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879100.html","width":130,"caption":"1992 Tour of Europe<br>\r\n","height":81});
															thumbnails[4879105] = clik.newPhoto({"id":4879105,"src":"1992b_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879105.html","width":130,"caption":"1992 Tour of Europe<br>\r\n","height":86});
															thumbnails[4879122] = clik.newPhoto({"id":4879122,"src":"1993_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879122.html","width":130,"caption":"1993-Pot Pourri","height":70});
															thumbnails[4879128] = clik.newPhoto({"id":4879128,"src":"1999_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879128.html","width":130,"caption":"1999-Malta","height":78});
															thumbnails[4879137] = clik.newPhoto({"id":4879137,"src":"20011_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879137.html","width":130,"caption":"2001 -Malta","height":64});
															thumbnails[4879142] = clik.newPhoto({"id":4879142,"src":"1994_thumb.jpg","galleries_id":278323,"server_id":18,"link":"photo_4879142.html","width":130,"caption":"1994-Scotland","height":68});
															thumbnails[4879191] = clik.newPhoto({"id":4879191,"src":"choir_town_hall_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4879191.html","width":130,"caption":"2002 Wallasey Town Hall","height":95});
															thumbnails[4879206] = clik.newPhoto({"id":4879206,"src":"choir053_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4879206.html","width":130,"caption":"2003 Carol Singing","height":69});
															thumbnails[4879234] = clik.newPhoto({"id":4879234,"src":"IMG_0102b_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4879234.html","width":130,"caption":2006.0,"height":78});
															thumbnails[4879235] = clik.newPhoto({"id":4879235,"src":"Malta_2004_ratzett_thumb.JPG","galleries_id":278324,"server_id":18,"link":"photo_4879235.html","width":130,"caption":"2004 Malta","height":54});
															thumbnails[4879253] = clik.newPhoto({"id":4879253,"src":"IMG_0207_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4879253.html","width":130,"caption":"40th Celebrations","height":87});
															thumbnails[4881106] = clik.newPhoto({"id":4881106,"src":"cnv00007_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881106.html","width":130,"caption":"Wedding","height":98});
															thumbnails[4881275] = clik.newPhoto({"id":4881275,"src":"IMG_0101-2_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881275.html","width":130,"caption":"40th Anniversary","height":87});
															thumbnails[4881468] = clik.newPhoto({"id":4881468,"src":"IMG_0102-2_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881468.html","width":130,"caption":"40th Celebrations","height":87});
															thumbnails[4881470] = clik.newPhoto({"id":4881470,"src":"IMG_0224_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881470.html","width":130,"caption":"40th Celebrations","height":127});
															thumbnails[4881637] = clik.newPhoto({"id":4881637,"src":"IMG_0227_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881637.html","width":130,"caption":"40th Celebrations","height":87});
															thumbnails[4881641] = clik.newPhoto({"id":4881641,"src":"IMG_0208_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881641.html","width":130,"caption":"40th Celebration Concert","height":87});
															thumbnails[4881644] = clik.newPhoto({"id":4881644,"src":"IMG_5320_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881644.html","width":130,"caption":"Pacific Road ","height":87});
															thumbnails[4881653] = clik.newPhoto({"id":4881653,"src":"IMG_53391_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_4881653.html","width":130,"caption":"Pacific Road","height":88});
															thumbnails[6847920] = clik.newPhoto({"id":6847920,"src":"IMG_1029web2_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_6847920.html","width":130,"caption":"Carol Singing in Birkenhead Precinct 2009","height":98});
															thumbnails[6847921] = clik.newPhoto({"id":6847921,"src":"Choir-002-WEB1_thumb.jpg","galleries_id":278324,"server_id":18,"link":"photo_6847921.html","width":130,"caption":"Oldershaw School Rotary Concert 2009","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[278323] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wallasey Girls Choir ","link":"gallery_278323.html","maxRecords":0.0,"photoIDs":[4878874.0,4878917.0,4878921.0,4878922.0,4878926.0,4878934.0,4878936.0,4878940.0,4878943.0,4878946.0,4878952.0,4878960.0,4878961.0,4878964.0,4878971.0,4878980.0,4878982.0,4878985.0,4879013.0,4879018.0,4879022.0,4879029.0,4879047.0,4879053.0,4879054.0,4879056.0,4879060.0,4879063.0,4879068.0,4879071.0,4879072.0,4879075.0,4879079.0,4879086.0,4879088.0,4879090.0,4879100.0,4879105.0,4879122.0,4879128.0,4879137.0,4879142.0],"skipIndex":0,"section_code":"gallery","featured_images":"4879142,4879137,4879128,4879122,4879105,4879100,4879090,4879088,4879086,4879079","id":278323,"singleSection":false});				  						galleries[278324] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Wallasey Choir","link":"gallery_278324.html","maxRecords":0.0,"photoIDs":[4878564.0,4879191.0,4879206.0,4879234.0,4879235.0,4879253.0,4881106.0,4881275.0,4881468.0,4881470.0,4881637.0,4881641.0,4881644.0,4881653.0,6847920.0,6847921.0],"skipIndex":0,"section_code":"gallery","featured_images":"6847921,6847920,4881653,4881644,4881641,4881637,4881470,4881468,4881275,4881106","id":278324,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4878564';
imageSets[3] = '6847921,6847920,4881653,4881644,4881641,4881637,4881470,4881468,4881275,4881106,4879253,4879235,4879234,4879206,4879191,4879142,4879137,4879128,4879122,4879105,4879100,4879090,4879088,4879086,4879079,4879075,4879072,4879071,4879068,4879063,4879060,4879056,4879054,4879053,4879047,4879029,4879022,4879018,4879013,4878985,4878982,4878980,4878971,4878964,4878961,4878960,4878952,4878946,4878943,4878940';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/WallaseyChoir/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/WallaseyChoir/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 = 'The Wallasey Choir: ' + 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;
	}
}

			

