window.thumbnails = new Object();
												thumbnails[7911634] = new thumbnail(7911634,'','','BLOG040_thumb.jpg',130, 104,5,'#');
												thumbnails[7905702] = new thumbnail(7905702,'426398','','luyfliyf_thumb.jpg',130, 104,5,'photo_7905702.html');
												thumbnails[7910875] = new thumbnail(7910875,'424814','','BLOG001_thumb.jpg',130, 104,5,'photo_7910875.html');
												thumbnails[7910879] = new thumbnail(7910879,'424814','','BLOG002_thumb.jpg',130, 104,5,'photo_7910879.html');
												thumbnails[7910881] = new thumbnail(7910881,'424814','','BLOG003_thumb.jpg',130, 104,5,'photo_7910881.html');
												thumbnails[7910883] = new thumbnail(7910883,'424814','','BLOG004_thumb.jpg',130, 108,5,'photo_7910883.html');
												thumbnails[7910884] = new thumbnail(7910884,'424814','','BLOG005_thumb.jpg',130, 108,5,'photo_7910884.html');
												thumbnails[7910885] = new thumbnail(7910885,'424814','','BLOG006_thumb.jpg',130, 108,5,'photo_7910885.html');
												thumbnails[7910887] = new thumbnail(7910887,'424814','','BLOG007_thumb.jpg',130, 108,5,'photo_7910887.html');
												thumbnails[7910888] = new thumbnail(7910888,'424814','','BLOG008_thumb.jpg',130, 108,5,'photo_7910888.html');
												thumbnails[7910889] = new thumbnail(7910889,'424814','','BLOG009_thumb.jpg',130, 108,5,'photo_7910889.html');
												thumbnails[7910891] = new thumbnail(7910891,'424814','','BLOG010_thumb.jpg',130, 108,5,'photo_7910891.html');
												thumbnails[7910892] = new thumbnail(7910892,'424814','','BLOG011_thumb.jpg',130, 104,5,'photo_7910892.html');
												thumbnails[7910895] = new thumbnail(7910895,'424814','','BLOG012_thumb.jpg',130, 108,5,'photo_7910895.html');
												thumbnails[7910897] = new thumbnail(7910897,'424814','','BLOG013_thumb.jpg',130, 108,5,'photo_7910897.html');
												thumbnails[7910900] = new thumbnail(7910900,'424814','','BLOG014_thumb.jpg',130, 108,5,'photo_7910900.html');
												thumbnails[7910901] = new thumbnail(7910901,'424814','','BLOG015_thumb.jpg',130, 104,5,'photo_7910901.html');
												thumbnails[7911380] = new thumbnail(7911380,'426422','','BLOG020_thumb.jpg',130, 108,5,'photo_7911380.html');
												thumbnails[7911382] = new thumbnail(7911382,'426422','','BLOG021_thumb.jpg',130, 104,5,'photo_7911382.html');
												thumbnails[7911383] = new thumbnail(7911383,'426422','','BLOG022_thumb.jpg',130, 104,5,'photo_7911383.html');
												thumbnails[7911384] = new thumbnail(7911384,'426422','','BLOG024_thumb.jpg',130, 108,5,'photo_7911384.html');
												thumbnails[7911385] = new thumbnail(7911385,'426422','','BLOG0231_thumb.jpg',130, 104,5,'photo_7911385.html');
												thumbnails[7911386] = new thumbnail(7911386,'426422','','BLOG025_thumb.jpg',130, 108,5,'photo_7911386.html');
												thumbnails[7911387] = new thumbnail(7911387,'426422','','BLOG026_thumb.jpg',130, 104,5,'photo_7911387.html');
												thumbnails[7911388] = new thumbnail(7911388,'426422','','BLOG027_thumb.jpg',130, 108,5,'photo_7911388.html');
												thumbnails[7911389] = new thumbnail(7911389,'426422','','BLOG028_thumb.jpg',130, 108,5,'photo_7911389.html');
												thumbnails[7911390] = new thumbnail(7911390,'426422','','BLOG029_thumb.jpg',130, 104,5,'photo_7911390.html');
												thumbnails[7911392] = new thumbnail(7911392,'426422','','BLOG030_thumb.jpg',130, 108,5,'photo_7911392.html');
												thumbnails[7911393] = new thumbnail(7911393,'426422','','BLOG031_thumb.jpg',130, 104,5,'photo_7911393.html');
												thumbnails[7911396] = new thumbnail(7911396,'426422','','BLOG032_thumb.jpg',130, 108,5,'photo_7911396.html');
												thumbnails[7911413] = new thumbnail(7911413,'426422','','BLOG033_thumb.jpg',130, 108,5,'photo_7911413.html');
												thumbnails[7911431] = new thumbnail(7911431,'426422','','BLOG034_thumb.jpg',130, 108,5,'photo_7911431.html');
												thumbnails[7911449] = new thumbnail(7911449,'426422','','BLOG035_thumb.jpg',130, 108,5,'photo_7911449.html');
												thumbnails[7911630] = new thumbnail(7911630,'426422','','BLOG036_thumb.jpg',130, 104,5,'photo_7911630.html');
												thumbnails[7911633] = new thumbnail(7911633,'426422','','BLOG039_thumb.jpg',130, 108,5,'photo_7911633.html');
												thumbnails[7912215] = new thumbnail(7912215,'426622','','BLOG0401_thumb.jpg',130, 108,5,'photo_7912215.html');
												thumbnails[7912217] = new thumbnail(7912217,'426622','','BLOG041_thumb.jpg',130, 104,5,'photo_7912217.html');
												thumbnails[7912218] = new thumbnail(7912218,'426622','','BLOG042_thumb.jpg',130, 104,5,'photo_7912218.html');
												thumbnails[7912219] = new thumbnail(7912219,'426622','','BLOG043_thumb.jpg',130, 104,5,'photo_7912219.html');
												thumbnails[7912220] = new thumbnail(7912220,'426622','','BLOG044_thumb.jpg',130, 104,5,'photo_7912220.html');
												thumbnails[7912223] = new thumbnail(7912223,'426622','','BLOG045_thumb.jpg',130, 108,5,'photo_7912223.html');
												thumbnails[7912224] = new thumbnail(7912224,'426622','','BLOG046_thumb.jpg',130, 108,5,'photo_7912224.html');
												thumbnails[7912225] = new thumbnail(7912225,'426622','','BLOG047_thumb.jpg',130, 108,5,'photo_7912225.html');
												thumbnails[7912227] = new thumbnail(7912227,'426622','','BLOG048_thumb.jpg',130, 108,5,'photo_7912227.html');
												thumbnails[7912228] = new thumbnail(7912228,'426622','','BLOG049_thumb.jpg',130, 104,5,'photo_7912228.html');
												thumbnails[7912241] = new thumbnail(7912241,'426622','','BLOG051_thumb.jpg',130, 108,5,'photo_7912241.html');
												thumbnails[7912244] = new thumbnail(7912244,'426622','','BLOG052_thumb.jpg',130, 108,5,'photo_7912244.html');
												thumbnails[7912306] = new thumbnail(7912306,'426398','','BLOG060_thumb.jpg',130, 104,5,'photo_7912306.html');
												thumbnails[7912309] = new thumbnail(7912309,'426398','','BLOG061_thumb.jpg',130, 104,5,'photo_7912309.html');
												thumbnails[7912311] = new thumbnail(7912311,'426398','','BLOG062_thumb.jpg',130, 104,5,'photo_7912311.html');
												thumbnails[7912315] = new thumbnail(7912315,'426398','','BLOG063_thumb.jpg',130, 104,5,'photo_7912315.html');
												thumbnails[7912316] = new thumbnail(7912316,'426398','','BLOG064_thumb.jpg',130, 104,5,'photo_7912316.html');
												thumbnails[7912317] = new thumbnail(7912317,'426398','','BLOG065_thumb.jpg',130, 104,5,'photo_7912317.html');
												thumbnails[7912319] = new thumbnail(7912319,'426398','','BLOG066_thumb.jpg',130, 104,5,'photo_7912319.html');
												thumbnails[7912320] = new thumbnail(7912320,'426398','','BLOG067_thumb.jpg',130, 104,5,'photo_7912320.html');
												thumbnails[7912321] = new thumbnail(7912321,'426398','','BLOG068_thumb.jpg',130, 104,5,'photo_7912321.html');
												thumbnails[7912324] = new thumbnail(7912324,'426398','','BLOG069_thumb.jpg',130, 104,5,'photo_7912324.html');
												thumbnails[7912345] = new thumbnail(7912345,'426398','','BLOG082_thumb.jpg',130, 104,5,'photo_7912345.html');
												thumbnails[7912346] = new thumbnail(7912346,'426398','','BLOG087_thumb.jpg',130, 104,5,'photo_7912346.html');
												thumbnails[7912349] = new thumbnail(7912349,'426398','','BLOG084_thumb.jpg',130, 104,5,'photo_7912349.html');
												thumbnails[7912353] = new thumbnail(7912353,'426398','','BLOG085_thumb.jpg',130, 104,5,'photo_7912353.html');
												thumbnails[7946805] = new thumbnail(7946805,'428006','','BLOG200_thumb.jpg',130, 104,5,'photo_7946805.html');
												thumbnails[7946806] = new thumbnail(7946806,'428006','','BLOG201_thumb.jpg',130, 104,5,'photo_7946806.html');
												thumbnails[7946807] = new thumbnail(7946807,'428006','','BLOG202_thumb.jpg',130, 104,5,'photo_7946807.html');
												thumbnails[7946808] = new thumbnail(7946808,'428006','','BLOG203_thumb.jpg',130, 104,5,'photo_7946808.html');
												thumbnails[7946810] = new thumbnail(7946810,'428006','','BLOG204_thumb.jpg',130, 104,5,'photo_7946810.html');
												thumbnails[7946811] = new thumbnail(7946811,'428006','','BLOG205_thumb.jpg',130, 104,5,'photo_7946811.html');
												thumbnails[7946813] = new thumbnail(7946813,'428006','','BLOG206_thumb.jpg',130, 101,5,'photo_7946813.html');
												thumbnails[7946814] = new thumbnail(7946814,'428006','','BLOG207_thumb.jpg',130, 104,5,'photo_7946814.html');
												thumbnails[7946815] = new thumbnail(7946815,'428006','','BLOG208_thumb.jpg',130, 104,5,'photo_7946815.html');
												thumbnails[7946817] = new thumbnail(7946817,'428006','','BLOG209_thumb.jpg',130, 104,5,'photo_7946817.html');
												thumbnails[7946818] = new thumbnail(7946818,'428006','','BLOG210_thumb.jpg',130, 104,5,'photo_7946818.html');
												thumbnails[7946819] = new thumbnail(7946819,'428006','','BLOG211_thumb.jpg',130, 108,5,'photo_7946819.html');
												thumbnails[7946820] = new thumbnail(7946820,'428006','','BLOG212_thumb.jpg',130, 67,5,'photo_7946820.html');
												thumbnails[7946821] = new thumbnail(7946821,'428006','','BLOG213_thumb.jpg',130, 104,5,'photo_7946821.html');
												thumbnails[7946823] = new thumbnail(7946823,'428006','','BLOG214_thumb.jpg',130, 104,5,'photo_7946823.html');
												thumbnails[7946824] = new thumbnail(7946824,'428006','','BLOG219_thumb.jpg',130, 104,5,'photo_7946824.html');
												thumbnails[7946839] = new thumbnail(7946839,'428006','','London004181106_thumb.jpg',130, 104,5,'photo_7946839.html');
												thumbnails[7946841] = new thumbnail(7946841,'428006','','Lon039181106_thumb.jpg',130, 104,5,'photo_7946841.html');
												thumbnails[7994913] = new thumbnail(7994913,'429790','','RDBW001_thumb.jpg',130, 104,5,'photo_7994913.html');
												thumbnails[7994916] = new thumbnail(7994916,'429790','','RDBW008_thumb.jpg',130, 104,5,'photo_7994916.html');
												thumbnails[7994917] = new thumbnail(7994917,'429790','','RDBW002_thumb.jpg',130, 104,5,'photo_7994917.html');
												thumbnails[7994919] = new thumbnail(7994919,'429790','','RDBW003_thumb.jpg',130, 104,5,'photo_7994919.html');
												thumbnails[7994921] = new thumbnail(7994921,'429790','','RDBW004_thumb.jpg',130, 104,5,'photo_7994921.html');
												thumbnails[7994922] = new thumbnail(7994922,'429790','','RDBW005_thumb.jpg',130, 104,5,'photo_7994922.html');
												thumbnails[7994923] = new thumbnail(7994923,'429790','','RDBW006_thumb.jpg',130, 104,5,'photo_7994923.html');
												thumbnails[7994925] = new thumbnail(7994925,'429790','','RDBW007_thumb.jpg',130, 104,5,'photo_7994925.html');
												thumbnails[7994926] = new thumbnail(7994926,'429790','','RDBW009_thumb.jpg',130, 104,5,'photo_7994926.html');
												thumbnails[7994927] = new thumbnail(7994927,'429790','','RDBW010_thumb.jpg',130, 104,5,'photo_7994927.html');
												thumbnails[7994929] = new thumbnail(7994929,'429790','','RDBW011_thumb.jpg',130, 104,5,'photo_7994929.html');
												thumbnails[7994930] = new thumbnail(7994930,'429790','','RDBW012_thumb.jpg',130, 104,5,'photo_7994930.html');
												thumbnails[7994931] = new thumbnail(7994931,'429790','','RDBW013_thumb.jpg',130, 104,5,'photo_7994931.html');
												thumbnails[7994932] = new thumbnail(7994932,'429790','','RDBW014_thumb.jpg',130, 104,5,'photo_7994932.html');
												thumbnails[7994934] = new thumbnail(7994934,'429790','','RDBW015_thumb.jpg',130, 104,5,'photo_7994934.html');
												thumbnails[7994935] = new thumbnail(7994935,'429790','','RDBW016_thumb.jpg',130, 104,5,'photo_7994935.html');
												thumbnails[7870191] = new thumbnail(7870191,'424807','','KM001_thumb.jpg',130, 108,5,'photo_7870191.html');
												thumbnails[7870208] = new thumbnail(7870208,'424807','','KM0021_thumb.jpg',130, 108,5,'photo_7870208.html');
												thumbnails[7870193] = new thumbnail(7870193,'424807','','KM003_thumb.jpg',130, 108,5,'photo_7870193.html');
												thumbnails[7870224] = new thumbnail(7870224,'424807','','KM004_thumb.jpg',130, 108,5,'photo_7870224.html');
												thumbnails[7870226] = new thumbnail(7870226,'424807','','KM005_thumb.jpg',130, 108,5,'photo_7870226.html');
												thumbnails[7870227] = new thumbnail(7870227,'424807','','KM006_thumb.jpg',130, 108,5,'photo_7870227.html');
												thumbnails[7870228] = new thumbnail(7870228,'424807','','KM007_thumb.jpg',130, 108,5,'photo_7870228.html');
												thumbnails[7870229] = new thumbnail(7870229,'424807','','KM008_thumb.jpg',130, 108,5,'photo_7870229.html');
												thumbnails[7870230] = new thumbnail(7870230,'424807','','KM009_thumb.jpg',130, 108,5,'photo_7870230.html');
												thumbnails[7870231] = new thumbnail(7870231,'424807','','KM010_thumb.jpg',130, 108,5,'photo_7870231.html');
												thumbnails[7870233] = new thumbnail(7870233,'424807','','KM011_thumb.jpg',130, 108,5,'photo_7870233.html');
												thumbnails[7870234] = new thumbnail(7870234,'424807','','KM012_thumb.jpg',130, 108,5,'photo_7870234.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[424814] = new gallery(424814,'7910901,7910900,7910897,7910895,7910892,7910891,7910889,7910888,7910887,7910885','Côte Rouge','section410082',[7910875,7910879,7910881,7910883,7910884,7910885,7910887,7910888,7910889,7910891,7910892,7910895,7910897,7910900,7910901],0, 0, '', 'section410082_424814.html',0,0);
				  					galleries[426422] = new gallery(426422,'7911633,7911630,7911449,7911431,7911413,7911396,7911393,7911392,7911390,7911389','I\'m Here','section410082',[7911380,7911382,7911383,7911384,7911385,7911386,7911387,7911388,7911389,7911390,7911392,7911393,7911396,7911413,7911431,7911449,7911630,7911633],0, 0, '', 'section410082_426422.html',0,0);
				  					galleries[426622] = new gallery(426622,'7912244,7912241,7912228,7912227,7912225,7912224,7912223,7912220,7912219,7912218','Marshland','section410082',[7912215,7912217,7912218,7912219,7912220,7912223,7912224,7912225,7912227,7912228,7912241,7912244],0, 0, '', 'section410082_426622.html',0,0);
				  					galleries[426398] = new gallery(426398,'7912353,7912349,7912346,7912345,7912324,7912321,7912320,7912319,7912317,7912316','Random','section410082',[7905702,7912306,7912309,7912311,7912315,7912316,7912317,7912319,7912320,7912321,7912324,7912345,7912346,7912349,7912353],0, 0, '', 'section410082_426398.html',0,0);
				  					galleries[424807] = new gallery(424807,'7870234,7870233,7870231,7870230,7870229,7870228,7870227,7870226,7870224,7870208','Frequency','section410082',[7870191,7870208,7870193,7870224,7870226,7870227,7870228,7870229,7870230,7870231,7870233,7870234],0, 0, '', 'section410082_424807.html',0,0);
				  					galleries[428006] = new gallery(428006,'7946841,7946839,7946824,7946823,7946821,7946820,7946819,7946818,7946817,7946815','2012','section410082',[7946805,7946806,7946807,7946808,7946810,7946811,7946813,7946814,7946815,7946817,7946818,7946819,7946820,7946821,7946823,7946824,7946839,7946841],0, 0, '', 'section410082_428006.html',0,0);
				  					galleries[429790] = new gallery(429790,'7994935,7994934,7994932,7994931,7994930,7994929,7994927,7994926,7994925,7994923','B&W','section410082',[7994913,7994916,7994917,7994919,7994921,7994922,7994923,7994925,7994926,7994927,7994929,7994930,7994931,7994932,7994934,7994935],0, 0, '', 'section410082_429790.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7912321,7912306,7911396,7911380,7910889,7910883,7905702,7870228';
imageSets[3] = '7994935,7994934,7994932,7994931,7994930,7994929,7994927,7994926,7994925,7994923,7994922,7994921,7994919,7994917,7994916,7994913,7946841,7946839,7946824,7946823,7946821,7946820,7946819,7946818,7946817,7946815,7946814,7946813,7946811,7946810,7946808,7946807,7946806,7946805,7912353,7912349,7912346,7912345,7912324,7912321,7912320,7912319,7912317,7912316,7912315,7912311,7912309,7912306,7912244,7912241';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/russelldawson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/russelldawson/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 += 'section410082.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 && 'section410082' != '') {
					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 = 'Russell Dawson  -  Photographer: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      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> &pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																				temp = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="rdawson121@hotmail.com">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="rdawson121@hotmail.com">';
	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;
	}
}

			

