window.thumbnails = {};
															thumbnails[7643034] = clik.newPhoto({"id":7643034,"src":"WarmachinePinup01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643034.html","width":130,"caption":"War Machine Pin-up","height":130});
															thumbnails[7643030] = clik.newPhoto({"id":7643030,"src":"CapVsModok01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643030.html","width":130,"caption":"Captain America Vs Modok Pin-up","height":130});
															thumbnails[7643028] = clik.newPhoto({"id":7643028,"src":"GodzillaPinup01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643028.html","width":130,"caption":"Godzilla Pin-up","height":130});
															thumbnails[7643024] = clik.newPhoto({"id":7643024,"src":"AOTWSplash01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643024.html","width":130,"caption":"Age of the Wolf Fenris Splash Page","height":130});
															thumbnails[7643019] = clik.newPhoto({"id":7643019,"src":"ElektraPinup01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643019.html","width":130,"caption":"Elektra Pin-up","height":130});
															thumbnails[7643015] = clik.newPhoto({"id":7643015,"src":"DanSplash01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_7643015.html","width":130,"caption":"Dandridge House that Dripped Devilry Splash","height":130});
															thumbnails[7642807] = clik.newPhoto({"id":7642807,"src":"DanCover01_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_7642807.html","width":130,"caption":"Dandridge Cover from Prog 1730","height":130});
															thumbnails[7642805] = clik.newPhoto({"id":7642805,"src":"KingdomCover01_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_7642805.html","width":130,"caption":"Kingdom Cover from Prog 1717","height":130});
															thumbnails[7642801] = clik.newPhoto({"id":7642801,"src":"AOTWCover01_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_7642801.html","width":130,"caption":"Age of The Wolf Cover Inks from Prog 1703","height":130});
															thumbnails[6630115] = clik.newPhoto({"id":6630115,"src":"2000AD_Thrill_Power_Cover_Thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_6630115.html","width":130,"caption":"2000AD Prog 1700 Cover","height":130});
															thumbnails[6630141] = clik.newPhoto({"id":6630141,"src":"Tempest_Mech_Cover_01_Thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_6630141.html","width":130,"caption":"Judge Dredd Megazine 296 Cover","height":130});
															thumbnails[6630114] = clik.newPhoto({"id":6630114,"src":"Strontium_Dog_Cover_01_Thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_6630114.html","width":130,"caption":"2000AD Prog 1694 Cover","height":130});
															thumbnails[6630121] = clik.newPhoto({"id":6630121,"src":"Age_of_the_Wolf_Teaser_Thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_6630121.html","width":130,"caption":"2000AD Age of the Wolf Teaser image","height":130});
															thumbnails[5499202] = clik.newPhoto({"id":5499202,"src":"Final_Tempest_2_Cover_01_Thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5499202.html","width":130,"caption":"Yin","height":130});
															thumbnails[5499440] = clik.newPhoto({"id":5499440,"src":"Tempest_Cover_01_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5499440.html","width":130,"caption":"Tempest's first cover","height":130});
															thumbnails[5499304] = clik.newPhoto({"id":5499304,"src":"Stalag_Cover_01_Finish_02_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5499304.html","width":130,"caption":"Stalag Commander","height":130});
															thumbnails[5499433] = clik.newPhoto({"id":5499433,"src":"Tempest_Cover_02_Final_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5499433.html","width":130,"caption":"Tempest's Lair","height":130});
															thumbnails[5502777] = clik.newPhoto({"id":5502777,"src":"Cover_01_Starscream_Final_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5502777.html","width":130,"caption":"Starscream","height":130});
															thumbnails[6630126] = clik.newPhoto({"id":6630126,"src":"Tempest_2_Issue_5_Page_05_Thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_6630126.html","width":130,"caption":"2000AD Tempest Time Zero Issue 5 Splash","height":130});
															thumbnails[8559843] = clik.newPhoto({"id":8559843,"src":"JD-Gold-01_thumb.jpg","galleries_id":67001,"server_id":35,"link":"photo_8559843.html","width":130,"caption":"Judge Dredd Gold of Exodus Page 01","height":130});
															thumbnails[8569744] = clik.newPhoto({"id":8569744,"src":"JD-Gold-02_thumb.jpg","galleries_id":67001,"server_id":19,"link":"photo_8569744.html","width":130,"caption":"Judge Dredd The Gold of Exodus Page 02","height":130});
															thumbnails[8569747] = clik.newPhoto({"id":8569747,"src":"JD-Gold-03_thumb.jpg","galleries_id":67001,"server_id":19,"link":"photo_8569747.html","width":130,"caption":"Judge Dredd The Gold of Exodus Page 03","height":130});
															thumbnails[8569749] = clik.newPhoto({"id":8569749,"src":"JD-Gold-04_thumb.jpg","galleries_id":67001,"server_id":19,"link":"photo_8569749.html","width":130,"caption":"Judge Dredd The Gold of Exodus Page 04","height":130});
															thumbnails[8569756] = clik.newPhoto({"id":8569756,"src":"JD-Gold-05_thumb.jpg","galleries_id":67001,"server_id":19,"link":"photo_8569756.html","width":130,"caption":"Judge Dredd The Gold of Exodus Page 05","height":130});
															thumbnails[8559837] = clik.newPhoto({"id":8559837,"src":"FS-Hacked-01_thumb.jpg","galleries_id":67001,"server_id":35,"link":"photo_8559837.html","width":130,"caption":"Future Shock Hacked Page 01","height":130});
															thumbnails[8559841] = clik.newPhoto({"id":8559841,"src":"FS-Hacked-02_thumb.jpg","galleries_id":67001,"server_id":35,"link":"photo_8559841.html","width":130,"caption":"Future Shock Hacked Page 02","height":130});
															thumbnails[7642962] = clik.newPhoto({"id":7642962,"src":"DanPage01_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642962.html","width":130,"caption":"2000AD Dandridge Page 01","height":130});
															thumbnails[7642963] = clik.newPhoto({"id":7642963,"src":"DanPage02_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642963.html","width":130,"caption":"2000AD Dandridge Page 02","height":130});
															thumbnails[7642966] = clik.newPhoto({"id":7642966,"src":"DanPage03_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642966.html","width":130,"caption":"2000AD Dandridge Page 03","height":130});
															thumbnails[7642970] = clik.newPhoto({"id":7642970,"src":"DanPage07_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642970.html","width":130,"caption":"2000AD Dandridge Page 07","height":130});
															thumbnails[7642975] = clik.newPhoto({"id":7642975,"src":"DanPage15_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642975.html","width":130,"caption":"2000AD Dandridge Page 15","height":130});
															thumbnails[7642980] = clik.newPhoto({"id":7642980,"src":"DanPage18_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642980.html","width":130,"caption":"2000AD Dandridge Page 18","height":130});
															thumbnails[7642983] = clik.newPhoto({"id":7642983,"src":"DanPage22_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642983.html","width":130,"caption":"2000AD Dandridge Page 22","height":130});
															thumbnails[7642996] = clik.newPhoto({"id":7642996,"src":"JDPage01_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642996.html","width":130,"caption":"2000Ad Megazine Judge Dredd","height":130});
															thumbnails[5489595] = clik.newPhoto({"id":5489595,"src":"Dredd_Cover_Final_011_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5489595.html","width":130,"caption":"Judge Dredd","height":130});
															thumbnails[7642832] = clik.newPhoto({"id":7642832,"src":"AOTWPage01_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642832.html","width":130,"caption":"2000AD Age of the Wolf Page 01","height":130});
															thumbnails[7642834] = clik.newPhoto({"id":7642834,"src":"AOTWPage02_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642834.html","width":130,"caption":"2000AD Age of the Wolf Page 02","height":130});
															thumbnails[5502786] = clik.newPhoto({"id":5502786,"src":"Engineer_Inks_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5502786.html","width":130,"caption":"The Engineer","height":130});
															thumbnails[7642902] = clik.newPhoto({"id":7642902,"src":"AOTWPage16_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642902.html","width":130,"caption":"2000AD Age of the Wolf Page 16","height":130});
															thumbnails[5502792] = clik.newPhoto({"id":5502792,"src":"Hellboy_Inks_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5502792.html","width":130,"caption":"Hellboy","height":130});
															thumbnails[7642909] = clik.newPhoto({"id":7642909,"src":"AOTWPage18_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642909.html","width":130,"caption":"2000AD Age of the Wolf Page 18","height":130});
															thumbnails[7642922] = clik.newPhoto({"id":7642922,"src":"AOTWPage21_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642922.html","width":130,"caption":"2000AD Age of the Wolf Page 21","height":130});
															thumbnails[5499482] = clik.newPhoto({"id":5499482,"src":"TFUK_vol2_01_Page_01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5499482.html","width":130,"caption":"Training Day","height":130});
															thumbnails[7642958] = clik.newPhoto({"id":7642958,"src":"AOTWPage22_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642958.html","width":130,"caption":"2000AD Age of the Wolf Page 22","height":130});
															thumbnails[5499447] = clik.newPhoto({"id":5499447,"src":"TF_Movie_Issue_01_Page_22_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5499447.html","width":130,"caption":"Megatron","height":130});
															thumbnails[7642811] = clik.newPhoto({"id":7642811,"src":"Sector7Page01_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642811.html","width":130,"caption":"IDW Sector 7 Issue 05 Page 01","height":130});
															thumbnails[7642813] = clik.newPhoto({"id":7642813,"src":"Sector7Page03_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642813.html","width":130,"caption":"IDW Sector 7 Issue 5 Page 03","height":130});
															thumbnails[7642814] = clik.newPhoto({"id":7642814,"src":"Sector7Page04_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642814.html","width":130,"caption":"IDW Sector 7 Issue 5 Page 04","height":130});
															thumbnails[7642815] = clik.newPhoto({"id":7642815,"src":"Sector7Page08_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642815.html","width":130,"caption":"IDW Sector 7 Issue 5 Page 08","height":130});
															thumbnails[7642822] = clik.newPhoto({"id":7642822,"src":"Sector7Page09_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_7642822.html","width":130,"caption":"IDW Sector 7 Issue 5 Page 09","height":130});
															thumbnails[5502779] = clik.newPhoto({"id":5502779,"src":"Cover_02_Optimus_Prime_Final02_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5502779.html","width":130,"caption":"Optimus Prime","height":130});
															thumbnails[6630100] = clik.newPhoto({"id":6630100,"src":"2000AD_Purgation_Page_02_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_6630100.html","width":130,"caption":"2000AD Purgation Page 2","height":130});
															thumbnails[6630102] = clik.newPhoto({"id":6630102,"src":"2000AD_Purgation_Page_04_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_6630102.html","width":130,"caption":"2000AD Purgation Page 4","height":130});
															thumbnails[6630105] = clik.newPhoto({"id":6630105,"src":"2000AD_Purgation_Page_05_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_6630105.html","width":130,"caption":"2000AD Purgation Page 5","height":130});
															thumbnails[6630106] = clik.newPhoto({"id":6630106,"src":"2000AD_Purgation_Page_06_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_6630106.html","width":130,"caption":"2000AD Purgation Page 6","height":130});
															thumbnails[6630111] = clik.newPhoto({"id":6630111,"src":"2000AD_Purgation_Page_08_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_6630111.html","width":130,"caption":"2000AD Purgation Page 8","height":130});
															thumbnails[5502782] = clik.newPhoto({"id":5502782,"src":"Cover_04_Starscream_Tormented_01Final_thumb.jpg","galleries_id":66925,"server_id":18,"link":"photo_5502782.html","width":130,"caption":"Starscream Tormented","height":130});
															thumbnails[5489639] = clik.newPhoto({"id":5489639,"src":"Episode_04_Page_09_Final_Thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5489639.html","width":130,"caption":"Tempest Smiles","height":130});
															thumbnails[5499457] = clik.newPhoto({"id":5499457,"src":"TFUK_Issue_07_Page_01_thumb.jpg","galleries_id":68327,"server_id":18,"link":"photo_5499457.html","width":130,"caption":"Decepticon Twins","height":130});
															thumbnails[5499353] = clik.newPhoto({"id":5499353,"src":"Tempest_2_Issue_01_Page_03_thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_5499353.html","width":130,"caption":"Tempest : Time Zero Page 3","height":130});
															thumbnails[5499396] = clik.newPhoto({"id":5499396,"src":"Tempest_2_Issue_01_Page_04_Thumb.jpg","galleries_id":67001,"server_id":18,"link":"photo_5499396.html","width":130,"caption":"Tempest : Time Zero page 4","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[66925] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Covers","link":"gallery_66925.html","maxRecords":0.0,"photoIDs":[7642807.0,7642805.0,7642801.0,6630115.0,6630141.0,6630114.0,5499202.0,5499440.0,5499304.0,5499433.0,5502777.0,5489595.0,5502779.0,5502782.0],"skipIndex":0,"section_code":"gallery","featured_images":6630115.0,"id":66925,"singleSection":false});				  						galleries[67001] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Pages","link":"gallery_67001.html","maxRecords":0.0,"photoIDs":[8559843.0,8569744.0,8569747.0,8569749.0,8569756.0,8559837.0,8559841.0,7642962.0,7642963.0,7642966.0,7642970.0,7642975.0,7642980.0,7642983.0,7642996.0,7642832.0,7642834.0,7642902.0,7642909.0,7642922.0,7642958.0,7642811.0,7642813.0,7642814.0,7642815.0,7642822.0,6630100.0,6630102.0,6630105.0,6630106.0,6630111.0,5499353.0,5499396.0],"skipIndex":0,"section_code":"gallery","featured_images":7642811.0,"id":67001,"singleSection":false});				  						galleries[68327] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Pin-ups","link":"gallery_68327.html","maxRecords":0.0,"photoIDs":[7643034.0,7643030.0,7643028.0,7643024.0,7643019.0,7643015.0,6630121.0,6630126.0,5502786.0,5502792.0,5499482.0,5499447.0,5489639.0,5499457.0],"skipIndex":0,"section_code":"gallery","featured_images":7643024.0,"id":68327,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6630115';
imageSets[2] = '7643024,6630115,7642811';
imageSets[3] = '5499482';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jonathanleedavis/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jonathanleedavis/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$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 = 'JonathanDavisHunt: ' + 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>';
	}
				
				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>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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="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 += '<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;
	}
}

			

