window.thumbnails = {};
															thumbnails[3297778] = clik.newPhoto({"id":3297778,"src":"lightstalkers_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":15});
															thumbnails[5519272] = clik.newPhoto({"id":5519272,"src":"Wedding-flyer_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"","height":100});
															thumbnails[3360582] = clik.newPhoto({"id":3360582,"src":"Sydney-Sails_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"Sydney Sails","height":100});
															thumbnails[5492436] = clik.newPhoto({"id":5492436,"src":"Gibson-blue-2p_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"Gibsons beach","height":100});
															thumbnails[3360378] = clik.newPhoto({"id":3360378,"src":"Apostle-Sunset5_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"Apostle at dusk","height":100});
															thumbnails[3377228] = clik.newPhoto({"id":3377228,"src":"H-Ports20_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"","height":100});
															thumbnails[3360380] = clik.newPhoto({"id":3360380,"src":"Altona-Pier1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"Altona Pier","height":100});
															thumbnails[3360381] = clik.newPhoto({"id":3360381,"src":"Hopetoun-Falls3_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":100,"caption":"Hopetoun Falls","height":100});
															thumbnails[5491886] = clik.newPhoto({"id":5491886,"src":"Cradle-xpan_thumb.jpg","galleries_id":312308,"server_id":32,"link":"photo_5491886.html","width":100,"caption":"Cradle Mountain, Tasmania Australia","height":100});
															thumbnails[5147754] = clik.newPhoto({"id":5147754,"src":"Footscray29d_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5147754.html","width":100,"caption":"Food 1","height":100});
															thumbnails[5149245] = clik.newPhoto({"id":5149245,"src":"BW46_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5149245.html","width":100,"caption":"","height":100});
															thumbnails[5515197] = clik.newPhoto({"id":5515197,"src":"GCcanvasx_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5515197.html","width":100,"caption":"","height":100});
															thumbnails[5492222] = clik.newPhoto({"id":5492222,"src":"Freycinet-lodge-pierxy_thumb.jpg","galleries_id":312308,"server_id":32,"link":"photo_5492222.html","width":100,"caption":"Freycinet Pier","height":100});
															thumbnails[5492333] = clik.newPhoto({"id":5492333,"src":"Cul-Mor-with-Cul-Beagx_thumb.jpg","galleries_id":312308,"server_id":32,"link":"photo_5492333.html","width":100,"caption":"Cul Mor ","height":100});
															thumbnails[5514677] = clik.newPhoto({"id":5514677,"src":"Grierson-organic096_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5514677.html","width":100,"caption":"Food 2","height":100});
															thumbnails[5515234] = clik.newPhoto({"id":5515234,"src":"Lisa-bwp_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5515234.html","width":100,"caption":"","height":100});
															thumbnails[5515314] = clik.newPhoto({"id":5515314,"src":"JF0231a_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5515314.html","width":100,"caption":"","height":100});
															thumbnails[3420626] = clik.newPhoto({"id":3420626,"src":"BR43_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_3420626.html","width":100,"caption":"","height":100});
															thumbnails[5515241] = clik.newPhoto({"id":5515241,"src":"Archie_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5515241.html","width":100,"caption":"","height":100});
															thumbnails[5149262] = clik.newPhoto({"id":5149262,"src":"BW47a_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5149262.html","width":100,"caption":"","height":100});
															thumbnails[5514685] = clik.newPhoto({"id":5514685,"src":"Grierson-organic075_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5514685.html","width":100,"caption":"Food 4","height":100});
															thumbnails[5515252] = clik.newPhoto({"id":5515252,"src":"kira-2p_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5515252.html","width":100,"caption":"","height":100});
															thumbnails[3360653] = clik.newPhoto({"id":3360653,"src":"coffee_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360653.html","width":100,"caption":"Food 3","height":100});
															thumbnails[3420669] = clik.newPhoto({"id":3420669,"src":"food_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420669.html","width":100,"caption":"Food 5","height":100});
															thumbnails[5518734] = clik.newPhoto({"id":5518734,"src":"a0019_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518734.html","width":100,"caption":"","height":100});
															thumbnails[5519417] = clik.newPhoto({"id":5519417,"src":"GCCP_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519417.html","width":100,"caption":"","height":100});
															thumbnails[5147812] = clik.newPhoto({"id":5147812,"src":"BW26f_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5147812.html","width":100,"caption":"Food 6 ","height":100});
															thumbnails[5518741] = clik.newPhoto({"id":5518741,"src":"highlights0030_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518741.html","width":100,"caption":"","height":100});
															thumbnails[5519657] = clik.newPhoto({"id":5519657,"src":"a5_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519657.html","width":100,"caption":"","height":100});
															thumbnails[5147463] = clik.newPhoto({"id":5147463,"src":"BR64_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5147463.html","width":100,"caption":"Editorial 1","height":100});
															thumbnails[5518788] = clik.newPhoto({"id":5518788,"src":"rings_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518788.html","width":100,"caption":"","height":100});
															thumbnails[5519683] = clik.newPhoto({"id":5519683,"src":"Kira-driveway-big_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519683.html","width":100,"caption":"","height":100});
															thumbnails[3420642] = clik.newPhoto({"id":3420642,"src":"bracks_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420642.html","width":100,"caption":"Editorial 2","height":100});
															thumbnails[5518736] = clik.newPhoto({"id":5518736,"src":"flowersfront_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518736.html","width":100,"caption":"","height":100});
															thumbnails[3420655] = clik.newPhoto({"id":3420655,"src":"swim01_thumb.JPG","galleries_id":179352,"server_id":32,"link":"photo_3420655.html","width":100,"caption":"Editorial 3","height":100});
															thumbnails[5518789] = clik.newPhoto({"id":5518789,"src":"eyes-down_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518789.html","width":100,"caption":"","height":100});
															thumbnails[5519688] = clik.newPhoto({"id":5519688,"src":"hands_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519688.html","width":100,"caption":"","height":100});
															thumbnails[5519722] = clik.newPhoto({"id":5519722,"src":"_TNP7353_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519722.html","width":100,"caption":"","height":100});
															thumbnails[3420692] = clik.newPhoto({"id":3420692,"src":"Mr-papparazziw_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420692.html","width":100,"caption":"Editorial 4","height":100});
															thumbnails[5518794] = clik.newPhoto({"id":5518794,"src":"a10235_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518794.html","width":100,"caption":"","height":100});
															thumbnails[5519739] = clik.newPhoto({"id":5519739,"src":"page3_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519739.html","width":100,"caption":"","height":100});
															thumbnails[5147820] = clik.newPhoto({"id":5147820,"src":"bbh_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5147820.html","width":100,"caption":"Event 1","height":100});
															thumbnails[5518798] = clik.newPhoto({"id":5518798,"src":"aa_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518798.html","width":100,"caption":"","height":100});
															thumbnails[5519748] = clik.newPhoto({"id":5519748,"src":"luarenx_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519748.html","width":100,"caption":"","height":100});
															thumbnails[5514889] = clik.newPhoto({"id":5514889,"src":"crowd-view03_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5514889.html","width":100,"caption":"Event 2","height":100});
															thumbnails[5518800] = clik.newPhoto({"id":5518800,"src":"JF0442_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518800.html","width":100,"caption":"","height":100});
															thumbnails[5519805] = clik.newPhoto({"id":5519805,"src":"t2_thumb.jpg","galleries_id":312305,"server_id":32,"link":"photo_5519805.html","width":100,"caption":"","height":100});
															thumbnails[3360468] = clik.newPhoto({"id":3360468,"src":"Synchrotron_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360468.html","width":100,"caption":"Architecture 1","height":100});
															thumbnails[5518849] = clik.newPhoto({"id":5518849,"src":"astir0269_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518849.html","width":100,"caption":"","height":100});
															thumbnails[3360575] = clik.newPhoto({"id":3360575,"src":"crown1_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360575.html","width":100,"caption":"Architecture 2","height":100});
															thumbnails[5147421] = clik.newPhoto({"id":5147421,"src":"BR41i_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5147421.html","width":100,"caption":"","height":100});
															thumbnails[5514908] = clik.newPhoto({"id":5514908,"src":"holiday-innx_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_5514908.html","width":100,"caption":"Architecture 3","height":100});
															thumbnails[5516050] = clik.newPhoto({"id":5516050,"src":"Fabian--Kelly623x_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5516050.html","width":100,"caption":"","height":100});
															thumbnails[3377212] = clik.newPhoto({"id":3377212,"src":"Centenary_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377212.html","width":100,"caption":"Architecture 4","height":100});
															thumbnails[5149257] = clik.newPhoto({"id":5149257,"src":"BW42_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5149257.html","width":100,"caption":"","height":100});
															thumbnails[3360639] = clik.newPhoto({"id":3360639,"src":"Geelong-Ring-Rd181_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360639.html","width":100,"caption":"Construction 1","height":100});
															thumbnails[5149172] = clik.newPhoto({"id":5149172,"src":"BW41_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5149172.html","width":100,"caption":"","height":100});
															thumbnails[3377202] = clik.newPhoto({"id":3377202,"src":"Builders-on-roof_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377202.html","width":100,"caption":"Construction 2","height":100});
															thumbnails[5147582] = clik.newPhoto({"id":5147582,"src":"BW39_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5147582.html","width":100,"caption":"","height":100});
															thumbnails[3377173] = clik.newPhoto({"id":3377173,"src":"msac3-(2)_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377173.html","width":100,"caption":"Infrastructure 1","height":100});
															thumbnails[5518860] = clik.newPhoto({"id":5518860,"src":"astir0382_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518860.html","width":100,"caption":"","height":100});
															thumbnails[3360647] = clik.newPhoto({"id":3360647,"src":"H-Ports01_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360647.html","width":100,"caption":"Infrastucture 2","height":100});
															thumbnails[5518863] = clik.newPhoto({"id":5518863,"src":"blowy-bride_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518863.html","width":100,"caption":"","height":100});
															thumbnails[3377230] = clik.newPhoto({"id":3377230,"src":"96-Trams06_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377230.html","width":100,"caption":"Infrastructure 3","height":100});
															thumbnails[3420645] = clik.newPhoto({"id":3420645,"src":"bike1_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420645.html","width":100,"caption":"Infrastructure 4","height":100});
															thumbnails[5518866] = clik.newPhoto({"id":5518866,"src":"TF_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518866.html","width":100,"caption":"","height":100});
															thumbnails[5518912] = clik.newPhoto({"id":5518912,"src":"highlights0071x_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518912.html","width":100,"caption":"","height":100});
															thumbnails[3377169] = clik.newPhoto({"id":3377169,"src":"Port_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377169.html","width":100,"caption":"Infrastructure 5","height":100});
															thumbnails[5518981] = clik.newPhoto({"id":5518981,"src":"b-clare--Kieran0190_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518981.html","width":100,"caption":"","height":100});
															thumbnails[3420665] = clik.newPhoto({"id":3420665,"src":"Staff-shot1_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420665.html","width":100,"caption":"Infrastucture 6","height":100});
															thumbnails[5518984] = clik.newPhoto({"id":5518984,"src":"astir0368_thumb.jpg","galleries_id":312306,"server_id":32,"link":"photo_5518984.html","width":100,"caption":"","height":100});
															thumbnails[3377175] = clik.newPhoto({"id":3377175,"src":"Geelong-Ring-Rd08_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377175.html","width":100,"caption":"Infrastructure  7","height":100});
															thumbnails[3420677] = clik.newPhoto({"id":3420677,"src":"Dandenong33_thumb.JPG","galleries_id":179352,"server_id":32,"link":"photo_3420677.html","width":100,"caption":"Infrastructure  8","height":100});
															thumbnails[3377210] = clik.newPhoto({"id":3377210,"src":"Untitled-11_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377210.html","width":100,"caption":"Infrastructure 9","height":100});
															thumbnails[3360589] = clik.newPhoto({"id":3360589,"src":"Boat-21_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3360589.html","width":100,"caption":"Infrastructure 10","height":100});
															thumbnails[3377231] = clik.newPhoto({"id":3377231,"src":"St-Kilda-Rd_11_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3377231.html","width":100,"caption":"Infrastructure 11","height":100});
															thumbnails[3420705] = clik.newPhoto({"id":3420705,"src":"sport_thumb.jpg","galleries_id":179352,"server_id":32,"link":"photo_3420705.html","width":100,"caption":"Sport 1","height":100});
															thumbnails[3360538] = clik.newPhoto({"id":3360538,"src":"Aurora_thumb.jpg","galleries_id":312308,"server_id":32,"link":"photo_3360538.html","width":100,"caption":"Aurora","height":100});
															thumbnails[3360377] = clik.newPhoto({"id":3360377,"src":"Perry-Sandhills1_thumb.jpg","galleries_id":312308,"server_id":32,"link":"photo_3360377.html","width":100,"caption":"Perry Sand Hills","height":100});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[312306] = clik.newGallery({"parentGallery":290911,"usePopups":true,"title":"wedding","link":"section222814_312306.html","maxRecords":0.0,"photoIDs":[5149245.0,5515314.0,3420626.0,5149262.0,5518734.0,5518741.0,5518788.0,5518736.0,5518789.0,5518794.0,5518798.0,5518800.0,5518849.0,5147421.0,5516050.0,5149257.0,5149172.0,5147582.0,5518860.0,5518863.0,5518866.0,5518912.0,5518981.0,5518984.0],"skipIndex":0,"section_code":"section222814","featured_images":5147582.0,"id":312306,"singleSection":false});				  						galleries[312308] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Landscape Gallery","link":"section222814_312308.html","maxRecords":0.0,"photoIDs":[5491886.0,5492222.0,5492333.0,3360538.0,3360377.0],"skipIndex":0,"section_code":"section222814","featured_images":"5492222,5491886","id":312308,"singleSection":false});				  						galleries[179352] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"    Commercial","link":"section222814_179352.html","maxRecords":0.0,"photoIDs":[5147754.0,5514677.0,5514685.0,3360653.0,3420669.0,5147812.0,5147463.0,3420642.0,3420655.0,3420692.0,5147820.0,5514889.0,3360468.0,3360575.0,5514908.0,3377212.0,3360639.0,3377202.0,3377173.0,3360647.0,3377230.0,3420645.0,3377169.0,3420665.0,3377175.0,3420677.0,3377210.0,3360589.0,3377231.0,3420705.0],"skipIndex":0,"section_code":"section222814","featured_images":3360468.0,"id":179352,"singleSection":false});				  						galleries[290911] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"People","link":"section222814_290911.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section222814","featured_images":"5519739,5147582","id":290911,"singleSection":false});				  						galleries[312305] = clik.newGallery({"parentGallery":290911,"usePopups":true,"title":"Portrait","link":"section222814_312305.html","maxRecords":0.0,"photoIDs":[5515197.0,5515234.0,5515241.0,5515252.0,5519417.0,5519657.0,5519683.0,5519688.0,5519722.0,5519739.0,5519748.0,5519805.0],"skipIndex":0,"section_code":"section222814","featured_images":5519739.0,"id":312305,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3360589,3360582';
imageSets[2] = '5491886,5492222,5519739,3360468,5147582,3360378';
imageSets[3] = '3420626,3420669,3420642,3420692,3377212,3377202,3377173,3420645,3377230,3377169,3420665,3377175,3420677,3377210,3377231,3377228';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Glensphotos/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Glensphotos/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 += 'section222814.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 && 'section222814' != '') {
					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 + ': Glen Campbell -  Commercial Photographer';
			    }
        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> &pound;' + (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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<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="GLENSPHOTOS">';
			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;
	}
}

			

