window.thumbnails = new Object();
												thumbnails[2171679] = new thumbnail(2171679,'','Leaf and Rose rings, 2008','Web image 1_thumb.jpg',130, 133,1,'															#');
												thumbnails[2172063] = new thumbnail(2172063,'','Oval Brooch, 2008','Web image 5_thumb.jpg',130, 139,1,'															#');
												thumbnails[2172073] = new thumbnail(2172073,'','Leaf Neckpiece, 2008','Web image 21_thumb.jpg',130, 173,1,'															#');
												thumbnails[2172077] = new thumbnail(2172077,'','Leaf Brooch, 2008','Web image 31_thumb.jpg',130, 162,1,'															#');
												thumbnails[2325411] = new thumbnail(2325411,'','Rose Wire Earrings, 2008','Rose Wire Earrings_thumb.jpg',130, 88,1,'															#');
												thumbnails[2325424] = new thumbnail(2325424,'','Leaf Earrings, 2008','Wreath earrings_thumb.jpg',130, 90,1,'															#');
												thumbnails[2619909] = new thumbnail(2619909,'','Selection of Brooches, 2008','BroochCluster3_thumb.jpg',98, 130,1,'															#');
												thumbnails[3163786] = new thumbnail(3163786,'','Leaf 2 Stud Earrings, 2008','Copy (1) of IMG_3162a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163796] = new thumbnail(3163796,'','Square Leaf Cluster Earrings, 2008','Copy (1) of IMG_3218a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325013] = new thumbnail(3325013,'','Leaf 1 Stud Earring (Black), 2008','Leaf 1 Stud Earring (Black)_thumb.jpg',108, 130,1,'															#');
												thumbnails[3163965] = new thumbnail(3163965,'','Circle Leaf Neckpiece, 2008','IMG_3202a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163810] = new thumbnail(3163810,'','Rose Circle Neckpiece, 2008','IMG_3092a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163807] = new thumbnail(3163807,'','Flat Frame Circle Wire Necklace, 2008','IMG_3083_1a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163963] = new thumbnail(3163963,'','Flat Frame Circle Necklace, 2008','IMG_3188a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163927] = new thumbnail(3163927,'','White Leaf Patterned Brooch with Black Detail, 2008','IMG_3114a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3164079] = new thumbnail(3164079,'','White Circle Brooch with Leaf Detail, 2008','IMG_3225a_thumb.jpg',130, 130,1,'															#');
												thumbnails[7174864] = new thumbnail(7174864,'','Leaf 1 Stud - Mini','Leaf_1_Stud_Earring_Mini_thumb.JPG',160, 123,1,'															#');
												thumbnails[3163813] = new thumbnail(3163813,'','Black Circle Brooch with Rose Cluster, 2008','IMG_3098_1a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163930] = new thumbnail(3163930,'','Box Leaf Cluster Brooch, 2008','IMG_3135a_thumb.jpg',130, 130,1,'															#');
												thumbnails[7174838] = new thumbnail(7174838,'','Leaf 2 Stud - Mini, Oxidised','Leaf_2_Stud_Mini_thumb.jpg',160, 124,1,'															#');
												thumbnails[3163929] = new thumbnail(3163929,'','Circle Leaf Pattern Earrings, 2008','IMG_3116_1a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163820] = new thumbnail(3163820,'','Circle Leaf Pattern Earring, 2008','IMG_3105a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3324972] = new thumbnail(3324972,'','Square Leaf Cluster Earrings (Black), 2008','IMG_3222a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3324978] = new thumbnail(3324978,'','Square Leaf Cluster Earring (Gold-plated), 2008','IMG_3177b_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325008] = new thumbnail(3325008,'','Double Domed Rose CLuster Cufflinks (Black) (Gold-plated), 2008','IMG_3230_1b_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163797] = new thumbnail(3163797,'','Double Domed Rose Cluster Cufflinks (Black), 2008','IMG_3046a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163931] = new thumbnail(3163931,'','Double Domed Rose Cluster Ring, 2008','IMG_3172a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3164081] = new thumbnail(3164081,'','Flat Frame Oval Drop Earring, 2008','IMG_3234a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325018] = new thumbnail(3325018,'','Leaf 1 Stud Earring (Miniature, Gold-plated), 2008','IMG_3161a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325021] = new thumbnail(3325021,'','Leaf 1 Stud Earring (White, Patterned), 2008','IMG_3157a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325125] = new thumbnail(3325125,'','Leaf 1 Stud Earring (Gold-Plated), 2008','IMG_3154a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3325030] = new thumbnail(3325030,'','Leaf 2 Stud Earring (White), 2008','IMG_3155a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3164083] = new thumbnail(3164083,'','Wire Leaf Stud Earring, 2008','IMG_3235a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3163966] = new thumbnail(3163966,'','Small Wire Leaf Necklace and Small Solid Leaf Necklace, 2008','IMG_3208a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3164077] = new thumbnail(3164077,'','Small Solid Leaf Necklace and Leaf Earring','IMG_3217a_thumb.jpg',130, 130,1,'															#');
												thumbnails[3164076] = new thumbnail(3164076,'','Small Wire Leaf Necklace and Wire Leaf Earring, 2008','IMG_3212a_thumb.jpg',130, 130,1,'															#');
												thumbnails[2172064] = new thumbnail(2172064,'387545','Rose Brooch, 2008','Web image 6_thumb.jpg',130, 173,1,'																			photo_2172064.html');
												thumbnails[2171695] = new thumbnail(2171695,'143892','','Web image 7_thumb.jpg',130, 192,1,'																			photo_2171695.html');
												thumbnails[7172594] = new thumbnail(7172594,'387543','Leaf Cluster Bangle with Natural Pearl and Rose Quartz','Leaf_Cluster_Bangle_Light_thumb.jpg',160, 143,1,'																			photo_7172594.html');
												thumbnails[7174747] = new thumbnail(7174747,'387542','Double Domed Leaf Cluster Cufflinks - Oxidised','Double_Domed_Leaf_Cluster_Cufflinks_thumb.jpg',160, 111,1,'																			photo_7174747.html');
												thumbnails[7174755] = new thumbnail(7174755,'387544','Circle Leaf Cluster Dome Stud','Circle_Leaf_Cluster_Dome_Stud_thumb.jpg',160, 107,1,'																			photo_7174755.html');
												thumbnails[7174926] = new thumbnail(7174926,'387546','Double Domed Leaf Cluster Necklace - Dark with Black Onyx and Natural Pearl','Double_Domed_Leaf_Cluster_Necklace_Dark_thumb.jpg',160, 115,1,'																			photo_7174926.html');
												thumbnails[7175040] = new thumbnail(7175040,'387541','Double Domed Rose Cluster Ring - Oxidised','Double_Domed_Rose_Cluster_Ring_Oxidised1_thumb.jpg',160, 124,1,'																			photo_7175040.html');
												thumbnails[7357750] = new thumbnail(7357750,'387545','Brooches','BroochCluster2_thumb.jpg',120, 160,1,'																			photo_7357750.html');
												thumbnails[2172056] = new thumbnail(2172056,'143892','','Web images 4_thumb.jpg',130, 173,1,'																			photo_2172056.html');
												thumbnails[7174499] = new thumbnail(7174499,'387543','Rose Cluster Bangle with Black Onyx and Amethyst','Rose_Cluster_Bangle_Dark_thumb.jpg',160, 141,1,'																			photo_7174499.html');
												thumbnails[7174746] = new thumbnail(7174746,'387542','Double Domed Leaf Cluster Cufflinks','Double_Domed_Leaf_Cluster_Cufflinks_Silver_thumb.jpg',160, 109,1,'																			photo_7174746.html');
												thumbnails[7174757] = new thumbnail(7174757,'387544','Square Leaf Cluster Stud - Oxidised','Square_Leaf_Cluster_Stud_Oxidised_thumb.JPG',160, 134,1,'																			photo_7174757.html');
												thumbnails[7174930] = new thumbnail(7174930,'387546','Double Domed Leaf Cluster Necklace - Light with Amazonite and Natural Pearl','Double_Domed_Leaf_Cluster_Necklace_thumb.jpg',160, 120,1,'																			photo_7174930.html');
												thumbnails[7175044] = new thumbnail(7175044,'387541','Double Domd Leaf Cluster Ring - Dark','Leaf_Cluster_Ring_300dpi_thumb.jpg',160, 127,1,'																			photo_7175044.html');
												thumbnails[7357609] = new thumbnail(7357609,'387545','Circle Leaf Cluster Brooch with 9ct Gold','Brooch_2008_thumb.jpg',128, 160,1,'																			photo_7357609.html');
												thumbnails[2172049] = new thumbnail(2172049,'143892','','Web images 1_thumb.jpg',130, 168,1,'																			photo_2172049.html');
												thumbnails[7174615] = new thumbnail(7174615,'387543','Rose Cluster Bangle with Natural Pearl and Amazonite','Rose_Cluster_Bangle_Light_thumb.jpg',160, 141,1,'																			photo_7174615.html');
												thumbnails[7174758] = new thumbnail(7174758,'387544','Square Leaf Cluster Stud','Square_Leaf_Cluster_Stud_thumb.jpg',160, 131,1,'																			photo_7174758.html');
												thumbnails[7174823] = new thumbnail(7174823,'387544','Circle Pattern with Leaf Detail','Leaf_Pattern_with_Leaf_Black_thumb.jpg',160, 114,1,'																			photo_7174823.html');
												thumbnails[7175006] = new thumbnail(7175006,'387546','Large Cube Leaf Cluster Pendant','Large_Cube_Leaf_Cluster_thumb.jpg',160, 103,1,'																			photo_7175006.html');
												thumbnails[7175047] = new thumbnail(7175047,'387541','Double Domed Rose Cluster Ring','Rose_Cluster_Ring_300dpi_thumb.jpg',160, 120,1,'																			photo_7175047.html');
												thumbnails[7357872] = new thumbnail(7357872,'387545','Coaster Brooch with Gold Plated Leaf Detail','Coaster_Brooch_-_Oxidised_with_Silver_and_Gold_Plated_Leaf_thumb.JPG',160, 150,1,'																			photo_7357872.html');
												thumbnails[2172052] = new thumbnail(2172052,'143892','','Web images 3_thumb.jpg',130, 189,1,'																			photo_2172052.html');
												thumbnails[7172527] = new thumbnail(7172527,'387543','Bangles','Bangles_thumb.jpg',130, 79,1,'																			photo_7172527.html');
												thumbnails[7174751] = new thumbnail(7174751,'387542','Square Leaf Cufflinks - Large','Square_Leaf_Cufflinks_Large_thumb.jpg',160, 109,1,'																			photo_7174751.html');
												thumbnails[7174827] = new thumbnail(7174827,'387544','Circle Pattern with Leaf Detail','Leaf_Pattern_with_Leaf_Silver_thumb.jpg',160, 106,1,'																			photo_7174827.html');
												thumbnails[7175014] = new thumbnail(7175014,'387546','Small Cube Leaf Cluster Pendant','Small_Cube_Leaf_Cluster_thumb.jpg',160, 114,1,'																			photo_7175014.html');
												thumbnails[7357875] = new thumbnail(7357875,'387545','Coaster Brooch with Gold Plated Leaf Outline','Coaster_Brooch_-_Silver_with_Gold_Plated_Leaf_thumb.JPG',160, 129,1,'																			photo_7357875.html');
												thumbnails[2172129] = new thumbnail(2172129,'143892','','Web images 21_thumb.jpg',130, 98,1,'																			photo_2172129.html');
												thumbnails[7174754] = new thumbnail(7174754,'387542','Square Leaf Cufflinks - Small','Square_Leaf_Cufflinks_Small_thumb.jpg',160, 107,1,'																			photo_7174754.html');
												thumbnails[7174834] = new thumbnail(7174834,'387544','Leaf 1 Stud - Gold Plated','Leaf_1_Stud_Earrings_Gold_Plated_thumb.jpg',160, 108,1,'																			photo_7174834.html');
												thumbnails[7175016] = new thumbnail(7175016,'387546','Square Leaf Necklace','Square_Leaf_Necklace_thumb.jpg',160, 118,1,'																			photo_7175016.html');
												thumbnails[2172055] = new thumbnail(2172055,'143892','','Web images 6_thumb.jpg',130, 203,1,'																			photo_2172055.html');
												thumbnails[7174835] = new thumbnail(7174835,'387544','Leaf 1 Stud','Leaf_1_Stud_Earrings_thumb.JPG',160, 128,1,'																			photo_7174835.html');
												thumbnails[7175019] = new thumbnail(7175019,'387546','Leaf 2 Double Domed Neckpiece','Leaf_2_Double_Dome_Necklace_2_thumb.JPG',154, 160,1,'																			photo_7175019.html');
												thumbnails[7174836] = new thumbnail(7174836,'387544','Leaf 2 Stud ','Leaf_2_Stud_Earring_thumb.JPG',160, 123,1,'																			photo_7174836.html');
												thumbnails[7175022] = new thumbnail(7175022,'387546','Leaf Cluster Wire Circle Pendant','Flat_Frame_Wire_Circle_Neckpiece_thumb.jpg',160, 125,1,'																			photo_7175022.html');
												thumbnails[7175059] = new thumbnail(7175059,'143892','','Mum_Brooch_thumb.jpg',120, 160,1,'																			photo_7175059.html');
												thumbnails[7175081] = new thumbnail(7175081,'143892','','ROAR3_thumb.jpg',120, 160,1,'																			photo_7175081.html');
												thumbnails[7357878] = new thumbnail(7357878,'387545','Coaster Brooch - Silver with Silver Leaves','Coaster_Brooch_Silver_with_Leaves_thumb.jpg',160, 114,1,'																			photo_7357878.html');
												thumbnails[7175028] = new thumbnail(7175028,'387546','Leaf Cluster Circle Domed Neckpiece with 9ct Gold','Necklace_2008_thumb.jpg',120, 160,1,'																			photo_7175028.html');
												thumbnails[7175070] = new thumbnail(7175070,'143892','','ROAR1_thumb.jpg',160, 120,1,'																			photo_7175070.html');
												thumbnails[7357960] = new thumbnail(7357960,'387545','Coaster Brooch with 9ct Gold','Coaster_Brooch_with_Gold_thumb.jpg',160, 119,1,'																			photo_7357960.html');
												thumbnails[2172067] = new thumbnail(2172067,'387546','Rose Neckpiece, 2008','Web images 7_thumb.jpg',130, 173,1,'																			photo_2172067.html');
												thumbnails[7174869] = new thumbnail(7174869,'387544','Leaf 3 Drop Wire Earring with Natural Pearl - Oxidised','Leaf_1_Drop_Wire_Earring_thumb.jpg',160, 105,1,'																			photo_7174869.html');
												thumbnails[7175079] = new thumbnail(7175079,'143892','','ROAR2_thumb.jpg',160, 120,1,'																			photo_7175079.html');
												thumbnails[7174873] = new thumbnail(7174873,'387544','Leaf 2 Drop Wire Earring - Gold Plated with Amethyst','Leaf_2_Drop_Earrings_Gold_and_Amethist_thumb.jpg',160, 111,1,'																			photo_7174873.html');
												thumbnails[7174882] = new thumbnail(7174882,'387544','Leaf 4 Drop Wire Earring with Natural Pearl - Oxidised','Leaf_2_Drop_Wire_Earring_thumb.jpg',160, 115,1,'																			photo_7174882.html');
												thumbnails[7174887] = new thumbnail(7174887,'387544','Leaf Cluster Oval Drop Earrings','Flat_Frame_Oval_Leaf_Cluster_Drop_Earrings_thumb.JPG',160, 116,1,'																			photo_7174887.html');
												thumbnails[7174892] = new thumbnail(7174892,'387544','Rose Cluster Stud - Oxidised','Rose_Cluster_Stud_Earrings_Oxidised_thumb.JPG',160, 124,1,'																			photo_7174892.html');
												thumbnails[7174895] = new thumbnail(7174895,'387544','Rose Cluster Stud','Rose_Cluster_Stud_Earrings_thumb.JPG',160, 139,1,'																			photo_7174895.html');
												thumbnails[7174899] = new thumbnail(7174899,'387544','Limited Edition Leaf 1 Stud','Limited_Edition_Leaf_1_Stud_thumb.jpg',160, 114,1,'																			photo_7174899.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[387541] = new gallery(387541,'7175040','Rings','gallery',[7175040,7175044,7175047],0, 0, '', '																																																																																																							gallery_387541.html',0,0);
				  					galleries[387542] = new gallery(387542,'7174754,7174751,7174747,7174746','Cufflinks','gallery',[7174747,7174746,7174751,7174754],0, 0, '', '																																																																																																							gallery_387542.html',0,0);
				  					galleries[387543] = new gallery(387543,'7174615,7174499,7172594,7172527','Bangles','gallery',[7172594,7174499,7174615,7172527],0, 0, '', '																																																																																																							gallery_387543.html',0,0);
				  					galleries[387544] = new gallery(387544,'7174827','Earrings','gallery',[7174755,7174757,7174758,7174823,7174827,7174834,7174835,7174836,7174869,7174873,7174882,7174887,7174892,7174895,7174899],0, 0, '', '																																																																																																							gallery_387544.html',0,0);
				  					galleries[387545] = new gallery(387545,'7357960','Brooches','gallery',[2172064,7357750,7357609,7357872,7357875,7357878,7357960],0, 0, '', '																																																																																																							gallery_387545.html',0,0);
				  					galleries[387546] = new gallery(387546,'7175006','Necklaces','gallery',[7174926,7174930,7175006,7175014,7175016,7175019,7175022,7175028,2172067],0, 0, '', '																																																																																																							gallery_387546.html',0,0);
				  					galleries[143892] = new gallery(143892,'7175059','Exhibitions and Models','gallery',[2171695,2172056,2172049,2172052,2172129,2172055,7175059,7175081,7175070,7175079],0, 0, '', '																																																																																																							gallery_143892.html',0,0);
				  					galleries[387547] = new gallery(387547,'','In The Workshop','gallery',[],0, 0, '', '																																																																																																							gallery_387547.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7175047,7175006,7174751';
imageSets[2] = '7357960,7175059,7175040,7175006,7174827,3163965';
imageSets[3] = '7357960,7357878,7357875,7357872,7357750,7357609,7175081,7175079,7175070,7175059,7175047,7175044,7175040,7175028,7175022,7175019,7175016,7175014,7175006,7174930,7174926,7174899,7174895,7174892,7174887,7174882,7174873,7174869,7174864,7174838,7174836,7174835,7174834,7174827,7174823,7174758,7174757,7174755,7174754,7174751,7174747,7174746,7174615,7174499,7172594,7172527,3325125,3325030,3325021,3325018';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/annahegarty/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/annahegarty/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 = 'anna hegarty handmade scottish jewellery: ' + 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> 				&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="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;
	}
}

		

