window.thumbnails = new Object();
												thumbnails[1345480] = new thumbnail(1345480,'43412','','GEORGIA_2_thumb.jpg',130, 166,1,'photo_1345480.html');
												thumbnails[1345483] = new thumbnail(1345483,'43412','','GEORGIA_4a_thumb.jpg',130, 166,1,'photo_1345483.html');
												thumbnails[1345482] = new thumbnail(1345482,'43412','','GEORGIA_3_thumb.jpg',130, 166,1,'photo_1345482.html');
												thumbnails[1345478] = new thumbnail(1345478,'43412','','GEORGIA_1_thumb.jpg',130, 166,1,'photo_1345478.html');
												thumbnails[8167458] = new thumbnail(8167458,'433009','','_MG_0633rt2_thumb.jpg',130, 87,1,'photo_8167458.html');
												thumbnails[1345484] = new thumbnail(1345484,'43412','','GEORGIA_4b_thumb.jpg',130, 166,1,'photo_1345484.html');
												thumbnails[8086306] = new thumbnail(8086306,'432986','','KEW-Port_211_thumb.jpg',130, 195,1,'photo_8086306.html');
												thumbnails[1345485] = new thumbnail(1345485,'43412','','GEORGIA_5_thumb.jpg',130, 166,1,'photo_1345485.html');
												thumbnails[959502] = new thumbnail(959502,'43412','','_MG_0366 b&w_thumb.F.KENNEDY.jpg',130, 166,1,'photo_959502.html');
												thumbnails[959500] = new thumbnail(959500,'43412','','_MG_0279F_thumb.KENNEDY.jpg',130, 166,1,'photo_959500.html');
												thumbnails[961214] = new thumbnail(961214,'43412','','_MG_0389F_thumb.KENNEDY21.jpg',130, 166,1,'photo_961214.html');
												thumbnails[8086313] = new thumbnail(8086313,'432986','','KEW-Port_658_thumb.jpg',130, 195,1,'photo_8086313.html');
												thumbnails[959493] = new thumbnail(959493,'43412','','_MG_0134F_thumb.KENNEDY.jpg',130, 166,1,'photo_959493.html');
												thumbnails[959490] = new thumbnail(959490,'43412','','_MG_0245F_thumb.KENNEDY.jpg',130, 166,1,'photo_959490.html');
												thumbnails[563691] = new thumbnail(563691,'43412','','lucie-re1_thumb.jpg',130, 148,1,'photo_563691.html');
												thumbnails[563695] = new thumbnail(563695,'43412','','laura-re2_thumb.jpg',130, 166,1,'photo_563695.html');
												thumbnails[563689] = new thumbnail(563689,'43412','','Black&Red2dust copy_thumb.jpg',130, 166,1,'photo_563689.html');
												thumbnails[8085868] = new thumbnail(8085868,'433009','','LinsIsabella-000148rt123_thumb.jpg',130, 195,1,'photo_8085868.html');
												thumbnails[8086312] = new thumbnail(8086312,'432986','','KEW-Port_648_thumb.jpg',130, 195,1,'photo_8086312.html');
												thumbnails[563693] = new thumbnail(563693,'43412','','lucie-re2_thumb.jpg',130, 166,1,'photo_563693.html');
												thumbnails[563683] = new thumbnail(563683,'43412','','bench_thumb.jpg',130, 166,1,'photo_563683.html');
												thumbnails[563730] = new thumbnail(563730,'43412','','Ivora1reb&w1_thumb.jpg',130, 166,1,'photo_563730.html');
												thumbnails[8085686] = new thumbnail(8085686,'433009','','LinsIsabella-000147rt1_thumb.jpg',130, 195,1,'photo_8085686.html');
												thumbnails[8086431] = new thumbnail(8086431,'432986','','KEW-Port_077_thumb.jpg',130, 195,1,'photo_8086431.html');
												thumbnails[563756] = new thumbnail(563756,'43412','','Ivora4re_thumb.jpg',130, 166,1,'photo_563756.html');
												thumbnails[563768] = new thumbnail(563768,'43412','','Mermaid1b&w-re_thumb.jpg',130, 166,1,'photo_563768.html');
												thumbnails[8167312] = new thumbnail(8167312,'432986','','KEW_LH_322-2_thumb.jpg',130, 87,1,'photo_8167312.html');
												thumbnails[563773] = new thumbnail(563773,'43412','','mermaid2re_thumb.jpg',130, 166,1,'photo_563773.html');
												thumbnails[563732] = new thumbnail(563732,'43412','','irland001re_thumb.jpg',130, 166,1,'photo_563732.html');
												thumbnails[563751] = new thumbnail(563751,'43412','','irland002re1_thumb.jpg',130, 166,1,'photo_563751.html');
												thumbnails[8085602] = new thumbnail(8085602,'433009','','Michelle_0102rt_thumb.jpg',130, 122,1,'photo_8085602.html');
												thumbnails[8086138] = new thumbnail(8086138,'432986','','KEW_LH_291_thumb.jpg',130, 195,1,'photo_8086138.html');
												thumbnails[8085658] = new thumbnail(8085658,'433009','','Michelle_0109-2rt4_thumb.jpg',130, 122,1,'photo_8085658.html');
												thumbnails[8167265] = new thumbnail(8167265,'432986','','phone-bird2_thumb.jpg',130, 98,1,'photo_8167265.html');
												thumbnails[8085731] = new thumbnail(8085731,'433009','','ELLAnew_3rt_thumb.jpg',130, 195,1,'photo_8085731.html');
												thumbnails[8167310] = new thumbnail(8167310,'432986','','KEW_LH_058-2_thumb.jpg',130, 87,1,'photo_8167310.html');
												thumbnails[8086433] = new thumbnail(8086433,'432986','','KEW-Palma_251_thumb.jpg',130, 195,1,'photo_8086433.html');
												thumbnails[8085705] = new thumbnail(8085705,'433009','','_MG_0942rt_thumb.jpg',130, 195,1,'photo_8085705.html');
												thumbnails[8086435] = new thumbnail(8086435,'432986','','KEW-Palma_197_thumb.jpg',130, 192,1,'photo_8086435.html');
												thumbnails[8085727] = new thumbnail(8085727,'433009','','_MG_0992rt_thumb.jpg',130, 195,1,'photo_8085727.html');
												thumbnails[8167289] = new thumbnail(8167289,'432986','','wicker2_thumb.jpg',130, 97,1,'photo_8167289.html');
												thumbnails[8085722] = new thumbnail(8085722,'433009','','_MG_0974rt_thumb.jpg',130, 195,1,'photo_8085722.html');
												thumbnails[8086144] = new thumbnail(8086144,'432986','','KEW_LH_411_thumb.jpg',130, 195,1,'photo_8086144.html');
												thumbnails[8085478] = new thumbnail(8085478,'433009','','_MG_0924rt_thumb.jpg',130, 166,1,'photo_8085478.html');
												thumbnails[8086147] = new thumbnail(8086147,'432986','','KEW_LH_475_thumb.jpg',130, 195,1,'photo_8086147.html');
												thumbnails[8167309] = new thumbnail(8167309,'432986','','2necklass-2_thumb.jpg',130, 97,1,'photo_8167309.html');
												thumbnails[8167261] = new thumbnail(8167261,'432986','','belts-hats2_thumb.jpg',130, 98,1,'photo_8167261.html');
												thumbnails[8167285] = new thumbnail(8167285,'432986','','fisherman2_thumb.jpg',130, 98,1,'photo_8167285.html');
												thumbnails[8167291] = new thumbnail(8167291,'432986','','boat2_thumb.jpg',130, 98,1,'photo_8167291.html');
												thumbnails[8086316] = new thumbnail(8086316,'432986','','KEW-Port_680_thumb.jpg',130, 195,1,'photo_8086316.html');
												thumbnails[8167410] = new thumbnail(8167410,'432986','','KEW-Port_609-2_thumb.jpg',130, 87,1,'photo_8167410.html');
												thumbnails[8086998] = new thumbnail(8086998,'432986','','Flowers_070rt_thumb.jpg',130, 194,1,'photo_8086998.html');
												thumbnails[8087000] = new thumbnail(8087000,'432986','','Flowers_074rt_thumb.jpg',130, 187,1,'photo_8087000.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[432986] = new gallery(432986,'8086313,8086312,8086306,8086147,8086138','OBJECTS','gallery',[8086306,8086313,8086312,8086431,8167312,8086138,8167265,8167310,8086433,8086435,8167289,8086144,8086147,8167309,8167261,8167285,8167291,8086316,8167410,8086998,8087000],0, 0, '', 'gallery_432986.html',0,0);
				  					galleries[43412] = new gallery(43412,'959502,959490','FASHION','gallery',[1345480,1345483,1345482,1345478,1345484,1345485,959502,959500,961214,959493,959490,563691,563695,563689,563693,563683,563730,563756,563768,563773,563732,563751],0, 0, '', 'gallery_43412.html',0,0);
				  					galleries[433009] = new gallery(433009,'8085722,8085705','CHILDREN','gallery',[8167458,8085868,8085686,8085602,8085658,8085731,8085705,8085727,8085722,8085478],0, 0, '', 'gallery_433009.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '8087000,8086313,8086306,8086147,8086138,8085722,8085658,1345483,1345480,959502,959490,563768,563695,563691';
imageSets[2] = '8086313,8086312,8086306,8086147,8086138,8085722,8085705,959502,959490';
imageSets[3] = '8167458,8167410,8167312,8167310,8167309,8167291,8167289,8167285,8167265,8167261,8087000,8086998,8086435,8086433,8086431,8086316,8086313,8086312,8086306,8086147,8086144,8086138,8085868,8085731,8085727,8085722,8085705,8085686,8085658,8085602,8085478,1345485,1345484,1345483,1345482,1345480,1345478,961214,959502,959500,959493,959490,563773,563768,563756,563751,563732,563730,563695,563693';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/fikennedy/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/fikennedy/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));		  $('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 = 'FIONA KENNEDY: ' + 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 == undefined) {
    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;
	}
}

			

