window.thumbnails = {};
															thumbnails[3288772] = clik.newPhoto({"id":3288772,"src":"Living room from balcony_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_3288772.html","width":130,"caption":"Living room from mezzanine bedroom balcony, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288841] = clik.newPhoto({"id":3288841,"src":"Living room and kitchen1_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_3288841.html","width":130,"caption":"Living and kitchen area, Villency Court studio apartment, Loughborough.","height":98});
															thumbnails[3288768] = clik.newPhoto({"id":3288768,"src":"Living room and kitchen_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_3288768.html","width":130,"caption":"Living and kitchen area, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288844] = clik.newPhoto({"id":3288844,"src":"Kitchen1_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_3288844.html","width":130,"caption":"Kitchen, Villency Court studio apartment, Loughborough.","height":98});
															thumbnails[8970228] = clik.newPhoto({"id":8970228,"src":"Living_room_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_8970228.html","width":130,"caption":"Living room, Villency Court studio apartment, Loughborough.","height":98});
															thumbnails[3288794] = clik.newPhoto({"id":3288794,"src":"Kitchen_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_3288794.html","width":130,"caption":"Kitchen, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288848] = clik.newPhoto({"id":3288848,"src":"Living room pullout bed_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_3288848.html","width":130,"caption":"Living room pullout bed, Villency Court studio apartment, Loughborough.","height":98});
															thumbnails[3288792] = clik.newPhoto({"id":3288792,"src":"Mezzanine balconey_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_3288792.html","width":130,"caption":"Mezzanine balcony, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288849] = clik.newPhoto({"id":3288849,"src":"Bathroom_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_3288849.html","width":130,"caption":"Bathroom, Villency Court studio apartment, Loughborough.","height":98});
															thumbnails[8970422] = clik.newPhoto({"id":8970422,"src":"Living_room_pullout_bed_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_8970422.html","width":130,"caption":"Living room pullout bed, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288775] = clik.newPhoto({"id":3288775,"src":"52756_161_IMG_03_thumb.jpg","galleries_id":198659,"server_id":5,"link":"photo_3288775.html","width":130,"caption":"Downstairs bathroom, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[3288851] = clik.newPhoto({"id":3288851,"src":"Apartment corner view1_thumb.jpeg","galleries_id":198658,"server_id":5,"link":"photo_3288851.html","width":130,"caption":"View of Villency Court apartment complex from Nottingham Road Loughborough.","height":98});
															thumbnails[3288779] = clik.newPhoto({"id":3288779,"src":"52756_161_IMG_05_thumb.jpg","galleries_id":198659,"server_id":5,"link":"photo_3288779.html","width":130,"caption":"Ensuite, Villency Court duplex apartment, Loughborough.","height":98});
															thumbnails[8970429] = clik.newPhoto({"id":8970429,"src":"Bedroom_thumb.JPG","galleries_id":198659,"server_id":5,"link":"photo_8970429.html","width":130,"caption":"Bedroom, Villency Court duplex apartment, Loughborough.","height":87});
															thumbnails[3288835] = clik.newPhoto({"id":3288835,"src":"Apartment corner view_thumb.jpeg","galleries_id":198659,"server_id":5,"link":"photo_3288835.html","width":130,"caption":"View of Villency Court apartment complex from Nottingham Road Loughborough.","height":98});
															thumbnails[7053907] = clik.newPhoto({"id":7053907,"src":"MoorhenWay_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053907.html","width":130,"caption":"5 Moorhen Way, Loughborough, LE11 3HH.","height":98});
															thumbnails[7612231] = clik.newPhoto({"id":7612231,"src":"Grace_Dieu_Road_199D5F80-1EC9-D45B-1CD9748180B62DAF_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7612231.html","width":130,"caption":"74 Grace Dieu Road, Loughborough, LE11 4QG.","height":86});
															thumbnails[7053917] = clik.newPhoto({"id":7053917,"src":"Kitchen_19693D14-1EC9-D45B-1C2E6314DDBA728A_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053917.html","width":130,"caption":"Kitchen, Moorhen Way, Loughborough.","height":98});
															thumbnails[7612235] = clik.newPhoto({"id":7612235,"src":"Grace_Dieu_Road_Location_21AACEB8-1E4F-37DC-7198BB491DCAB9AA_thumb.gif","galleries_id":412418,"server_id":5,"link":"photo_7612235.html","width":130,"caption":"Location of 74 Grace Dieu Road, Loughborough, LE11 4QG.","height":130});
															thumbnails[7053958] = clik.newPhoto({"id":7053958,"src":"Lounge_197E5A5C-1EC9-D45B-1CE1E8CB71A4502C_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053958.html","width":130,"caption":"Lounge, Moorhen Way, Loughborough.","height":98});
															thumbnails[7604163] = clik.newPhoto({"id":7604163,"src":"Lounge_area_1_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7604163.html","width":130,"caption":"Lounge area with wall mounted LCD TV, wireless broadband, Grace Dieu Road, Loughborough.","height":97});
															thumbnails[7053967] = clik.newPhoto({"id":7053967,"src":"Typical_bedroom1_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053967.html","width":130,"caption":"Typical bedroom with double bed and premium quality matress, wardrobe, chest of drawers, desk and chair, shelves, mirror, pinboard, Moorhen Way, Loughborough.","height":98});
															thumbnails[7612255] = clik.newPhoto({"id":7612255,"src":"Kitchen_21AE69CE-1E4F-37DC-71D54BB73BE0EF84_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7612255.html","width":130,"caption":"Modern luxury kitchen, Grace Dieu Road, Loughborough.","height":97});
															thumbnails[7053933] = clik.newPhoto({"id":7053933,"src":"Garage_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053933.html","width":130,"caption":"Garage, Moorhen Way, Loughborough.","height":98});
															thumbnails[7612264] = clik.newPhoto({"id":7612264,"src":"Shower_room_19B28289-1EC9-D45B-1CCDF81411CB77DE_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7612264.html","width":130,"caption":"Hotel style shower room as well as an additional toilet in the adjacent room, Grace Dieu Road, Loughborough.","height":173});
															thumbnails[7053971] = clik.newPhoto({"id":7053971,"src":"Garden1_thumb.jpg","galleries_id":381846,"server_id":5,"link":"photo_7053971.html","width":130,"caption":"Garden, Moorhen Way, Loughborough.","height":98});
															thumbnails[7612288] = clik.newPhoto({"id":7612288,"src":"Upstairs_room_1_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7612288.html","width":130,"caption":"Typical bedroom with double bed and premium quality matress, wardrobe, chest of drawers, desk and chair, shelves, mirror, pinboard, Grace Dieu Road, Loughborough.","height":98});
															thumbnails[7612290] = clik.newPhoto({"id":7612290,"src":"Rear_garden_19E7BF00-1EC9-D45B-1CDC514FA673687D_thumb.JPG","galleries_id":412418,"server_id":5,"link":"photo_7612290.html","width":130,"caption":"Garden, Grace Dieu Road, Loughborough.","height":86});
															thumbnails[7525087] = clik.newPhoto({"id":7525087,"src":"ForestRd_Exterior_thumb.jpg","galleries_id":193341,"server_id":5,"link":"photo_7525087.html","width":130,"caption":"100 Forest Road, Loughborough, LE11 3NR.","height":94});
															thumbnails[7053112] = clik.newPhoto({"id":7053112,"src":"Garden_thumb.jpg","galleries_id":193341,"server_id":5,"link":"photo_7053112.html","width":130,"caption":"Garden, Forest Road, Loughborough.","height":98});
															thumbnails[3289486] = clik.newPhoto({"id":3289486,"src":"23112008078_thumb.jpg","galleries_id":193341,"server_id":5,"link":"photo_3289486.html","width":130,"caption":"Kitchen, Forest Road, Loughborough.","height":98});
															thumbnails[7053064] = clik.newPhoto({"id":7053064,"src":"Lounge1_thumb.JPG","galleries_id":193341,"server_id":5,"link":"photo_7053064.html","width":130,"caption":"Lounge, Forest Road, Loughborough.","height":98});
															thumbnails[7053105] = clik.newPhoto({"id":7053105,"src":"Bedroom1_thumb.JPG","galleries_id":193341,"server_id":5,"link":"photo_7053105.html","width":130,"caption":"Bedroom1, Forest Road, Loughborough.","height":98});
															thumbnails[3409913] = clik.newPhoto({"id":3409913,"src":"06022009081_thumb.jpg","galleries_id":193341,"server_id":5,"link":"photo_3409913.html","width":130,"caption":"Bathroom with large walk-in shower, Forest Road, Loughborough.","height":173});
															thumbnails[3409940] = clik.newPhoto({"id":3409940,"src":"06022009090_thumb.jpg","galleries_id":193341,"server_id":5,"link":"photo_3409940.html","width":130,"caption":"Wetroom, Forest Road, Loughborough.","height":173});
															thumbnails[7077050] = clik.newPhoto({"id":7077050,"src":"Grace_Dieu_Road_19A7D7A3-1EC9-D45B-1CDF78B220BEDEB0_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_7077050.html","width":130,"caption":"74 Grace Dieu Road, Loughborough, LE11 4QG.","height":86});
															thumbnails[3155635] = clik.newPhoto({"id":3155635,"src":"Grace_Dieu_Road_Location_thumb.gif","galleries_id":198227,"server_id":5,"link":"photo_3155635.html","width":130,"caption":"Location of 74 Grace Dieu Road, Loughborough, LE11 4QG.","height":130});
															thumbnails[3155393] = clik.newPhoto({"id":3155393,"src":"Lounge_area_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_3155393.html","width":130,"caption":"Lounge area with wall mounted LCD TV, wireless broadband, Grace Dieu Road, Loughborough.","height":97});
															thumbnails[3155385] = clik.newPhoto({"id":3155385,"src":"Kitchen_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_3155385.html","width":130,"caption":"Modern luxury kitchen, Grace Dieu Road, Loughborough.","height":97});
															thumbnails[3155436] = clik.newPhoto({"id":3155436,"src":"Shower_room_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_3155436.html","width":130,"caption":"Hotel style shower room as well as an additional toilet in the adjacent room, Grace Dieu Road, Loughborough.","height":173});
															thumbnails[3155412] = clik.newPhoto({"id":3155412,"src":"Upstairs_room_11_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_3155412.html","width":130,"caption":"Typical bedroom with double bed and premium quality matress, wardrobe, chest of drawers, desk and chair, shelves, mirror, pinboard, Grace Dieu Road, Loughborough.","height":98});
															thumbnails[7536102] = clik.newPhoto({"id":7536102,"src":"Rear_garden_thumb.JPG","galleries_id":198227,"server_id":5,"link":"photo_7536102.html","width":130,"caption":"Garden, Grace Dieu Road, Loughborough.","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[198658] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"1 Bed Villency Court Studio","link":"1_Bed_Loughborough_Apartments_198658.html","maxRecords":0.0,"photoIDs":[3288841.0,3288844.0,8970228.0,3288848.0,3288849.0,3288851.0],"skipIndex":0,"section_code":"1_Bed_Loughborough_Apartments","featured_images":3288851.0,"id":198658,"singleSection":false});				  						galleries[198659] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"1 Bed Villency Court Duplex","link":"1_Bed_Loughborough_Apartments_198659.html","maxRecords":0.0,"photoIDs":[3288772.0,3288768.0,3288794.0,3288792.0,8970422.0,3288775.0,3288779.0,8970429.0,3288835.0],"skipIndex":0,"section_code":"1_Bed_Loughborough_Apartments","featured_images":3288792.0,"id":198659,"singleSection":false});				  						galleries[381846] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"5 Moorhen Way","link":"4_Bed_Loughborough_Student_Houses_381846.html","maxRecords":0.0,"photoIDs":[7053907.0,7053917.0,7053958.0,7053967.0,7053933.0,7053971.0],"skipIndex":0,"section_code":"4_Bed_Loughborough_Student_Houses","featured_images":7053907.0,"id":381846,"singleSection":false});				  						galleries[412418] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"74 Grace Dieu Road","link":"4_Bed_Loughborough_Student_Houses_412418.html","maxRecords":0.0,"photoIDs":[7612231.0,7612235.0,7604163.0,7612255.0,7612264.0,7612288.0,7612290.0],"skipIndex":0,"section_code":"4_Bed_Loughborough_Student_Houses","featured_images":7604163.0,"id":412418,"singleSection":false});				  						galleries[198227] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"74 Grace Dieu Road","link":"5_Bed_Loughborough_Student_Houses_198227.html","maxRecords":0.0,"photoIDs":[7077050.0,3155635.0,3155393.0,3155385.0,3155436.0,3155412.0,7536102.0],"skipIndex":0,"section_code":"5_Bed_Loughborough_Student_Houses","featured_images":3155393.0,"id":198227,"singleSection":false});				  						galleries[193341] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"100 Forest Road","link":"5_Bed_Loughborough_Student_Houses_193341.html","maxRecords":0.0,"photoIDs":[7525087.0,7053112.0,3289486.0,7053064.0,7053105.0,3409913.0,3409940.0],"skipIndex":0,"section_code":"5_Bed_Loughborough_Student_Houses","featured_images":3289486.0,"id":193341,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3289486';
imageSets[2] = '3289486,7053907,7604163,3155393,3288792,3288851';
imageSets[3] = '8970429,8970422,8970228,7612290,7612288,7612264,7612255,7612235,7612231,7604163,7536102,7525087,7077050,7053971,7053967,7053958,7053933,7053917,7053907,7053112,7053105,7053064,3409940,3409913,3289486,3288851,3288849,3288848,3288844,3288841,3288835,3288794,3288792,3288779,3288775,3288772,3288768,3155635,3155436,3155412,3155393,3155385';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/j8kefrew/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/j8kefrew/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 || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += '1_Bed_Loughborough_Apartments.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 && '1_Bed_Loughborough_Apartments' != '') {
					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 = 'Loughborough Student Accommodation: ' + 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.item_price !== '') {
			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;
	}
}

			

