window.thumbnails = {};
															thumbnails[6173719] = clik.newPhoto({"id":6173719,"src":"The_Prints_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"The Prints Header","height":12});
															thumbnails[3673268] = clik.newPhoto({"id":3673268,"src":"cobbledock_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_3673268.html","width":130,"caption":"The First Step is the Hardest","height":221});
															thumbnails[3673345] = clik.newPhoto({"id":3673345,"src":"Pier_Head_GVC_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_3673345.html","width":130,"caption":"3 Graces - Autumn","height":102});
															thumbnails[3673530] = clik.newPhoto({"id":3673530,"src":"exhbibshot_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_3673530.html","width":130,"caption":"Liverpool Reflected","height":67});
															thumbnails[3697185] = clik.newPhoto({"id":3697185,"src":"archi_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_3697185.html","width":130,"caption":"Stairwell Geometry","height":88});
															thumbnails[3697187] = clik.newPhoto({"id":3697187,"src":"jurys_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_3697187.html","width":130,"caption":"Jurys Inn","height":76});
															thumbnails[3697189] = clik.newPhoto({"id":3697189,"src":"candid1_thumb.jpg","galleries_id":225943,"server_id":15,"link":"photo_3697189.html","width":130,"caption":"Contemplate","height":192});
															thumbnails[3697194] = clik.newPhoto({"id":3697194,"src":"tiltshift_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_3697194.html","width":130,"caption":"Teeny Town Hall","height":212});
															thumbnails[3697197] = clik.newPhoto({"id":3697197,"src":"gent2_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_3697197.html","width":130,"caption":"John","height":195});
															thumbnails[3697202] = clik.newPhoto({"id":3697202,"src":"btest_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_3697202.html","width":130,"caption":"Williamson Sq Man","height":87});
															thumbnails[3697206] = clik.newPhoto({"id":3697206,"src":"phil_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_3697206.html","width":130,"caption":"The Philharmonic Pub","height":188});
															thumbnails[3697289] = clik.newPhoto({"id":3697289,"src":"candid2_thumb.jpg","galleries_id":225943,"server_id":15,"link":"photo_3697289.html","width":130,"caption":"Studying Form","height":174});
															thumbnails[4500800] = clik.newPhoto({"id":4500800,"src":"sunset2_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_4500800.html","width":130,"caption":"Sunet and Turbines","height":200});
															thumbnails[4511179] = clik.newPhoto({"id":4511179,"src":"waves_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_4511179.html","width":130,"caption":"Waves","height":180});
															thumbnails[4511314] = clik.newPhoto({"id":4511314,"src":"Dandy_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_4511314.html","width":130,"caption":"Dandelion in the Lakes","height":199});
															thumbnails[4511323] = clik.newPhoto({"id":4511323,"src":"sunset1_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_4511323.html","width":130,"caption":"Dramatic Sunset, New Brighton","height":72});
															thumbnails[4511336] = clik.newPhoto({"id":4511336,"src":"_Wall_E_Liverpool_Style_O_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511336.html","width":130,"caption":"An Ancient Robot","height":86});
															thumbnails[4511338] = clik.newPhoto({"id":4511338,"src":"a380_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511338.html","width":130,"caption":"A380 Emerging","height":66});
															thumbnails[4511343] = clik.newPhoto({"id":4511343,"src":"bokeh_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511343.html","width":130,"caption":"Farmer and Robot","height":90});
															thumbnails[4511371] = clik.newPhoto({"id":4511371,"src":"jetski_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511371.html","width":130,"caption":"Jet Ski Mersey","height":61});
															thumbnails[4511378] = clik.newPhoto({"id":4511378,"src":"menatwork_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511378.html","width":130,"caption":"Men at Work","height":213});
															thumbnails[4511382] = clik.newPhoto({"id":4511382,"src":"Rusty_Muldoon_O_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511382.html","width":130,"caption":"Rusty Muldoon","height":78});
															thumbnails[4511389] = clik.newPhoto({"id":4511389,"src":"whitelining_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511389.html","width":130,"caption":"White Lines","height":82});
															thumbnails[4511398] = clik.newPhoto({"id":4511398,"src":"lights_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_4511398.html","width":130,"caption":"The Lights","height":71});
															thumbnails[4511426] = clik.newPhoto({"id":4511426,"src":"Liverpool_Skyline_Post_Storm_O_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4511426.html","width":130,"caption":"Skyline Post Storm","height":76});
															thumbnails[4511428] = clik.newPhoto({"id":4511428,"src":"merseyblur_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4511428.html","width":130,"caption":"Waiting to Leave","height":49});
															thumbnails[4511435] = clik.newPhoto({"id":4511435,"src":"Night_Skyline_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4511435.html","width":130,"caption":"3 Graces by Night","height":77});
															thumbnails[4511445] = clik.newPhoto({"id":4511445,"src":"Night_Skyline2_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4511445.html","width":130,"caption":"Changing Face","height":56});
															thumbnails[4532933] = clik.newPhoto({"id":4532933,"src":"sgirl3_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_4532933.html","width":130,"caption":"Church St ","height":196});
															thumbnails[4532940] = clik.newPhoto({"id":4532940,"src":"streetbloke_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_4532940.html","width":130,"caption":"Man leaving Liverpool One","height":199});
															thumbnails[4532950] = clik.newPhoto({"id":4532950,"src":"streetgirl2_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_4532950.html","width":130,"caption":"Woman leaving Liverpool One","height":157});
															thumbnails[4533001] = clik.newPhoto({"id":4533001,"src":"barber_thumb.jpg","galleries_id":225943,"server_id":15,"link":"photo_4533001.html","width":130,"caption":"Looking for a Barber","height":217});
															thumbnails[4533010] = clik.newPhoto({"id":4533010,"src":"Cat_Trpy_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533010.html","width":130,"caption":"Cathdedral Tryptych","height":79});
															thumbnails[4533018] = clik.newPhoto({"id":4533018,"src":"Derelict_-_Four_Bridges_O_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533018.html","width":130,"caption":"Derelict - Four Bridges","height":195});
															thumbnails[4533067] = clik.newPhoto({"id":4533067,"src":"new_muzz_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533067.html","width":130,"caption":"The new canal link","height":76});
															thumbnails[4533071] = clik.newPhoto({"id":4533071,"src":"new_ferry_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533071.html","width":130,"caption":"New Ferry Terminal","height":231});
															thumbnails[4533073] = clik.newPhoto({"id":4533073,"src":"derilict1_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533073.html","width":130,"caption":"Condemned","height":95});
															thumbnails[4533078] = clik.newPhoto({"id":4533078,"src":"alley_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533078.html","width":130,"caption":"Red Alley","height":216});
															thumbnails[4533080] = clik.newPhoto({"id":4533080,"src":"ferrybed_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_4533080.html","width":130,"caption":"Ferrys Rest","height":68});
															thumbnails[4541222] = clik.newPhoto({"id":4541222,"src":"Liverpool_City_Panorama_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4541222.html","width":130,"caption":"Liverpool Skyline & Warship","height":56});
															thumbnails[4546614] = clik.newPhoto({"id":4546614,"src":"The_New_Pier_Head4web_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_4546614.html","width":130,"caption":"The Pier Head of 2009","height":38});
															thumbnails[5455820] = clik.newPhoto({"id":5455820,"src":"graces1_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_5455820.html","width":130,"caption":"Graces Reflected","height":98});
															thumbnails[5455823] = clik.newPhoto({"id":5455823,"src":"snowstorm_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_5455823.html","width":130,"caption":"Thundersnow Storm","height":98});
															thumbnails[5455832] = clik.newPhoto({"id":5455832,"src":"wirral_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_5455832.html","width":130,"caption":"Wales and Wirral at Sunset","height":96});
															thumbnails[5455856] = clik.newPhoto({"id":5455856,"src":"street_thumb.jpg","galleries_id":225943,"server_id":15,"link":"photo_5455856.html","width":130,"caption":"Matthew St Festival","height":100});
															thumbnails[5455863] = clik.newPhoto({"id":5455863,"src":"skyline_thumb.jpg","galleries_id":262453,"server_id":15,"link":"photo_5455863.html","width":130,"caption":"Magnificent Mersey","height":92});
															thumbnails[6154417] = clik.newPhoto({"id":6154417,"src":"Parklife2_-_Liverpool_2010CP_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_6154417.html","width":130,"caption":"Parklife 2","height":211});
															thumbnails[6154437] = clik.newPhoto({"id":6154437,"src":"City_of_Light_-_Liverpool_2010CP_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_6154437.html","width":130,"caption":"City of Light","height":91});
															thumbnails[4510996] = clik.newPhoto({"id":4510996,"src":"dude_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_4510996.html","width":130,"caption":"Caught coming out of the Swan","height":196});
															thumbnails[6154344] = clik.newPhoto({"id":6154344,"src":"Parklife1_-_Liverpool_2010_CP_thumb.jpg","galleries_id":224340,"server_id":15,"link":"photo_6154344.html","width":130,"caption":"Parklife 1","height":217});
															thumbnails[6154422] = clik.newPhoto({"id":6154422,"src":"F122_CP_thumb.jpg","galleries_id":224339,"server_id":15,"link":"photo_6154422.html","width":130,"caption":"Depth of Field","height":195});
															thumbnails[6154428] = clik.newPhoto({"id":6154428,"src":"Wheel__Arena_Albert_Dock_Liverpool_2010CP_thumb.jpg","galleries_id":224348,"server_id":15,"link":"photo_6154428.html","width":130,"caption":"The new additions to the Albert Dock","height":105});
															thumbnails[6154463] = clik.newPhoto({"id":6154463,"src":"squiz_thumb.jpg","galleries_id":262171,"server_id":15,"link":"photo_6154463.html","width":130,"caption":"Leap","height":188});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[262453] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Liverpool Skylines","link":"gallery_262453.html","maxRecords":0.0,"photoIDs":[3673530.0,4511426.0,4511428.0,4511435.0,4511445.0,4541222.0,4546614.0,5455863.0],"skipIndex":0,"section_code":"gallery","featured_images":"5455863,4546614,4541222,4511445,4511435,4511428,4511426,3673530","id":262453,"singleSection":false});				  						galleries[262171] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Nature","link":"gallery_262171.html","maxRecords":0.0,"photoIDs":[4500800.0,4511179.0,4511314.0,4511323.0,5455823.0,5455832.0,6154463.0],"skipIndex":0,"section_code":"gallery","featured_images":4511323.0,"id":262171,"singleSection":false});				  						galleries[224339] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Creative","link":"gallery_224339.html","maxRecords":0.0,"photoIDs":[3673268.0,3697194.0,4511336.0,4511338.0,4511343.0,4511371.0,4511378.0,4511382.0,4511389.0,4511398.0,6154422.0],"skipIndex":0,"section_code":"gallery","featured_images":4511336.0,"id":224339,"singleSection":false});				  						galleries[224340] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"People","link":"gallery_224340.html","maxRecords":0.0,"photoIDs":[3697197.0,3697202.0,4532933.0,4532940.0,4532950.0,6154417.0,4510996.0,6154344.0],"skipIndex":0,"section_code":"gallery","featured_images":"6154417,6154344,4532950","id":224340,"singleSection":false});				  						galleries[224348] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Architecture","link":"gallery_224348.html","maxRecords":0.0,"photoIDs":[3673345.0,3697185.0,3697187.0,3697206.0,4533010.0,4533018.0,4533067.0,4533071.0,4533073.0,4533078.0,4533080.0,5455820.0,6154437.0,6154428.0],"skipIndex":0,"section_code":"gallery","featured_images":"6154437,6154428,5455820","id":224348,"singleSection":false});				  						galleries[225943] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Candid & Street","link":"gallery_225943.html","maxRecords":0.0,"photoIDs":[3697189.0,3697289.0,4533001.0,5455856.0],"skipIndex":0,"section_code":"gallery","featured_images":"5455856,4533001","id":225943,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6154437,5455863,5455820,4533067,4533018,4533001,4532950,4511435,4511426,4511378,4511336,4511323,4511314,4511179,4500800,3697185,3673530,3673268,6154428,4510996';
imageSets[2] = '6154437,6154417,5455856,5455820,4533001,4532950,4511336,4511323,6154428,6154344';
imageSets[3] = '6154437,6154417,5455863,5455820,6154428';
imageSets[232039] = '6154437,5455856,5455832,5455823,5455820,4546614,4533078,4533067,4533018,3697289,3697189,6154428,6154344';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lcarus/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lcarus/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lcarus/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lcarus/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lcarus/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lcarus/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lcarus/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 += '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 = 'Lee Carus Photography: ' + 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 !== '' || 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;
	}
}

			

