window.thumbnails = new Object();
												thumbnails[1341196] = new thumbnail(1341196,'','Back garden','BACKGARDEN1.jpg',130, 162,18,'															#');
												thumbnails[1341201] = new thumbnail(1341201,'','Mother','MUM1.jpg',130, 111,18,'															#');
												thumbnails[1342444] = new thumbnail(1342444,'','Portrait','me1.jpg',130, 170,18,'															#');
												thumbnails[1339158] = new thumbnail(1339158,'94178','Stuck','stuck2004_thumb.jpg',130, 116,18,'																			photo_1339158.html');
												thumbnails[1347054] = new thumbnail(1347054,'94178','Monday afternoon','mondayafternoon1.jpg',130, 141,18,'																			photo_1347054.html');
												thumbnails[1341219] = new thumbnail(1341219,'94178','Gay messiah','GAY-MESS31.jpg',130, 115,18,'																			photo_1341219.html');
												thumbnails[1341144] = new thumbnail(1341144,'94178','Mantra','COLCALM1.jpg',130, 117,18,'																			photo_1341144.html');
												thumbnails[1341146] = new thumbnail(1341146,'94178','Game','CULTUREWARS2.jpg',130, 126,18,'																			photo_1341146.html');
												thumbnails[1341149] = new thumbnail(1341149,'94178','I love Rita','RITA1.jpg',130, 138,18,'																			photo_1341149.html');
												thumbnails[1341187] = new thumbnail(1341187,'94178','Cynic','SUGARDARK4.jpg',130, 105,18,'																			photo_1341187.html');
												thumbnails[1341189] = new thumbnail(1341189,'94178','untitled','BATHROOMPIC1.jpg',130, 109,18,'																			photo_1341189.html');
												thumbnails[1341190] = new thumbnail(1341190,'94178','Domestic bliss 2','DOMESTIC1.jpg',130, 182,18,'																			photo_1341190.html');
												thumbnails[1341193] = new thumbnail(1341193,'94178','Night out','PEOPLE1.jpg',130, 188,18,'																			photo_1341193.html');
												thumbnails[1341195] = new thumbnail(1341195,'94178','Hockney\'s house plant','PLANT1.jpg',130, 111,18,'																			photo_1341195.html');
												thumbnails[1341210] = new thumbnail(1341210,'94178','Pool house','POOL5.jpg',130, 113,18,'																			photo_1341210.html');
												thumbnails[1341213] = new thumbnail(1341213,'94178','Mountain','MOUNTAIN1.jpg',130, 109,18,'																			photo_1341213.html');
												thumbnails[1341214] = new thumbnail(1341214,'94178','Mantra 2','COLLCALMFUCKING1.jpg',130, 98,18,'																			photo_1341214.html');
												thumbnails[1341216] = new thumbnail(1341216,'94178','What is the formula?','FORM1.jpg',130, 132,18,'																			photo_1341216.html');
												thumbnails[1342439] = new thumbnail(1342439,'93599','Donna Mcglynn','mcglynn1.jpg',130, 126,18,'																			photo_1342439.html');
												thumbnails[1346973] = new thumbnail(1346973,'94178','Game','breasts1.jpg',130, 125,18,'																			photo_1346973.html');
												thumbnails[1346974] = new thumbnail(1346974,'94178','Barking','barking1.jpg',130, 115,18,'																			photo_1346974.html');
												thumbnails[1346975] = new thumbnail(1346975,'94178','Dogs chance','dogscahnce1.jpg',130, 109,18,'																			photo_1346975.html');
												thumbnails[1346977] = new thumbnail(1346977,'94178','Exit','etching11.jpg',130, 173,18,'																			photo_1346977.html');
												thumbnails[1346979] = new thumbnail(1346979,'94178','Exit 2','etching21.jpg',130, 97,18,'																			photo_1346979.html');
												thumbnails[1347050] = new thumbnail(1347050,'94178','I love my chihuahua','kris1.jpg',130, 183,18,'																			photo_1347050.html');
												thumbnails[1347058] = new thumbnail(1347058,'94178','Kit','kitfinal1.jpg',130, 176,18,'																			photo_1347058.html');
												thumbnails[1347061] = new thumbnail(1347061,'94178','Mary','mary1.jpg',130, 171,18,'																			photo_1347061.html');
												thumbnails[1347247] = new thumbnail(1347247,'94178','Bullet proof','mum21.jpg',130, 135,18,'																			photo_1347247.html');
												thumbnails[2832236] = new thumbnail(2832236,'161857','Odalisque','P1010005_thumb.jpg',130, 130,18,'																			photo_2832236.html');
												thumbnails[2832261] = new thumbnail(2832261,'161857','venus','P1010009_thumb.jpg',130, 129,18,'																			photo_2832261.html');
												thumbnails[2833368] = new thumbnail(2833368,'161857','stately home','P1010017_thumb.jpg',130, 131,18,'																			photo_2833368.html');
												thumbnails[2833378] = new thumbnail(2833378,'161857','interview','P1010030_thumb.jpg',130, 133,18,'																			photo_2833378.html');
												thumbnails[2868280] = new thumbnail(2868280,'161857','Eve\'s day out','adam-and-eve_thumb.jpg',129, 129,18,'																			photo_2868280.html');
												thumbnails[2526668] = new thumbnail(2526668,'161857','untitled','P1010008_thumb.JPG',130, 116,18,'																			photo_2526668.html');
												thumbnails[2526657] = new thumbnail(2526657,'161857','Strawberries','P1010015_thumb.JPG',130, 86,18,'																			photo_2526657.html');
												thumbnails[2527031] = new thumbnail(2527031,'161857','stolen goods','P1010008_1_thumb.jpg',130, 89,18,'																			photo_2527031.html');
												thumbnails[2544582] = new thumbnail(2544582,'161857','origami','P1010054_thumb.jpg',130, 140,18,'																			photo_2544582.html');
												thumbnails[2544585] = new thumbnail(2544585,'161857','black and white mountain','P1010011_1_thumb.jpg',130, 134,18,'																			photo_2544585.html');
												thumbnails[2544587] = new thumbnail(2544587,'161857','pastiche','P1010022_1_thumb.jpg',130, 124,18,'																			photo_2544587.html');
												thumbnails[1342447] = new thumbnail(1342447,'93599','Tomatoes','produce-of-cyprus1.jpg',130, 174,18,'																			photo_1342447.html');
												thumbnails[1339132] = new thumbnail(1339132,'94178','Untitled','dombliss2_thumb.jpg',130, 119,18,'																			photo_1339132.html');
												thumbnails[1341235] = new thumbnail(1341235,'93599','Argument','argumentupdate1.jpg',130, 41,18,'																			photo_1341235.html');
												thumbnails[1342436] = new thumbnail(1342436,'93599','Strawberries','summerstrawbs1.jpg',130, 129,18,'																			photo_1342436.html');
												thumbnails[1339141] = new thumbnail(1339141,'94178','Descent','desent_thumb.jpg',130, 130,18,'																			photo_1339141.html');
												thumbnails[1339155] = new thumbnail(1339155,'94178','Ascent','assent_thumb.jpg',130, 131,18,'																			photo_1339155.html');
												thumbnails[1339052] = new thumbnail(1339052,'94178','Prescription','mantra_thumb.jpg',130, 88,18,'																			photo_1339052.html');
												thumbnails[1339151] = new thumbnail(1339151,'94178','Porn star','pornstar2005_thumb.jpg',130, 106,18,'																			photo_1339151.html');
												thumbnails[1339038] = new thumbnail(1339038,'94178','Process','process_thumb.jpg',130, 89,18,'																			photo_1339038.html');
												thumbnails[1339037] = new thumbnail(1339037,'93599','Diptych','diptych_thumb.jpg',130, 67,18,'																			photo_1339037.html');
												thumbnails[1339033] = new thumbnail(1339033,'93599','Triptych','triptych_thumb.jpg',130, 44,18,'																			photo_1339033.html');
												thumbnails[1339045] = new thumbnail(1339045,'93599','Argyll girl','argyll_thumb.jpg',130, 128,18,'																			photo_1339045.html');
												thumbnails[1339021] = new thumbnail(1339021,'93599','Diversion','diversion_thumb.jpg',130, 135,18,'																			photo_1339021.html');
												thumbnails[1339027] = new thumbnail(1339027,'93599','Breaking the ice','luckys_thumb.jpg',130, 130,18,'																			photo_1339027.html');
												thumbnails[1339049] = new thumbnail(1339049,'93599','figure','figure_thumb.jpg',130, 88,18,'																			photo_1339049.html');
												thumbnails[1339042] = new thumbnail(1339042,'93599','Skinny dipping','skinny_thumb.jpg',130, 130,18,'																			photo_1339042.html');
												thumbnails[1339041] = new thumbnail(1339041,'93599','maps','maps_thumb.jpg',130, 44,18,'																			photo_1339041.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[93599] = new gallery(93599,'1339049,1339045,1339042,1339041,1339037,1339033,1339027,1339021','Work 1996 - 2000','gallery',[1342439,1342447,1341235,1342436,1339037,1339033,1339045,1339021,1339027,1339049,1339042,1339041],0, 0, '', '																																																																																																							gallery_93599.html',0,0);
				  					galleries[94178] = new gallery(94178,'1341189,1339155,1339151,1339141,1339132,1339052,1339038','Work 2001 - 2007','gallery',[1339158,1347054,1341219,1341144,1341146,1341149,1341187,1341189,1341190,1341193,1341195,1341210,1341213,1341214,1341216,1346973,1346974,1346975,1346977,1346979,1347050,1347058,1347061,1347247,1339132,1339141,1339155,1339052,1339151,1339038],0, 0, '', '																																																																																																							gallery_94178.html',0,0);
				  					galleries[161857] = new gallery(161857,'2868280,2833378,2833368,2832261,2832236,2544587,2544585,2544582,2527031,2526668','work 2008 onwards','gallery',[2832236,2832261,2833368,2833378,2868280,2526668,2526657,2527031,2544582,2544585,2544587],0, 0, '', '																																																																																																							gallery_161857.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2832236';
imageSets[2] = '1341189,1339155,1339151,1339141,1339132,1339052,1339049,1339045,1339042,1339041,1339038,1339037,1339033,1339027,1339021';
imageSets[3] = '2868280,2833378,2833368,2832261,2832236,2544587,2544585,2544582,2527031,2526668,2526657,1347247,1347061,1347058,1347054,1347050,1346979,1346977,1346975,1346974,1346973,1342447,1342444,1342439,1342436,1341235,1341219,1341216,1341214,1341213,1341210,1341201,1341196,1341195,1341193,1341190,1341189,1341187,1341149,1341146,1341144,1339158,1339155,1339151,1339141,1339132,1339052,1339049,1339045,1339042';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rowan106/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rowan106/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rowan106/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rowan106/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rowan106/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rowan106/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 = 'Rowan Paton Risby: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 							' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

