window.thumbnails = {};
thumbnails[7498797] = clik.newPhoto({"link":"#","caption":"","height":130,"id":7498797,"server_id":21,"src":"portrait_thumb.jpg","galleries_id":"","width":88});
thumbnails[8992521] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8992521,"server_id":21,"src":"wedding-sheet_thumb.jpg","galleries_id":"","width":89});
thumbnails[9045600] = clik.newPhoto({"link":"#","caption":"","height":130,"id":9045600,"server_id":21,"src":"wedding-sheet-2_thumb.jpg","galleries_id":"","width":89});
thumbnails[7498754] = clik.newPhoto({"link":"photo_7498754.html","caption":"","height":130,"id":7498754,"server_id":21,"src":"JoBradfordPhotography-38_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499359] = clik.newPhoto({"link":"photo_7499359.html","caption":"","height":130,"id":7499359,"server_id":21,"src":"cymbeline_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158269] = clik.newPhoto({"link":"photo_9158269.html","caption":"","height":130,"id":9158269,"server_id":21,"src":"GreenIslandStudios10_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7498757] = clik.newPhoto({"link":"photo_7498757.html","caption":"","height":130,"id":7498757,"server_id":21,"src":"Elsies-Coat_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499361] = clik.newPhoto({"link":"photo_7499361.html","caption":"","height":130,"id":7499361,"server_id":21,"src":"float-away_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158266] = clik.newPhoto({"link":"photo_9158266.html","caption":"","height":130,"id":9158266,"server_id":21,"src":"GreenIslandStudios07_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7498759] = clik.newPhoto({"link":"photo_7498759.html","caption":"","height":130,"id":7498759,"server_id":21,"src":"JoBradfordPhotography-31_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499364] = clik.newPhoto({"link":"photo_7499364.html","caption":"","height":130,"id":7499364,"server_id":21,"src":"Grecian_Queen_thumb.jpg","galleries_id":406119,"width":76});
thumbnails[9158283] = clik.newPhoto({"link":"photo_9158283.html","caption":"","height":130,"id":9158283,"server_id":21,"src":"GreenIslandStudios26_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7498763] = clik.newPhoto({"link":"photo_7498763.html","caption":"","height":130,"id":7498763,"server_id":21,"src":"mexican_blanket_thumb.jpg","galleries_id":406118,"width":88});
thumbnails[7499363] = clik.newPhoto({"link":"photo_7499363.html","caption":"","height":130,"id":7499363,"server_id":21,"src":"havana-club_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158264] = clik.newPhoto({"link":"photo_9158264.html","caption":"","height":130,"id":9158264,"server_id":21,"src":"GreenIslandStudios05_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499325] = clik.newPhoto({"link":"photo_7499325.html","caption":"","height":130,"id":7499325,"server_id":21,"src":"jo_bradford_photography_thumb.jpg","galleries_id":406118,"width":86});
thumbnails[9158281] = clik.newPhoto({"link":"photo_9158281.html","caption":"","height":130,"id":9158281,"server_id":21,"src":"GreenIslandStudios24_1_thumb.jpg","galleries_id":483602,"width":127});
thumbnails[7499356] = clik.newPhoto({"link":"photo_7499356.html","caption":"","height":130,"id":7499356,"server_id":21,"src":"Summer_of_Love_thumb.jpg","galleries_id":406118,"width":89});
thumbnails[7498781] = clik.newPhoto({"link":"photo_7498781.html","caption":"","height":130,"id":7498781,"server_id":21,"src":"JoBradfordPhotography-331_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499367] = clik.newPhoto({"link":"photo_7499367.html","caption":"","height":130,"id":7499367,"server_id":21,"src":"JoBradfordPhotography-312_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7499439] = clik.newPhoto({"link":"photo_7499439.html","caption":"","height":87,"id":7499439,"server_id":21,"src":"the-race_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7498789] = clik.newPhoto({"link":"photo_7498789.html","caption":"","height":130,"id":7498789,"server_id":21,"src":"peacecful_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499370] = clik.newPhoto({"link":"photo_7499370.html","caption":"","height":130,"id":7499370,"server_id":21,"src":"joyful_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158260] = clik.newPhoto({"link":"photo_9158260.html","caption":"","height":87,"id":9158260,"server_id":21,"src":"GreenIslandStudios01_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7498790] = clik.newPhoto({"link":"photo_7498790.html","caption":"","height":130,"id":7498790,"server_id":21,"src":"JoBradfordPhotography-301_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499427] = clik.newPhoto({"link":"photo_7499427.html","caption":"","height":130,"id":7499427,"server_id":21,"src":"JoBradfordPhotography-34_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158265] = clik.newPhoto({"link":"photo_9158265.html","caption":"","height":87,"id":9158265,"server_id":21,"src":"GreenIslandStudios06_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7706027] = clik.newPhoto({"link":"photo_7706027.html","caption":"","height":130,"id":7706027,"server_id":21,"src":"JoBradfordPhotography-14_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7498788] = clik.newPhoto({"link":"photo_7498788.html","caption":"","height":130,"id":7498788,"server_id":21,"src":"JoBradfordPhotography-302_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499428] = clik.newPhoto({"link":"photo_7499428.html","caption":"","height":130,"id":7499428,"server_id":21,"src":"autumnal_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158270] = clik.newPhoto({"link":"photo_9158270.html","caption":"","height":96,"id":9158270,"server_id":21,"src":"GreenIslandStudios11_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499430] = clik.newPhoto({"link":"photo_7499430.html","caption":"","height":130,"id":7499430,"server_id":21,"src":"JoBradfordPhotography-39_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7706028] = clik.newPhoto({"link":"photo_7706028.html","caption":"","height":130,"id":7706028,"server_id":21,"src":"JoBradfordPhotography-13_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[9158273] = clik.newPhoto({"link":"photo_9158273.html","caption":"","height":87,"id":9158273,"server_id":21,"src":"GreenIslandStudios15_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499329] = clik.newPhoto({"link":"photo_7499329.html","caption":"","height":130,"id":7499329,"server_id":21,"src":"autumn-afternoon_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499314] = clik.newPhoto({"link":"photo_7499314.html","caption":"","height":130,"id":7499314,"server_id":21,"src":"JoBradfordPhotography-305_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499366] = clik.newPhoto({"link":"photo_7499366.html","caption":"","height":130,"id":7499366,"server_id":21,"src":"search_thumb.jpg","galleries_id":483602,"width":87});
thumbnails[7499431] = clik.newPhoto({"link":"photo_7499431.html","caption":"","height":130,"id":7499431,"server_id":21,"src":"charlotte_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7706025] = clik.newPhoto({"link":"photo_7706025.html","caption":"","height":130,"id":7706025,"server_id":21,"src":"JoBradfordPhotography-11_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7498791] = clik.newPhoto({"link":"photo_7498791.html","caption":"","height":130,"id":7498791,"server_id":21,"src":"JoBradfordPhotography-304_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7706012] = clik.newPhoto({"link":"photo_7706012.html","caption":"","height":130,"id":7706012,"server_id":21,"src":"JoBradfordPhotography-4_thumb.jpg","galleries_id":406119,"width":85});
thumbnails[9158268] = clik.newPhoto({"link":"photo_9158268.html","caption":"","height":130,"id":9158268,"server_id":21,"src":"GreenIslandStudios09_1_thumb.jpg","galleries_id":483602,"width":87});
thumbnails[7499437] = clik.newPhoto({"link":"photo_7499437.html","caption":"","height":130,"id":7499437,"server_id":21,"src":"JoBradfordPhotography-311_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7706026] = clik.newPhoto({"link":"photo_7706026.html","caption":"","height":130,"id":7706026,"server_id":21,"src":"JoBradfordPhotography-12_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[7499312] = clik.newPhoto({"link":"photo_7499312.html","caption":"","height":130,"id":7499312,"server_id":21,"src":"Acorn_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499436] = clik.newPhoto({"link":"photo_7499436.html","caption":"","height":130,"id":7499436,"server_id":21,"src":"the-runaway_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158282] = clik.newPhoto({"link":"photo_9158282.html","caption":"","height":86,"id":9158282,"server_id":21,"src":"GreenIslandStudios25_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499335] = clik.newPhoto({"link":"photo_7499335.html","caption":"","height":130,"id":7499335,"server_id":21,"src":"JoBradfordPhotography-40_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499438] = clik.newPhoto({"link":"photo_7499438.html","caption":"","height":87,"id":7499438,"server_id":21,"src":"silver_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158279] = clik.newPhoto({"link":"photo_9158279.html","caption":"","height":87,"id":9158279,"server_id":21,"src":"GreenIslandStudios21_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499341] = clik.newPhoto({"link":"photo_7499341.html","caption":"","height":130,"id":7499341,"server_id":21,"src":"JoBradfordPhotography-35_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[9158275] = clik.newPhoto({"link":"photo_9158275.html","caption":"","height":98,"id":9158275,"server_id":21,"src":"GreenIslandStudios16_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7706017] = clik.newPhoto({"link":"photo_7706017.html","caption":"","height":130,"id":7706017,"server_id":21,"src":"JoBradfordPhotography-8_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499441] = clik.newPhoto({"link":"photo_7499441.html","caption":"","height":98,"id":7499441,"server_id":21,"src":"sleep-to-dream_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[7706013] = clik.newPhoto({"link":"photo_7706013.html","caption":"","height":130,"id":7706013,"server_id":21,"src":"JoBradfordPhotography-2_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[9158263] = clik.newPhoto({"link":"photo_9158263.html","caption":"","height":130,"id":9158263,"server_id":21,"src":"GreenIslandStudios04_1_thumb.jpg","galleries_id":483602,"width":87});
thumbnails[7499344] = clik.newPhoto({"link":"photo_7499344.html","caption":"","height":130,"id":7499344,"server_id":21,"src":"Naomi_F_final-Edit_thumb.jpg","galleries_id":406118,"width":85});
thumbnails[7499442] = clik.newPhoto({"link":"photo_7499442.html","caption":"","height":87,"id":7499442,"server_id":21,"src":"torso_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158280] = clik.newPhoto({"link":"photo_9158280.html","caption":"","height":115,"id":9158280,"server_id":21,"src":"GreenIslandStudios22_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499443] = clik.newPhoto({"link":"photo_7499443.html","caption":"","height":87,"id":7499443,"server_id":21,"src":"surf_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[7706016] = clik.newPhoto({"link":"photo_7706016.html","caption":"","height":130,"id":7706016,"server_id":21,"src":"JoBradfordPhotography-9_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[9158276] = clik.newPhoto({"link":"photo_9158276.html","caption":"","height":130,"id":9158276,"server_id":21,"src":"GreenIslandStudios18_1_thumb.jpg","galleries_id":483602,"width":127});
thumbnails[7499445] = clik.newPhoto({"link":"photo_7499445.html","caption":"","height":87,"id":7499445,"server_id":21,"src":"JoBradfordPhotography-332_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158271] = clik.newPhoto({"link":"photo_9158271.html","caption":"","height":87,"id":9158271,"server_id":21,"src":"GreenIslandStudios12_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499357] = clik.newPhoto({"link":"photo_7499357.html","caption":"","height":130,"id":7499357,"server_id":21,"src":"happy-days_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499446] = clik.newPhoto({"link":"photo_7499446.html","caption":"","height":130,"id":7499446,"server_id":21,"src":"ford_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158277] = clik.newPhoto({"link":"photo_9158277.html","caption":"","height":87,"id":9158277,"server_id":21,"src":"GreenIslandStudios19_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7705783] = clik.newPhoto({"link":"photo_7705783.html","caption":"","height":87,"id":7705783,"server_id":21,"src":"Tea_Party1_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[7499354] = clik.newPhoto({"link":"photo_7499354.html","caption":"","height":130,"id":7499354,"server_id":21,"src":"Darkside_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[7499447] = clik.newPhoto({"link":"photo_7499447.html","caption":"","height":107,"id":7499447,"server_id":21,"src":"JoBradfordPhotography-37_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158278] = clik.newPhoto({"link":"photo_9158278.html","caption":"","height":98,"id":9158278,"server_id":21,"src":"GreenIslandStudios20_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499448] = clik.newPhoto({"link":"photo_7499448.html","caption":"","height":130,"id":7499448,"server_id":21,"src":"friends_thumb.jpg","galleries_id":406119,"width":87});
thumbnails[9158267] = clik.newPhoto({"link":"photo_9158267.html","caption":"","height":87,"id":9158267,"server_id":21,"src":"GreenIslandStudios08_1_thumb.jpg","galleries_id":483602,"width":130});
thumbnails[7499451] = clik.newPhoto({"link":"photo_7499451.html","caption":"","height":87,"id":7499451,"server_id":21,"src":"IMG_5797_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[7500803] = clik.newPhoto({"link":"photo_7500803.html","caption":"","height":130,"id":7500803,"server_id":21,"src":"jo-bradford-01_thumb.jpg","galleries_id":406118,"width":87});
thumbnails[9158262] = clik.newPhoto({"link":"photo_9158262.html","caption":"","height":130,"id":9158262,"server_id":21,"src":"GreenIslandStudios03_1_thumb.jpg","galleries_id":483602,"width":87});
thumbnails[7499452] = clik.newPhoto({"link":"photo_7499452.html","caption":"","height":87,"id":7499452,"server_id":21,"src":"freedom_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158261] = clik.newPhoto({"link":"photo_9158261.html","caption":"","height":130,"id":9158261,"server_id":21,"src":"GreenIslandStudios02_1_thumb.jpg","galleries_id":483602,"width":84});
thumbnails[7499456] = clik.newPhoto({"link":"photo_7499456.html","caption":"","height":85,"id":7499456,"server_id":21,"src":"IMG_6149_thumb.jpg","galleries_id":406119,"width":130});
thumbnails[9158274] = clik.newPhoto({"link":"photo_9158274.html","caption":"","height":94,"id":9158274,"server_id":21,"src":"GreenIslandStudios17_1_thumb.jpg","galleries_id":483602,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[406118] = clik.newGallery({"photoIDs":[7498754,7498757,7498759,7498763,7499325,7499356,7498781,7498789,7498790,7498788,7706028,7499329,7499314,7498791,7499312,7499335,7499341,7706017,7706013,7499344,7706016,7499357,7499354,7500803],"link":"gallery_406118.html","skipIndex":0,"section_code":"gallery","id":406118,"parentGallery":"","featured_images":"7499356,7498781,7498763,7498759,7498757,7498754","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Portrait Photography"});galleries[406119] = clik.newGallery({"photoIDs":[7499359,7499361,7499364,7499363,7499367,7499370,7499427,7706027,7499428,7499430,7499431,7706025,7706012,7499437,7706026,7499436,7499438,7499441,7499442,7499443,7499445,7499446,7705783,7499447,7499448,7499451,7499452,7499456],"link":"gallery_406119.html","skipIndex":0,"section_code":"gallery","id":406119,"parentGallery":"","featured_images":"7499438,7499436,7499361,7499359","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Editorial Photography"});galleries[483602] = clik.newGallery({"photoIDs":[9158269,9158266,9158283,9158264,9158281,7499439,9158260,9158265,9158270,9158273,7499366,9158268,9158282,9158279,9158275,9158263,9158280,9158276,9158271,9158277,9158278,9158267,9158262,9158261,9158274],"link":"gallery_483602.html","skipIndex":0,"section_code":"gallery","id":483602,"parentGallery":"","featured_images":"9158263,7499366","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Commercial Photography"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '7498797';
imageSets[2] = '7499359,7498754,7499361,7498757,7498759,7498763,7499356,7498781,7499366,7499436,7499438,9158263';
imageSets[1] = '9158269,7499359,7498754,9158266,7499361,7498757,9158283,7498759,7498763,7499356,9158260,7499436,7499438';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/GreenIslandStudios/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/GreenIslandStudios/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 = 'Green Island Studios: ' + 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;
	}
}

		

