window.thumbnails = new Object();
												thumbnails[3330125] = new thumbnail(3330125,'','St Ives, Cornwall 2008','a 12x36 clickpic_thumb.jpg',130, 44,18,'															#');
												thumbnails[3330133] = new thumbnail(3330133,'','St Ives Town, Cornwall 2008','f 12X16 clickpic_thumb.jpg',130, 97,18,'															#');
												thumbnails[3330136] = new thumbnail(3330136,'','Whitby Abbey 2009','Image3 HDR Finished clickpic_thumb.jpg',130, 47,18,'															#');
												thumbnails[3330140] = new thumbnail(3330140,'','Castleford \'New\' Bridge 2009','z 12X36 clickpic_thumb.jpg',130, 43,18,'															#');
												thumbnails[1405619] = new thumbnail(1405619,'97647','','IMAGE1EDITED1_thumb.jpg',130, 94,18,'																			photo_1405619.html');
												thumbnails[1405620] = new thumbnail(1405620,'97647','','PHOTO07_61_thumb.JPG',130, 174,18,'																			photo_1405620.html');
												thumbnails[1405621] = new thumbnail(1405621,'97647','','PICTURE 006_thumb.JPG',130, 86,18,'																			photo_1405621.html');
												thumbnails[1405622] = new thumbnail(1405622,'97647','','PICTURE024_thumb.jpg',130, 86,18,'																			photo_1405622.html');
												thumbnails[1405623] = new thumbnail(1405623,'97647','','PICTURE 039_thumb.JPG',130, 196,18,'																			photo_1405623.html');
												thumbnails[1405624] = new thumbnail(1405624,'97647','','PICTURE 045_thumb.jpg',130, 86,18,'																			photo_1405624.html');
												thumbnails[1405625] = new thumbnail(1405625,'97647','','PICTURE 109_thumb.jpg',130, 196,18,'																			photo_1405625.html');
												thumbnails[1405628] = new thumbnail(1405628,'97647','','PICTURE 153_thumb.jpg',130, 86,18,'																			photo_1405628.html');
												thumbnails[1405629] = new thumbnail(1405629,'97647','','PICTURE 194_thumb.jpg',130, 196,18,'																			photo_1405629.html');
												thumbnails[1405632] = new thumbnail(1405632,'97647','','PICTURE 197_thumb.jpg',130, 196,18,'																			photo_1405632.html');
												thumbnails[1405659] = new thumbnail(1405659,'97643','','1_thumb.jpg',130, 196,18,'																			photo_1405659.html');
												thumbnails[1406225] = new thumbnail(1406225,'97643','','farrahsmall1_thumb.jpg',130, 86,18,'																			photo_1406225.html');
												thumbnails[1406228] = new thumbnail(1406228,'97643','','Image2edited_thumb.jpg',130, 195,18,'																			photo_1406228.html');
												thumbnails[1406242] = new thumbnail(1406242,'97643','','Picture 022_thumb.jpg',130, 193,18,'																			photo_1406242.html');
												thumbnails[1406246] = new thumbnail(1406246,'97643','','Picture 038_thumb.jpg',130, 88,18,'																			photo_1406246.html');
												thumbnails[1406248] = new thumbnail(1406248,'97643','','Picture 041_thumb.jpg',130, 193,18,'																			photo_1406248.html');
												thumbnails[1406251] = new thumbnail(1406251,'97643','','Picture 042_thumb.jpg',130, 88,18,'																			photo_1406251.html');
												thumbnails[1406252] = new thumbnail(1406252,'97643','','Picture 054_thumb.jpg',130, 88,18,'																			photo_1406252.html');
												thumbnails[1406254] = new thumbnail(1406254,'97643','','Picture 165_thumb.jpg',130, 88,18,'																			photo_1406254.html');
												thumbnails[1406727] = new thumbnail(1406727,'97648','','16_thumb.jpg',130, 86,18,'																			photo_1406727.html');
												thumbnails[1406731] = new thumbnail(1406731,'97648','','18_thumb.jpg',130, 86,18,'																			photo_1406731.html');
												thumbnails[1406736] = new thumbnail(1406736,'97648','','Image3small_thumb.jpg',130, 88,18,'																			photo_1406736.html');
												thumbnails[1484897] = new thumbnail(1484897,'97643','','faceedited_thumb.jpg',130, 193,18,'																			photo_1484897.html');
												thumbnails[1484965] = new thumbnail(1484965,'97647','','wed3_thumb.jpg',130, 86,18,'																			photo_1484965.html');
												thumbnails[1484971] = new thumbnail(1484971,'97647','','wed11_thumb.jpg',130, 87,18,'																			photo_1484971.html');
												thumbnails[1484972] = new thumbnail(1484972,'97647','','wed21_thumb.jpg',130, 194,18,'																			photo_1484972.html');
												thumbnails[1484975] = new thumbnail(1484975,'97647','','wed5_thumb.jpg',130, 87,18,'																			photo_1484975.html');
												thumbnails[1484976] = new thumbnail(1484976,'97647','','wed6_thumb.jpg',130, 87,18,'																			photo_1484976.html');
												thumbnails[1484978] = new thumbnail(1484978,'97647','','wed7_thumb.jpg',130, 194,18,'																			photo_1484978.html');
												thumbnails[1484980] = new thumbnail(1484980,'97647','','wed8_thumb.jpg',130, 87,18,'																			photo_1484980.html');
												thumbnails[1518804] = new thumbnail(1518804,'104246','Mal from the \'Spunksters\'','Image1mm_thumb.jpg',130, 194,18,'																			photo_1518804.html');
												thumbnails[1518806] = new thumbnail(1518806,'104246','Jimmy \'tourettes\'','Image2mm_thumb.jpg',130, 87,18,'																			photo_1518806.html');
												thumbnails[1547161] = new thumbnail(1547161,'97647','','Image41_thumb.jpg',130, 88,18,'																			photo_1547161.html');
												thumbnails[1547163] = new thumbnail(1547163,'97647','','Image52_thumb.jpg',130, 88,18,'																			photo_1547163.html');
												thumbnails[1547164] = new thumbnail(1547164,'97647','','Image6_thumb.jpg',130, 88,18,'																			photo_1547164.html');
												thumbnails[1547169] = new thumbnail(1547169,'97648','','Image7_thumb.jpg',130, 88,18,'																			photo_1547169.html');
												thumbnails[1547177] = new thumbnail(1547177,'97648','','Image9_thumb.jpg',130, 88,18,'																			photo_1547177.html');
												thumbnails[1547179] = new thumbnail(1547179,'97643','','Image10_thumb.jpg',130, 192,18,'																			photo_1547179.html');
												thumbnails[1547181] = new thumbnail(1547181,'97647','','Image111_thumb.jpg',130, 88,18,'																			photo_1547181.html');
												thumbnails[1547182] = new thumbnail(1547182,'97647','','Image12_thumb.jpg',130, 195,18,'																			photo_1547182.html');
												thumbnails[1547183] = new thumbnail(1547183,'97647','','Image13_thumb.jpg',130, 194,18,'																			photo_1547183.html');
												thumbnails[1547209] = new thumbnail(1547209,'97643','','Image15_thumb.jpg',130, 188,18,'																			photo_1547209.html');
												thumbnails[1567936] = new thumbnail(1567936,'97643','','por1_thumb.jpg',130, 196,18,'																			photo_1567936.html');
												thumbnails[1567938] = new thumbnail(1567938,'97643','','por2_thumb.jpg',130, 87,18,'																			photo_1567938.html');
												thumbnails[1567942] = new thumbnail(1567942,'104246','Breeze and Wilson','breeze1_thumb.jpg',130, 87,18,'																			photo_1567942.html');
												thumbnails[1567943] = new thumbnail(1567943,'104246','Breeze and Wilson','breeze2_thumb.jpg',130, 123,18,'																			photo_1567943.html');
												thumbnails[1567952] = new thumbnail(1567952,'97643','','den2_thumb.jpg',130, 195,18,'																			photo_1567952.html');
												thumbnails[1567971] = new thumbnail(1567971,'97647','','wedding121_thumb.jpg',130, 194,18,'																			photo_1567971.html');
												thumbnails[1583083] = new thumbnail(1583083,'104246','the dangerous stiltwalkers','firefest1clik_thumb.jpg',130, 88,18,'																			photo_1583083.html');
												thumbnails[1583084] = new thumbnail(1583084,'104246','','firefest2clik_thumb.jpg',130, 87,18,'																			photo_1583084.html');
												thumbnails[1583090] = new thumbnail(1583090,'104246','','firefest3clik_thumb.jpg',130, 87,18,'																			photo_1583090.html');
												thumbnails[1583227] = new thumbnail(1583227,'104246','Ian \'Angus\'','ian1clik_thumb.jpg',130, 193,18,'																			photo_1583227.html');
												thumbnails[1583263] = new thumbnail(1583263,'104246','\'The Erics\'','erics1_thumb.jpg',130, 88,18,'																			photo_1583263.html');
												thumbnails[1583265] = new thumbnail(1583265,'104246','\'The Erics\'','erics2_thumb.jpg',130, 88,18,'																			photo_1583265.html');
												thumbnails[1583299] = new thumbnail(1583299,'104246','Bassist/singer of \'the erics\'','erics3_thumb.jpg',130, 157,18,'																			photo_1583299.html');
												thumbnails[3583878] = new thumbnail(3583878,'97647','','wedding_thumb.jpg',130, 110,18,'																			photo_3583878.html');
												thumbnails[5738320] = new thumbnail(5738320,'97643','','1_BE8D0011-1D09-001F-991C90DA15016E84_thumb.jpg',130, 186,18,'																			photo_5738320.html');
												thumbnails[5738321] = new thumbnail(5738321,'97643','','1aa_thumb.jpg',130, 186,18,'																			photo_5738321.html');
												thumbnails[5738328] = new thumbnail(5738328,'97648','','1b_thumb.jpg',130, 90,18,'																			photo_5738328.html');
												thumbnails[5738332] = new thumbnail(5738332,'97648','','1e_thumb.jpg',130, 186,18,'																			photo_5738332.html');
												thumbnails[5738333] = new thumbnail(5738333,'97643','','1f_thumb.jpg',130, 186,18,'																			photo_5738333.html');
												thumbnails[5738335] = new thumbnail(5738335,'97648','','1small_thumb.jpg',130, 96,18,'																			photo_5738335.html');
												thumbnails[5738337] = new thumbnail(5738337,'97643','','2_thumb.jpg',130, 188,18,'																			photo_5738337.html');
												thumbnails[5738338] = new thumbnail(5738338,'97648','','2d_thumb.jpg',130, 186,18,'																			photo_5738338.html');
												thumbnails[5738339] = new thumbnail(5738339,'97643','','2j_thumb.jpg',130, 186,18,'																			photo_5738339.html');
												thumbnails[5738340] = new thumbnail(5738340,'97648','','2small_thumb.jpg',130, 91,18,'																			photo_5738340.html');
												thumbnails[5738341] = new thumbnail(5738341,'97648','','3_pp_thumb.jpg',130, 89,18,'																			photo_5738341.html');
												thumbnails[5738342] = new thumbnail(5738342,'97648','','3a_thumb.jpg',130, 198,18,'																			photo_5738342.html');
												thumbnails[5738343] = new thumbnail(5738343,'97648','','3h_thumb.jpg',130, 186,18,'																			photo_5738343.html');
												thumbnails[5738349] = new thumbnail(5738349,'97643','','4_thumb.jpg',130, 89,18,'																			photo_5738349.html');
												thumbnails[5738350] = new thumbnail(5738350,'97643','','7_thumb.jpg',130, 93,18,'																			photo_5738350.html');
												thumbnails[5738351] = new thumbnail(5738351,'97643','','8_thumb.jpg',130, 91,18,'																			photo_5738351.html');
												thumbnails[5738352] = new thumbnail(5738352,'97648','','b_12X16_thumb.jpg',130, 174,18,'																			photo_5738352.html');
												thumbnails[5738354] = new thumbnail(5738354,'97643','','Image1_thumb.jpg',130, 128,18,'																			photo_5738354.html');
												thumbnails[5738355] = new thumbnail(5738355,'97648','','Image1bn_thumb.jpg',130, 93,18,'																			photo_5738355.html');
												thumbnails[5738356] = new thumbnail(5738356,'97643','','Image1zx_thumb.jpg',130, 183,18,'																			photo_5738356.html');
												thumbnails[5738362] = new thumbnail(5738362,'97648','','Image2a_thumb.jpg',130, 89,18,'																			photo_5738362.html');
												thumbnails[5738363] = new thumbnail(5738363,'97643','','Image2axc_thumb.jpg',130, 91,18,'																			photo_5738363.html');
												thumbnails[5738367] = new thumbnail(5738367,'97648','','Image2c_thumb.jpg',130, 84,18,'																			photo_5738367.html');
												thumbnails[5738370] = new thumbnail(5738370,'97648','','Image3a_thumb.jpg',130, 204,18,'																			photo_5738370.html');
												thumbnails[5738376] = new thumbnail(5738376,'97648','','Image3x_thumb.jpg',130, 91,18,'																			photo_5738376.html');
												thumbnails[5738378] = new thumbnail(5738378,'97648','','Image7_BE97373E-1D09-001F-992D4E1F8DED7FB4_thumb.jpg',130, 259,18,'																			photo_5738378.html');
												thumbnails[5738386] = new thumbnail(5738386,'97643','','Image7_pp_thumb.jpg',130, 189,18,'																			photo_5738386.html');
												thumbnails[5738396] = new thumbnail(5738396,'97648','','Image_1jk_thumb.jpg',130, 91,18,'																			photo_5738396.html');
												thumbnails[5738398] = new thumbnail(5738398,'97643','','Jay_nude_art_studio_light_002_thumb.jpg',130, 186,18,'																			photo_5738398.html');
												thumbnails[5738399] = new thumbnail(5738399,'97643','','Lib_Garage_shoot_073_pp_thumb.jpg',130, 186,18,'																			photo_5738399.html');
												thumbnails[5738401] = new thumbnail(5738401,'97643','','Paul_Rowes_shoot_061_edit_thumb.jpg',130, 186,18,'																			photo_5738401.html');
												thumbnails[5738402] = new thumbnail(5738402,'97648','','Yorkshire_Studios_29th_March_09_144edit_thumb.jpg',130, 91,18,'																			photo_5738402.html');
												thumbnails[5738403] = new thumbnail(5738403,'97648','','Yorkshire_Studios_29th_March_09_211_thumb.jpg',130, 91,18,'																			photo_5738403.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[97648] = new gallery(97648,'5738403,5738402,5738396,5738378,5738376,5738370,5738367,5738362,5738355,5738352','Portfolio\'s','gallery',[1406727,1406731,1406736,1547169,1547177,5738328,5738332,5738335,5738338,5738340,5738341,5738342,5738343,5738352,5738355,5738362,5738367,5738370,5738376,5738378,5738396,5738402,5738403],0, 0, '', '																																																																																																							gallery_97648.html',0,0);
				  					galleries[97647] = new gallery(97647,'3583878,1567971,1547183,1547182,1547181,1547164,1547163,1547161,1484980,1484978','Weddings','gallery',[1405619,1405620,1405621,1405622,1405623,1405624,1405625,1405628,1405629,1405632,1484965,1484971,1484972,1484975,1484976,1484978,1484980,1547161,1547163,1547164,1547181,1547182,1547183,1567971,3583878],0, 0, '', '																																																																																																							gallery_97647.html',0,0);
				  					galleries[97643] = new gallery(97643,'5738401,5738399,5738398,5738386,5738363,5738356,5738354,5738351,5738350,5738349','Portraits','gallery',[1405659,1406225,1406228,1406242,1406246,1406248,1406251,1406252,1406254,1484897,1547179,1547209,1567936,1567938,1567952,5738320,5738321,5738333,5738337,5738339,5738349,5738350,5738351,5738354,5738356,5738363,5738386,5738398,5738399,5738401],0, 0, '', '																																																																																																							gallery_97643.html',0,0);
				  					galleries[104246] = new gallery(104246,'1583299,1583265,1583263,1583227,1583090,1583084,1583083,1567943,1567942,1518806','Performing','gallery',[1518804,1518806,1567942,1567943,1583083,1583084,1583090,1583227,1583263,1583265,1583299],0, 0, '', '																																																																																																							gallery_104246.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5738399,5738349,5738342,5738333,5738332,3583878,1567971,1567952,1547183,1547182,1547181,1547179,1547177,1547169,1547164,1547163,1547161,1405629,1405625,1405619';
imageSets[3] = '5738403,5738402,5738401,5738399,5738398,5738396,5738386,5738378,5738376,5738370,5738367,5738363,5738362,5738356,5738355,5738354,5738352,5738351,5738350,5738349,5738343,5738342,5738341,5738340,5738339,5738338,5738337,5738335,5738333,5738332,5738328,5738321,5738320,3583878,3330140,3330136,3330133,3330125,1583299,1583265,1583263,1583227,1583090,1583084,1583083,1567971,1567952,1567943,1567942,1567938';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sykesphotography/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sykesphotography/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('');
		if (!basic) {
	img.src = photos[imageID].src;
	img.width = photos[imageID].width;
	img.height = photos[imageID].height;
  img.parentNode.title = img.alt = photos[imageID].caption;
	}
	else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
				
	}
			}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}
/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
  var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
		if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
    
  updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
  var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',
                    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));		}, 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 = 'sykesphotography: ' + 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));    }        
    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>';
	}
					
				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>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 							' + (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="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		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 + '<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;
	}
}

			

