window.thumbnails = {};
															thumbnails[275606] = clik.newPhoto({"id":275606,"src":"150 Graffitti-Escape From_thumb..JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Escape From","height":100});
															thumbnails[275609] = clik.newPhoto({"id":275609,"src":"356 The Street_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"The Street","height":172});
															thumbnails[275392] = clik.newPhoto({"id":275392,"src":"L -Graffitti 11_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Graffiti 1<br>\r\n","height":65});
															thumbnails[275378] = clik.newPhoto({"id":275378,"src":"283 Rusty Buckets_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_275378.html","width":130,"caption":"Rusty Buckets","height":172});
															thumbnails[276452] = clik.newPhoto({"id":276452,"src":"C - 362 Endless Horizon_thumb.JPG","galleries_id":225939,"server_id":18,"link":"photo_276452.html","width":130,"caption":"Endless Horizons","height":163});
															thumbnails[277846] = clik.newPhoto({"id":277846,"src":"131-Quadrant_thumb.jpg","galleries_id":24448,"server_id":18,"link":"photo_277846.html","width":130,"caption":"Quadrant","height":174});
															thumbnails[277854] = clik.newPhoto({"id":277854,"src":"C---354-2+11_thumb.jpg","galleries_id":225942,"server_id":18,"link":"photo_277854.html","width":130,"caption":"2 + 1","height":222});
															thumbnails[277857] = clik.newPhoto({"id":277857,"src":"C-205-Vast-x-3-PGMV_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_277857.html","width":130,"caption":"Mini x 3","height":70});
															thumbnails[337335] = clik.newPhoto({"id":337335,"src":"271 Dried up City_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_337335.html","width":130,"caption":"Fusion","height":96});
															thumbnails[337347] = clik.newPhoto({"id":337347,"src":"123 Fields1_thumb.JPG","galleries_id":24448,"server_id":18,"link":"photo_337347.html","width":130,"caption":"Fields","height":191});
															thumbnails[343416] = clik.newPhoto({"id":343416,"src":"G - 124_thumb.JPG","galleries_id":24448,"server_id":18,"link":"photo_343416.html","width":130,"caption":"Blue 1","height":166});
															thumbnails[1811853] = clik.newPhoto({"id":1811853,"src":"Long Journey2_thumb.jpg","galleries_id":24454,"server_id":18,"link":"photo_1811853.html","width":130,"caption":"Long Journey","height":70});
															thumbnails[1835861] = clik.newPhoto({"id":1835861,"src":"Somewhere_thumb.jpg","galleries_id":24454,"server_id":18,"link":"photo_1835861.html","width":130,"caption":"Somewhere","height":129});
															thumbnails[3697180] = clik.newPhoto({"id":3697180,"src":"2003_0419Image0006_thumb.JPG","galleries_id":225942,"server_id":18,"link":"photo_3697180.html","width":130,"caption":"Red Bottle","height":158});
															thumbnails[3697184] = clik.newPhoto({"id":3697184,"src":"Distant_Window1_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_3697184.html","width":130,"caption":"Distant Window","height":181});
															thumbnails[3697188] = clik.newPhoto({"id":3697188,"src":"Cityscape_1_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_3697188.html","width":130,"caption":"Cityscape 1","height":155});
															thumbnails[3697195] = clik.newPhoto({"id":3697195,"src":"2003_0114Image0026_thumb.JPG","galleries_id":225939,"server_id":18,"link":"photo_3697195.html","width":130,"caption":"Me, Myself & my room","height":170});
															thumbnails[3697335] = clik.newPhoto({"id":3697335,"src":"Grid_5_thumb.JPG","galleries_id":24448,"server_id":18,"link":"photo_3697335.html","width":130,"caption":"Repetition","height":261});
															thumbnails[3697338] = clik.newPhoto({"id":3697338,"src":"Self_Direct_3_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_3697338.html","width":130,"caption":"Broken Hill Bound","height":157});
															thumbnails[3697339] = clik.newPhoto({"id":3697339,"src":"the_maddening_crowd_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_3697339.html","width":130,"caption":"Colours 1","height":159});
															thumbnails[3697344] = clik.newPhoto({"id":3697344,"src":"Self_Direct__thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_3697344.html","width":130,"caption":"Blue Lake","height":195});
															thumbnails[4291059] = clik.newPhoto({"id":4291059,"src":"Origami_1_thumb.jpg","galleries_id":225942,"server_id":18,"link":"photo_4291059.html","width":130,"caption":"Tension","height":129});
															thumbnails[4291107] = clik.newPhoto({"id":4291107,"src":"DSCF3085_thumb.JPG","galleries_id":107806,"server_id":18,"link":"photo_4291107.html","width":130,"caption":"Opening Night - Gallery 307 - Abstract Series ","height":98});
															thumbnails[4340539] = clik.newPhoto({"id":4340539,"src":"DSCF3109_thumb.JPG","galleries_id":107806,"server_id":18,"link":"photo_4340539.html","width":130,"caption":"Global Gallery Exhibtion","height":98});
															thumbnails[5116634] = clik.newPhoto({"id":5116634,"src":"Urban_Lanscape2_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_5116634.html","width":130,"caption":"Woolloomoolloo Street","height":169});
															thumbnails[5116672] = clik.newPhoto({"id":5116672,"src":"landscape6_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_5116672.html","width":130,"caption":"Shadows","height":101});
															thumbnails[5116674] = clik.newPhoto({"id":5116674,"src":"lanscape1_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_5116674.html","width":130,"caption":"Timberyard","height":98});
															thumbnails[5173087] = clik.newPhoto({"id":5173087,"src":"hydrant_copy-1_Tinted_Negative_thumb.JPG","galleries_id":291899,"server_id":18,"link":"photo_5173087.html","width":130,"caption":"San Francisco Hydrant - Turquoise","height":310});
															thumbnails[5173089] = clik.newPhoto({"id":5173089,"src":"Hydrant_x41_thumb.jpg","galleries_id":291899,"server_id":18,"link":"photo_5173089.html","width":130,"caption":"Hydrant x 4","height":308});
															thumbnails[5173090] = clik.newPhoto({"id":5173090,"src":"Shadows_thumb.jpg","galleries_id":291899,"server_id":18,"link":"photo_5173090.html","width":130,"caption":"Shadows","height":135});
															thumbnails[7231330] = clik.newPhoto({"id":7231330,"src":"My_House_Your_house_11_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7231330.html","width":130,"caption":"My House, your House 11","height":124});
															thumbnails[7232794] = clik.newPhoto({"id":7232794,"src":"Group_Show_2010_thumb.jpg","galleries_id":107806,"server_id":18,"link":"photo_7232794.html","width":130,"caption":"Group Show 2010","height":97});
															thumbnails[614652] = clik.newPhoto({"id":614652,"src":"258 Opal Country_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_614652.html","width":130,"caption":"Opal Country","height":131});
															thumbnails[460043] = clik.newPhoto({"id":460043,"src":"210 Vast Series -Five_thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_460043.html","width":130,"caption":"Vast Series - Five","height":131});
															thumbnails[7232750] = clik.newPhoto({"id":7232750,"src":"Interuption_1_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232750.html","width":130,"caption":"Interuption 1.jpg","height":131});
															thumbnails[277865] = clik.newPhoto({"id":277865,"src":"C 207 Vast 5 PGMV_thumb.3.JPG","galleries_id":24447,"server_id":18,"link":"photo_277865.html","width":130,"caption":"Vastness","height":42});
															thumbnails[325855] = clik.newPhoto({"id":325855,"src":"117 Elements 3_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_325855.html","width":130,"caption":"Elements series - 6","height":130});
															thumbnails[7232754] = clik.newPhoto({"id":7232754,"src":"Interuption_2_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232754.html","width":130,"caption":"Interuption 4","height":128});
															thumbnails[7232796] = clik.newPhoto({"id":7232796,"src":"build_32_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232796.html","width":130,"caption":"Whose house is it","height":108});
															thumbnails[531709] = clik.newPhoto({"id":531709,"src":"118 Elements - Opal_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_531709.html","width":130,"caption":"Elements - Opal","height":132});
															thumbnails[7232799] = clik.newPhoto({"id":7232799,"src":"build_33_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232799.html","width":130,"caption":"Building 33","height":108});
															thumbnails[7232760] = clik.newPhoto({"id":7232760,"src":"My_House_Your_House_12_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232760.html","width":130,"caption":"My House, your House 12","height":128});
															thumbnails[277841] = clik.newPhoto({"id":277841,"src":"110-Broken-Dreams_thumb.jpg","galleries_id":24447,"server_id":18,"link":"photo_277841.html","width":130,"caption":"Broken Dreams 1","height":127});
															thumbnails[7232767] = clik.newPhoto({"id":7232767,"src":"my_House_Your_House_14_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232767.html","width":130,"caption":"My House, Your House 14","height":138});
															thumbnails[7232774] = clik.newPhoto({"id":7232774,"src":"Red_wall_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232774.html","width":130,"caption":"Red Wall","height":109});
															thumbnails[7232756] = clik.newPhoto({"id":7232756,"src":"leaving_teh_airport_6_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232756.html","width":130,"caption":"Leaving on a jet plane 1","height":176});
															thumbnails[645661] = clik.newPhoto({"id":645661,"src":"106_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_645661.html","width":130,"caption":"Nectar","height":132});
															thumbnails[7232758] = clik.newPhoto({"id":7232758,"src":"leaving_the_airport_3_thumb.jpg","galleries_id":289116,"server_id":18,"link":"photo_7232758.html","width":130,"caption":"Leaving on a jet plane 6","height":166});
															thumbnails[275593] = clik.newPhoto({"id":275593,"src":"262 Out in the bush _thumb.JPG","galleries_id":24447,"server_id":18,"link":"photo_275593.html","width":130,"caption":"Out in the Bush","height":104});
															thumbnails[275432] = clik.newPhoto({"id":275432,"src":"280 Field of flowers3_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_275432.html","width":130,"caption":"Desert Flowers 1","height":103});
															thumbnails[275595] = clik.newPhoto({"id":275595,"src":"264 Approaching Storm_thumb.JPG","galleries_id":24454,"server_id":18,"link":"photo_275595.html","width":130,"caption":"Approaching Storm","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[289116] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Works","link":"gallery_289116.html","maxRecords":0.0,"photoIDs":[7231330.0,7232750.0,7232754.0,7232796.0,7232799.0,7232760.0,7232767.0,7232774.0,7232756.0,7232758.0],"skipIndex":0,"section_code":"gallery","featured_images":"7232799,7232796,7232774,7232767,7232760,7232758,7232756,7232754,7232750,7231330","id":289116,"singleSection":false});				  						galleries[24454] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"gallery_24454.html","maxRecords":0.0,"photoIDs":[1811853.0,1835861.0,3697339.0,325855.0,531709.0,645661.0,275432.0,275595.0],"skipIndex":0,"section_code":"gallery","featured_images":275432.0,"id":24454,"singleSection":false});				  						galleries[24447] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_24447.html","maxRecords":0.0,"photoIDs":[275378.0,277857.0,337335.0,3697184.0,3697188.0,3697338.0,3697344.0,5116634.0,5116672.0,5116674.0,614652.0,460043.0,277865.0,277841.0,275593.0],"skipIndex":0,"section_code":"gallery","featured_images":"5116674,5116672,5116634,3697344,3697338,3697188,3697184,614652,460043,337335","id":24447,"singleSection":false});				  						galleries[225939] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Figurative","link":"gallery_225939.html","maxRecords":0.0,"photoIDs":[276452.0,3697195.0],"skipIndex":0,"section_code":"gallery","featured_images":"3697195,276452","id":225939,"singleSection":false});				  						galleries[225942] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Still Life","link":"gallery_225942.html","maxRecords":0.0,"photoIDs":[277854.0,3697180.0,4291059.0],"skipIndex":0,"section_code":"gallery","featured_images":"4291059,3697180,277854","id":225942,"singleSection":false});				  						galleries[24448] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Geometric","link":"gallery_24448.html","maxRecords":0.0,"photoIDs":[277846.0,337347.0,343416.0,3697335.0],"skipIndex":0,"section_code":"gallery","featured_images":"3697335,343416,337347,277846","id":24448,"singleSection":false});				  						galleries[291899] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prints","link":"gallery_291899.html","maxRecords":0.0,"photoIDs":[5173087.0,5173089.0,5173090.0],"skipIndex":0,"section_code":"gallery","featured_images":"5173090,5173089,5173087","id":291899,"singleSection":false});				  						galleries[107806] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Photos","link":"gallery_107806.html","maxRecords":0.0,"photoIDs":[4291107.0,4340539.0,7232794.0],"skipIndex":0,"section_code":"gallery","featured_images":"7232794,4340539,4291107","id":107806,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4340539,7232754';
imageSets[2] = '275432';
imageSets[3] = '7232799,7232796,7232794,7232774,7232767,7232760,7232758,7232756,7232754,7232750,7231330,5173090,5173089,5173087,5116674,5116672,5116634,4340539,4291107,4291059,3697344,3697339,3697338,3697335,3697195,3697188,3697184,3697180,1835861,1811853,645661,614652,531709,460043,343416,337347,337335,325855,277865,277857,277854,277846,277841,276452,275609,275606,275595,275593,275432,275392';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/michaely/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/michaely/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/michaely/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 = 'ART - is it?   : ' + 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;
	}
}

			

