window.thumbnails = {};
															thumbnails[4557767] = clik.newPhoto({"id":4557767,"src":"under-construction-00_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":102});
															thumbnails[4557910] = clik.newPhoto({"id":4557910,"src":"DSCF0735-sized_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4568537] = clik.newPhoto({"id":4568537,"src":"DSCF0040_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[4568760] = clik.newPhoto({"id":4568760,"src":"DSCF0526_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":78});
															thumbnails[4575984] = clik.newPhoto({"id":4575984,"src":"DSCF0533_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4575985] = clik.newPhoto({"id":4575985,"src":"DSCF0535_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4575987] = clik.newPhoto({"id":4575987,"src":"DSCF0689_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4575988] = clik.newPhoto({"id":4575988,"src":"DSCF0733_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":78});
															thumbnails[4575991] = clik.newPhoto({"id":4575991,"src":"DSCF05261_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":78});
															thumbnails[4590915] = clik.newPhoto({"id":4590915,"src":"DSC00134_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4596323] = clik.newPhoto({"id":4596323,"src":"DSCF0020_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":65});
															thumbnails[4647914] = clik.newPhoto({"id":4647914,"src":"DSCF00044_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4648083] = clik.newPhoto({"id":4648083,"src":"DSCF0002_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[4648084] = clik.newPhoto({"id":4648084,"src":"DSCF0003_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[4981458] = clik.newPhoto({"id":4981458,"src":"Huey-001_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[4981459] = clik.newPhoto({"id":4981459,"src":"Huey-002_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4981460] = clik.newPhoto({"id":4981460,"src":"Huey-003_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4984590] = clik.newPhoto({"id":4984590,"src":"Huey-004_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":91});
															thumbnails[5009948] = clik.newPhoto({"id":5009948,"src":"sosbanner_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":17});
															thumbnails[5020228] = clik.newPhoto({"id":5020228,"src":"h4h_donations_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":65});
															thumbnails[5043040] = clik.newPhoto({"id":5043040,"src":"Huey-005_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":91});
															thumbnails[5043041] = clik.newPhoto({"id":5043041,"src":"Huey_006_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":78});
															thumbnails[5043107] = clik.newPhoto({"id":5043107,"src":"Huey_007_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":91});
															thumbnails[5124222] = clik.newPhoto({"id":5124222,"src":"Huey-007_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5124226] = clik.newPhoto({"id":5124226,"src":"Huey-008_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5187860] = clik.newPhoto({"id":5187860,"src":"rcha-logo1_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":29});
															thumbnails[5197398] = clik.newPhoto({"id":5197398,"src":"Bell-214-008_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5205671] = clik.newPhoto({"id":5205671,"src":"Lama-004_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":40});
															thumbnails[5226286] = clik.newPhoto({"id":5226286,"src":"Huey-011_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[5226287] = clik.newPhoto({"id":5226287,"src":"Huey-012_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[5226289] = clik.newPhoto({"id":5226289,"src":"Huey-013_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[5226291] = clik.newPhoto({"id":5226291,"src":"Huey-014_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[5226300] = clik.newPhoto({"id":5226300,"src":"Huey-015_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5226393] = clik.newPhoto({"id":5226393,"src":"Huey-009_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[5410483] = clik.newPhoto({"id":5410483,"src":"Huey-016_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5410485] = clik.newPhoto({"id":5410485,"src":"Huey-017_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[5436740] = clik.newPhoto({"id":5436740,"src":"Huey-018_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[5436751] = clik.newPhoto({"id":5436751,"src":"Huey-019_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5436755] = clik.newPhoto({"id":5436755,"src":"Huey-020_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5436759] = clik.newPhoto({"id":5436759,"src":"Huey-021_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5459868] = clik.newPhoto({"id":5459868,"src":"Huey-022_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[5459875] = clik.newPhoto({"id":5459875,"src":"Huey-023_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5695479] = clik.newPhoto({"id":5695479,"src":"Huey-024_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5695482] = clik.newPhoto({"id":5695482,"src":"Huey-025_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5695485] = clik.newPhoto({"id":5695485,"src":"Huey-027_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5695488] = clik.newPhoto({"id":5695488,"src":"Huey-026_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5699687] = clik.newPhoto({"id":5699687,"src":"Huey-028_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5770813] = clik.newPhoto({"id":5770813,"src":"Huey-030_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5770814] = clik.newPhoto({"id":5770814,"src":"Huey-031_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5770815] = clik.newPhoto({"id":5770815,"src":"Huey-032_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5770817] = clik.newPhoto({"id":5770817,"src":"Huey-033_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6104235] = clik.newPhoto({"id":6104235,"src":"Huey-0341_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":95});
															thumbnails[6104352] = clik.newPhoto({"id":6104352,"src":"Huey-036_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6104407] = clik.newPhoto({"id":6104407,"src":"Huey-0351_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6397516] = clik.newPhoto({"id":6397516,"src":"Huey-038_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6397519] = clik.newPhoto({"id":6397519,"src":"Huey-039_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7094563] = clik.newPhoto({"id":7094563,"src":"Huey-041_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7094565] = clik.newPhoto({"id":7094565,"src":"Huey-042_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7094568] = clik.newPhoto({"id":7094568,"src":"Huey-043_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7094571] = clik.newPhoto({"id":7094571,"src":"Huey-045_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7094573] = clik.newPhoto({"id":7094573,"src":"Huey-044_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7839357] = clik.newPhoto({"id":7839357,"src":"tools_012271_tnb_thb_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":101});
															thumbnails[7839362] = clik.newPhoto({"id":7839362,"src":"under-construction_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[8136307] = clik.newPhoto({"id":8136307,"src":"IMG_2942_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":104});
															thumbnails[4797349] = clik.newPhoto({"id":4797349,"src":"Lama-001_thumb.jpg","galleries_id":397689,"server_id":18,"link":"photo_4797349.html","width":130,"caption":"","height":130});
															thumbnails[4797350] = clik.newPhoto({"id":4797350,"src":"Lama-002_thumb.jpg","galleries_id":397689,"server_id":18,"link":"photo_4797350.html","width":130,"caption":"","height":130});
															thumbnails[4797351] = clik.newPhoto({"id":4797351,"src":"Lama-003_thumb.jpg","galleries_id":397689,"server_id":18,"link":"photo_4797351.html","width":130,"caption":"","height":130});
															thumbnails[7347808] = clik.newPhoto({"id":7347808,"src":"IMG_1003_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347808.html","width":130,"caption":"","height":88});
															thumbnails[7347822] = clik.newPhoto({"id":7347822,"src":"IMG_1025_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347822.html","width":130,"caption":"","height":95});
															thumbnails[7347823] = clik.newPhoto({"id":7347823,"src":"IMG_1035_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347823.html","width":130,"caption":"","height":87});
															thumbnails[7347825] = clik.newPhoto({"id":7347825,"src":"IMG_1038_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347825.html","width":130,"caption":"","height":87});
															thumbnails[7347826] = clik.newPhoto({"id":7347826,"src":"IMG_0985_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347826.html","width":130,"caption":"","height":120});
															thumbnails[7347833] = clik.newPhoto({"id":7347833,"src":"IMG_0968_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347833.html","width":130,"caption":"","height":120});
															thumbnails[7347834] = clik.newPhoto({"id":7347834,"src":"IMG_1017_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347834.html","width":130,"caption":"","height":78});
															thumbnails[7347836] = clik.newPhoto({"id":7347836,"src":"IMG_1037_thumb.jpg","galleries_id":397684,"server_id":18,"link":"photo_7347836.html","width":130,"caption":"","height":87});
															thumbnails[8214770] = clik.newPhoto({"id":8214770,"src":"camera-ship-001_thumb.jpg","galleries_id":438016,"server_id":18,"link":"photo_8214770.html","width":130,"caption":"","height":173});
															thumbnails[8214780] = clik.newPhoto({"id":8214780,"src":"camera-ship-002_thumb.jpg","galleries_id":438016,"server_id":18,"link":"photo_8214780.html","width":130,"caption":"","height":163});
															thumbnails[8136317] = clik.newPhoto({"id":8136317,"src":"IMG_2931_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8136317.html","width":130,"caption":"","height":87});
															thumbnails[8214783] = clik.newPhoto({"id":8214783,"src":"camera-ship-003_thumb.jpg","galleries_id":438016,"server_id":18,"link":"photo_8214783.html","width":130,"caption":"","height":173});
															thumbnails[8214784] = clik.newPhoto({"id":8214784,"src":"camera-ship-004_thumb.jpg","galleries_id":438016,"server_id":18,"link":"photo_8214784.html","width":130,"caption":"","height":173});
															thumbnails[8136306] = clik.newPhoto({"id":8136306,"src":"Picture_090_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8136306.html","width":130,"caption":"","height":98});
															thumbnails[8214812] = clik.newPhoto({"id":8214812,"src":"IMG_2936-web-jet_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8214812.html","width":130,"caption":"","height":87});
															thumbnails[8214817] = clik.newPhoto({"id":8214817,"src":"IMG_2973_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8214817.html","width":130,"caption":"","height":87});
															thumbnails[8214822] = clik.newPhoto({"id":8214822,"src":"jet-crash-001_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8214822.html","width":130,"caption":"","height":87});
															thumbnails[8214826] = clik.newPhoto({"id":8214826,"src":"IMG_2975_thumb.jpg","galleries_id":438017,"server_id":18,"link":"photo_8214826.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[397684] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Huey 214 ","link":"section473577_397684.html","maxRecords":0.0,"photoIDs":[7347808.0,7347822.0,7347823.0,7347825.0,7347826.0,7347833.0,7347834.0,7347836.0],"skipIndex":0,"section_code":"section473577","featured_images":"7347836,7347834,7347833,7347826,7347825,7347823,7347822,7347808","id":397684,"singleSection":false});				  						galleries[397689] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Hirobo Lama SA 315 B","link":"section473577_397689.html","maxRecords":0.0,"photoIDs":[4797349.0,4797350.0,4797351.0],"skipIndex":0,"section_code":"section473577","featured_images":"4797351,4797350,4797349","id":397689,"singleSection":false});				  						galleries[438016] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Camera Ship","link":"section473577_438016.html","maxRecords":0.0,"photoIDs":[8214770.0,8214780.0,8214783.0,8214784.0],"skipIndex":0,"section_code":"section473577","featured_images":"8214784,8214783,8214780,8214770","id":438016,"singleSection":false});				  						galleries[438017] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Vario Jet Ranger","link":"section473577_438017.html","maxRecords":0.0,"photoIDs":[8136317.0,8136306.0,8214812.0,8214817.0,8214822.0,8214826.0],"skipIndex":0,"section_code":"section473577","featured_images":"8214826,8214822,8214817,8214812,8136317,8136306","id":438017,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4797350';
imageSets[2] = '4557910,8136307';
imageSets[3] = '8214826,8214822,8214817,8214812,8214784,8214783,8214780,8214770,8136317,8136307,8136306,7839362,7839357,7347836,7347834,7347833,7347826,7347825,7347823,7347822,7347808,7094573,7094571,7094568,7094565,7094563,6397519,6397516,6104407,6104352,6104235,5770817,5770815,5770814,5770813,5699687,5695488,5695485,5695482,5695479,5459875,5459868,5436759,5436755,5436751,5436740,5410485,5410483,5226393,5226300';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/copter/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/copter/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/copter/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/copter/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/copter/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/copter/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/copter/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 += 'section473577.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 && 'section473577' != '') {
					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 = 'Copter62: ' + 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;
	}
}

			

