window.thumbnails = new Object();
												thumbnails[1225985] = new thumbnail(1225985,'','Off sick.','MG-off-sick_thumb.jpg',130, 88,15,'#');
												thumbnails[1134980] = new thumbnail(1134980,'','CNN','CNN_thumb.jpg',130, 80,15,'#');
												thumbnails[1134983] = new thumbnail(1134983,'','Footsie.','Dooley\'s ad 2_thumb.jpg',130, 184,15,'#');
												thumbnails[1135001] = new thumbnail(1135001,'','Ice.','Kremly1_thumb.jpg',130, 183,15,'#');
												thumbnails[1135037] = new thumbnail(1135037,'','BMW.4','bmw6_thumb.jpg',130, 89,15,'#');
												thumbnails[1134985] = new thumbnail(1134985,'','Chin chin.','Dooley\'s ad 4_thumb.jpg',130, 184,15,'#');
												thumbnails[1135005] = new thumbnail(1135005,'','Style.','KREMLY3_thumb.jpg',130, 183,15,'#');
												thumbnails[1135042] = new thumbnail(1135042,'','Baby.','NW_bath2_thumb.jpg',130, 66,15,'#');
												thumbnails[1135044] = new thumbnail(1135044,'','Travel.','NW_furcoat1_thumb.jpg',130, 65,15,'#');
												thumbnails[1135045] = new thumbnail(1135045,'','Auction.','NW_mortgage1_thumb.jpg',130, 64,15,'#');
												thumbnails[1135052] = new thumbnail(1135052,'',' Gift Service brochure.','A5 Leaflet hab_thumb.jpg',130, 92,15,'#');
												thumbnails[1135053] = new thumbnail(1135053,'',' Gift Service.2','DM Postcard_A6 hab_thumb..jpg',130, 93,15,'#');
												thumbnails[1135012] = new thumbnail(1135012,'','Gym poster.','ISO_A1_poster_thumb.jpg',130, 184,15,'#');
												thumbnails[1135017] = new thumbnail(1135017,'',' Video.','ISO_DVD_pic_thumb.jpg',130, 173,15,'#');
												thumbnails[1135021] = new thumbnail(1135021,'','Kettle.','Brunch_1_thumb.jpg',130, 176,15,'#');
												thumbnails[1135023] = new thumbnail(1135023,'','Toaster.','Brunch_2_thumb.jpg',130, 176,15,'#');
												thumbnails[6208767] = new thumbnail(6208767,'342956','Isle of Wight Council. 1','_IOW_new_hammock1_thumb.jpg',130, 184,15,'photo_6208767.html');
												thumbnails[6208763] = new thumbnail(6208763,'342956','Isle of Wight Council. 2','_IOW__newrockpool_thumb.jpg',130, 184,15,'photo_6208763.html');
												thumbnails[6208769] = new thumbnail(6208769,'342956','Isle of Wight Council. 3','IOW_new_Kitesurf_thumb.jpg',130, 184,15,'photo_6208769.html');
												thumbnails[6208800] = new thumbnail(6208800,'342956','Isle of Wight Council. 4','iow_new_lobster_thumb.jpg',130, 185,15,'photo_6208800.html');
												thumbnails[5094904] = new thumbnail(5094904,'342956','Neilson Holidays 1.','Neilson-41_thumb.jpg',130, 184,15,'photo_5094904.html');
												thumbnails[5094913] = new thumbnail(5094913,'342956','Neilson Holidays 4.','Neilson_312_thumb.jpg',130, 184,15,'photo_5094913.html');
												thumbnails[5094897] = new thumbnail(5094897,'342956','Neilson Holidays 3.','Neilson--1_thumb.jpg',130, 184,15,'photo_5094897.html');
												thumbnails[5094946] = new thumbnail(5094946,'342956','Neilson Holidays 3.','Neilson_612_thumb.jpg',130, 184,15,'photo_5094946.html');
												thumbnails[6429517] = new thumbnail(6429517,'342956','Flanders Tourism. 1','la_thumb.jpg',130, 175,15,'photo_6429517.html');
												thumbnails[6429521] = new thumbnail(6429521,'342956','Flanders Tourism. 2','rome_thumb.jpg',130, 175,15,'photo_6429521.html');
												thumbnails[6429527] = new thumbnail(6429527,'342956','Flanders Tourism. 3','sydney_thumb.jpg',130, 175,15,'photo_6429527.html');
												thumbnails[6429530] = new thumbnail(6429530,'342956','Flanders Tourism. 4','_5189_Knokke_Heist_M11EB74_thumb.jpg',130, 175,15,'photo_6429530.html');
												thumbnails[2226864] = new thumbnail(2226864,'342956','Norfolk Young Offenders 1.','NYOT_boys1_thumb.jpg',130, 184,15,'photo_2226864.html');
												thumbnails[2226870] = new thumbnail(2226870,'342956','Norfolk Young Offenders 2.','NYOT_girls2_thumb.jpg',130, 184,15,'photo_2226870.html');
												thumbnails[2226888] = new thumbnail(2226888,'342956','Norfolk Young Offenders 3.','NYOTbench copy2_thumb.jpg',130, 184,15,'photo_2226888.html');
												thumbnails[6122434] = new thumbnail(6122434,'342956','Norfolk Young Offenders 4.','NYOT_need_help1_thumb.jpg',130, 184,15,'photo_6122434.html');
												thumbnails[1135048] = new thumbnail(1135048,'342957','P&O Cruises 1.','po celebrating1_thumb.jpg',130, 87,15,'photo_1135048.html');
												thumbnails[1135051] = new thumbnail(1135051,'342957','P&O Cruises 2.','po_thumb.honeymoon1.jpg',130, 87,15,'photo_1135051.html');
												thumbnails[1135050] = new thumbnail(1135050,'342957','P&O Cruises 3.','po_thumb.azores.jpg',130, 87,15,'photo_1135050.html');
												thumbnails[1135049] = new thumbnail(1135049,'342957','P&O Cruises 4.','po_thumb.10years1.jpg',130, 87,15,'photo_1135049.html');
												thumbnails[2218377] = new thumbnail(2218377,'342956','Qatar Tourism 1.','qataroldman1_thumb.jpg',130, 92,15,'photo_2218377.html');
												thumbnails[2218382] = new thumbnail(2218382,'342956','Qatar Tourism 2.','qatareyes-1_thumb.jpg',130, 92,15,'photo_2218382.html');
												thumbnails[2218384] = new thumbnail(2218384,'342956','Qatar Tourism 3.','qatar-legs1_thumb.jpg',130, 92,15,'photo_2218384.html');
												thumbnails[6125250] = new thumbnail(6125250,'342956','Qatar Tourism 4.','qatar_child_thumb.jpg',130, 92,15,'photo_6125250.html');
												thumbnails[1135033] = new thumbnail(1135033,'342957','BMW 1.','bmw11_thumb.jpg',130, 89,15,'photo_1135033.html');
												thumbnails[5094951] = new thumbnail(5094951,'342956','Visit Kent pitch. 1','VK1_thumb.jpg',130, 180,15,'photo_5094951.html');
												thumbnails[5094955] = new thumbnail(5094955,'342956','Weekend 2.','VK2_thumb.jpg',130, 173,15,'photo_5094955.html');
												thumbnails[5094962] = new thumbnail(5094962,'342956','Visit Kent pitch. 3','VK4_thumb.jpg',130, 182,15,'photo_5094962.html');
												thumbnails[5094958] = new thumbnail(5094958,'342956','Visit Kent pitch. 4','VK3_thumb.jpg',130, 184,15,'photo_5094958.html');
												thumbnails[1135034] = new thumbnail(1135034,'342957','BMW 2.','bmw2_thumb.jpg',130, 92,15,'photo_1135034.html');
												thumbnails[1135036] = new thumbnail(1135036,'342957','BMW 3.','bmw32_thumb.jpg',130, 86,15,'photo_1135036.html');
												thumbnails[6125110] = new thumbnail(6125110,'342957','BMW 4.','bmwdiamonds_thumb.jpg',130, 90,15,'photo_6125110.html');
												thumbnails[7582892] = new thumbnail(7582892,'342956','Habitat 1.','black-red-gold_thumb.jpg',130, 184,15,'photo_7582892.html');
												thumbnails[7582897] = new thumbnail(7582897,'342956','Habitat 2.','White-dull_thumb.jpg',130, 185,15,'photo_7582897.html');
												thumbnails[7582901] = new thumbnail(7582901,'342956','Habitat 3.','White-not_us_thumb.jpg',130, 182,15,'photo_7582901.html');
												thumbnails[1135046] = new thumbnail(1135046,'342957','Pernod 1.','pernod_thumb.2cv1.jpg',130, 90,15,'photo_1135046.html');
												thumbnails[1135047] = new thumbnail(1135047,'342957','Pernod 2.','pernod_thumb.marcel1.jpg',130, 90,15,'photo_1135047.html');
												thumbnails[1226102] = new thumbnail(1226102,'342957','MG. TGIF.','MG-TGIF-bigheadline_thumb.jpg',130, 88,15,'photo_1226102.html');
												thumbnails[1226192] = new thumbnail(1226192,'342957','MG. Yeeha.','MG-Yeeha_thumb.jpg',130, 88,15,'photo_1226192.html');
												thumbnails[1135043] = new thumbnail(1135043,'342957','NatWest 1.','NW_dog1_thumb.jpg',130, 65,15,'photo_1135043.html');
												thumbnails[6125155] = new thumbnail(6125155,'342957','NatWest 2.','natwesttravel_thumb.jpg',130, 65,15,'photo_6125155.html');
												thumbnails[6125158] = new thumbnail(6125158,'342957','NatWest 3.','natwestmortgaga_thumb.jpg',130, 65,15,'photo_6125158.html');
												thumbnails[6125087] = new thumbnail(6125087,'342957','NatWest 4.','natwestbath_thumb.jpg',130, 66,15,'photo_6125087.html');
												thumbnails[1456489] = new thumbnail(1456489,'342957','Greyhound Trust 1.','GHT_p_thumb.gif',130, 194,15,'photo_1456489.html');
												thumbnails[1456498] = new thumbnail(1456498,'342957','Greyhound Trust 2.','cutep_thumb.gif',130, 194,15,'photo_1456498.html');
												thumbnails[1456501] = new thumbnail(1456501,'342957','Greyhound Trust 3.','faithful_p_thumb.gif',130, 194,15,'photo_1456501.html');
												thumbnails[6162328] = new thumbnail(6162328,'342957','Copy/Reverse side.','GHT_p_thumb.jpg',130, 202,15,'photo_6162328.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[342956] = new gallery(342956,'6122434,5094946,5094904,5094897,2226870','Some recent work.','section114230',[6208767,6208763,6208769,6208800,5094904,5094913,5094897,5094946,6429517,6429521,6429527,6429530,2226864,2226870,2226888,6122434,2218377,2218382,2218384,6125250,5094951,5094955,5094962,5094958,7582892,7582897,7582901],0, 0, '', 'section114230_342956.html',0,0);
				  					galleries[342957] = new gallery(342957,'1456501,1456498,1456489,1226102,1135051,1135050,1135049,1135048,1135047,1135046,1135043,1135036,1135033','Some older stuff.','section114230',[1135048,1135051,1135050,1135049,1135033,1135034,1135036,6125110,1135046,1135047,1226102,1226192,1135043,6125155,6125158,6125087,1456489,1456498,1456501,6162328],0, 0, '', 'section114230_342957.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5094946,5094904,5094897,2226870,2226864,2218377,1456501,1456498,1456489,1226102,1135049,1135048,1135047,1135046,1135044,1135043,1135042';
imageSets[2] = '6122434,5094946,5094904,5094897,2226870,1456501,1456498,1456489,1226102,1225985,1135051,1135050,1135049,1135048,1135047,1135046,1135044,1135043,1135042,1135036,1135033,1135023,1135021,1134980';
imageSets[3] = '2218377';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/peterharold/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/peterharold/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/peterharold/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/peterharold/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www2.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/peterharold/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/peterharold/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 += 'section114230.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 && 'section114230' != '') {
					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 = 'peter harold advertising: ' + 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.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;
	}
}

			

