window.thumbnails = new Object();
												thumbnails[2021749] = new thumbnail(2021749,'','','Nick-Davies-photo_thumb.jpg',87, 130,1,'#');
												thumbnails[2021750] = new thumbnail(2021750,'','','Bethlehem-0641_thumb.jpg',130, 87,1,'#');
												thumbnails[5055768] = new thumbnail(5055768,'286082','','priest5_thumb.jpg',130, 87,1,'photo_5055768.html');
												thumbnails[2015819] = new thumbnail(2015819,'128294','Church next to the Israeli security barrier','Bethlehem-016_thumb.jpg',130, 87,1,'photo_2015819.html');
												thumbnails[1931004] = new thumbnail(1931004,'128294','Yousef Hussein at the Bethlehem Star Hotel','Bethlehem-001_thumb.jpg',130, 87,1,'photo_1931004.html');
												thumbnails[2015813] = new thumbnail(2015813,'128294','Sunrise over Bethlehem','Bethlehem-015_thumb.jpg',130, 87,1,'photo_2015813.html');
												thumbnails[2015759] = new thumbnail(2015759,'128294','Prof. Awad of the Bethlehem Bible College ','Bethlehem-002_thumb.jpg',130, 87,1,'photo_2015759.html');
												thumbnails[2020993] = new thumbnail(2020993,'135298','Behold','Epiphany-Cambridge-18_thumb.jpg',130, 87,1,'photo_2020993.html');
												thumbnails[2021035] = new thumbnail(2021035,'135444','Kings','Southwark-18_thumb.jpg',86, 130,1,'photo_2021035.html');
												thumbnails[2021121] = new thumbnail(2021121,'135451','Gary from Australia','Haw-and-stars04_thumb.jpg',130, 87,1,'photo_2021121.html');
												thumbnails[2015803] = new thumbnail(2015803,'128294','Pilgrims visiting the Church of the Nativity','Bethlehem-003_thumb.jpg',130, 86,1,'photo_2015803.html');
												thumbnails[2017559] = new thumbnail(2017559,'128294','Candles are lit in the Church of the Nativity','Bethlehem-059_thumb.jpg',86, 130,1,'photo_2017559.html');
												thumbnails[2020997] = new thumbnail(2020997,'135298','North Star','Haw-and-stars17_thumb.jpg',130, 87,1,'photo_2020997.html');
												thumbnails[2021038] = new thumbnail(2021038,'135444','Offering at High Altar','Southwark-04_thumb.jpg',86, 130,1,'photo_2021038.html');
												thumbnails[2021123] = new thumbnail(2021123,'135451','Brian tunes-up','Haw-and-stars09_thumb.jpg',130, 87,1,'photo_2021123.html');
												thumbnails[2015916] = new thumbnail(2015916,'128294','Souvenir shopping at Bethlehem bus station','Bethlehem-043_thumb.jpg',130, 87,1,'photo_2015916.html');
												thumbnails[2015827] = new thumbnail(2015827,'128294','Coffee seller on Manger Square','Bethlehem-017_thumb.jpg',130, 89,1,'photo_2015827.html');
												thumbnails[2015854] = new thumbnail(2015854,'128294','The Holy Family Maternity Hospital','Bethlehem-023_thumb.jpg',86, 130,1,'photo_2015854.html');
												thumbnails[2020995] = new thumbnail(2020995,'135298','Contemplation','Ethiopia-802_thumb.jpg',130, 87,1,'photo_2020995.html');
												thumbnails[2021039] = new thumbnail(2021039,'135444','Revd Canon Andrew Nunn preaching','Southwark-05_thumb.jpg',130, 87,1,'photo_2021039.html');
												thumbnails[2021125] = new thumbnail(2021125,'135451','Brian Haw singing','Haw-and-stars10_thumb.jpg',130, 87,1,'photo_2021125.html');
												thumbnails[2015860] = new thumbnail(2015860,'128294','Premature baby girl weighing just 500g','Bethlehem-026_thumb.jpg',130, 87,1,'photo_2015860.html');
												thumbnails[2015842] = new thumbnail(2015842,'128294','Building work at Har Homar settlement <br>\r\n','Bethlehem-018_thumb.jpg',86, 130,1,'photo_2015842.html');
												thumbnails[2020990] = new thumbnail(2020990,'135298','Star buy','Epiphany-Cambridge-03_thumb.jpg',130, 87,1,'photo_2020990.html');
												thumbnails[2021127] = new thumbnail(2021127,'135451','Protest songs','Haw-and-stars08_thumb.jpg',130, 87,1,'photo_2021127.html');
												thumbnails[2015849] = new thumbnail(2015849,'128294','Sales office at Har Homar Israeli settlement','Bethlehem-019_thumb.jpg',130, 87,1,'photo_2015849.html');
												thumbnails[2015898] = new thumbnail(2015898,'128294','A watchtower overlooks Ayda refugee camp','Bethlehem-042_thumb.jpg',86, 130,1,'photo_2015898.html');
												thumbnails[2020991] = new thumbnail(2020991,'135298','Light from above','Epiphany-Cambridge-11_thumb.jpg',130, 85,1,'photo_2020991.html');
												thumbnails[2021055] = new thumbnail(2021055,'135444','Fruit of the vine and work of human hands','Southwark-09_thumb.jpg',130, 94,1,'photo_2021055.html');
												thumbnails[2021129] = new thumbnail(2021129,'135451','Words softly spoken','Haw-and-stars14_thumb.jpg',130, 87,1,'photo_2021129.html');
												thumbnails[2015810] = new thumbnail(2015810,'128294','A young boy in the Ayda refugee camp','Bethlehem-013_thumb.jpg',130, 88,1,'photo_2015810.html');
												thumbnails[2015900] = new thumbnail(2015900,'128294','Issa Abu-Srour looks out over the Ayda camp<br>\r\n ','Bethlehem-037_thumb.jpg',130, 87,1,'photo_2015900.html');
												thumbnails[2020998] = new thumbnail(2020998,'135298','Light and dark','Sunset-2_thumb.jpg',130, 87,1,'photo_2020998.html');
												thumbnails[2015981] = new thumbnail(2015981,'128294','Separation barrier cuts through Olive groves','Bethlehem-063_thumb.jpg',130, 87,1,'photo_2015981.html');
												thumbnails[2015985] = new thumbnail(2015985,'128294','Daoud Nasser on his farm near Bethlehem','Bethlehem-066_thumb.jpg',130, 87,1,'photo_2015985.html');
												thumbnails[2021603] = new thumbnail(2021603,'135298','A sign','Epiphany-Cambridge-13_thumb.jpg',130, 87,1,'photo_2021603.html');
												thumbnails[2015988] = new thumbnail(2015988,'128294','Daoud Nasser, founder of Tent of Nations','Bethlehem-067_thumb.jpg',130, 87,1,'photo_2015988.html');
												thumbnails[2015864] = new thumbnail(2015864,'128294','Open air prayers before protest','Bethlehem-031_thumb.jpg',130, 87,1,'photo_2015864.html');
												thumbnails[2021062] = new thumbnail(2021062,'135444','Come unto me, all you who are weary','Southwark-15_thumb.jpg',86, 130,1,'photo_2021062.html');
												thumbnails[2015869] = new thumbnail(2015869,'128294','A young boy attends Friday prayers','Bethlehem-032_thumb.jpg',130, 94,1,'photo_2015869.html');
												thumbnails[2015889] = new thumbnail(2015889,'128294','Protestors against Israeli separation barrier','Bethlehem-033_thumb.jpg',130, 89,1,'photo_2015889.html');
												thumbnails[2015805] = new thumbnail(2015805,'128294','Israeli soldiers confront protest','Bethlehem-005_thumb.jpg',130, 87,1,'photo_2015805.html');
												thumbnails[2015808] = new thumbnail(2015808,'128294','Views are exchanged during protest','Bethlehem-007_thumb.jpg',130, 87,1,'photo_2015808.html');
												thumbnails[2020994] = new thumbnail(2020994,'135298','Hiding','Epiphany-Cambridge-19_thumb.jpg',130, 82,1,'photo_2020994.html');
												thumbnails[2015892] = new thumbnail(2015892,'128294','Israeli teargas canisters fired into crowd','Bethlehem-035_thumb.jpg',130, 87,1,'photo_2015892.html');
												thumbnails[2015809] = new thumbnail(2015809,'128294','Marksman views protest through gun sights','Bethlehem-008_thumb.jpg',86, 130,1,'photo_2015809.html');
												thumbnails[2015903] = new thumbnail(2015903,'128294','Watch tower on the Israeli separation barrier','Bethlehem-039_thumb.jpg',88, 130,1,'photo_2015903.html');
												thumbnails[2015980] = new thumbnail(2015980,'128294','Olivewood crib with separation barrier','Bethlehem-053_thumb.jpg',130, 87,1,'photo_2015980.html');
												thumbnails[2015925] = new thumbnail(2015925,'128294','Checkpoint at Bethlehem','Bethlehem-054_thumb.jpg',130, 87,1,'photo_2015925.html');
												thumbnails[2017767] = new thumbnail(2017767,'128294','Child stands at \'Door of Humility\'','Bethlehem-047_thumb.jpg',86, 130,1,'photo_2017767.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[286084] = new gallery(286084,'','China','gallery',[],0, 0, '', 'gallery_286084.html',0,0);
				  					galleries[286085] = new gallery(286085,'','Parish','gallery',[],0, 0, '', 'gallery_286085.html',0,0);
				  					galleries[286083] = new gallery(286083,'','Turkey','gallery',[],0, 0, '', 'gallery_286083.html',0,0);
				  					galleries[128294] = new gallery(128294,'2015759','21st Century Magi','gallery',[2015819,1931004,2015813,2015759,2015803,2017559,2015916,2015827,2015854,2015860,2015842,2015849,2015898,2015810,2015900,2015981,2015985,2015988,2015864,2015869,2015889,2015805,2015808,2015892,2015809,2015903,2015980,2015925,2017767],0, 0, '', 'gallery_128294.html',0,0);
				  					galleries[135298] = new gallery(135298,'2020995','Intuition','gallery',[2020993,2020997,2020995,2020990,2020991,2020998,2021603,2020994],0, 0, '', 'gallery_135298.html',0,0);
				  					galleries[135444] = new gallery(135444,'2021039','Festival','gallery',[2021035,2021038,2021039,2021055,2021062],0, 0, '', 'gallery_135444.html',0,0);
				  					galleries[135451] = new gallery(135451,'2021123','Prophecy','gallery',[2021121,2021123,2021125,2021127,2021129],0, 0, '', 'gallery_135451.html',0,0);
				  					galleries[286082] = new gallery(286082,'5055768','Ethiopia','gallery',[5055768],0, 0, '', 'gallery_286082.html',0,0);
				  					galleries[286081] = new gallery(286081,'','Portraits','gallery',[],0, 0, '', 'gallery_286081.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2021750,2021129,2021123,2021055,2020995,2020993,2020991,2015988,2015860,2015827,2015819,2015813';
imageSets[2] = '2021123,2021039,2020995,2015759';
imageSets[3] = '5055768,2021750,2021749,2021603,2021129,2021127,2021125,2021123,2021121,2021062,2021055,2021039,2021038,2021035,2020998,2020997,2020995,2020994,2020993,2020991,2020990,2017767,2017559,2015988,2015985,2015981,2015980,2015925,2015916,2015903,2015900,2015898,2015892,2015889,2015869,2015864,2015860,2015854,2015849,2015842,2015827,2015819,2015813,2015810,2015809,2015808,2015805,2015803,2015759,1931004';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/NickDD/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/NickDD/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/NickDD/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/NickDD/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/NickDD/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/NickDD/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 = 'Images & icons: ' + 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.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;
	}
}

			

