window.thumbnails = {};
															thumbnails[9161286] = clik.newPhoto({"id":9161286,"src":"Main_Logo_Blue_and_Red_1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":159,"caption":"logo","height":160});
															thumbnails[9162068] = clik.newPhoto({"id":9162068,"src":"THE_FROG_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162068.html","width":113,"caption":"THE FROG","height":160});
															thumbnails[9162072] = clik.newPhoto({"id":9162072,"src":"SAILBOAT_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162072.html","width":113,"caption":"SAILBOAT","height":160});
															thumbnails[9162094] = clik.newPhoto({"id":9162094,"src":"Back_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162094.html","width":113,"caption":"Back","height":160});
															thumbnails[9162095] = clik.newPhoto({"id":9162095,"src":"Guitar_Man_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162095.html","width":113,"caption":"Guitar Man","height":160});
															thumbnails[9162098] = clik.newPhoto({"id":9162098,"src":"PLEASURE_ME_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162098.html","width":113,"caption":"PLEASURE ME","height":160});
															thumbnails[9162092] = clik.newPhoto({"id":9162092,"src":"20_1_thumb.jpg","galleries_id":483922,"server_id":1,"link":"photo_9162092.html","width":160,"caption":20.0,"height":113});
															thumbnails[9082629] = clik.newPhoto({"id":9082629,"src":"_DSF1300-Edit1_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082629.html","width":107,"caption":"","height":160});
															thumbnails[9082631] = clik.newPhoto({"id":9082631,"src":"2011-08-25_12-36-25_00531_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082631.html","width":128,"caption":"","height":160});
															thumbnails[9082669] = clik.newPhoto({"id":9082669,"src":"Asha_005_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9082669.html","width":128,"caption":"","height":160});
															thumbnails[9082674] = clik.newPhoto({"id":9082674,"src":"DSC_0146_jpeg_3_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9082674.html","width":106,"caption":"","height":160});
															thumbnails[9082678] = clik.newPhoto({"id":9082678,"src":"Panini_Rolls_002-Edit_thumb.jpg","galleries_id":478990,"server_id":1,"link":"photo_9082678.html","width":104,"caption":"","height":160});
															thumbnails[9082680] = clik.newPhoto({"id":9082680,"src":"Tomatoes1_thumb.jpg","galleries_id":478990,"server_id":1,"link":"photo_9082680.html","width":107,"caption":"","height":160});
															thumbnails[9082873] = clik.newPhoto({"id":9082873,"src":"dree_002366__bw_edit__thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082873.html","width":160,"caption":"","height":120});
															thumbnails[9082881] = clik.newPhoto({"id":9082881,"src":"dree_002476-Edit-Edit_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082881.html","width":120,"caption":"","height":160});
															thumbnails[9083007] = clik.newPhoto({"id":9083007,"src":"dree_002640-Edit_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9083007.html","width":120,"caption":"","height":160});
															thumbnails[9090778] = clik.newPhoto({"id":9090778,"src":"FTS0221-Edit_1_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9090778.html","width":100,"caption":"","height":160});
															thumbnails[9090780] = clik.newPhoto({"id":9090780,"src":"FTS0251-Edit_1_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9090780.html","width":106,"caption":"","height":160});
															thumbnails[9090850] = clik.newPhoto({"id":9090850,"src":"Gotcha_1_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9090850.html","width":106,"caption":"","height":160});
															thumbnails[9090857] = clik.newPhoto({"id":9090857,"src":"Sample_11_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9090857.html","width":120,"caption":"","height":160});
															thumbnails[9127766] = clik.newPhoto({"id":9127766,"src":"Card_1_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127766.html","width":121,"caption":"","height":160});
															thumbnails[9127784] = clik.newPhoto({"id":9127784,"src":"Anoushka_13_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127784.html","width":109,"caption":"","height":160});
															thumbnails[9127787] = clik.newPhoto({"id":9127787,"src":"Birthplace_1_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127787.html","width":147,"caption":"","height":160});
															thumbnails[9127793] = clik.newPhoto({"id":9127793,"src":"Untitled-13_1_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127793.html","width":121,"caption":"","height":160});
															thumbnails[9127804] = clik.newPhoto({"id":9127804,"src":"Julie_2_thumb.jpg","galleries_id":481890,"server_id":1,"link":"photo_9127804.html","width":107,"caption":"","height":160});
															thumbnails[9127821] = clik.newPhoto({"id":9127821,"src":"Image4_1_thumb.jpg","galleries_id":481890,"server_id":1,"link":"photo_9127821.html","width":128,"caption":"","height":160});
															thumbnails[9127825] = clik.newPhoto({"id":9127825,"src":"IMG_0358-Edit-Edit_1_thumb.jpg","galleries_id":481890,"server_id":1,"link":"photo_9127825.html","width":141,"caption":"","height":160});
															thumbnails[9127920] = clik.newPhoto({"id":9127920,"src":"Sample_Card_2_eye_1_thumb.jpg","galleries_id":481890,"server_id":1,"link":"photo_9127920.html","width":113,"caption":"","height":160});
															thumbnails[9127943] = clik.newPhoto({"id":9127943,"src":"A__S_468_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9127943.html","width":106,"caption":"","height":160});
															thumbnails[9127990] = clik.newPhoto({"id":9127990,"src":"Pegs_3_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9127990.html","width":131,"caption":"","height":160});
															thumbnails[9161803] = clik.newPhoto({"id":9161803,"src":"Bare_Back_2_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9161803.html","width":106,"caption":"","height":160});
															thumbnails[9082632] = clik.newPhoto({"id":9082632,"src":"Untitled-91_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082632.html","width":160,"caption":"","height":121});
															thumbnails[9082672] = clik.newPhoto({"id":9082672,"src":"Asha_008-Edit_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9082672.html","width":160,"caption":"","height":128});
															thumbnails[9082693] = clik.newPhoto({"id":9082693,"src":"2011-08-24_11-10-40_0029_thumb.jpg","galleries_id":478989,"server_id":1,"link":"photo_9082693.html","width":160,"caption":"","height":128});
															thumbnails[9082738] = clik.newPhoto({"id":9082738,"src":"Padlock_003-Edit_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9082738.html","width":160,"caption":"","height":107});
															thumbnails[9082745] = clik.newPhoto({"id":9082745,"src":"Black_Pulsar_Watch_041_thumb.jpg","galleries_id":479008,"server_id":1,"link":"photo_9082745.html","width":160,"caption":"","height":107});
															thumbnails[9082889] = clik.newPhoto({"id":9082889,"src":"dree_002569_bw_edit_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082889.html","width":160,"caption":"","height":120});
															thumbnails[9082897] = clik.newPhoto({"id":9082897,"src":"dree_002590-Edit_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9082897.html","width":160,"caption":"","height":120});
															thumbnails[9086680] = clik.newPhoto({"id":9086680,"src":"IR19490002_1_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9086680.html","width":160,"caption":"","height":128});
															thumbnails[9086796] = clik.newPhoto({"id":9086796,"src":"Skateboard_Man_1_thumb.jpg","galleries_id":478989,"server_id":1,"link":"photo_9086796.html","width":160,"caption":"","height":126});
															thumbnails[9086997] = clik.newPhoto({"id":9086997,"src":"MAN_150_exposure_4_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9086997.html","width":160,"caption":"","height":106});
															thumbnails[9087007] = clik.newPhoto({"id":9087007,"src":"Wedding_Dance_1_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9087007.html","width":160,"caption":"","height":106});
															thumbnails[9087010] = clik.newPhoto({"id":9087010,"src":"Chocolates_42_thumb.jpg","galleries_id":478990,"server_id":1,"link":"photo_9087010.html","width":160,"caption":"","height":107});
															thumbnails[9090845] = clik.newPhoto({"id":9090845,"src":"DG_Album_20_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9090845.html","width":160,"caption":"","height":110});
															thumbnails[9091273] = clik.newPhoto({"id":9091273,"src":"PW_315_high_pass_1_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9091273.html","width":160,"caption":"","height":106});
															thumbnails[9091277] = clik.newPhoto({"id":9091277,"src":"Sample_58_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9091277.html","width":160,"caption":"","height":106});
															thumbnails[9127759] = clik.newPhoto({"id":9127759,"src":"_DSF0915_1_thumb.jpg","galleries_id":479008,"server_id":1,"link":"photo_9127759.html","width":160,"caption":"","height":107});
															thumbnails[9127765] = clik.newPhoto({"id":9127765,"src":"File0010_1_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127765.html","width":160,"caption":"","height":113});
															thumbnails[9127788] = clik.newPhoto({"id":9127788,"src":"Sarah_13_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127788.html","width":160,"caption":"","height":121});
															thumbnails[9127792] = clik.newPhoto({"id":9127792,"src":"Flavia_6_thumb.jpg","galleries_id":479030,"server_id":1,"link":"photo_9127792.html","width":160,"caption":"","height":106});
															thumbnails[9127909] = clik.newPhoto({"id":9127909,"src":"DSC_32_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9127909.html","width":160,"caption":"","height":105});
															thumbnails[9127911] = clik.newPhoto({"id":9127911,"src":"File0025_1_thumb.jpg","galleries_id":478989,"server_id":1,"link":"photo_9127911.html","width":160,"caption":"","height":128});
															thumbnails[9127913] = clik.newPhoto({"id":9127913,"src":"File0027_1_thumb.jpg","galleries_id":478989,"server_id":1,"link":"photo_9127913.html","width":160,"caption":"","height":128});
															thumbnails[9127917] = clik.newPhoto({"id":9127917,"src":"Sample_24_thumb.jpg","galleries_id":478991,"server_id":1,"link":"photo_9127917.html","width":160,"caption":"","height":109});
															thumbnails[9127984] = clik.newPhoto({"id":9127984,"src":"Chalk_1_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9127984.html","width":160,"caption":"","height":128});
															thumbnails[9127987] = clik.newPhoto({"id":9127987,"src":"Egg__Whisk_3_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9127987.html","width":160,"caption":"","height":120});
															thumbnails[9128006] = clik.newPhoto({"id":9128006,"src":"The_Busker_1_thumb.jpg","galleries_id":478989,"server_id":1,"link":"photo_9128006.html","width":160,"caption":"","height":147});
															thumbnails[9161777] = clik.newPhoto({"id":9161777,"src":"Back_To_School_6_thumb.jpg","galleries_id":479007,"server_id":1,"link":"photo_9161777.html","width":160,"caption":"","height":107});
															thumbnails[9161815] = clik.newPhoto({"id":9161815,"src":"DSC_9591_thumb.jpg","galleries_id":479319,"server_id":1,"link":"photo_9161815.html","width":160,"caption":"","height":106});
															thumbnails[9161818] = clik.newPhoto({"id":9161818,"src":"Ring_1_thumb.jpg","galleries_id":479008,"server_id":1,"link":"photo_9161818.html","width":107,"caption":"","height":160});
															thumbnails[9161839] = clik.newPhoto({"id":9161839,"src":"Lacie_3_thumb.jpg","galleries_id":479008,"server_id":1,"link":"photo_9161839.html","width":160,"caption":"","height":106});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[483922] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"<b>PRINTS<\/b>","link":"section590406.html","maxRecords":0.0,"photoIDs":[9162068.0,9162072.0,9162094.0,9162095.0,9162098.0,9162092.0],"skipIndex":0,"section_code":"section590406","featured_images":"9162098,9162095,9162094,9162092,9162072,9162068","id":483922,"singleSection":true});				  						galleries[478989] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"URBAN","link":"gallery_478989.html","maxRecords":0.0,"photoIDs":[9082693.0,9086796.0,9127911.0,9127913.0,9128006.0],"skipIndex":0,"section_code":"gallery","featured_images":"9128006,9127913,9127911,9086796,9082693","id":478989,"singleSection":false});				  						galleries[478990] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"FOOD","link":"gallery_478990.html","maxRecords":0.0,"photoIDs":[9082678.0,9082680.0,9087010.0],"skipIndex":0,"section_code":"gallery","featured_images":"9087010,9082680,9082678","id":478990,"singleSection":false});				  						galleries[478991] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"LIFESTYLE","link":"gallery_478991.html","maxRecords":0.0,"photoIDs":[9082669.0,9082674.0,9090778.0,9090780.0,9082672.0,9086997.0,9127909.0,9127917.0],"skipIndex":0,"section_code":"gallery","featured_images":"9127917,9127909,9090780,9090778,9086997,9082674,9082672,9082669","id":478991,"singleSection":false});				  						galleries[479007] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"ABSTRACT","link":"gallery_479007.html","maxRecords":0.0,"photoIDs":[9127990.0,9082738.0,9086680.0,9127984.0,9127987.0,9161777.0],"skipIndex":0,"section_code":"gallery","featured_images":"9161777,9127990,9127987,9127984,9086680,9082738","id":479007,"singleSection":false});				  						galleries[479008] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"COMMERCIAL","link":"gallery_479008.html","maxRecords":0.0,"photoIDs":[9082745.0,9127759.0,9161818.0,9161839.0],"skipIndex":0,"section_code":"gallery","featured_images":"9161839,9161818,9127759,9082745","id":479008,"singleSection":false});				  						galleries[479030] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"FEMART","link":"gallery_479030.html","maxRecords":0.0,"photoIDs":[9082629.0,9082631.0,9082873.0,9082881.0,9083007.0,9127766.0,9127784.0,9127787.0,9127793.0,9161803.0,9082632.0,9082889.0,9082897.0,9127765.0,9127788.0,9127792.0],"skipIndex":0,"section_code":"gallery","featured_images":"9161803,9127793,9127792,9127788,9127787,9127784,9127766,9127765,9083007,9082897","id":479030,"singleSection":false});				  						galleries[479319] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"MOMENTS","link":"gallery_479319.html","maxRecords":0.0,"photoIDs":[9090850.0,9090857.0,9127943.0,9087007.0,9090845.0,9091273.0,9091277.0,9161815.0],"skipIndex":0,"section_code":"gallery","featured_images":"9161815,9127943,9091277,9091273,9090857,9090850,9090845,9087007","id":479319,"singleSection":false});				  						galleries[481890] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PEOPLE","link":"gallery_481890.html","maxRecords":0.0,"photoIDs":[9127804.0,9127821.0,9127825.0,9127920.0],"skipIndex":0,"section_code":"gallery","featured_images":"9127920,9127825,9127821,9127804","id":481890,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9161777,9127913,9127759,9086680';
imageSets[3] = '9162098,9162095,9162094,9162092,9162072,9162068,9161839,9161818,9161815,9161803,9161777,9161286,9128006,9127990,9127987,9127984,9127943,9127920,9127917,9127913,9127911,9127909,9127825,9127821,9127804,9127793,9127792,9127788,9127787,9127784,9127766,9127765,9127759,9091277,9091273,9090857,9090850,9090845,9090780,9090778,9087010,9087007,9086997,9086796,9086680,9083007,9082897,9082889,9082881,9082873';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Vaughan/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Vaughan/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 += 'section590406.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 && 'section590406' != '') {
					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 = 'FORBES FOTO: ' + 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 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 print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="VAUGHAN">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

