window.thumbnails = new Object();
												thumbnails[3302767] = new thumbnail(3302767,'201349','','img003_thumb.jpg',130, 181,15,'photo_3302767.html');
												thumbnails[3302773] = new thumbnail(3302773,'201349','','img004_thumb.jpg',130, 185,15,'photo_3302773.html');
												thumbnails[3302903] = new thumbnail(3302903,'201349','','img007_thumb.jpg',130, 179,15,'photo_3302903.html');
												thumbnails[3302904] = new thumbnail(3302904,'201349','','img008_thumb.jpg',130, 179,15,'photo_3302904.html');
												thumbnails[3302906] = new thumbnail(3302906,'201349','','img009_thumb.jpg',130, 187,15,'photo_3302906.html');
												thumbnails[3302909] = new thumbnail(3302909,'201348','','img010_thumb.jpg',130, 182,15,'photo_3302909.html');
												thumbnails[3302910] = new thumbnail(3302910,'201349','','img011_thumb.jpg',130, 94,15,'photo_3302910.html');
												thumbnails[3302913] = new thumbnail(3302913,'201348','','img012_thumb.jpg',130, 181,15,'photo_3302913.html');
												thumbnails[3302915] = new thumbnail(3302915,'201349','','img013_thumb.jpg',130, 180,15,'photo_3302915.html');
												thumbnails[3302917] = new thumbnail(3302917,'201349','','img014_thumb.jpg',130, 180,15,'photo_3302917.html');
												thumbnails[3302920] = new thumbnail(3302920,'201349','','img015_thumb.jpg',130, 180,15,'photo_3302920.html');
												thumbnails[3302922] = new thumbnail(3302922,'201348','','img016_thumb.jpg',130, 94,15,'photo_3302922.html');
												thumbnails[3302925] = new thumbnail(3302925,'201349','','img017_thumb.jpg',130, 180,15,'photo_3302925.html');
												thumbnails[3302927] = new thumbnail(3302927,'201348','','img018_thumb.jpg',130, 181,15,'photo_3302927.html');
												thumbnails[3302929] = new thumbnail(3302929,'201349','','img019_thumb.jpg',130, 180,15,'photo_3302929.html');
												thumbnails[3302932] = new thumbnail(3302932,'201348','','img020_thumb.jpg',130, 181,15,'photo_3302932.html');
												thumbnails[3302934] = new thumbnail(3302934,'201348','','img022_thumb.jpg',130, 181,15,'photo_3302934.html');
												thumbnails[3302937] = new thumbnail(3302937,'201348','','img023_thumb.jpg',130, 94,15,'photo_3302937.html');
												thumbnails[3302939] = new thumbnail(3302939,'201349','','img024_thumb.jpg',130, 181,15,'photo_3302939.html');
												thumbnails[3302943] = new thumbnail(3302943,'201349','','img021_thumb.jpg',130, 180,15,'photo_3302943.html');
												thumbnails[3367986] = new thumbnail(3367986,'205690','','sam_thumb.jpg',130, 173,15,'photo_3367986.html');
												thumbnails[3368164] = new thumbnail(3368164,'205690','','chris two_thumb.jpg',130, 173,15,'photo_3368164.html');
												thumbnails[3368212] = new thumbnail(3368212,'205690','','chris three_thumb.jpg',130, 173,15,'photo_3368212.html');
												thumbnails[3374319] = new thumbnail(3374319,'201394','','lauraandgavin040_thumb.jpg',130, 194,15,'photo_3374319.html');
												thumbnails[3374321] = new thumbnail(3374321,'201394','','laura and gavin 048_thumb.jpg',130, 194,15,'photo_3374321.html');
												thumbnails[3374330] = new thumbnail(3374330,'201394','','laura and gavin 053_thumb.jpg',130, 194,15,'photo_3374330.html');
												thumbnails[3374331] = new thumbnail(3374331,'201394','','laura and gavin 083_thumb.jpg',130, 194,15,'photo_3374331.html');
												thumbnails[3374334] = new thumbnail(3374334,'201394','','laura and gavin 109_thumb.jpg',130, 194,15,'photo_3374334.html');
												thumbnails[3488060] = new thumbnail(3488060,'201394','','KATE WEDDING 2_thumb.JPG',130, 176,15,'photo_3488060.html');
												thumbnails[3488063] = new thumbnail(3488063,'201394','','KATE WEDDING_thumb.JPG',130, 87,15,'photo_3488063.html');
												thumbnails[3488067] = new thumbnail(3488067,'201394','','KATE WEDDING3_thumb.JPG',130, 115,15,'photo_3488067.html');
												thumbnails[3488072] = new thumbnail(3488072,'201394','','KATE WEDDING 5_thumb.JPG',130, 194,15,'photo_3488072.html');
												thumbnails[3488208] = new thumbnail(3488208,'201394','','mum_thumb.jpg',130, 88,15,'photo_3488208.html');
												thumbnails[3488227] = new thumbnail(3488227,'201394','','kate_thumb.jpg',130, 207,15,'photo_3488227.html');
												thumbnails[3508522] = new thumbnail(3508522,'201394','','sam wedding7_thumb.jpg',130, 170,15,'photo_3508522.html');
												thumbnails[3508553] = new thumbnail(3508553,'201394','','sam wedding8_thumb.jpg',130, 193,15,'photo_3508553.html');
												thumbnails[3508591] = new thumbnail(3508591,'201394','','sam wedding11_thumb.jpg',130, 92,15,'photo_3508591.html');
												thumbnails[3508594] = new thumbnail(3508594,'201394','','sam wedding41_thumb.jpg',130, 90,15,'photo_3508594.html');
												thumbnails[3508596] = new thumbnail(3508596,'201394','','sam wedding53_thumb.jpg',130, 89,15,'photo_3508596.html');
												thumbnails[3508599] = new thumbnail(3508599,'201394','','sam wedding61_thumb.jpg',130, 195,15,'photo_3508599.html');
												thumbnails[3508603] = new thumbnail(3508603,'201394','','sam wedding 22_thumb.jpg',130, 197,15,'photo_3508603.html');
												thumbnails[3508605] = new thumbnail(3508605,'201394','','sam wedding 32_thumb.jpg',130, 88,15,'photo_3508605.html');
												thumbnails[3508607] = new thumbnail(3508607,'201394','','sam wedding 8_thumb.jpg',130, 206,15,'photo_3508607.html');
												thumbnails[3603204] = new thumbnail(3603204,'201394','','lizzie_3_thumb.jpg',130, 87,15,'photo_3603204.html');
												thumbnails[3603208] = new thumbnail(3603208,'201394','','lizzie_8_thumb.jpg',130, 195,15,'photo_3603208.html');
												thumbnails[3603209] = new thumbnail(3603209,'201394','','lizzie_thumb.jpg',130, 195,15,'photo_3603209.html');
												thumbnails[3603262] = new thumbnail(3603262,'201394','','lizzie_2_thumb.jpg',130, 195,15,'photo_3603262.html');
												thumbnails[3603265] = new thumbnail(3603265,'201394','','lizzie_9_thumb.jpg',130, 96,15,'photo_3603265.html');
												thumbnails[3603270] = new thumbnail(3603270,'201394','','lizzie_4_thumb.jpg',130, 195,15,'photo_3603270.html');
												thumbnails[3603272] = new thumbnail(3603272,'201394','','lizzie_6_thumb.jpg',130, 195,15,'photo_3603272.html');
												thumbnails[3603287] = new thumbnail(3603287,'201394','','lizzie5_thumb.jpg',130, 195,15,'photo_3603287.html');
												thumbnails[5685314] = new thumbnail(5685314,'201394','','SeanAnna100_thumb.jpg',130, 87,15,'photo_5685314.html');
												thumbnails[5685315] = new thumbnail(5685315,'201394','','SeanAnna101_thumb.jpg',130, 195,15,'photo_5685315.html');
												thumbnails[5685316] = new thumbnail(5685316,'201394','','SeanAnna102_thumb.jpg',130, 195,15,'photo_5685316.html');
												thumbnails[5685318] = new thumbnail(5685318,'201394','','SeanAnna111_thumb.jpg',130, 87,15,'photo_5685318.html');
												thumbnails[5685320] = new thumbnail(5685320,'201394','','SeanAnna338_thumb.jpg',130, 195,15,'photo_5685320.html');
												thumbnails[5685321] = new thumbnail(5685321,'201394','','SeanAnna243_thumb.jpg',130, 212,15,'photo_5685321.html');
												thumbnails[5685329] = new thumbnail(5685329,'201394','','SeanAnna279_thumb.jpg',130, 87,15,'photo_5685329.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[205690] = new gallery(205690,'3367986','Themed looks','gallery',[3367986,3368164,3368212],0, 0, '', 'gallery_205690.html',0,0);
				  					galleries[201394] = new gallery(201394,'3488060','Weddings','gallery',[3374319,3374321,3374330,3374331,3374334,3488060,3488063,3488067,3488072,3488208,3488227,3508522,3508553,3508591,3508594,3508596,3508599,3508603,3508605,3508607,3603204,3603208,3603209,3603262,3603265,3603270,3603272,3603287,5685314,5685315,5685316,5685318,5685320,5685321,5685329],0, 0, '', 'gallery_201394.html',0,0);
				  					galleries[201348] = new gallery(201348,'3302913','Fashion ','gallery',[3302909,3302913,3302922,3302927,3302932,3302934,3302937],0, 0, '', 'gallery_201348.html',0,0);
				  					galleries[201349] = new gallery(201349,'3302904','Beauty','gallery',[3302767,3302773,3302903,3302904,3302906,3302910,3302915,3302917,3302920,3302925,3302929,3302939,3302943],0, 0, '', 'gallery_201349.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[241210] = '3508594';
imageSets[1] = '5685321,5685320,5685316,3603208,3508522,3488227,3488060';
imageSets[2] = '3488060,3367986,3302913,3302904';
imageSets[3] = '3508596';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/pinchy/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/pinchy/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/pinchy/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/pinchy/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/pinchy/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/pinchy/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 = 'ANNA MARIE MILNE MAKE UP ARTIST: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:220};	    	      	      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;
	}
}

			

