window.thumbnails = new Object();
												thumbnails[2407200] = new thumbnail(2407200,'108102','','DSC_0568_bw_thumb.jpg',130, 87,1,'photo_2407200.html');
												thumbnails[2407204] = new thumbnail(2407204,'108102','','DSC_0012_4_popcol_thumb.jpg',130, 195,1,'photo_2407204.html');
												thumbnails[2407207] = new thumbnail(2407207,'108102','','DSC_0035_bw_2_thumb.jpg',130, 86,1,'photo_2407207.html');
												thumbnails[2407208] = new thumbnail(2407208,'108102','','DSC_6663_thumb.JPG',130, 196,1,'photo_2407208.html');
												thumbnails[2712775] = new thumbnail(2712775,'108099','','0 (84) email_thumb.jpg',130, 195,1,'photo_2712775.html');
												thumbnails[3034794] = new thumbnail(3034794,'108099','','DSCF5071 web_thumb.jpg',130, 195,1,'photo_3034794.html');
												thumbnails[3034795] = new thumbnail(3034795,'108099','','DSCF5640 web_thumb.jpg',130, 195,1,'photo_3034795.html');
												thumbnails[3077206] = new thumbnail(3077206,'108099','','DSCF6999 web_thumb.jpg',130, 195,1,'photo_3077206.html');
												thumbnails[3192043] = new thumbnail(3192043,'108099','','DSCF4787 web_thumb.jpg',130, 194,1,'photo_3192043.html');
												thumbnails[3192044] = new thumbnail(3192044,'108099','','DSCF4796 web_thumb.jpg',130, 87,1,'photo_3192044.html');
												thumbnails[3250121] = new thumbnail(3250121,'108102','','DSCF8219_thumb.JPG',130, 194,1,'photo_3250121.html');
												thumbnails[3250127] = new thumbnail(3250127,'108102','','DSCF8763 bw_thumb.jpg',130, 194,1,'photo_3250127.html');
												thumbnails[3277032] = new thumbnail(3277032,'199830','','DSCF1043 web_thumb.jpg',130, 195,1,'photo_3277032.html');
												thumbnails[3277033] = new thumbnail(3277033,'199830','','DSCF1045 web_thumb.jpg',130, 195,1,'photo_3277033.html');
												thumbnails[3277036] = new thumbnail(3277036,'199830','','DSCF1425 web_thumb.jpg',130, 195,1,'photo_3277036.html');
												thumbnails[3277038] = new thumbnail(3277038,'199830','','DSCF1543web_thumb.jpg',130, 194,1,'photo_3277038.html');
												thumbnails[3277096] = new thumbnail(3277096,'199830','','DSCF1740 WEB1_thumb.jpg',130, 195,1,'photo_3277096.html');
												thumbnails[3278375] = new thumbnail(3278375,'199917','','DSCF1931 web_thumb.jpg',130, 87,1,'photo_3278375.html');
												thumbnails[3278388] = new thumbnail(3278388,'199917','','DSCF1942 web_thumb.jpg',130, 87,1,'photo_3278388.html');
												thumbnails[3278389] = new thumbnail(3278389,'199917','','DSCF1954 web_thumb.jpg',130, 194,1,'photo_3278389.html');
												thumbnails[3278391] = new thumbnail(3278391,'199917','','DSCF1970 web_thumb.jpg',130, 194,1,'photo_3278391.html');
												thumbnails[3278435] = new thumbnail(3278435,'199917','','DSCF1839 web1_thumb.jpg',130, 194,1,'photo_3278435.html');
												thumbnails[3278440] = new thumbnail(3278440,'199917','','DSCF1898 bw web2_thumb.jpg',130, 194,1,'photo_3278440.html');
												thumbnails[3323976] = new thumbnail(3323976,'108102','','DSC_2608 bw web_thumb.jpg',130, 196,1,'photo_3323976.html');
												thumbnails[3323977] = new thumbnail(3323977,'108102','','DSC_2609 sepia web_thumb.jpg',130, 196,1,'photo_3323977.html');
												thumbnails[3652438] = new thumbnail(3652438,'108099','','DSCF8855_hisat_thumb.jpg',130, 195,1,'photo_3652438.html');
												thumbnails[4405437] = new thumbnail(4405437,'108102','','DSCF0923_popcol_thumb.jpg',130, 194,1,'photo_4405437.html');
												thumbnails[4405940] = new thumbnail(4405940,'199830','','DSCF2049_sepia_thumb.jpg',130, 195,1,'photo_4405940.html');
												thumbnails[4405942] = new thumbnail(4405942,'199830','','DSCF1873_thumb.JPG',130, 195,1,'photo_4405942.html');
												thumbnails[4405944] = new thumbnail(4405944,'199830','','DSCF1640_bw_thumb.jpg',130, 194,1,'photo_4405944.html');
												thumbnails[4405945] = new thumbnail(4405945,'199830','','DSCF1460_thumb.JPG',130, 194,1,'photo_4405945.html');
												thumbnails[4406148] = new thumbnail(4406148,'108102','','DSC_0160_4_crop_thumb.jpg',130, 163,1,'photo_4406148.html');
												thumbnails[4406156] = new thumbnail(4406156,'108102','','DSCF3403_bw_thumb.jpg',130, 194,1,'photo_4406156.html');
												thumbnails[4406159] = new thumbnail(4406159,'108102','','DSC_0779_bw_crop_thumb.jpg',130, 87,1,'photo_4406159.html');
												thumbnails[4406165] = new thumbnail(4406165,'108102','','DSCF4142_bw_thumb.jpg',130, 194,1,'photo_4406165.html');
												thumbnails[4406167] = new thumbnail(4406167,'108102','','DSCF6196_bw_thumb.jpg',130, 87,1,'photo_4406167.html');
												thumbnails[4406318] = new thumbnail(4406318,'108102','','DSCF7124_bw_thumb.jpg',130, 195,1,'photo_4406318.html');
												thumbnails[4406498] = new thumbnail(4406498,'108102','','DSCF2625_bw1_thumb.jpg',130, 195,1,'photo_4406498.html');
												thumbnails[4407071] = new thumbnail(4407071,'108099','','DSC_1661_7x5_thumb.JPG',130, 163,1,'photo_4407071.html');
												thumbnails[4407074] = new thumbnail(4407074,'108099','','DSCF0669_bw_thumb.jpg',130, 195,1,'photo_4407074.html');
												thumbnails[4407080] = new thumbnail(4407080,'108099','','DSCF1410_popcol_thumb.jpg',130, 195,1,'photo_4407080.html');
												thumbnails[4407085] = new thumbnail(4407085,'108099','','DSCF4255_thumb.JPG',130, 195,1,'photo_4407085.html');
												thumbnails[4409270] = new thumbnail(4409270,'108099','','DSCF0050_bw_thumb.jpg',130, 195,1,'photo_4409270.html');
												thumbnails[4410037] = new thumbnail(4410037,'199830','','DSCF1383_sepia_thumb.jpg',130, 195,1,'photo_4410037.html');
												thumbnails[4695186] = new thumbnail(4695186,'199830','','DSCF8390_hisat_thumb.jpg',130, 195,1,'photo_4695186.html');
												thumbnails[4695187] = new thumbnail(4695187,'199830','','DSCF8588_thumb.JPG',130, 195,1,'photo_4695187.html');
												thumbnails[4695191] = new thumbnail(4695191,'199830','','DSC_7781_thumb.JPG',130, 195,1,'photo_4695191.html');
												thumbnails[4699125] = new thumbnail(4699125,'108102','','DSC_0186_thumb.JPG',130, 87,1,'photo_4699125.html');
												thumbnails[5372847] = new thumbnail(5372847,'108099','','DSC_7854_7x5_-_Copy_thumb.JPG',130, 195,1,'photo_5372847.html');
												thumbnails[5823252] = new thumbnail(5823252,'199917','','6786-2_thumb.jpg',130, 196,1,'photo_5823252.html');
												thumbnails[5823254] = new thumbnail(5823254,'199917','','DSC_0020_thumb.JPG',130, 87,1,'photo_5823254.html');
												thumbnails[5823259] = new thumbnail(5823259,'199917','','DSC_0038_bw_thumb.jpg',130, 87,1,'photo_5823259.html');
												thumbnails[5823261] = new thumbnail(5823261,'199917','','DSC_0122_thumb.JPG',130, 87,1,'photo_5823261.html');
												thumbnails[5823265] = new thumbnail(5823265,'199917','','DSC_6705_thumb.JPG',130, 86,1,'photo_5823265.html');
												thumbnails[5823269] = new thumbnail(5823269,'199917','','DSC_6756_thumb.JPG',130, 86,1,'photo_5823269.html');
												thumbnails[5823274] = new thumbnail(5823274,'199917','','DSC_6803_thumb.JPG',130, 195,1,'photo_5823274.html');
												thumbnails[5823275] = new thumbnail(5823275,'108099','','DSC_1979_hisat_thumb.jpg',130, 195,1,'photo_5823275.html');
												thumbnails[5823277] = new thumbnail(5823277,'108099','','DSC_7078_bw_thumb.jpg',130, 195,1,'photo_5823277.html');
												thumbnails[5823357] = new thumbnail(5823357,'108102','','DSC_4721_bw_thumb.jpg',130, 86,1,'photo_5823357.html');
												thumbnails[5823372] = new thumbnail(5823372,'108102','','DSC_4894_bw_thumb.jpg',130, 87,1,'photo_5823372.html');
												thumbnails[5823375] = new thumbnail(5823375,'108102','','DSC_4926_crop_thumb.jpg',130, 87,1,'photo_5823375.html');
												thumbnails[5823380] = new thumbnail(5823380,'108102','','DSC_4934_thumb.JPG',130, 196,1,'photo_5823380.html');
												thumbnails[6053859] = new thumbnail(6053859,'108102','','1_58_thumb.JPG',130, 86,1,'photo_6053859.html');
												thumbnails[6053861] = new thumbnail(6053861,'108102','','1_83_thumb.jpg',130, 86,1,'photo_6053861.html');
												thumbnails[6053864] = new thumbnail(6053864,'108102','','DSC_0060_bw_thumb.jpg',130, 86,1,'photo_6053864.html');
												thumbnails[6053930] = new thumbnail(6053930,'108102','','DSC_0152_bw_thumb.jpg',130, 196,1,'photo_6053930.html');
												thumbnails[6053931] = new thumbnail(6053931,'108102','','DSC_0184_thumb.JPG',130, 195,1,'photo_6053931.html');
												thumbnails[6053932] = new thumbnail(6053932,'108102','','DSC_7729_bw_thumb.jpg',130, 86,1,'photo_6053932.html');
												thumbnails[6053934] = new thumbnail(6053934,'108102','','DSC_0292_bw_thumb.jpg',130, 86,1,'photo_6053934.html');
												thumbnails[6053936] = new thumbnail(6053936,'108102','','DSC_8577_sepia_thumb.jpg',130, 86,1,'photo_6053936.html');
												thumbnails[6053948] = new thumbnail(6053948,'108102','','1_66_thumb.JPG',130, 196,1,'photo_6053948.html');
												thumbnails[6053950] = new thumbnail(6053950,'108102','','DSC_0352_bw_thumb.jpg',130, 196,1,'photo_6053950.html');
												thumbnails[6053952] = new thumbnail(6053952,'108102','','DSC_0123_sepia_thumb.jpg',130, 196,1,'photo_6053952.html');
												thumbnails[6053954] = new thumbnail(6053954,'108102','','DSC_0249_bw_thumb.jpg',130, 196,1,'photo_6053954.html');
												thumbnails[6066709] = new thumbnail(6066709,'108099','','DSC_0292_thumb.JPG',130, 87,1,'photo_6066709.html');
												thumbnails[6066712] = new thumbnail(6066712,'108099','','DSC_0373_bw_thumb.jpg',130, 195,1,'photo_6066712.html');
												thumbnails[6066716] = new thumbnail(6066716,'108099','','DSC_9719_bw_thumb.jpg',130, 195,1,'photo_6066716.html');
												thumbnails[6066719] = new thumbnail(6066719,'108099','','DSC_0827_bw_thumb.jpg',130, 195,1,'photo_6066719.html');
												thumbnails[6066723] = new thumbnail(6066723,'199830','','DSC_0227_thumb.JPG',130, 196,1,'photo_6066723.html');
												thumbnails[6702049] = new thumbnail(6702049,'108102','','DSC_0403_bw_thumb.jpg',130, 86,1,'photo_6702049.html');
												thumbnails[6702057] = new thumbnail(6702057,'108102','','DSC_0123_sepia_2_thumb.jpg',130, 196,1,'photo_6702057.html');
												thumbnails[6702164] = new thumbnail(6702164,'108102','','DSC_8453_thumb.JPG',130, 86,1,'photo_6702164.html');
												thumbnails[6066714] = new thumbnail(6066714,'108099','','DSC_0476_thumb.JPG',130, 195,1,'photo_6066714.html');
												thumbnails[7690772] = new thumbnail(7690772,'199917','Little Fairy in dubai','DSC_0253_thumb.JPG',130, 86,1,'photo_7690772.html');
												thumbnails[7512154] = new thumbnail(7512154,'407351','','WI93_p154_thumb.jpg',130, 177,1,'photo_7512154.html');
												thumbnails[7512155] = new thumbnail(7512155,'407351','','WI93_p155_thumb.jpg',130, 177,1,'photo_7512155.html');
												thumbnails[7512156] = new thumbnail(7512156,'407351','','WI93_p156_thumb.jpg',130, 177,1,'photo_7512156.html');
												thumbnails[7512158] = new thumbnail(7512158,'407351','','WI93_p157_thumb.jpg',130, 177,1,'photo_7512158.html');
												thumbnails[7512159] = new thumbnail(7512159,'407351','','WI93_p158_thumb.jpg',130, 177,1,'photo_7512159.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[407351] = new gallery(407351,'7512159,7512158,7512156,7512155,7512154','Published Work','section487236',[7512154,7512155,7512156,7512158,7512159],0, 0, '', 'section487236.html',0,1);
				  					galleries[108102] = new gallery(108102,'6053934','Weddings ','gallery',[2407200,2407204,2407207,2407208,3250121,3250127,3323976,3323977,4405437,4406148,4406156,4406159,4406165,4406167,4406318,4406498,4699125,5823357,5823372,5823375,5823380,6053859,6053861,6053864,6053930,6053931,6053932,6053934,6053936,6053948,6053950,6053952,6053954,6702049,6702057,6702164],0, 0, '', 'gallery_108102.html',0,0);
				  					galleries[108099] = new gallery(108099,'6066716',' Portraits','gallery',[2712775,3034794,3034795,3077206,3192043,3192044,3652438,4407071,4407074,4407080,4407085,4409270,5372847,5823275,5823277,6066709,6066712,6066716,6066719,6066714],0, 0, '', 'gallery_108099.html',0,0);
				  					galleries[199830] = new gallery(199830,'4695191','Girls On Film','gallery',[3277032,3277033,3277036,3277038,3277096,4405940,4405942,4405944,4405945,4410037,4695186,4695187,4695191,6066723],0, 0, '', 'gallery_199830.html',0,0);
				  					galleries[199917] = new gallery(199917,'7690772','LifeStyle Shoot','gallery',[3278375,3278388,3278389,3278391,3278435,3278440,5823252,5823254,5823259,5823261,5823265,5823269,5823274,7690772],0, 0, '', 'gallery_199917.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7690772,6702049,6066723,6066719,6066716,6066714,6066712,6066709,6053954,6053952,6053950,6053948,6053936,6053934,6053932,6053931,6053930,6053864,6053861,6053859,5823380,5823375,5823372,5823357,5823277,5823275,5823274,5823269,5823265,5823261,5823259,5823254,5823252,5372847,4695191,4695186,3652438,3323977,3323976,3278440,3278435,3278391,3278389,3278388,3278375,3277096,3277038,3277036,3277033,3277032,3250127,3250121,3192044,3192043,3077206,3034795,3034794,2712775,2407208,2407207,2407204,2407200';
imageSets[2] = '7690772,6066716,6053934,4695191';
imageSets[3] = '6702049,6066723,6066719,6066716,6066714,6066712,6066709,6053954,6053952,6053950,6053948,6053936,6053934,6053932,6053931,6053930,6053864,6053861,6053859,5372847,4695191,4695186,3192043';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/abbeystudios/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/abbeystudios/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 = 'ABBEY STUDIOS: ' + 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));      $('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 == undefined) {
    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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="kerryandjacquie@tesco.net">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="kerryandjacquie@tesco.net">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

