window.thumbnails = {};
															thumbnails[2631299] = clik.newPhoto({"id":2631299,"src":"123499886e116d482b62e0bd47b138b66ac4646b0e3d3a076480b1347a59be6bd8bb6986_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2631308] = clik.newPhoto({"id":2631308,"src":"193191450f68c497db0eb115a71f4c7f713f1e19d8eb393540d7805d8d652712e099d342_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":92});
															thumbnails[2631401] = clik.newPhoto({"id":2631401,"src":"7492852733841872a5232649f3c601edee61e0bf574b867a2d51fc3a111444412d8311a71_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":104});
															thumbnails[2631309] = clik.newPhoto({"id":2631309,"src":"523903801fab5492992ef82d5eed488047ba6e09946b330b4ce78359436c7ae36e201fe5_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":62});
															thumbnails[2631403] = clik.newPhoto({"id":2631403,"src":"BecksNuts1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":181});
															thumbnails[2631310] = clik.newPhoto({"id":2631310,"src":"70472686b9ce46f7606357dcea09ffc054b58bff429d2e893f8779114b4f8d8d54341d04_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2631406] = clik.newPhoto({"id":2631406,"src":"BecksNuts3-1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":178});
															thumbnails[2631311] = clik.newPhoto({"id":2631311,"src":"71086138626bb170e07fd5ccd890a8fc87c217046458aec747bb1dc8639f9a9757d2f95c_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":102});
															thumbnails[2631408] = clik.newPhoto({"id":2631408,"src":"l_df9e246c0588404e7c2dc51047b67333_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":108});
															thumbnails[2631312] = clik.newPhoto({"id":2631312,"src":"7492852733841872a5232649f3c601edee61e0bf574b867a2d51fc3a111444412d8311a7_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":104});
															thumbnails[2631411] = clik.newPhoto({"id":2631411,"src":"70472686b9ce46f7606357dcea09ffc054b58bff429d2e893f8779114b4f8d8d54341d041_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2631413] = clik.newPhoto({"id":2631413,"src":"279257902737759d43a401db386ba8d21a8e3121c40a52fd968ab0e11f8f92eaff8dafde_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2631415] = clik.newPhoto({"id":2631415,"src":"max power_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":105});
															thumbnails[2631416] = clik.newPhoto({"id":2631416,"src":"tabloid news page3_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":83});
															thumbnails[2631418] = clik.newPhoto({"id":2631418,"src":"2ECW1098editedtiny_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":89});
															thumbnails[2631422] = clik.newPhoto({"id":2631422,"src":"item_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":91});
															thumbnails[2631424] = clik.newPhoto({"id":2631424,"src":"item2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2631425] = clik.newPhoto({"id":2631425,"src":"item3_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":236});
															thumbnails[2631427] = clik.newPhoto({"id":2631427,"src":"item4_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":92});
															thumbnails[2631428] = clik.newPhoto({"id":2631428,"src":"item5_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":178});
															thumbnails[2631430] = clik.newPhoto({"id":2631430,"src":"item6_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":208});
															thumbnails[2631399] = clik.newPhoto({"id":2631399,"src":"l_23a0d36ea3508cf848257d092b89f3c9_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2631399.html","width":130,"caption":"","height":184});
															thumbnails[2631438] = clik.newPhoto({"id":2631438,"src":"l_cb960813c4caef2ab0d05b550db659df_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2631438.html","width":130,"caption":"","height":173});
															thumbnails[4750441] = clik.newPhoto({"id":4750441,"src":"16460516292845ee631fdbf5e5402e2c5cd403c34d1e402a65663c23287155fc5f40ed9eheadshotre_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_4750441.html","width":130,"caption":"","height":179});
															thumbnails[4827603] = clik.newPhoto({"id":4827603,"src":"IMG_5503editsmall_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4827603.html","width":130,"caption":"","height":195});
															thumbnails[4827604] = clik.newPhoto({"id":4827604,"src":"IMG_5549editsmall_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4827604.html","width":130,"caption":"","height":195});
															thumbnails[4827605] = clik.newPhoto({"id":4827605,"src":"2ECW1075edittiny_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_4827605.html","width":130,"caption":"","height":195});
															thumbnails[4827606] = clik.newPhoto({"id":4827606,"src":"2ECW0996edittiny_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_4827606.html","width":130,"caption":"","height":77});
															thumbnails[4827608] = clik.newPhoto({"id":4827608,"src":"2ECW1098editedtiny1_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_4827608.html","width":130,"caption":"","height":89});
															thumbnails[4827609] = clik.newPhoto({"id":4827609,"src":"6-SHILL-BENNETTsmall_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4827609.html","width":130,"caption":"","height":169});
															thumbnails[4827623] = clik.newPhoto({"id":4827623,"src":"44d5d6df267a0_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4827623.html","width":130,"caption":"","height":199});
															thumbnails[4827637] = clik.newPhoto({"id":4827637,"src":"n616845815_148807_7381_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_4827637.html","width":130,"caption":"","height":195});
															thumbnails[4828620] = clik.newPhoto({"id":4828620,"src":"2ECW0952edit_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4828620.html","width":130,"caption":"","height":195});
															thumbnails[4828622] = clik.newPhoto({"id":4828622,"src":"2ECW0957edit_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_4828622.html","width":130,"caption":"","height":258});
															thumbnails[2630877] = clik.newPhoto({"id":2630877,"src":"4576046447c2c85ddbc545e4e4f593fe7dc0b8e80ee526301807ffd5b7deab903492d016_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2630877.html","width":130,"caption":"","height":195});
															thumbnails[2631338] = clik.newPhoto({"id":2631338,"src":"2652255332e17a2209f2b6fcded91344662ed869594ac0ef14130e0c74346050f8e77aa62_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2631338.html","width":130,"caption":"","height":247});
															thumbnails[2619967] = clik.newPhoto({"id":2619967,"src":"960539807a80c94ee89d5ca1d2c364eadec0c89c1e3119aa24243c5d4a1f6384bd505c412_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619967.html","width":130,"caption":"","height":227});
															thumbnails[2620019] = clik.newPhoto({"id":2620019,"src":"629339312e7fe69e85be302a53ab55bfa73a9ade0d64b935f2a134c7237641f235ff08b0_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2620019.html","width":130,"caption":"","height":194});
															thumbnails[2630882] = clik.newPhoto({"id":2630882,"src":"67892977e86a4a04d03d93eca1488daea2b964ece8c98ce9b03ce72a10b0278173198b83_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2630882.html","width":130,"caption":"","height":195});
															thumbnails[2621180] = clik.newPhoto({"id":2621180,"src":"IMG_5806_NEWFORMAT_unmarked_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2621180.html","width":130,"caption":"","height":194});
															thumbnails[2630890] = clik.newPhoto({"id":2630890,"src":"p3_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2630890.html","width":130,"caption":"","height":194});
															thumbnails[2619968] = clik.newPhoto({"id":2619968,"src":"92684464954d89a05051c5a7441abe13cff278c41251b9213745a7193ed2ad802fb68712_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619968.html","width":130,"caption":"","height":191});
															thumbnails[2620020] = clik.newPhoto({"id":2620020,"src":"8777845815b23121462612111ea6ea68eeab682bd269b51e4f488b0113a3778c92d5a7a0_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2620020.html","width":130,"caption":"","height":194});
															thumbnails[2630894] = clik.newPhoto({"id":2630894,"src":"632979430ebdd1a7f497bd9968352f7802fe9dc2fc8c0880f86d7f0d110ebbb9255c60f5_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2630894.html","width":130,"caption":"","height":195});
															thumbnails[2630896] = clik.newPhoto({"id":2630896,"src":"1253275723_l_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2630896.html","width":130,"caption":"","height":198});
															thumbnails[2619971] = clik.newPhoto({"id":2619971,"src":"104383226944d2786112685704502b7781feb683e4c7644aa1f69e26db7060eed775c61f_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619971.html","width":130,"caption":"","height":253});
															thumbnails[2620022] = clik.newPhoto({"id":2620022,"src":"9174169221cf06bd4c3f3c1344c466ef73ee936b08798d9a923eb23d7c8822cd2bb1e2e4_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2620022.html","width":130,"caption":"","height":195});
															thumbnails[2631067] = clik.newPhoto({"id":2631067,"src":"markhatton_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2631067.html","width":130,"caption":"","height":173});
															thumbnails[2653256] = clik.newPhoto({"id":2653256,"src":"45ede1093b1dd_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2653256.html","width":130,"caption":"","height":251});
															thumbnails[2653258] = clik.newPhoto({"id":2653258,"src":"47e816d3a64c4_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2653258.html","width":130,"caption":"","height":195});
															thumbnails[2619973] = clik.newPhoto({"id":2619973,"src":"521590515383d81b9a4494ee583b4b1956b169e81a00ea4b8f80dc1a703a082e45e515b4_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619973.html","width":130,"caption":"","height":245});
															thumbnails[2653260] = clik.newPhoto({"id":2653260,"src":"item1_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2653260.html","width":130,"caption":"","height":174});
															thumbnails[2653263] = clik.newPhoto({"id":2653263,"src":"47e815d8750d3_thumb.jpg","galleries_id":166386,"server_id":32,"link":"photo_2653263.html","width":130,"caption":"","height":194});
															thumbnails[2620025] = clik.newPhoto({"id":2620025,"src":"686198525765e3a59831f880156cab5e074b2c28a4bf3c037f776ee5c27ef3cd96705713_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2620025.html","width":130,"caption":"","height":195});
															thumbnails[2619975] = clik.newPhoto({"id":2619975,"src":"p4_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619975.html","width":130,"caption":"","height":195});
															thumbnails[2621173] = clik.newPhoto({"id":2621173,"src":"SDP_9903_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2621173.html","width":130,"caption":"","height":196});
															thumbnails[2737287] = clik.newPhoto({"id":2737287,"src":"BECKY-030edit_thumb.jpg","galleries_id":165870,"server_id":32,"link":"photo_2737287.html","width":130,"caption":"","height":280});
															thumbnails[2619988] = clik.newPhoto({"id":2619988,"src":"646653438617bab949963e66566a465f08c0a03fdbda227f0922f792937dab7968ec2d33_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619988.html","width":130,"caption":"","height":206});
															thumbnails[2619990] = clik.newPhoto({"id":2619990,"src":"73791811fc72304f7d0531e17dbbb283224289036259b1ec44eb28054df3897ddb89bb64_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619990.html","width":130,"caption":"","height":87});
															thumbnails[2619991] = clik.newPhoto({"id":2619991,"src":"1522216951a2be0d0e8f2f551eaf0ade25db9630987888bff9215176953d30d0cbf64a04_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2619991.html","width":130,"caption":"","height":87});
															thumbnails[2620036] = clik.newPhoto({"id":2620036,"src":"l_71dc64272c1a02643c0152ac988c602a_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2620036.html","width":130,"caption":"","height":295});
															thumbnails[2631348] = clik.newPhoto({"id":2631348,"src":"52189966ed556012a0cf0ac58ed5c6405f0963733bd4a45fb0dc30304a0fccf88ff66c6c_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2631348.html","width":130,"caption":"","height":86});
															thumbnails[2737274] = clik.newPhoto({"id":2737274,"src":"BECKY-005edit_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2737274.html","width":130,"caption":"","height":100});
															thumbnails[2737276] = clik.newPhoto({"id":2737276,"src":"BECKY-008edit_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2737276.html","width":130,"caption":"","height":115});
															thumbnails[2737285] = clik.newPhoto({"id":2737285,"src":"BECKY-016edit_thumb.jpg","galleries_id":165869,"server_id":32,"link":"photo_2737285.html","width":130,"caption":"","height":239});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[165869] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"covered glamour photos","link":"gallery_165869.html","maxRecords":0.0,"photoIDs":[2631399.0,2631438.0,4750441.0,4827605.0,4827606.0,4827608.0,4827637.0,2631338.0,2619967.0,2621180.0,2619968.0,2619971.0,2619973.0,2619975.0,2619988.0,2619990.0,2619991.0,2620036.0,2631348.0,2737274.0,2737276.0,2737285.0],"skipIndex":0,"section_code":"gallery","featured_images":"4750441,2631399","id":165869,"singleSection":false});				  						galleries[165870] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"topless glamour","link":"gallery_165870.html","maxRecords":0.0,"photoIDs":[2620019.0,2620020.0,2620022.0,2653256.0,2620025.0,2621173.0,2737287.0],"skipIndex":0,"section_code":"gallery","featured_images":2620019.0,"id":165870,"singleSection":false});				  						galleries[166386] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Fashion\/commercial","link":"gallery_166386.html","maxRecords":0.0,"photoIDs":[4827603.0,4827604.0,4827609.0,4827623.0,4828620.0,4828622.0,2630877.0,2630882.0,2630890.0,2630894.0,2630896.0,2631067.0,2653258.0,2653260.0,2653263.0],"skipIndex":0,"section_code":"gallery","featured_images":2630877.0,"id":166386,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4750441';
imageSets[2] = '4750441,2631399,2630877,2620019,2631312';
imageSets[3] = '2631418';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/beckyb123/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/beckyb123/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 || photos || {})[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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'becky bennett: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>buy now using secure payment method paypal</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>buy this photo signed</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			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 += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="beckybennett123@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="beckybennett123@hotmail.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"view cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

