window.thumbnails = new Object();
												thumbnails[4283785] = new thumbnail(4283785,'252884','Lets face it - no one wins in War. This is the first panel I made for the women\'s sewing for peace exhibition  in Exeter. It is a very naive piece but very powful in its message.','gilly-012_thumb.jpg',130, 169,15,'							photo_4283785.html');
												thumbnails[4283791] = new thumbnail(4283791,'252884','One of the banners carried during the Women\'s March for Peace in Exeter March 2009','gilly-013_thumb.jpg',130, 67,15,'							photo_4283791.html');
												thumbnails[4283801] = new thumbnail(4283801,'252884','International womens arts - \'view the banners\'','gilly-014_thumb.jpg',130, 97,15,'							photo_4283801.html');
												thumbnails[4338183] = new thumbnail(4338183,'255364','This work is a reminder of changing times in Rwanda involving women and children of the country. Children still continue to die from such as diarrhoea, malaria, chickenpox and pulmonary infections. Sadly for every 100,000 live births 750 mothers die during delivery. Young children also face a daunting statistics, 86 out of 1000 new borns will die before reaching the age of one year old and 152 out of 1000 will not celebrate their fifth birthday.<br>\r\nThis collection of hand stichings celebrates the conception, applauds the nurture of the child and then morns the death. I let the picture tell the story.','gilly-015_thumb.jpg',130, 99,15,'							photo_4338183.html');
												thumbnails[4338187] = new thumbnail(4338187,'255364','This hand stitched panel celebrates the miracle  that is the conception of the baby','gilly-016_thumb.jpg',130, 219,15,'							photo_4338187.html');
												thumbnails[4338190] = new thumbnail(4338190,'255364','This hand stitched panel applauds the nurture and love of the child with the mother','gilly-017_thumb.jpg',130, 251,15,'							photo_4338190.html');
												thumbnails[4338195] = new thumbnail(4338195,'255364','The last hand stitched panel morns the loss of the child with the mother.','gilly-018_thumb.jpg',130, 218,15,'							photo_4338195.html');
												thumbnails[5672957] = new thumbnail(5672957,'321404','Triptych Wants, Needs and Greed depicting aspects of consumer driven society and contrasts of poverty','trail-015-web_thumb.jpg',130, 43,15,'							photo_5672957.html');
												thumbnails[5672961] = new thumbnail(5672961,'321404','Panel left','trail-014-web_thumb.jpg',130, 128,15,'							photo_5672961.html');
												thumbnails[5672964] = new thumbnail(5672964,'321404','Panel centre','trail-012-web_thumb.jpg',130, 85,15,'							photo_5672964.html');
												thumbnails[5672965] = new thumbnail(5672965,'321404','Panel right','trail-006-web_thumb.jpg',130, 131,15,'							photo_5672965.html');
												thumbnails[6091576] = new thumbnail(6091576,'250319','Lest We Forget<br>\r\nThis picture tells a story of the horrors created by the act of war. It serves as a reminder not as ajudgement.','lest-we-forget_thumb.jpg',130, 33,15,'							photo_6091576.html');
												thumbnails[7154285] = new thumbnail(7154285,'386704','Nude, Green Leaves and Bust','castle-exhibition-gilly-pit_thumb.jpg',130, 163,15,'							photo_7154285.html');
												thumbnails[7154418] = new thumbnail(7154418,'386704','Girl with a Ponytail','gilly-girl-with-ponytail_thumb.jpg',130, 158,15,'							photo_7154418.html');
												thumbnails[7154429] = new thumbnail(7154429,'386704','Nude Woman on a Red Arnchair','gilly-nude-woman-on-a-red-a1_thumb.jpg',130, 167,15,'							photo_7154429.html');
												thumbnails[7154456] = new thumbnail(7154456,'386704','Reclining Woman with a Book','gilly-reclining-woman-with-_thumb.jpg',130, 93,15,'							photo_7154456.html');
												thumbnails[7154488] = new thumbnail(7154488,'386704','The Horse','gilly-horse-007_thumb.jpg',130, 84,15,'							photo_7154488.html');
												thumbnails[4182549] = new thumbnail(4182549,'248557','Guernica ','gilly-005_thumb.jpg',130, 68,15,'							photo_4182549.html');
												thumbnails[4182571] = new thumbnail(4182571,'248557','Twin towers 9/11','gilly-003_thumb.jpg',130, 115,15,'							photo_4182571.html');
												thumbnails[4182579] = new thumbnail(4182579,'248557','Your country needs you','gilly-00_thumb.jpg',130, 189,15,'							photo_4182579.html');
												thumbnails[4182590] = new thumbnail(4182590,'248557','Holocaust','gilly-004_thumb.jpg',130, 138,15,'							photo_4182590.html');
												thumbnails[7154164] = new thumbnail(7154164,'248557','Reality - Miranda ','miranda--reality_thumb.jpg',130, 189,15,'							photo_7154164.html');
												thumbnails[7154305] = new thumbnail(7154305,'248557','','illusion_thumb.jpg',130, 154,15,'							photo_7154305.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[386704] = new gallery(386704,'7154488,7154456,7154429,7154418,7154285','Homage to Picasso','gallery',[7154285,7154418,7154429,7154456,7154488],0, 0, '', '																																																																																																							gallery_386704.html',0,0);
				  					galleries[250319] = new gallery(250319,'6091576','Lest we Forget','gallery',[6091576],0, 0, '', '																																																																																																							gallery_250319.html',0,0);
				  					galleries[255364] = new gallery(255364,'4338195,4338190,4338187,4338183','Rwanda','gallery',[4338183,4338187,4338190,4338195],0, 0, '', '																																																																																																							gallery_255364.html',0,0);
				  					galleries[252884] = new gallery(252884,'4283801,4283791,4283785','Sewing for Peace ','gallery',[4283785,4283791,4283801],0, 0, '', '																																																																																																							gallery_252884.html',0,0);
				  					galleries[321404] = new gallery(321404,'5672965,5672964,5672961,5672957','Wants, Needs and Greed','gallery',[5672957,5672961,5672964,5672965],0, 0, '', '																																																																																																							gallery_321404.html',0,0);
				  					galleries[248557] = new gallery(248557,'7154305,7154164,4182590,4182579,4182571,4182549','Stitched with silks','gallery',[4182549,4182571,4182579,4182590,7154164,7154305],0, 0, '', '																																																																																																							gallery_248557.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '4182549';
imageSets[3] = '7154488,7154456,7154429,7154418,7154305,7154285,7154164,6091576,5672965,5672964,5672961,5672957,4338195,4338190,4338187,4338183,4283801,4283791,4283785,4182590,4182579,4182571,4182549';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/gillypitman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/gillypitman/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 = 'gillypitman: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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;
	}
}

			

