window.thumbnails = {};
															thumbnails[3653739] = clik.newPhoto({"id":3653739,"src":"Mini-Album-Double-Page-12_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_3653739.html","width":130,"caption":"Carla & Kevin","height":95});
															thumbnails[3653763] = clik.newPhoto({"id":3653763,"src":"Mini-Album-Double-Page-56_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_3653763.html","width":130,"caption":"Carla & Kevin","height":95});
															thumbnails[3653771] = clik.newPhoto({"id":3653771,"src":"Mini-Album-Double-Page-78_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_3653771.html","width":130,"caption":"Carla & Kevin","height":95});
															thumbnails[3653790] = clik.newPhoto({"id":3653790,"src":"Mini-Album-Double-Page-910_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_3653790.html","width":130,"caption":"Carla & Kevin","height":95});
															thumbnails[6614931] = clik.newPhoto({"id":6614931,"src":"Mini-Album-Double72dpi_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_6614931.html","width":130,"caption":"Carla & Kevin","height":95});
															thumbnails[6637841] = clik.newPhoto({"id":6637841,"src":"DSC_1255-001_72dpi_thumb.jpg","galleries_id":201997,"server_id":15,"link":"photo_6637841.html","width":130,"caption":"Carla & Kevin","height":86});
															thumbnails[6372387] = clik.newPhoto({"id":6372387,"src":"Pic_02_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_6372387.html","width":67,"caption":"Portrait, Hollywood style, Kevin Meechan Photography","height":100});
															thumbnails[6372425] = clik.newPhoto({"id":6372425,"src":"Pic_07_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_6372425.html","width":67,"caption":"Sammy & Natalie, David Bailie type portrait, Kevin Meechan Photography","height":100});
															thumbnails[6372518] = clik.newPhoto({"id":6372518,"src":"Pic_10_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_6372518.html","width":67,"caption":"Fashion, portrait, Kevin Meechan Photography","height":100});
															thumbnails[6491528] = clik.newPhoto({"id":6491528,"src":"Portraiture_72dpi_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_6491528.html","width":130,"caption":"Fashion, portrait, Kevin Meechan Photography","height":163});
															thumbnails[6584143] = clik.newPhoto({"id":6584143,"src":"DSC_0259a72dpi_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_6584143.html","width":130,"caption":"Bill & Jane","height":86});
															thumbnails[7247854] = clik.newPhoto({"id":7247854,"src":"Family_Portrait_72dpi_thumb.jpg","galleries_id":352378,"server_id":15,"link":"photo_7247854.html","width":130,"caption":"The McNeill Family","height":95});
															thumbnails[6498480] = clik.newPhoto({"id":6498480,"src":"The_Blazing_Saddles_72dpi_thumb.jpg","galleries_id":352420,"server_id":15,"link":"photo_6498480.html","width":130,"caption":"The Blazing Saddles - Strathclyde Fire & Rescue Bikers, Glasgow Easter Egg Run 2008 to Yorkhill Sick Childrens Hospital.","height":86});
															thumbnails[6498519] = clik.newPhoto({"id":6498519,"src":"Veteran_Sailor_72dpi_thumb.jpg","galleries_id":352420,"server_id":15,"link":"photo_6498519.html","width":86,"caption":"Remembrance Sunday, George Square 8th November 2009, Normandy, D-Day, Veterans","height":130});
															thumbnails[7248242] = clik.newPhoto({"id":7248242,"src":"Anti__Nazi_Flag_Glasgow72dpi_thumb.jpg","galleries_id":352420,"server_id":15,"link":"photo_7248242.html","width":86,"caption":"STUC, March Against Fascism, Glasgow","height":130});
															thumbnails[7248291] = clik.newPhoto({"id":7248291,"src":"DSC_1534a_72dpi_thumb.jpg","galleries_id":352420,"server_id":15,"link":"photo_7248291.html","width":130,"caption":"Chest Heart Stroke Scotland","height":86});
															thumbnails[3314642] = clik.newPhoto({"id":3314642,"src":"DSC_4758_copy72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_3314642.html","width":130,"caption":"Fashion Portrait, Kevin Meechan Photography","height":86});
															thumbnails[6372360] = clik.newPhoto({"id":6372360,"src":"DSC_4662_copy72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_6372360.html","width":86,"caption":"Fashion Portrait, Kevin Meechan Photography","height":130});
															thumbnails[6498406] = clik.newPhoto({"id":6498406,"src":"DSC_9939_72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_6498406.html","width":130,"caption":"Fashion Image, Model Kim, Kevin Meechan Photography","height":86});
															thumbnails[6498412] = clik.newPhoto({"id":6498412,"src":"DSC_9957_72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_6498412.html","width":86,"caption":"Fashion image, Model Jane, Kevin Meechan Photography","height":130});
															thumbnails[7247512] = clik.newPhoto({"id":7247512,"src":"DSC_8838portfolio_72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_7247512.html","width":86,"caption":"Fashion image, Model Lee, Kevin Meechan Photography","height":130});
															thumbnails[7247564] = clik.newPhoto({"id":7247564,"src":"DSC_8855BW_72dpi_thumb.jpg","galleries_id":352419,"server_id":15,"link":"photo_7247564.html","width":130,"caption":"Fashion image, Model Lee, Kevin Meechan Photography","height":86});
															thumbnails[3314649] = clik.newPhoto({"id":3314649,"src":"Avertising_-TIGER_TIGER_thumb.jpg","galleries_id":352424,"server_id":15,"link":"photo_3314649.html","width":130,"caption":"Tiger Tiger, Interior architecture, Kevin Meechan Photography ","height":98});
															thumbnails[3314950] = clik.newPhoto({"id":3314950,"src":"DSC_3980BWWillowTeaRooms7dpi_thumb.jpg","galleries_id":352424,"server_id":15,"link":"photo_3314950.html","width":84,"caption":"Award winning, image, Tettley Tea,  Glasgow, Kevin Meechan Photography, ","height":130});
															thumbnails[6372498] = clik.newPhoto({"id":6372498,"src":"Pic_03_EA960DA5-1D09-001F-99FA8D859FDD6BE3_thumb.jpg","galleries_id":352424,"server_id":15,"link":"photo_6372498.html","width":100,"caption":"food, advertising, Kevin Meechan Photography","height":67});
															thumbnails[6491842] = clik.newPhoto({"id":6491842,"src":"DSC_8542WebRedspire72dpi_thumb.jpg","galleries_id":352421,"server_id":15,"link":"photo_6491842.html","width":86,"caption":"Corporate Portrait, Redspire IT","height":130});
															thumbnails[6491849] = clik.newPhoto({"id":6491849,"src":"DSC_8507WebRedspire72dpi_thumb.jpg","galleries_id":352421,"server_id":15,"link":"photo_6491849.html","width":86,"caption":"Corporate Portrait, Redspire IT","height":130});
															thumbnails[6491851] = clik.newPhoto({"id":6491851,"src":"DSC_8501WebRedspire72dpi_thumb.jpg","galleries_id":352421,"server_id":15,"link":"photo_6491851.html","width":86,"caption":"Corporate Portrait, Redspire IT","height":130});
															thumbnails[7247826] = clik.newPhoto({"id":7247826,"src":"Corporate_1_72dpi_thumb.jpg","galleries_id":352421,"server_id":15,"link":"photo_7247826.html","width":62,"caption":"Corporate Portrait, Glasgow Simon Community","height":130});
															thumbnails[3314643] = clik.newPhoto({"id":3314643,"src":"Stilllife_WatchFeathers72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_3314643.html","width":92,"caption":"Classic Still Life, Kevin Meechan Photography","height":130});
															thumbnails[3314646] = clik.newPhoto({"id":3314646,"src":"Pic_05_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_3314646.html","width":100,"caption":"Abstract Digital, Kevin Meechan Phtotography ","height":71});
															thumbnails[3314657] = clik.newPhoto({"id":3314657,"src":"Lava_Astronauts_Planets72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_3314657.html","width":130,"caption":"60's, space theme, Kevin Meechan Photography","height":74});
															thumbnails[3314882] = clik.newPhoto({"id":3314882,"src":"PICT0608_72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_3314882.html","width":130,"caption":"summer, giant daisies, Kevin Meechan Photography","height":98});
															thumbnails[3314960] = clik.newPhoto({"id":3314960,"src":"DSC_7595_copy72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_3314960.html","width":86,"caption":"victorian, style, dress, Kevin Meechan Photography","height":130});
															thumbnails[6372523] = clik.newPhoto({"id":6372523,"src":"Pic_08_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_6372523.html","width":67,"caption":"Glasgow Cathedral, exterior architecture at night, Kevin Meechan Photography","height":100});
															thumbnails[6491556] = clik.newPhoto({"id":6491556,"src":"After_Dark72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_6491556.html","width":130,"caption":"After Dark, landscape, Kevin Meechan Photography","height":86});
															thumbnails[6498281] = clik.newPhoto({"id":6498281,"src":"DSC_3484_72dpi_thumb.jpg","galleries_id":352422,"server_id":15,"link":"photo_6498281.html","width":86,"caption":"Foam Fountain, Statue, Kevin Meechan Photography","height":130});
															thumbnails[6282214] = clik.newPhoto({"id":6282214,"src":"web_Advert_Home_Portraiture_2010__300dpi_copy_thumb.jpg","galleries_id":348869,"server_id":15,"link":"photo_6282214.html","width":130,"caption":"Home Portraiture Price List","height":184});
															thumbnails[6282350] = clik.newPhoto({"id":6282350,"src":"formywebsite157_1kb_thumb.jpg","galleries_id":348869,"server_id":15,"link":"photo_6282350.html","width":130,"caption":"Wedding Photography Price List","height":184});
															thumbnails[6282351] = clik.newPhoto({"id":6282351,"src":"email_Advert_food_72dpi_thumb.jpg","galleries_id":348869,"server_id":15,"link":"photo_6282351.html","width":130,"caption":"Commercial Photography","height":184});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  							galleries[348869] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prices-Photography","link":"photo_6282214.html","maxRecords":0.0,"photoIDs":[6282214.0,6282350.0,6282351.0],"skipIndex":true,"section_code":"section416409","featured_images":"6282351,6282350,6282214","id":348869,"singleSection":true});				  						galleries[201997] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding- Photography-Glasgow","link":"section418399.html","maxRecords":0.0,"photoIDs":[3653739.0,3653763.0,3653771.0,3653790.0,6614931.0,6637841.0],"skipIndex":0,"section_code":"section418399","featured_images":"6637841,6614931,3653790,3653771,3653763,3653739","id":201997,"singleSection":true});				  						galleries[352378] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Family Portraiture","link":"section418400.html","maxRecords":0.0,"photoIDs":[6372387.0,6372425.0,6372518.0,6491528.0,6584143.0,7247854.0],"skipIndex":0,"section_code":"section418400","featured_images":"7247854,6584143,6491528,6372518,6372425,6372387","id":352378,"singleSection":true});				  						galleries[352419] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fashion","link":"section418398.html","maxRecords":0.0,"photoIDs":[3314642.0,6372360.0,6498406.0,6498412.0,7247512.0,7247564.0],"skipIndex":0,"section_code":"section418398","featured_images":"7247564,7247512,6498412,6498406,6372360,3314642","id":352419,"singleSection":true});				  							galleries[352420] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Press & PR","link":"photo_6498480.html","maxRecords":0.0,"photoIDs":[6498480.0,6498519.0,7248242.0,7248291.0],"skipIndex":true,"section_code":"section418401","featured_images":"7248291,7248242,6498519,6498480","id":352420,"singleSection":true});				  						galleries[352421] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Corporate","link":"section418395.html","maxRecords":0.0,"photoIDs":[6491842.0,6491849.0,6491851.0,7247826.0],"skipIndex":0,"section_code":"section418395","featured_images":"7247826,6491851,6491849,6491842","id":352421,"singleSection":true});				  						galleries[352422] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Personal Work","link":"section418397.html","maxRecords":0.0,"photoIDs":[3314643.0,3314646.0,3314657.0,3314882.0,3314960.0,6372523.0,6491556.0,6498281.0],"skipIndex":0,"section_code":"section418397","featured_images":"6498281,6491556,6372523,3314960,3314882,3314657,3314646,3314643","id":352422,"singleSection":true});				  						galleries[352424] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Advertising","link":"section418403.html","maxRecords":0.0,"photoIDs":[3314649.0,3314950.0,6372498.0],"skipIndex":0,"section_code":"section418403","featured_images":"6372498,3314950,3314649","id":352424,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[236568] = '6498281,6491556,6372523,3314960,3314882,3314657,3314646,3314643';
