window.thumbnails = {};
thumbnails[8724575] = clik.newPhoto({"link":"#","caption":"","height":107,"id":8724575,"server_id":21,"src":"Lady_on_boat_2_copy_thumb.jpg","galleries_id":"","width":150});
thumbnails[8254630] = clik.newPhoto({"link":"#","caption":"","height":153,"id":8254630,"server_id":21,"src":"Fri5_thumb.jpg","galleries_id":"","width":150});
thumbnails[7631455] = clik.newPhoto({"link":"#","caption":"","height":178,"id":7631455,"server_id":21,"src":"Koala_thumb.jpg","galleries_id":"","width":150});
thumbnails[8646809] = clik.newPhoto({"link":"#","caption":"","height":180,"id":8646809,"server_id":21,"src":"wash_day2_2_copy_copy_thumb.jpg","galleries_id":"","width":150});
thumbnails[7681696] = clik.newPhoto({"link":"#","caption":"","height":116,"id":7681696,"server_id":21,"src":"buterfly1wings22_thumb.jpg","galleries_id":"","width":150});
thumbnails[8705646] = clik.newPhoto({"link":"#","caption":"","height":157,"id":8705646,"server_id":21,"src":"white_craine72with_border_copy_thumb.jpg","galleries_id":"","width":150});
thumbnails[7606013] = clik.newPhoto({"link":"#","caption":"","height":100,"id":7606013,"server_id":21,"src":"_anddon72_thumb.jpg","galleries_id":"","width":150});
thumbnails[7498808] = clik.newPhoto({"link":"#","caption":"","height":135,"id":7498808,"server_id":21,"src":"aus52_thumb.jpg","galleries_id":"","width":150});
thumbnails[7631460] = clik.newPhoto({"link":"#","caption":"","height":118,"id":7631460,"server_id":21,"src":"city_of_Perth_thumb.jpg","galleries_id":"","width":150});
thumbnails[7631458] = clik.newPhoto({"link":"#","caption":"","height":102,"id":7631458,"server_id":21,"src":"SeaGull__thumb.jpg","galleries_id":"","width":150});
thumbnails[7361361] = clik.newPhoto({"link":"#","caption":"","height":100,"id":7361361,"server_id":21,"src":"seagullperth1_thumb.jpg","galleries_id":"","width":150});
thumbnails[7361396] = clik.newPhoto({"link":"#","caption":"","height":102,"id":7361396,"server_id":21,"src":"twoschoolgirlsinhk_thumb.jpg","galleries_id":"","width":150});
thumbnails[8648547] = clik.newPhoto({"link":"photo_8648547.html","caption":"","height":199,"id":8648547,"server_id":21,"src":"front_door__girl_copy_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8743967] = clik.newPhoto({"link":"photo_8743967.html","caption":"","height":145,"id":8743967,"server_id":21,"src":"seagull_copy72_2_thumb.jpg","galleries_id":398424,"width":150});
thumbnails[9001967] = clik.newPhoto({"link":"photo_9001967.html","caption":"","height":141,"id":9001967,"server_id":21,"src":"Shanghai_Conservatory_on_Music7777_copy_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[9051779] = clik.newPhoto({"link":"photo_9051779.html","caption":"","height":114,"id":9051779,"server_id":21,"src":"Hangzhou_Museum1_thumb.jpg","galleries_id":399360,"width":150});
thumbnails[8550010] = clik.newPhoto({"link":"photo_8550010.html","caption":"","height":103,"id":8550010,"server_id":21,"src":"two_statues_99c_copy1_thumb.jpg","galleries_id":399360,"width":150});
thumbnails[8559129] = clik.newPhoto({"link":"photo_8559129.html","caption":"","height":106,"id":8559129,"server_id":21,"src":"fruit_stall_h.k.3_copy_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8648549] = clik.newPhoto({"link":"photo_8648549.html","caption":"","height":154,"id":8648549,"server_id":21,"src":"pink_rose_O1.k._for_prining_check_sise_copy_thumb.jpg","galleries_id":398424,"width":150});
thumbnails[9002265] = clik.newPhoto({"link":"photo_9002265.html","caption":"","height":104,"id":9002265,"server_id":21,"src":"Cold_afternoon_at__Burns_Beach_Perth_Australia_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[7384877] = clik.newPhoto({"link":"photo_7384877.html","caption":" ","height":100,"id":7384877,"server_id":21,"src":"NarrowstreetsMacau_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[8550014] = clik.newPhoto({"link":"photo_8550014.html","caption":"","height":174,"id":8550014,"server_id":21,"src":"Jennymodel2c__thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8552091] = clik.newPhoto({"link":"photo_8552091.html","caption":"","height":80,"id":8552091,"server_id":21,"src":"Bangkok_Zoo_Thailand3333_21_thumb.jpg","galleries_id":398424,"width":150});
thumbnails[8554060] = clik.newPhoto({"link":"photo_8554060.html","caption":"","height":110,"id":8554060,"server_id":21,"src":"Hairdresser72_c_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[9001924] = clik.newPhoto({"link":"photo_9001924.html","caption":"","height":153,"id":9001924,"server_id":21,"src":"Shanghai_Conservatory_on_Music_72_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[9051894] = clik.newPhoto({"link":"photo_9051894.html","caption":"","height":141,"id":9051894,"server_id":21,"src":"Yellow_Rose_72_copy_thumb.jpg","galleries_id":399360,"width":150});
thumbnails[8550858] = clik.newPhoto({"link":"photo_8550858.html","caption":"","height":202,"id":8550858,"server_id":21,"src":"ada32_copy_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8550889] = clik.newPhoto({"link":"photo_8550889.html","caption":"","height":178,"id":8550889,"server_id":21,"src":"DSC_4510_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8553427] = clik.newPhoto({"link":"photo_8553427.html","caption":"","height":149,"id":8553427,"server_id":21,"src":"Phillip-15_copy_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[7636590] = clik.newPhoto({"link":"photo_7636590.html","caption":"","height":92,"id":7636590,"server_id":21,"src":"DSCsh_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[8550893] = clik.newPhoto({"link":"photo_8550893.html","caption":"","height":119,"id":8550893,"server_id":21,"src":"Thames_Town_331_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8555264] = clik.newPhoto({"link":"photo_8555264.html","caption":"","height":118,"id":8555264,"server_id":21,"src":"snoze_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[7381471] = clik.newPhoto({"link":"photo_7381471.html","caption":"","height":123,"id":7381471,"server_id":21,"src":"nightbund72dpi_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[8546455] = clik.newPhoto({"link":"photo_8546455.html","caption":"","height":199,"id":8546455,"server_id":21,"src":"the_woodsc_72_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8550891] = clik.newPhoto({"link":"photo_8550891.html","caption":"","height":193,"id":8550891,"server_id":21,"src":"DSC_0113_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8552045] = clik.newPhoto({"link":"photo_8552045.html","caption":"","height":140,"id":8552045,"server_id":21,"src":"Guard_Dog_copy_thumb.jpg","galleries_id":398424,"width":150});
thumbnails[8554046] = clik.newPhoto({"link":"photo_8554046.html","caption":"","height":180,"id":8554046,"server_id":21,"src":"Perth_Zoo_Water_spray_copy_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[8551649] = clik.newPhoto({"link":"photo_8551649.html","caption":"","height":207,"id":8551649,"server_id":21,"src":"Model_Jenny1_72copy_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8559110] = clik.newPhoto({"link":"photo_8559110.html","caption":"","height":138,"id":8559110,"server_id":21,"src":"unpaid_Models_copy_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8744288] = clik.newPhoto({"link":"photo_8744288.html","caption":"","height":101,"id":8744288,"server_id":21,"src":"goody_thumb.jpg","galleries_id":398340,"width":150});
thumbnails[8552235] = clik.newPhoto({"link":"photo_8552235.html","caption":"","height":172,"id":8552235,"server_id":21,"src":"chef_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[9038882] = clik.newPhoto({"link":"photo_9038882.html","caption":"","height":183,"id":9038882,"server_id":21,"src":"Joddie722_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8553428] = clik.newPhoto({"link":"photo_8553428.html","caption":"","height":113,"id":8553428,"server_id":21,"src":"Phillip-173_copy_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8554029] = clik.newPhoto({"link":"photo_8554029.html","caption":"","height":166,"id":8554029,"server_id":21,"src":"Mary1_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[7357353] = clik.newPhoto({"link":"photo_7357353.html","caption":"","height":152,"id":7357353,"server_id":21,"src":"Bridegettingready_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8554035] = clik.newPhoto({"link":"photo_8554035.html","caption":"","height":177,"id":8554035,"server_id":21,"src":"DSC_0055_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8396879] = clik.newPhoto({"link":"photo_8396879.html","caption":"","height":100,"id":8396879,"server_id":21,"src":"DSC_62592_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8550878] = clik.newPhoto({"link":"photo_8550878.html","caption":"","height":234,"id":8550878,"server_id":21,"src":"Maryup_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[8559152] = clik.newPhoto({"link":"photo_8559152.html","caption":"","height":102,"id":8559152,"server_id":21,"src":"DSC_0205_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8733364] = clik.newPhoto({"link":"photo_8733364.html","caption":"","height":179,"id":8733364,"server_id":21,"src":"jessica_close_up_3_copy_thumb.jpg","galleries_id":406773,"width":150});
thumbnails[9047744] = clik.newPhoto({"link":"photo_9047744.html","caption":"","height":87,"id":9047744,"server_id":21,"src":"twins_at_the_shop_window_thumb.jpg","galleries_id":398341,"width":150});
thumbnails[8744362] = clik.newPhoto({"link":"photo_8744362.html","caption":"","height":47,"id":8744362,"server_id":21,"src":"moore_1_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8723162] = clik.newPhoto({"link":"photo_8723162.html","caption":"","height":152,"id":8723162,"server_id":21,"src":"Butterfly_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8643840] = clik.newPhoto({"link":"photo_8643840.html","caption":"","height":72,"id":8643840,"server_id":21,"src":"Australia_new_withborder72_copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8749557] = clik.newPhoto({"link":"photo_8749557.html","caption":"","height":145,"id":8749557,"server_id":21,"src":"seagull_copy72_2_D5779CCE-24E8-5EC4-4F3E5BD8C9B331D3_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8646731] = clik.newPhoto({"link":"photo_8646731.html","caption":"","height":194,"id":8646731,"server_id":21,"src":"roseseorg72_with_border_and_sig_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8646786] = clik.newPhoto({"link":"photo_8646786.html","caption":"","height":157,"id":8646786,"server_id":21,"src":"white_craine72with_border_copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8714634] = clik.newPhoto({"link":"photo_8714634.html","caption":"","height":54,"id":8714634,"server_id":21,"src":"long_yellow_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8644145] = clik.newPhoto({"link":"photo_8644145.html","caption":"","height":96,"id":8644145,"server_id":21,"src":"Singaporeairlines_with_border72_copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8644112] = clik.newPhoto({"link":"photo_8644112.html","caption":"","height":99,"id":8644112,"server_id":21,"src":"new_parrot72_copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8498979] = clik.newPhoto({"link":"photo_8498979.html","caption":"","height":205,"id":8498979,"server_id":21,"src":"bike72_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8499254] = clik.newPhoto({"link":"photo_8499254.html","caption":"","height":201,"id":8499254,"server_id":21,"src":"CHOC_72_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8643901] = clik.newPhoto({"link":"photo_8643901.html","caption":"","height":111,"id":8643901,"server_id":21,"src":"Thailand_flower_O.K._for_printing_check_for_size__copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8810505] = clik.newPhoto({"link":"photo_8810505.html","caption":"","height":219,"id":8810505,"server_id":21,"src":"Wrghts_soap_30_x44_cm__copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8499218] = clik.newPhoto({"link":"photo_8499218.html","caption":"","height":106,"id":8499218,"server_id":21,"src":"A007_copy_copy_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8502540] = clik.newPhoto({"link":"photo_8502540.html","caption":"","height":226,"id":8502540,"server_id":21,"src":"post_card_done_by_lightroom_2_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8502565] = clik.newPhoto({"link":"photo_8502565.html","caption":"","height":223,"id":8502565,"server_id":21,"src":"Red_crosscompleted_24x16_2_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8502957] = clik.newPhoto({"link":"photo_8502957.html","caption":"","height":232,"id":8502957,"server_id":21,"src":"murder_2_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8530711] = clik.newPhoto({"link":"photo_8530711.html","caption":"","height":195,"id":8530711,"server_id":21,"src":"judy_Garland16hx13wide_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8531468] = clik.newPhoto({"link":"photo_8531468.html","caption":"","height":200,"id":8531468,"server_id":21,"src":"MAGAZINE_COVER_copy_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8810480] = clik.newPhoto({"link":"photo_8810480.html","caption":"","height":190,"id":8810480,"server_id":21,"src":"Young_Spinner_25_x_32_cm__72_thumb.jpg","galleries_id":437488,"width":150});
thumbnails[8821283] = clik.newPhoto({"link":"photo_8821283.html","caption":"","height":94,"id":8821283,"server_id":21,"src":"Tram_done_43_x_68_cm__thumb.jpg","galleries_id":437488,"width":150});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[406773] = clik.newGallery({"photoIDs":[9001967,8550014,9001924,8550858,8550893,8546455,8551649,9038882,8554029,8554035,8550878,8733364],"link":"gallery_406773.html","skipIndex":0,"section_code":"gallery","id":406773,"parentGallery":"","featured_images":"9038882,9001967,9001924,8733364,8554035,8554029,8551649,8550893,8550878,8550858","maxRecords":300,"usePopups":false,"singleSection":false,"title":"portraits "});galleries[398424] = clik.newGallery({"photoIDs":[8743967,8648549,8552091,8552045],"link":"gallery_398424.html","skipIndex":0,"section_code":"gallery","id":398424,"parentGallery":"","featured_images":"8743967,8648549,8552091,8552045","maxRecords":300,"usePopups":false,"singleSection":false,"title":"Nature"});galleries[398340] = clik.newGallery({"photoIDs":[9002265,7384877,8553427,7636590,7381471,8554046,8744288],"link":"gallery_398340.html","skipIndex":0,"section_code":"gallery","id":398340,"parentGallery":"","featured_images":"9002265,8744288,8554046,8553427,7636590,7384877,7381471","maxRecords":300,"usePopups":false,"singleSection":false,"title":"Landscapes"});galleries[398341] = clik.newGallery({"photoIDs":[8648547,8559129,8554060,8550889,8555264,8550891,8559110,8552235,8553428,7357353,8396879,8559152,9047744],"link":"gallery_398341.html","skipIndex":0,"section_code":"gallery","id":398341,"parentGallery":"","featured_images":"9047744,8648547,8559152,8559129,8559110,8555264,8554060,8553428,8552235,8550891","maxRecords":300,"usePopups":false,"singleSection":false,"title":"Candid "});galleries[437488] = clik.newGallery({"photoIDs":[8744362,8723162,8643840,8749557,8646731,8646786,8714634,8644145,8644112,8498979,8499254,8643901,8810505,8499218,8502540,8502565,8502957,8530711,8531468,8810480,8821283],"link":"section525338.html","skipIndex":0,"section_code":"section525338","id":437488,"parentGallery":"","featured_images":"8821283,8810505,8810480,8749557,8744362,8723162,8714634,8646786,8646731,8644145","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Posters"});galleries[399360] = clik.newGallery({"photoIDs":[9051779,8550010,9051894],"link":"gallery_399360.html","skipIndex":0,"section_code":"gallery","id":399360,"parentGallery":"","featured_images":"9051894,9051779,8550010","maxRecords":300,"usePopups":false,"singleSection":false,"title":"Still Life"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '7631460';
imageSets[1] = '9001967,9002265,9001924';
imageSets[239318] = '8646809,8554060,8550889,8552045,8550891,8552235,7357353,7361396';
imageSets[239317] = '8743967,8648547,8552091,7631455,8705646,8646731,8714634,7631458,7361361';
imageSets[239315] = '9001967,8254630,9001924,8550014,8550858,8550893,8546455,8551649,8554029,8554035,8550878';
imageSets[239316] = '9002265,7384877,7681696,7636590,7606013,8554046,7381471,7631460';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/wponsite/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/wponsite/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/wponsite/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
				  document.title = ': ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
			
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> AU$' + (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.item_price !== '') {
					temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="WPONSITE">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

