window.thumbnails = {};
															thumbnails[7030469] = clik.newPhoto({"id":7030469,"src":"0005_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":189});
															thumbnails[8954225] = clik.newPhoto({"id":8954225,"src":"CraigLizzie_021_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8954233] = clik.newPhoto({"id":8954233,"src":"CraigLizzie_010_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8954246] = clik.newPhoto({"id":8954246,"src":"CraigLizzie098_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8954249] = clik.newPhoto({"id":8954249,"src":"CraigLizzie231_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8954250] = clik.newPhoto({"id":8954250,"src":"CraigLizzie2311_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[4926648] = clik.newPhoto({"id":4926648,"src":"beautyguild3001_thumb.jpeg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":46});
															thumbnails[4917501] = clik.newPhoto({"id":4917501,"src":"IMG_0004b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917501.html","width":130,"caption":"","height":150});
															thumbnails[4917737] = clik.newPhoto({"id":4917737,"src":"b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917737.html","width":130,"caption":"","height":113});
															thumbnails[4917743] = clik.newPhoto({"id":4917743,"src":"IMG_9341b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917743.html","width":130,"caption":"","height":87});
															thumbnails[4917746] = clik.newPhoto({"id":4917746,"src":"IMG_9365b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917746.html","width":130,"caption":"","height":87});
															thumbnails[4917751] = clik.newPhoto({"id":4917751,"src":"IMG_9372b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917751.html","width":130,"caption":"","height":87});
															thumbnails[4917755] = clik.newPhoto({"id":4917755,"src":"IMG_9373b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917755.html","width":130,"caption":"","height":193});
															thumbnails[4917764] = clik.newPhoto({"id":4917764,"src":"IMG_9377b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917764.html","width":130,"caption":"","height":113});
															thumbnails[4917768] = clik.newPhoto({"id":4917768,"src":"IMG_9383b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917768.html","width":130,"caption":"","height":87});
															thumbnails[4917783] = clik.newPhoto({"id":4917783,"src":"IMG_9391b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917783.html","width":130,"caption":"","height":106});
															thumbnails[4917824] = clik.newPhoto({"id":4917824,"src":"IMG_9394b_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4917824.html","width":130,"caption":"","height":203});
															thumbnails[4921931] = clik.newPhoto({"id":4921931,"src":"90IMG_2470edit_copy_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921931.html","width":130,"caption":"","height":195});
															thumbnails[4921933] = clik.newPhoto({"id":4921933,"src":"313IMG_9724edit_copy_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921933.html","width":130,"caption":"","height":87});
															thumbnails[4921936] = clik.newPhoto({"id":4921936,"src":"355IMG_9770edit_copy_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921936.html","width":130,"caption":"","height":195});
															thumbnails[4921938] = clik.newPhoto({"id":4921938,"src":"090822-006_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921938.html","width":130,"caption":"","height":195});
															thumbnails[4921940] = clik.newPhoto({"id":4921940,"src":"090822-014_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921940.html","width":130,"caption":"","height":87});
															thumbnails[4921941] = clik.newPhoto({"id":4921941,"src":"090822-016_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921941.html","width":130,"caption":"","height":87});
															thumbnails[4921944] = clik.newPhoto({"id":4921944,"src":"090822-022_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921944.html","width":130,"caption":"","height":87});
															thumbnails[4921946] = clik.newPhoto({"id":4921946,"src":"090822-026_2_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921946.html","width":130,"caption":"","height":195});
															thumbnails[4921949] = clik.newPhoto({"id":4921949,"src":"090822-027_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921949.html","width":130,"caption":"","height":195});
															thumbnails[4921952] = clik.newPhoto({"id":4921952,"src":"090822-028_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921952.html","width":130,"caption":"","height":195});
															thumbnails[4921958] = clik.newPhoto({"id":4921958,"src":"fieldphoto-001_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921958.html","width":130,"caption":"","height":173});
															thumbnails[4921960] = clik.newPhoto({"id":4921960,"src":"fieldphoto-006_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921960.html","width":130,"caption":"","height":98});
															thumbnails[4921966] = clik.newPhoto({"id":4921966,"src":"lindsey_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921966.html","width":130,"caption":"","height":183});
															thumbnails[4921976] = clik.newPhoto({"id":4921976,"src":"Lindsey11_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921976.html","width":130,"caption":"","height":87});
															thumbnails[4921978] = clik.newPhoto({"id":4921978,"src":"Lindsey2_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4921978.html","width":130,"caption":"","height":87});
															thumbnails[4922084] = clik.newPhoto({"id":4922084,"src":"IMG_9570_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922084.html","width":130,"caption":"","height":195});
															thumbnails[4922094] = clik.newPhoto({"id":4922094,"src":"IMG_9602_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922094.html","width":130,"caption":"","height":195});
															thumbnails[4922110] = clik.newPhoto({"id":4922110,"src":"IMG_9681_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922110.html","width":130,"caption":"","height":86});
															thumbnails[4922118] = clik.newPhoto({"id":4922118,"src":"IMG_9739_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922118.html","width":130,"caption":"","height":91});
															thumbnails[4922504] = clik.newPhoto({"id":4922504,"src":"IMG_9546b21_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922504.html","width":130,"caption":"","height":128});
															thumbnails[4922536] = clik.newPhoto({"id":4922536,"src":"IMG_9587b_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922536.html","width":130,"caption":"","height":122});
															thumbnails[4922589] = clik.newPhoto({"id":4922589,"src":"IMG_9611b_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922589.html","width":130,"caption":"","height":103});
															thumbnails[4922592] = clik.newPhoto({"id":4922592,"src":"IMG_9624b_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922592.html","width":130,"caption":"","height":152});
															thumbnails[4922597] = clik.newPhoto({"id":4922597,"src":"IMG_9636b_thumb.jpg","galleries_id":280277,"server_id":18,"link":"photo_4922597.html","width":130,"caption":"","height":119});
															thumbnails[4926529] = clik.newPhoto({"id":4926529,"src":"_KM04602_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4926529.html","width":130,"caption":"","height":121});
															thumbnails[4926531] = clik.newPhoto({"id":4926531,"src":"_KM04605_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4926531.html","width":130,"caption":"","height":121});
															thumbnails[4926532] = clik.newPhoto({"id":4926532,"src":"4709_90497524365_511824365_2001904_6012102_n_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926532.html","width":130,"caption":"","height":87});
															thumbnails[4926572] = clik.newPhoto({"id":4926572,"src":"4709_90498304365_511824365_2001946_1464219_n_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926572.html","width":130,"caption":"","height":195});
															thumbnails[4926576] = clik.newPhoto({"id":4926576,"src":"4709_90499639365_511824365_2001967_4871852_n_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926576.html","width":130,"caption":"","height":87});
															thumbnails[4926577] = clik.newPhoto({"id":4926577,"src":"4709_90501089365_511824365_2001992_7269019_n_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926577.html","width":130,"caption":"","height":195});
															thumbnails[4926580] = clik.newPhoto({"id":4926580,"src":"3544861985_8608963aec_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926580.html","width":130,"caption":"","height":195});
															thumbnails[4926583] = clik.newPhoto({"id":4926583,"src":"3545526000_dbc5aa20ba_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926583.html","width":130,"caption":"","height":147});
															thumbnails[4926587] = clik.newPhoto({"id":4926587,"src":"3545671640_43502af7a7_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926587.html","width":130,"caption":"","height":195});
															thumbnails[4926590] = clik.newPhoto({"id":4926590,"src":"IMG_0017_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_4926590.html","width":130,"caption":"","height":92});
															thumbnails[4926593] = clik.newPhoto({"id":4926593,"src":"Kate1_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926593.html","width":130,"caption":"","height":87});
															thumbnails[4926599] = clik.newPhoto({"id":4926599,"src":"Kate2_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926599.html","width":130,"caption":"","height":87});
															thumbnails[4926601] = clik.newPhoto({"id":4926601,"src":"Kate10_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926601.html","width":130,"caption":"","height":194});
															thumbnails[4926643] = clik.newPhoto({"id":4926643,"src":"Nicola_Milward_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926643.html","width":130,"caption":"","height":94});
															thumbnails[4926708] = clik.newPhoto({"id":4926708,"src":"IMG_002111_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_4926708.html","width":130,"caption":"","height":87});
															thumbnails[4926719] = clik.newPhoto({"id":4926719,"src":"about2_thumb.jpg","galleries_id":280460,"server_id":18,"link":"photo_4926719.html","width":130,"caption":"","height":86});
															thumbnails[5483808] = clik.newPhoto({"id":5483808,"src":"kate_wed_hair_thumb.jpg","galleries_id":280460,"server_id":18,"link":"photo_5483808.html","width":130,"caption":"","height":96});
															thumbnails[9057581] = clik.newPhoto({"id":9057581,"src":"DSC_0022_thumb.JPG","galleries_id":280050,"server_id":18,"link":"photo_9057581.html","width":130,"caption":"","height":196});
															thumbnails[9057584] = clik.newPhoto({"id":9057584,"src":"DSC_0023_thumb.JPG","galleries_id":280051,"server_id":18,"link":"photo_9057584.html","width":130,"caption":"","height":196});
															thumbnails[9057589] = clik.newPhoto({"id":9057589,"src":"DSC_0018_thumb.JPG","galleries_id":280050,"server_id":18,"link":"photo_9057589.html","width":130,"caption":"","height":196});
															thumbnails[9057597] = clik.newPhoto({"id":9057597,"src":"DSCF2737_thumb.JPG","galleries_id":280050,"server_id":18,"link":"photo_9057597.html","width":130,"caption":"","height":87});
															thumbnails[9057628] = clik.newPhoto({"id":9057628,"src":"Fisher_086_thumb.jpg","galleries_id":280051,"server_id":18,"link":"photo_9057628.html","width":130,"caption":"","height":195});
															thumbnails[9057670] = clik.newPhoto({"id":9057670,"src":"00051_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057670.html","width":130,"caption":"","height":87});
															thumbnails[9057674] = clik.newPhoto({"id":9057674,"src":"00101_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057674.html","width":130,"caption":"","height":195});
															thumbnails[9057678] = clik.newPhoto({"id":9057678,"src":"00211_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057678.html","width":130,"caption":"","height":195});
															thumbnails[9057683] = clik.newPhoto({"id":9057683,"src":"00251_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057683.html","width":130,"caption":"","height":195});
															thumbnails[9057685] = clik.newPhoto({"id":9057685,"src":"00281_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057685.html","width":130,"caption":"","height":195});
															thumbnails[9057688] = clik.newPhoto({"id":9057688,"src":"00331_thumb.jpg","galleries_id":280050,"server_id":18,"link":"photo_9057688.html","width":130,"caption":"","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[280277] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Our Beautiful Sisters!","link":"gallery_280277.html","maxRecords":0.0,"photoIDs":[4922084.0,4922094.0,4922110.0,4922118.0,4922504.0,4922536.0,4922589.0,4922592.0,4922597.0],"skipIndex":0,"section_code":"gallery","featured_images":"4922597,4922592,4922589,4922536,4922504,4922118,4922110,4922094,4922084","id":280277,"singleSection":false});				  						galleries[280050] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"gallery_280050.html","maxRecords":0.0,"photoIDs":[4917501.0,4917737.0,4917743.0,4917746.0,4917751.0,4917755.0,4917764.0,4917768.0,4917783.0,4917824.0,4926529.0,4926531.0,4926590.0,9057581.0,9057589.0,9057597.0,9057670.0,9057674.0,9057678.0,9057683.0,9057685.0,9057688.0],"skipIndex":0,"section_code":"gallery","featured_images":"9057688,9057685,9057683,9057678,9057674,9057670,9057597,9057589,9057581,4926529,4917824,4917783,4917764,4917755,4917751,4917743,4917737,4917501","id":280050,"singleSection":false});				  						galleries[280460] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gloss Girls","link":"gallery_280460.html","maxRecords":0.0,"photoIDs":[4926719.0,5483808.0],"skipIndex":0,"section_code":"gallery","featured_images":"5483808,4926719","id":280460,"singleSection":false});				  						galleries[280051] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2","link":"gallery_280051.html","maxRecords":0.0,"photoIDs":[4921931.0,4921933.0,4921936.0,4921938.0,4921940.0,4921941.0,4921944.0,4921946.0,4921949.0,4921952.0,4921958.0,4921960.0,4921966.0,4921976.0,4921978.0,4926532.0,4926572.0,4926576.0,4926577.0,4926580.0,4926583.0,4926587.0,4926593.0,4926599.0,4926601.0,4926643.0,4926708.0,9057584.0,9057628.0],"skipIndex":0,"section_code":"gallery","featured_images":"9057628,9057584,4926708,4926643,4926583,4926532,4921978,4921966,4921960,4921949,4921946,4921944,4921936,4921933,4921931","id":280051,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[232965] = '9057688,9057685,9057683,9057678,9057674,9057670,9057628,9057597,9057589,9057584,9057581,8954250,8954246,8954233,8954225,7030469,5483808,4926708,4926643,4926583,4926532,4926529,4922597,4922592,4922589,4922536,4922504,4922118,4922110,4922094,4922084,4921978,4921966,4921960,4921949,4921946,4921944,4921936,4921933,4921931,4917824,4917783,4917764,4917755,4917751,4917743,4917737,4917501,4926648';
imageSets[1] = '9057688,9057685,9057683,9057678,9057674,9057670,9057628,9057597,9057589,9057584,9057581,8954250,8954246,8954233,8954225,7030469,5483808,4926708,4926643,4926583,4926532,4926529,4922597,4922592,4922589,4922536,4922504,4922118,4922110,4922094,4922084,4921978,4921966,4921960,4921949,4921946,4921944,4921936,4921933,4921931,4917824,4917783,4917764,4917755,4917751,4917743,4917737,4917501,4926648';
imageSets[2] = '9057688,9057685,9057683,9057678,9057674,9057670,9057628,9057597,9057589,9057584,9057581,8954250,8954246,8954233,7030469,4926708,4926643,4926583,4926532,4926529,4922597,4922592,4922589,4922536,4922504,4922118,4922110,4922094,4922084,4921978,4921966,4921960,4921949,4921946,4921944,4921936,4921933,4921931,4917824,4917783,4917764,4917755,4917751,4917743,4917737,4917501,4926648';
imageSets[3] = '9057688,9057685,9057683,9057678,9057674,9057670,9057628,9057597,9057589,9057584,9057581,8954250,8954246,7030469,5483808,4926708,4926643,4926583,4926532,4926529,4922597,4922592,4922589,4922536,4922504,4922118,4922110,4922094,4922084,4921978,4921966,4921960,4921949,4921946,4921944,4921936,4921933,4921931,4917824,4917783,4917764,4917755,4917751,4917743,4917737,4917501,4926648';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/GLOSS01/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/GLOSS01/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 = 'GLOSS Contemporary hair & make-up artistry: ' + 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.item_price !== '') {
			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;
	}
}

			