imageSets[197199] = '6637841,6614931,3653790,3653771,3653763';
imageSets[1] = '6637841,6614931,3653790,3653771,3653763,3653739';
imageSets[3] = '7248291,7248242,7247854,7247826,7247564,7247512,6637841,6614931,6584143,6498519,6498480,6498412,6498406,6498281,6491851,6491849,6491842,6491556,6491528,6372523,6372518,6372498,6372425,6372387,6372360,6282351,6282350,6282214,3653790,3653771,3653763,3653739,3314960,3314950,3314882,3314657,3314649,3314646,3314643,3314642';
imageSets[236397] = '6282351,6282350,6282214';
imageSets[236562] = '6637841,6584143,3653790,3653771,3653763,3653739';
imageSets[236563] = '7247564,7247512,6498412,6498406,6372360,3314960,3314642';
imageSets[236564] = '7247564,7247512,6584143,6491528,6372518,6372425,6372387,6282214';
imageSets[236565] = '7248291,7248242,6498519,6498480';
imageSets[236566] = '6372498,6282351,3314950,3314649';
imageSets[236567] = '7247826,6491851,6491849,6491842';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/KMP/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/KMP/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/KMP/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 += 'section418399.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 && 'section418399' != '') {
					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 = photoCaption + ': Kevin Meechan Photography';
			    }
        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>Kevin Meechan </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="KMP">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

