window.thumbnails = {};
															thumbnails[3753114] = clik.newPhoto({"id":3753114,"src":"2006_01Jan_Marias079_500x375_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7125107] = clik.newPhoto({"id":7125107,"src":"Underthesea_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":77});
															thumbnails[3981671] = clik.newPhoto({"id":3981671,"src":"SNV30682edited_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Luis Colom","height":169});
															thumbnails[3981672] = clik.newPhoto({"id":3981672,"src":"2009_April04edited2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Marisa Barcelo","height":197});
															thumbnails[2144893] = clik.newPhoto({"id":2144893,"src":"Imagen004_640x480_thumb.jpg","galleries_id":239784,"server_id":32,"link":"photo_2144893.html","width":130,"caption":"","height":98});
															thumbnails[2144908] = clik.newPhoto({"id":2144908,"src":"IMGP2289_640x480_thumb.JPG","galleries_id":239784,"server_id":32,"link":"photo_2144908.html","width":130,"caption":"","height":104});
															thumbnails[2144924] = clik.newPhoto({"id":2144924,"src":"SNV30267_640x480_thumb.JPG","galleries_id":239784,"server_id":32,"link":"photo_2144924.html","width":130,"caption":"","height":173});
															thumbnails[6352010] = clik.newPhoto({"id":6352010,"src":"Estudio5_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352010.html","width":87,"caption":"Orilla\/Shore","height":130});
															thumbnails[7507189] = clik.newPhoto({"id":7507189,"src":"Espectators-Shiny_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7507189.html","width":130,"caption":"Shiny\/ Alegres","height":83});
															thumbnails[7507203] = clik.newPhoto({"id":7507203,"src":"Espectators-Warmth_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7507203.html","width":130,"caption":"Warmth\/ Calidez","height":83});
															thumbnails[6352030] = clik.newPhoto({"id":6352030,"src":"FondMarinoVerde_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352030.html","width":130,"caption":"Fondo Marino (Verde)\/ Seabed (Green)","height":130});
															thumbnails[7124996] = clik.newPhoto({"id":7124996,"src":"Splashweb_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_7124996.html","width":130,"caption":"Splash1","height":127});
															thumbnails[7773401] = clik.newPhoto({"id":7773401,"src":"Happy_DegreeArt_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7773401.html","width":130,"caption":"Tensed\/ En tension","height":87});
															thumbnails[6352019] = clik.newPhoto({"id":6352019,"src":"Calma_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352019.html","width":128,"caption":"Calma\/ Calm Sea","height":130});
															thumbnails[7775444] = clik.newPhoto({"id":7775444,"src":"Passionate_Degreeart_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775444.html","width":130,"caption":"Passionate\/ Apasionados","height":95});
															thumbnails[6352023] = clik.newPhoto({"id":6352023,"src":"Marejadilla_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352023.html","width":130,"caption":"Marejadilla\/ Ripple Sea","height":127});
															thumbnails[7775448] = clik.newPhoto({"id":7775448,"src":"Cool_Degreeart_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775448.html","width":130,"caption":"Cool\/ Guay","height":87});
															thumbnails[6352026] = clik.newPhoto({"id":6352026,"src":"FuerteMarejada_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352026.html","width":130,"caption":"Fuerte Marejada\/ Storm Sea","height":127});
															thumbnails[7775446] = clik.newPhoto({"id":7775446,"src":"Hopeful_Degreeart_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775446.html","width":130,"caption":"Hopeful\/ Esperanzados","height":83});
															thumbnails[6352038] = clik.newPhoto({"id":6352038,"src":"Degrade1_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352038.html","width":130,"caption":"Mar, hacia lo profundo\/ Sea, towards the depth.","height":92});
															thumbnails[7775450] = clik.newPhoto({"id":7775450,"src":"Excitement_Degreeart_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775450.html","width":130,"caption":"Excitement\/ Excitados","height":94});
															thumbnails[6352044] = clik.newPhoto({"id":6352044,"src":"FondoMarinoTurquesa_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352044.html","width":130,"caption":"Fondo Marino Turquesa 2\/ Seabed Turquoise 2","height":130});
															thumbnails[7775452] = clik.newPhoto({"id":7775452,"src":"Excitement2_Degreeart_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775452.html","width":130,"caption":"Excitement2\/ Excitados2","height":75});
															thumbnails[6352042] = clik.newPhoto({"id":6352042,"src":"Degrade2_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352042.html","width":130,"caption":"Mar Adentro\/ The Sea Inside","height":92});
															thumbnails[7775454] = clik.newPhoto({"id":7775454,"src":"Excitement3_DegreeArt_thumb.jpg","galleries_id":407027,"server_id":32,"link":"photo_7775454.html","width":130,"caption":"Excitement3\/ Excitados3","height":84});
															thumbnails[3958234] = clik.newPhoto({"id":3958234,"src":"ok1-edited_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_3958234.html","width":130,"caption":"Ovation3 Ovacion3","height":132});
															thumbnails[6352056] = clik.newPhoto({"id":6352056,"src":"Splash3_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352056.html","width":130,"caption":"Fondo Marino Turquesa 3\/ Seabed Turquoise 3","height":87});
															thumbnails[8569755] = clik.newPhoto({"id":8569755,"src":"Good2_thumb.jpg","galleries_id":407027,"server_id":35,"link":"photo_8569755.html","width":130,"caption":"Good2","height":64});
															thumbnails[6352059] = clik.newPhoto({"id":6352059,"src":"Estela2_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_6352059.html","width":127,"caption":"Estela\/ Wake","height":130});
															thumbnails[3958244] = clik.newPhoto({"id":3958244,"src":"IMG_0377edited_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_3958244.html","width":130,"caption":"Ovation1 Ovacion1","height":135});
															thumbnails[4858935] = clik.newPhoto({"id":4858935,"src":"Ovacion2_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_4858935.html","width":130,"caption":"Ovation2 Ovacion2","height":129});
															thumbnails[2144919] = clik.newPhoto({"id":2144919,"src":"IMGP2477_edited-1_thumb.jpg","galleries_id":143775,"server_id":32,"link":"photo_2144919.html","width":130,"caption":"Installation: The Buckets.<br>\r\nInstalacion: Los Cubos","height":99});
															thumbnails[3958247] = clik.newPhoto({"id":3958247,"src":"IMG_0370edited_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_3958247.html","width":130,"caption":"Aplause\/ Aplauso","height":145});
															thumbnails[3958250] = clik.newPhoto({"id":3958250,"src":"IMG_0374_edited_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_3958250.html","width":130,"caption":"Ok","height":145});
															thumbnails[3958253] = clik.newPhoto({"id":3958253,"src":"IMG_0379edited_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_3958253.html","width":130,"caption":"Victory\/ Victoria","height":153});
															thumbnails[5013013] = clik.newPhoto({"id":5013013,"src":"Intensity1_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_5013013.html","width":130,"caption":"Intensity Intensidad","height":175});
															thumbnails[5013006] = clik.newPhoto({"id":5013006,"src":"Atmosfera1_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_5013006.html","width":130,"caption":"Atmosphere Atmosfera","height":174});
															thumbnails[5013001] = clik.newPhoto({"id":5013001,"src":"Un_fan1_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_5013001.html","width":130,"caption":"Fan","height":175});
															thumbnails[7894428] = clik.newPhoto({"id":7894428,"src":"EverybodysUpsDowns1_thumb.jpg","galleries_id":143779,"server_id":32,"link":"photo_7894428.html","width":52,"caption":"Everybody's Ups & Downs","height":130});
															thumbnails[2276616] = clik.newPhoto({"id":2276616,"src":"June 2008011_edited-1_thumb.jpg","galleries_id":143779,"server_id":32,"link":"photo_2276616.html","width":130,"caption":"Dyptich: Ups and downs<br>\r\n","height":171});
															thumbnails[3958805] = clik.newPhoto({"id":3958805,"src":"SNV34946-1_thumb.JPG","galleries_id":143779,"server_id":32,"link":"photo_3958805.html","width":130,"caption":"Feeling down\/ <br>\r\nDe bajon","height":98});
															thumbnails[3958802] = clik.newPhoto({"id":3958802,"src":"SNV34238edited_thumb.jpg","galleries_id":143779,"server_id":32,"link":"photo_3958802.html","width":130,"caption":"Joy<br>\r\nAlegria","height":94});
															thumbnails[2144940] = clik.newPhoto({"id":2144940,"src":"SNV33105_640x480_thumb.JPG","galleries_id":143779,"server_id":32,"link":"photo_2144940.html","width":130,"caption":"Drama","height":98});
															thumbnails[3958323] = clik.newPhoto({"id":3958323,"src":"IMG_0091_edited-1_thumb.jpg","galleries_id":143779,"server_id":32,"link":"photo_3958323.html","width":130,"caption":"Desire2 \/ Deseo2","height":140});
															thumbnails[5013022] = clik.newPhoto({"id":5013022,"src":"Panoramica1_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_5013022.html","width":130,"caption":"Panoramica","height":49});
															thumbnails[6635323] = clik.newPhoto({"id":6635323,"src":"08122009222_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_6635323.html","width":130,"caption":"Panoramica 3","height":68});
															thumbnails[6635324] = clik.newPhoto({"id":6635324,"src":"08122009223_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_6635324.html","width":130,"caption":"Panoramica 4","height":65});
															thumbnails[5013026] = clik.newPhoto({"id":5013026,"src":"Fugaz1_thumb.jpg","galleries_id":140842,"server_id":32,"link":"photo_5013026.html","width":130,"caption":"Fugaz","height":62});
															thumbnails[2276713] = clik.newPhoto({"id":2276713,"src":"June 2008013_edited-1_thumb.jpg","galleries_id":143779,"server_id":32,"link":"photo_2276713.html","width":130,"caption":"Dyptich: Secrets 1<br>\r\nDiptico: Secretos 1","height":173});
															thumbnails[2144933] = clik.newPhoto({"id":2144933,"src":"SNV30831_640x480_thumb.JPG","galleries_id":143779,"server_id":32,"link":"photo_2144933.html","width":130,"caption":"Untitled<br>\r\nSin titulo","height":179});
															thumbnails[7124593] = clik.newPhoto({"id":7124593,"src":"shows2_thumb.jpg","galleries_id":384742,"server_id":32,"link":"photo_7124593.html","width":87,"caption":"","height":130});
															thumbnails[7124596] = clik.newPhoto({"id":7124596,"src":"shows1_thumb.jpg","galleries_id":384742,"server_id":32,"link":"photo_7124596.html","width":130,"caption":"","height":87});
															thumbnails[7124692] = clik.newPhoto({"id":7124692,"src":"shows11_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7124692.html","width":130,"caption":"","height":87});
															thumbnails[7124709] = clik.newPhoto({"id":7124709,"src":"shows3_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7124709.html","width":130,"caption":"","height":87});
															thumbnails[7124715] = clik.newPhoto({"id":7124715,"src":"shows21_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7124715.html","width":130,"caption":"","height":87});
															thumbnails[7124721] = clik.newPhoto({"id":7124721,"src":"shows4_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7124721.html","width":130,"caption":"","height":87});
															thumbnails[7125272] = clik.newPhoto({"id":7125272,"src":"1_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7125272.html","width":130,"caption":"","height":87});
															thumbnails[7125277] = clik.newPhoto({"id":7125277,"src":"2_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7125277.html","width":130,"caption":"","height":87});
															thumbnails[7125280] = clik.newPhoto({"id":7125280,"src":"3_thumb.jpg","galleries_id":385372,"server_id":32,"link":"photo_7125280.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[407027] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Spectators - Espectadores 2011","link":"gallery_407027.html","maxRecords":0.0,"photoIDs":[7507189.0,7507203.0,7773401.0,7775444.0,7775448.0,7775446.0,7775450.0,7775452.0,7775454.0,8569755.0],"skipIndex":0,"section_code":"gallery","featured_images":"8569755,7775454,7775452,7775450,7775448,7775446,7775444,7773401,7507203,7507189","id":407027,"singleSection":false});				  						galleries[384742] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Spectators Show","link":"section458252_384742.html","maxRecords":0.0,"photoIDs":[7124593.0,7124596.0],"skipIndex":0,"section_code":"section458252","featured_images":"7124596,7124593","id":384742,"singleSection":false});				  						galleries[140842] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Spectators-Espectadores 2009","link":"gallery_140842.html","maxRecords":0.0,"photoIDs":[3958234.0,3958244.0,4858935.0,3958247.0,3958250.0,3958253.0,5013013.0,5013006.0,5013001.0,5013022.0,6635323.0,6635324.0,5013026.0],"skipIndex":0,"section_code":"gallery","featured_images":"6635324,6635323,5013026,5013022,5013013,5013006,5013001,4858935,3958253,3958250","id":140842,"singleSection":false});				  						galleries[143779] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Experiences-Experiencias","link":"gallery_143779.html","maxRecords":0.0,"photoIDs":[7894428.0,2276616.0,3958805.0,3958802.0,2144940.0,3958323.0,2276713.0,2144933.0],"skipIndex":0,"section_code":"gallery","featured_images":2144933.0,"id":143779,"singleSection":false});				  						galleries[143775] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sea - Mar 2010","link":"gallery_143775.html","maxRecords":0.0,"photoIDs":[6352010.0,6352030.0,7124996.0,6352019.0,6352023.0,6352026.0,6352038.0,6352044.0,6352042.0,6352056.0,6352059.0,2144919.0],"skipIndex":0,"section_code":"gallery","featured_images":"7124996,6352059,6352056,6352044,6352042,6352038,6352030,6352026,6352023,6352019","id":143775,"singleSection":false});				  						galleries[239784] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Archive-Archivo","link":"gallery_239784.html","maxRecords":0.0,"photoIDs":[2144893.0,2144908.0,2144924.0],"skipIndex":0,"section_code":"gallery","featured_images":"2144924,2144908,2144893","id":239784,"singleSection":false});				  						galleries[385372] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mar Show","link":"section458252_385372.html","maxRecords":0.0,"photoIDs":[7124692.0,7124709.0,7124715.0,7124721.0,7125272.0,7125277.0,7125280.0],"skipIndex":0,"section_code":"section458252","featured_images":"7125280,7125277,7125272,7124721,7124715,7124709,7124692","id":385372,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3753114';
imageSets[2] = '2144933';
imageSets[3] = '8569755,7894428,7775454,7775452,7775450,7775448,7775446,7775444,7773401,7507203,7507189,7125280,7125277,7125272,7125107,7124996,7124721,7124715,7124709,7124692,7124596,7124593,6635324,6635323,6352059,6352056,6352044,6352042,6352038,6352030,6352026,6352023,6352019,6352010,5013026,5013022,5013013,5013006,5013001,4858935,3981672,3981671,3958805,3958802,3958323,3958253,3958250,3958247,3958244,3958234';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/inside_0/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/inside_0/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/inside_0/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/inside_0/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/inside_0/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/inside_0/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/inside_0/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 += '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 = 'Maria Colom: ' + 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.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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		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 += '<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;
	}
}

			

