window.thumbnails = new Object();
												thumbnails[5596222] = new thumbnail(5596222,'316572','Bridal mkup','Chris7_thumb.jpg',130, 173,5,'photo_5596222.html');
												thumbnails[5596246] = new thumbnail(5596246,'316572','Bridal mkup','Sis1_thumb.jpg',130, 197,5,'photo_5596246.html');
												thumbnails[5596843] = new thumbnail(5596843,'316572','Bridal mkup','Chris51_thumb.jpg',130, 196,5,'photo_5596843.html');
												thumbnails[5686042] = new thumbnail(5686042,'316572','Bridal mkup','DSC_0817_thumb.JPG',130, 259,5,'photo_5686042.html');
												thumbnails[5686417] = new thumbnail(5686417,'316572','Bridal Mkup','caca_thumb.jpg',130, 87,5,'photo_5686417.html');
												thumbnails[5687018] = new thumbnail(5687018,'388847','Fashion show','Fashion6_thumb.jpg',130, 87,5,'photo_5687018.html');
												thumbnails[5687023] = new thumbnail(5687023,'388847','Runway Mkup','fashion7_thumb.jpg',130, 87,5,'photo_5687023.html');
												thumbnails[5687040] = new thumbnail(5687040,'322106','Short film: SUNDAY','DSCF0081_thumb.JPG',130, 98,5,'photo_5687040.html');
												thumbnails[5687088] = new thumbnail(5687088,'322106','Short Film:SUNDAY','DSCF0066_thumb.JPG',130, 98,5,'photo_5687088.html');
												thumbnails[5687101] = new thumbnail(5687101,'322106','TV : TUDORS season 4','phone_14_thumb.jpg',130, 118,5,'photo_5687101.html');
												thumbnails[5687111] = new thumbnail(5687111,'322106','The Tudors','mobile_006_thumb.jpg',130, 98,5,'photo_5687111.html');
												thumbnails[5687235] = new thumbnail(5687235,'388847','Hair','Morgan_2272-600x399_-_Copy_thumb.jpg',130, 176,5,'photo_5687235.html');
												thumbnails[5687244] = new thumbnail(5687244,'388847','Bridal Work','GetAttachmentaspx_thumb.jpg',130, 86,5,'photo_5687244.html');
												thumbnails[5687259] = new thumbnail(5687259,'388847','Bridal Work','Fashion11_thumb.jpg',130, 87,5,'photo_5687259.html');
												thumbnails[5688008] = new thumbnail(5688008,'388847','Hair','Image127_thumb.jpg',130, 173,5,'photo_5688008.html');
												thumbnails[5689748] = new thumbnail(5689748,'388847','Bridal Work','DSC_0770_thumb.jpg',130, 101,5,'photo_5689748.html');
												thumbnails[5772262] = new thumbnail(5772262,'316572','Bridal Mkup','Caroline_2_-_Copy_thumb.jpg',130, 170,5,'photo_5772262.html');
												thumbnails[6282252] = new thumbnail(6282252,'388847','Hair','26603_111065278903834_100000010861830_284841_6839138_n_thumb.jpg',130, 87,5,'photo_6282252.html');
												thumbnails[6321699] = new thumbnail(6321699,'388847','Rimmel Mkup','34124_407762366091_8605796091_4324577_4566954_n1_thumb.jpg',130, 102,5,'photo_6321699.html');
												thumbnails[6442226] = new thumbnail(6442226,'388847','Diet Coke Launch','Image004_thumb.jpg',130, 98,5,'photo_6442226.html');
												thumbnails[6442231] = new thumbnail(6442231,'322106','Documentary','Image019_thumb.jpg',130, 173,5,'photo_6442231.html');
												thumbnails[6864455] = new thumbnail(6864455,'372631','Photo','59619_475174790379_357688750379_7401528_8270211_n_thumb.jpg',130, 195,5,'photo_6864455.html');
												thumbnails[6864518] = new thumbnail(6864518,'372631','Dancing at Lughnasa','64342_475553805379_357688750379_7407213_5254821_n_thumb.jpg',130, 195,5,'photo_6864518.html');
												thumbnails[6864580] = new thumbnail(6864580,'372631','Dancing at Lughnasa','64909_475175275379_357688750379_7401534_88544_n_thumb.jpg',130, 196,5,'photo_6864580.html');
												thumbnails[6864685] = new thumbnail(6864685,'372631','Dancing at Lughnasa','64311_475176225379_357688750379_7401547_4578607_n_thumb.jpg',130, 235,5,'photo_6864685.html');
												thumbnails[6888972] = new thumbnail(6888972,'322106','Film: King Arthur','18734_1251708985662_1617655803_633251_6868256_n_thumb.jpg',130, 104,5,'photo_6888972.html');
												thumbnails[7198216] = new thumbnail(7198216,'372631','Mkup/hair','64974_475176130379_357688750379_7401546_6386094_n_thumb.jpg',130, 89,5,'photo_7198216.html');
												thumbnails[7198306] = new thumbnail(7198306,'388847','Mkup','P1120140_640x480_thumb.jpg',130, 98,5,'photo_7198306.html');
												thumbnails[7198355] = new thumbnail(7198355,'388847','Mkup/hair','Image016_thumb.jpg',130, 173,5,'photo_7198355.html');
												thumbnails[7219717] = new thumbnail(7219717,'322106','Theatre','Image029_480x640_thumb.jpg',130, 173,5,'photo_7219717.html');
												thumbnails[7219813] = new thumbnail(7219813,'322106','Game of Thrones','P1110654_640x480_thumb.jpg',130, 98,5,'photo_7219813.html');
												thumbnails[7219823] = new thumbnail(7219823,'322106','Documentary','Image009_480x640_thumb.jpg',130, 173,5,'photo_7219823.html');
												thumbnails[7388835] = new thumbnail(7388835,'404100','Publication','170893_186627651366616_146777985351583_622562_981167_o_thumb.jpg',130, 184,5,'photo_7388835.html');
												thumbnails[7453640] = new thumbnail(7453640,'322106','Pat Kenny\'s last day','phone_68_thumb.jpg',130, 98,5,'photo_7453640.html');
												thumbnails[7453672] = new thumbnail(7453672,'404100','U Magazine','DSC04799_455x640_thumb.jpg',130, 183,5,'photo_7453672.html');
												thumbnails[7453685] = new thumbnail(7453685,'404100','Theatre','P1110614_480x640_thumb.jpg',130, 173,5,'photo_7453685.html');
												thumbnails[7453702] = new thumbnail(7453702,'388847','','Image008_thumb.jpg',130, 98,5,'photo_7453702.html');
												thumbnails[7460800] = new thumbnail(7460800,'388847','','Image012_thumb.jpg',130, 173,5,'photo_7460800.html');
												thumbnails[7496150] = new thumbnail(7496150,'388847','','a_5_thumb.jpg',130, 87,5,'photo_7496150.html');
												thumbnails[7496241] = new thumbnail(7496241,'404100','','a_3_thumb.jpg',130, 77,5,'photo_7496241.html');
												thumbnails[7773312] = new thumbnail(7773312,'316572','Bridal Makeup','_MG_0173_784x1280_thumb.jpg',130, 212,5,'photo_7773312.html');
												thumbnails[7773313] = new thumbnail(7773313,'316572','','_MG_0071_448x640_thumb.jpg',130, 186,5,'photo_7773313.html');
												thumbnails[5596112] = new thumbnail(5596112,'316572','Bridal hair','7964477_thumb.jpg',130, 182,5,'photo_5596112.html');
												thumbnails[7774026] = new thumbnail(7774026,'317341','Mkup/Hair','c_IWD_Katy_-_Copy_thumb.jpg',130, 226,5,'photo_7774026.html');
												thumbnails[7931300] = new thumbnail(7931300,'317340','','Martha3_863x1280_thumb.jpg',130, 193,5,'photo_7931300.html');
												thumbnails[5596218] = new thumbnail(5596218,'316573','Bridal Hair','797714166_5hPfW-L_thumb.jpg',130, 93,5,'photo_5596218.html');
												thumbnails[5596350] = new thumbnail(5596350,'317340','Fashion Shoot(Hair)','ciaran_thumb.jpg',130, 195,5,'photo_5596350.html');
												thumbnails[7534222] = new thumbnail(7534222,'317341','Mkup/hair','Joy2_427x640_thumb.jpg',130, 195,5,'photo_7534222.html');
												thumbnails[5607907] = new thumbnail(5607907,'316573','Hair','model_2304_thumb.jpg',130, 185,5,'photo_5607907.html');
												thumbnails[5686963] = new thumbnail(5686963,'317340','Rimmel Fashion Show','fashion12_-_Copy_thumb.jpg',130, 261,5,'photo_5686963.html');
												thumbnails[7774127] = new thumbnail(7774127,'317341','Mkup/Hair','c_IWD_Piya_1024x819_546x819_thumb.jpg',130, 195,5,'photo_7774127.html');
												thumbnails[5607786] = new thumbnail(5607786,'316573','Hair','Model_2487_thumb.jpg',130, 139,5,'photo_5607786.html');
												thumbnails[7215904] = new thumbnail(7215904,'317341','Mkup/hair','FJB_9389_thumb.jpg',130, 195,5,'photo_7215904.html');
												thumbnails[7769836] = new thumbnail(7769836,'317340','','190928_167902966592917_100001196431413_326113_4950021_o_thumb.jpg',130, 147,5,'photo_7769836.html');
												thumbnails[5596052] = new thumbnail(5596052,'316573','Bridal Hair','797402_thumb.jpg',130, 185,5,'photo_5596052.html');
												thumbnails[5596421] = new thumbnail(5596421,'317340','Fashion Shoot','ciaranwhyte1_thumb.jpg',130, 184,5,'photo_5596421.html');
												thumbnails[7216960] = new thumbnail(7216960,'317341','Mkup/hair','_garethbyrd2010_21_thumb.jpg',130, 195,5,'photo_7216960.html');
												thumbnails[5596773] = new thumbnail(5596773,'317340','RUNWAY SHOW','14533_183603606983_682976983_3066414_868262_n_thumb.jpg',130, 173,5,'photo_5596773.html');
												thumbnails[6811162] = new thumbnail(6811162,'316573','Hair','4985527347a12189166969o_thumb.jpg',130, 182,5,'photo_6811162.html');
												thumbnails[7773390] = new thumbnail(7773390,'317341','','4ced9e3fe89d7_-_Copy_thumb.jpg',130, 171,5,'photo_7773390.html');
												thumbnails[5607855] = new thumbnail(5607855,'316573','Hair','Model_2519_thumb.jpg',130, 163,5,'photo_5607855.html');
												thumbnails[7460728] = new thumbnail(7460728,'317341','Mkup/Hair','Martha6_427x640_2_thumb.jpg',130, 195,5,'photo_7460728.html');
												thumbnails[7534226] = new thumbnail(7534226,'317340','Shoot','Joy5_434x640_thumb.jpg',130, 192,5,'photo_7534226.html');
												thumbnails[5596288] = new thumbnail(5596288,'316573','Hair','797713997_hgmaL-L_thumb.jpg',130, 87,5,'photo_5596288.html');
												thumbnails[5607859] = new thumbnail(5607859,'317340','Fashion Shoot(Hair)','Model_2466_thumb.jpg',130, 248,5,'photo_5607859.html');
												thumbnails[7216366] = new thumbnail(7216366,'317341','Mkup','veronika_-_Copy_thumb.jpg',130, 88,5,'photo_7216366.html');
												thumbnails[5596424] = new thumbnail(5596424,'316573','Hair','4985527347a12195266510o_thumb.jpg',130, 153,5,'photo_5596424.html');
												thumbnails[6812717] = new thumbnail(6812717,'317341','Rimmel makeover','2010-07-30_thumb.jpg',130, 103,5,'photo_6812717.html');
												thumbnails[7144666] = new thumbnail(7144666,'317340','Fashion show','DSC_8335_thumb.jpg',130, 209,5,'photo_7144666.html');
												thumbnails[5596325] = new thumbnail(5596325,'316573','Hair','joanne_thumb.jpg',130, 173,5,'photo_5596325.html');
												thumbnails[5686969] = new thumbnail(5686969,'317340','RDS','DSC_8578_thumb.jpg',130, 295,5,'photo_5686969.html');
												thumbnails[5596255] = new thumbnail(5596255,'316573','Hair','797713632_hYTMM-L_thumb.jpg',130, 195,5,'photo_5596255.html');
												thumbnails[7216678] = new thumbnail(7216678,'317340','Mkup/hair','_garethbyrd2010-2_2_thumb.jpg',130, 195,5,'photo_7216678.html');
												thumbnails[5688013] = new thumbnail(5688013,'316573','Hair','nelo2_suzanne_27_1_thumb.jpg',130, 195,5,'photo_5688013.html');
												thumbnails[7216680] = new thumbnail(7216680,'317340','Mkup','-garethbyrd201012.Jasmin_33_thumb.jpg',130, 195,5,'photo_7216680.html');
												thumbnails[5688552] = new thumbnail(5688552,'316573','Hair','nelo2_alli_41_thumb.jpg',130, 195,5,'photo_5688552.html');
												thumbnails[7769830] = new thumbnail(7769830,'317340','Mkup/Hair','c_IWD_Katy_1280x1024_thumb.jpg',130, 104,5,'photo_7769830.html');
												thumbnails[6889125] = new thumbnail(6889125,'316573','Mup/Hair','Image033_480x640_thumb.jpg',130, 173,5,'photo_6889125.html');
												thumbnails[7769831] = new thumbnail(7769831,'317340','Mkup/Hair','c_IWD_Piya_1024x819_thumb.jpg',130, 104,5,'photo_7769831.html');
												thumbnails[6889119] = new thumbnail(6889119,'316573','Mup/Hair','Image035_480x640_thumb.jpg',130, 173,5,'photo_6889119.html');
												thumbnails[7453441] = new thumbnail(7453441,'317340','Mansion House','7_thumb.jpg',130, 214,5,'photo_7453441.html');
												thumbnails[7453438] = new thumbnail(7453438,'317340','Mansion House','1_thumb.jpg',130, 194,5,'photo_7453438.html');
												thumbnails[5687003] = new thumbnail(5687003,'317340','Runway Show','fashion10_thumb.jpg',130, 87,5,'photo_5687003.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[322106] = new gallery(322106,'5687040','Behind the Scenes(TV,FILM,THEATRE)','gallery',[5687040,5687088,5687101,5687111,6442231,6888972,7219717,7219813,7219823,7453640],0, 0, '322104', 'gallery_322106.html',0,0);
				  					galleries[372631] = new gallery(372631,'6864455','Theatre Shoot','gallery',[6864455,6864518,6864580,6864685,7198216],0, 0, '322104', 'gallery_372631.html',0,0);
				  					galleries[317340] = new gallery(317340,'5596421','FASHION','gallery',[7931300,5596350,5686963,7769836,5596421,5596773,7534226,5607859,7144666,5686969,7216678,7216680,7769830,7769831,7453441,7453438,5687003],0, 0, '', 'gallery_317340.html',0,0);
				  					galleries[317341] = new gallery(317341,'7215904','PORTRAIT','gallery',[7774026,7534222,7774127,7215904,7216960,7773390,7460728,7216366,6812717],0, 0, '', 'gallery_317341.html',0,0);
				  					galleries[316572] = new gallery(316572,'5596222','BRIDAL MAKE-UP','gallery',[5596222,5596246,5596843,5686042,5686417,5772262,7773312,7773313,5596112],0, 0, '', 'gallery_316572.html',0,0);
				  					galleries[316573] = new gallery(316573,'5607855','HAIR STYLES','gallery',[5596218,5607907,5607786,5596052,6811162,5607855,5596288,5596424,5596325,5596255,5688013,5688552,6889125,6889119],0, 0, '', 'gallery_316573.html',0,0);
				  					galleries[322104] = new gallery(322104,'6864455,5687040','TV/Film/Theatre','gallery',[],0, 0, '', 'gallery_322104.html',0,0);
				  					galleries[388847] = new gallery(388847,'5687023','Behind the scenes','gallery',[5687018,5687023,5687235,5687244,5687259,5688008,5689748,6282252,6321699,6442226,7198306,7198355,7453702,7460800,7496150],0, 0, '', 'gallery_388847.html',0,0);
				  					galleries[404100] = new gallery(404100,'7496241,7453685,7453672,7388835','Publications','gallery',[7388835,7453672,7453685,7496241],0, 0, '', 'gallery_404100.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5687023';
imageSets[2] = '7215904,6864455,5687040,5687023,5607855,5596421,5596222';
imageSets[3] = '5607907,5607859,5607786,5596843,5596773,5596424,5596421,5596350,5596325,5596288,5596255,5596246,5596222,5596112,5596052';
imageSets[234940] = '5596843,5596255,5596222,5596112,5596052';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Leontia/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Leontia/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Leontia/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Leontia/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Leontia/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Leontia/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 = 'Leontia  Makeup & Hair: ' + 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 == 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>';
	}
					
				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> &euro;' + (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="">';
	temp = temp + '<input type="hidden" name="currency_code" value="EUR">';
	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="">';
	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;
	}
}

			

