window.thumbnails = new Object();
												thumbnails[7731319] = new thumbnail(7731319,'','','Annabelle-and-Peter6_thumb.jpg',130, 87,1,'#');
												thumbnails[7731229] = new thumbnail(7731229,'418240','','Candid11-2_thumb.jpg',130, 55,1,'photo_7731229.html');
												thumbnails[7731336] = new thumbnail(7731336,'418237','','Kirsty-and-John-655-of-695_thumb.jpg',130, 87,1,'photo_7731336.html');
												thumbnails[7731380] = new thumbnail(7731380,'418239','','Ceremony-429_thumb.jpg',130, 87,1,'photo_7731380.html');
												thumbnails[7731383] = new thumbnail(7731383,'418240','','flowers3_thumb.jpg',130, 87,1,'photo_7731383.html');
												thumbnails[7731385] = new thumbnail(7731385,'418237','','0164_thumb.jpg',130, 194,1,'photo_7731385.html');
												thumbnails[7731387] = new thumbnail(7731387,'418240','','beer-and-flowers1_thumb.jpg',130, 195,1,'photo_7731387.html');
												thumbnails[7731388] = new thumbnail(7731388,'418239','','Blacky4_thumb.jpg',130, 90,1,'photo_7731388.html');
												thumbnails[7731389] = new thumbnail(7731389,'418239','','Blacky-and-the-boys4_thumb.jpg',130, 87,1,'photo_7731389.html');
												thumbnails[7731392] = new thumbnail(7731392,'418239','','bridesmaid2_thumb.jpg',130, 229,1,'photo_7731392.html');
												thumbnails[7731393] = new thumbnail(7731393,'418239','','Bridesmaid-Page-boys8_thumb.jpg',130, 87,1,'photo_7731393.html');
												thumbnails[7731394] = new thumbnail(7731394,'418239','','bridesmaids4_thumb.jpg',130, 195,1,'photo_7731394.html');
												thumbnails[7731456] = new thumbnail(7731456,'418240','','bridesmaids-shoe1ns_thumb.jpg',130, 99,1,'photo_7731456.html');
												thumbnails[7731458] = new thumbnail(7731458,'418237','','Cake-Speeches359_thumb.jpg',130, 195,1,'photo_7731458.html');
												thumbnails[7731465] = new thumbnail(7731465,'418237','','Cake-Speeches-and-Dancing-_thumb.jpg',130, 43,1,'photo_7731465.html');
												thumbnails[7731466] = new thumbnail(7731466,'418240','','cake1_thumb.jpg',130, 195,1,'photo_7731466.html');
												thumbnails[7731468] = new thumbnail(7731468,'418240','','cake3_thumb.jpg',130, 87,1,'photo_7731468.html');
												thumbnails[7731471] = new thumbnail(7731471,'418239','','Candid-92_thumb.jpg',130, 87,1,'photo_7731471.html');
												thumbnails[7731473] = new thumbnail(7731473,'418239','','Candid-127_thumb.jpg',130, 87,1,'photo_7731473.html');
												thumbnails[7731475] = new thumbnail(7731475,'418240','','Candid-191_thumb.jpg',130, 195,1,'photo_7731475.html');
												thumbnails[7731478] = new thumbnail(7731478,'418239','','Candid-300_thumb.jpg',130, 87,1,'photo_7731478.html');
												thumbnails[7731479] = new thumbnail(7731479,'418239','','Candid_115_thumb.jpg',130, 130,1,'photo_7731479.html');
												thumbnails[7731480] = new thumbnail(7731480,'418239','','Candid_170_thumb.jpg',130, 130,1,'photo_7731480.html');
												thumbnails[7731481] = new thumbnail(7731481,'418239','','Candid_205_thumb.jpg',130, 87,1,'photo_7731481.html');
												thumbnails[7731483] = new thumbnail(7731483,'418239','','Candid_231_thumb.jpg',130, 87,1,'photo_7731483.html');
												thumbnails[7731486] = new thumbnail(7731486,'418239','','candid2ns_thumb.jpg',130, 124,1,'photo_7731486.html');
												thumbnails[7731487] = new thumbnail(7731487,'418239','','candid17-2_thumb.jpg',130, 89,1,'photo_7731487.html');
												thumbnails[7731488] = new thumbnail(7731488,'418239','','Candid21_thumb.jpg',130, 87,1,'photo_7731488.html');
												thumbnails[7731490] = new thumbnail(7731490,'418239','','Candid24_thumb.jpg',130, 195,1,'photo_7731490.html');
												thumbnails[7731491] = new thumbnail(7731491,'418239','','candid37_thumb.jpg',130, 87,1,'photo_7731491.html');
												thumbnails[7731492] = new thumbnail(7731492,'418239','','candid64_thumb.jpg',130, 87,1,'photo_7731492.html');
												thumbnails[7731493] = new thumbnail(7731493,'418237','','Ceremony-59_thumb.jpg',130, 87,1,'photo_7731493.html');
												thumbnails[7731495] = new thumbnail(7731495,'418237','','Ceremony-60_thumb.jpg',130, 87,1,'photo_7731495.html');
												thumbnails[7731496] = new thumbnail(7731496,'418239','','Ceremony-144_thumb.jpg',130, 87,1,'photo_7731496.html');
												thumbnails[7731497] = new thumbnail(7731497,'418237','','Ceremony-317_thumb.jpg',130, 87,1,'photo_7731497.html');
												thumbnails[7731498] = new thumbnail(7731498,'418237','','Chris-and-Katy26_thumb.jpg',130, 43,1,'photo_7731498.html');
												thumbnails[7731499] = new thumbnail(7731499,'418237','','Church_143_thumb.jpg',130, 195,1,'photo_7731499.html');
												thumbnails[7731502] = new thumbnail(7731502,'418239','','Church_195_thumb.jpg',130, 87,1,'photo_7731502.html');
												thumbnails[7731504] = new thumbnail(7731504,'418239','','Confetti1_thumb.jpg',130, 112,1,'photo_7731504.html');
												thumbnails[7731506] = new thumbnail(7731506,'418239','','Country-Club-104_thumb.jpg',130, 195,1,'photo_7731506.html');
												thumbnails[7731509] = new thumbnail(7731509,'418239','','cutting-cake1_thumb.jpg',130, 87,1,'photo_7731509.html');
												thumbnails[7731513] = new thumbnail(7731513,'418237','','Emily1_thumb.jpg',130, 84,1,'photo_7731513.html');
												thumbnails[7731522] = new thumbnail(7731522,'418240','','Everything-else135_thumb.jpg',130, 87,1,'photo_7731522.html');
												thumbnails[7731525] = new thumbnail(7731525,'418239','','Family-photo4_thumb.jpg',130, 86,1,'photo_7731525.html');
												thumbnails[7731526] = new thumbnail(7731526,'418240','','Feet1_thumb.jpg',130, 67,1,'photo_7731526.html');
												thumbnails[7731528] = new thumbnail(7731528,'418240','','Fireworks_2_thumb.jpg',130, 87,1,'photo_7731528.html');
												thumbnails[7731529] = new thumbnail(7731529,'418237','','Fireworks5_thumb.jpg',130, 195,1,'photo_7731529.html');
												thumbnails[7731530] = new thumbnail(7731530,'418239','','Getting-ready_15_thumb.jpg',130, 87,1,'photo_7731530.html');
												thumbnails[7731531] = new thumbnail(7731531,'418239','','Getting-Ready_77_thumb.jpg',130, 87,1,'photo_7731531.html');
												thumbnails[7731533] = new thumbnail(7731533,'418239','','Group9_thumb.jpg',130, 87,1,'photo_7731533.html');
												thumbnails[7731534] = new thumbnail(7731534,'418239','','group35_thumb.jpg',130, 166,1,'photo_7731534.html');
												thumbnails[7731535] = new thumbnail(7731535,'418237','','Group-Photos-113_thumb.jpg',130, 87,1,'photo_7731535.html');
												thumbnails[7731538] = new thumbnail(7731538,'418239','','Group-Photos-221_thumb.jpg',130, 87,1,'photo_7731538.html');
												thumbnails[7731539] = new thumbnail(7731539,'418237','','Groups-4_thumb.jpg',130, 87,1,'photo_7731539.html');
												thumbnails[7731540] = new thumbnail(7731540,'418239','','Groups-73_thumb.jpg',130, 45,1,'photo_7731540.html');
												thumbnails[7731541] = new thumbnail(7731541,'418239','','Horse-Usher_thumb.jpg',130, 195,1,'photo_7731541.html');
												thumbnails[7731542] = new thumbnail(7731542,'418240','','Ian-and-Alix5_95_thumb.jpg',130, 138,1,'photo_7731542.html');
												thumbnails[7731544] = new thumbnail(7731544,'418239','','Jack-and-Laura_109-2_thumb.jpg',130, 87,1,'photo_7731544.html');
												thumbnails[7731546] = new thumbnail(7731546,'418237','','Jo13_thumb.jpg',130, 195,1,'photo_7731546.html');
												thumbnails[7731547] = new thumbnail(7731547,'418237','','Jo-and-Kev-hdr4_thumb.jpg',130, 195,1,'photo_7731547.html');
												thumbnails[7731548] = new thumbnail(7731548,'418239','','Katy-and-Dad7_thumb.jpg',130, 195,1,'photo_7731548.html');
												thumbnails[7731550] = new thumbnail(7731550,'418237','','Kerry-and-Conrad-131-of-59_thumb.jpg',130, 86,1,'photo_7731550.html');
												thumbnails[7731551] = new thumbnail(7731551,'418240','','Kerry-and-Conrad-138-of-59_thumb.jpg',130, 87,1,'photo_7731551.html');
												thumbnails[7731552] = new thumbnail(7731552,'418239','','Kerry-and-Conrad-154-of-59_thumb.jpg',130, 87,1,'photo_7731552.html');
												thumbnails[7731553] = new thumbnail(7731553,'418237','','Kerry-and-Conrad-561-of-59_thumb.jpg',130, 87,1,'photo_7731553.html');
												thumbnails[7731554] = new thumbnail(7731554,'418240','','Kerry-and-Neil304_thumb.jpg',130, 87,1,'photo_7731554.html');
												thumbnails[7731557] = new thumbnail(7731557,'418237','','Kerry-and-Neil315_thumb.jpg',130, 43,1,'photo_7731557.html');
												thumbnails[7731558] = new thumbnail(7731558,'418239','','Kirsty-and-John-10-of-695_thumb.jpg',130, 196,1,'photo_7731558.html');
												thumbnails[7731559] = new thumbnail(7731559,'418237','','Kirsty-and-John-671-of-695_thumb.jpg',130, 87,1,'photo_7731559.html');
												thumbnails[7731560] = new thumbnail(7731560,'418240','','Lackham-detail6_thumb.jpg',130, 70,1,'photo_7731560.html');
												thumbnails[7731562] = new thumbnail(7731562,'418237','','Leaving-the-village_thumb.jpg',130, 196,1,'photo_7731562.html');
												thumbnails[7731563] = new thumbnail(7731563,'418237','','Lisa-and-Rory2_thumb.jpg',130, 196,1,'photo_7731563.html');
												thumbnails[7731564] = new thumbnail(7731564,'418239','','Malcolm-and-Katrina-205_thumb.jpg',130, 43,1,'photo_7731564.html');
												thumbnails[7731565] = new thumbnail(7731565,'418239','','Malcolm-and-Katrina-276_thumb.jpg',130, 87,1,'photo_7731565.html');
												thumbnails[7731566] = new thumbnail(7731566,'418239','','Nephew3_thumb.jpg',130, 146,1,'photo_7731566.html');
												thumbnails[7731567] = new thumbnail(7731567,'418237','','Phillipa-and-Ben-74_thumb.jpg',130, 130,1,'photo_7731567.html');
												thumbnails[7731568] = new thumbnail(7731568,'418240','','Phillipa-and-Ben-89_thumb.jpg',130, 87,1,'photo_7731568.html');
												thumbnails[7731569] = new thumbnail(7731569,'418237','','Rachel6_thumb.jpg',130, 195,1,'photo_7731569.html');
												thumbnails[7731571] = new thumbnail(7731571,'418239','','Reception_19_thumb.jpg',130, 87,1,'photo_7731571.html');
												thumbnails[7731572] = new thumbnail(7731572,'418239','','Reception-to-1st-Dance-85_thumb.jpg',130, 87,1,'photo_7731572.html');
												thumbnails[7731574] = new thumbnail(7731574,'418237','','Reception-to-1st-Dance-511_thumb.jpg',130, 195,1,'photo_7731574.html');
												thumbnails[7731576] = new thumbnail(7731576,'418239','','Reception-to-1st-Dance-514_thumb.jpg',130, 87,1,'photo_7731576.html');
												thumbnails[7731577] = new thumbnail(7731577,'418239','','Reception-venue2_thumb.jpg',130, 138,1,'photo_7731577.html');
												thumbnails[7731578] = new thumbnail(7731578,'418237','','Rob-and-Debbie_129_thumb.jpg',130, 195,1,'photo_7731578.html');
												thumbnails[7731579] = new thumbnail(7731579,'418239','','Ronni-Steve-and-Megan2_thumb.jpg',130, 196,1,'photo_7731579.html');
												thumbnails[7731580] = new thumbnail(7731580,'418239','','Ronni-Steve-Jordan-Sam-and-_thumb.jpg',130, 87,1,'photo_7731580.html');
												thumbnails[7731581] = new thumbnail(7731581,'418237','','Rory-and-Bestman1_thumb.jpg',130, 195,1,'photo_7731581.html');
												thumbnails[7731582] = new thumbnail(7731582,'418237','','Sarah-and-Steve_23_thumb.jpg',130, 195,1,'photo_7731582.html');
												thumbnails[7731583] = new thumbnail(7731583,'418237','','Sarah-and-Steve_82_thumb.jpg',130, 87,1,'photo_7731583.html');
												thumbnails[7731585] = new thumbnail(7731585,'418237','','Steve-and-Abby_33_thumb.jpg',130, 43,1,'photo_7731585.html');
												thumbnails[7731586] = new thumbnail(7731586,'418237','','Suzanne-and-Paul_17_thumb.jpg',130, 195,1,'photo_7731586.html');
												thumbnails[7731588] = new thumbnail(7731588,'418237','','Suzanne-and-Paul_144_thumb.jpg',130, 87,1,'photo_7731588.html');
												thumbnails[7731589] = new thumbnail(7731589,'418239','','The-boys4_thumb.jpg',130, 87,1,'photo_7731589.html');
												thumbnails[7731590] = new thumbnail(7731590,'418237','','The-Church_40_thumb.jpg',130, 195,1,'photo_7731590.html');
												thumbnails[7731591] = new thumbnail(7731591,'418239','','The-Church_202_thumb.jpg',130, 195,1,'photo_7731591.html');
												thumbnails[7731593] = new thumbnail(7731593,'418240','','The-Ivy-Hotel_277_thumb.jpg',130, 87,1,'photo_7731593.html');
												thumbnails[7731596] = new thumbnail(7731596,'418239','','walking-down-to-dad2_thumb.jpg',130, 198,1,'photo_7731596.html');
												thumbnails[7731597] = new thumbnail(7731597,'418237','','walking-to-reception7_thumb.jpg',130, 87,1,'photo_7731597.html');
												thumbnails[7731600] = new thumbnail(7731600,'418237','','Zoe-and-Stuart_62_thumb.jpg',130, 87,1,'photo_7731600.html');
												thumbnails[7731601] = new thumbnail(7731601,'418240','','Zoe-and-Stuart_1402_thumb.jpg',130, 195,1,'photo_7731601.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[418237] = new gallery(418237,'7731336','Bride and Groom','section501055',[7731336,7731385,7731458,7731465,7731493,7731495,7731497,7731498,7731499,7731513,7731529,7731535,7731539,7731546,7731547,7731550,7731553,7731557,7731559,7731562,7731563,7731567,7731569,7731574,7731578,7731581,7731582,7731583,7731585,7731586,7731588,7731590,7731597,7731600],0, 0, '', 'section501055_418237.html',0,0);
				  					galleries[418239] = new gallery(418239,'7731380','Wedding day','section501055',[7731380,7731388,7731389,7731392,7731393,7731394,7731471,7731473,7731478,7731479,7731480,7731481,7731483,7731486,7731487,7731488,7731490,7731491,7731492,7731496,7731502,7731504,7731506,7731509,7731525,7731530,7731531,7731533,7731534,7731538,7731540,7731541,7731544,7731548,7731552,7731558,7731564,7731565,7731566,7731571,7731572,7731576,7731577,7731579,7731580,7731589,7731591,7731596],0, 0, '', 'section501055_418239.html',0,0);
				  					galleries[418240] = new gallery(418240,'7731383','Its in the detail','section501055',[7731229,7731383,7731387,7731456,7731466,7731468,7731475,7731522,7731526,7731528,7731542,7731551,7731554,7731560,7731568,7731593,7731601],0, 0, '', 'section501055_418240.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7731319';
imageSets[2] = '7731383,7731380,7731336';
imageSets[3] = '7731601,7731600,7731597,7731596,7731593,7731591,7731590,7731589,7731588,7731586,7731585,7731583,7731582,7731581,7731580,7731579,7731578,7731577,7731576,7731574,7731572,7731571,7731569,7731568,7731567,7731566,7731565,7731564,7731563,7731562,7731560,7731559,7731558,7731557,7731554,7731553,7731552,7731551,7731550,7731548,7731547,7731546,7731544,7731542,7731541,7731540,7731539,7731538,7731535,7731534';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mafoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mafoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mafoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mafoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mafoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mafoto/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 += 'section501055.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 && 'section501055' != '') {
					href = getHomeImageLink(imageID);
	}
    
  updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
  var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
      op = $.extend({},defaults,options),
      html = '', temp = '',
      photoId = op.nextPhoto.id,
      photoCaption = op.nextPhoto.caption,
      photoSrc = op.nextPhoto.src;
		
		if (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    if (op.$photo.length > 0) {
      html = $('<img/>',{
        'class': 'mainphoto photo',
        src: photoSrc,
        id: 'mainPic',
        name: 'mainPic',
        width: op.nextPhoto.width,
        height: op.nextPhoto.height,
        alt: photoCaption,
        css: op.css || {}
      });
      if (op.href) {
      	if (op.href.match(/<a/)) {
      	  html = $(op.href).append(html);
      	} else {
		  html = $('<a/>', {
			href: op.href,
			title: photoCaption
		  }).append(html);
	    }
      } else {
      	html = $('<a/>', {
			title: photoCaption
		  }).append(html);
      }
      if (op.speed == 0) {        op.$photo.html(html);        if (op.onBefore) {          op.onBefore.apply(op.$photo);        }        if (op.onAfter) {          op.onAfter.apply(op.$photo);        }      } else {        op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){            if (op.onAfter) {		    op.onAfter.apply(this);          }		  clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Mafoto-imaging: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp = temp + '<p>Buy now using Google Checkout:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
									temp = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
	temp = temp + '	<input type="hidden" name="item_option" value="' + item_option + '">';
	temp = temp + '	<input type="hidden" name="site" value="MAFOTO">';
		temp = temp + '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp = temp + '	<input type="hidden" name="quantity" value="1">';
								temp = temp + '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
			temp = 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 = temp + '</form>';
		temp = temp + '<div class="clearing">&nbsp;</div>';
	temp = temp + '<div id="confirmContainer">';
	temp = temp + '<div id="paymentConfirm">Item added to cart</div>';
	temp = temp + '</div>';
			temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

