window.thumbnails = {};
															thumbnails[6673776] = clik.newPhoto({"id":6673776,"src":"meanddanielforwebpage_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":161});
															thumbnails[6692355] = clik.newPhoto({"id":6692355,"src":"AOI_logo_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":49});
															thumbnails[6773853] = clik.newPhoto({"id":6773853,"src":"close-up-of-woodcut_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":98});
															thumbnails[6935583] = clik.newPhoto({"id":6935583,"src":"sovio-drawings-webversion_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":102});
															thumbnails[7035301] = clik.newPhoto({"id":7035301,"src":"Christmas_2010_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":98});
															thumbnails[7398554] = clik.newPhoto({"id":7398554,"src":"blog_thumb.png","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":121});
															thumbnails[7822222] = clik.newPhoto({"id":7822222,"src":"PrivateVIew1_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":131});
															thumbnails[7884423] = clik.newPhoto({"id":7884423,"src":"beshanddaniel_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":98});
															thumbnails[8307044] = clik.newPhoto({"id":8307044,"src":"splashsheet_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":104});
															thumbnails[8320497] = clik.newPhoto({"id":8320497,"src":"meanddaniel3_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":124});
															thumbnails[7364988] = clik.newPhoto({"id":7364988,"src":"Bas-in-Eirinn-cvr_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_7364988.html","width":130,"caption":"","height":190});
															thumbnails[6556489] = clik.newPhoto({"id":6556489,"src":"Swiftcard_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6556489.html","width":130,"caption":"Woodcut Greeting Card for 'With Sympath' range. <br>\r\nMaterials: Found plywood","height":189});
															thumbnails[6557638] = clik.newPhoto({"id":6557638,"src":"moneyplant_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6557638.html","width":130,"caption":"Seasons Greeting Card.  For Collection of natural Woodcut prints.","height":179});
															thumbnails[6557709] = clik.newPhoto({"id":6557709,"src":"MHP_March_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6557709.html","width":130,"caption":"Front cover illustration for Mental Health Practice March 2008 issue.","height":183});
															thumbnails[6557718] = clik.newPhoto({"id":6557718,"src":"Kingofengland_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6557718.html","width":130,"caption":"","height":191});
															thumbnails[6562606] = clik.newPhoto({"id":6562606,"src":"robinchristmascard_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6562606.html","width":130,"caption":"Christmas card designed for a woodcut range of card illustrations","height":185});
															thumbnails[6562646] = clik.newPhoto({"id":6562646,"src":"fallingleaves_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6562646.html","width":130,"caption":"","height":186});
															thumbnails[6578904] = clik.newPhoto({"id":6578904,"src":"MHP_spread_July_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6578904.html","width":130,"caption":"Double page spread for Mental Health Practice Magazine. Commissioned by Nursing Magazines.","height":89});
															thumbnails[6592570] = clik.newPhoto({"id":6592570,"src":"windowsill_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6592570.html","width":130,"caption":"","height":94});
															thumbnails[6640514] = clik.newPhoto({"id":6640514,"src":"abbaro_b_24_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6640514.html","width":130,"caption":"","height":155});
															thumbnails[6640516] = clik.newPhoto({"id":6640516,"src":"CHEESE_STRIPS_6_SHEET_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_6640516.html","width":130,"caption":"I was commissioned by Chemistry Advertising to design a bus shelter and bus siding to promote Cheese strips. The brief was to make it to appeal to commuters and adults in general.","height":198});
															thumbnails[6640527] = clik.newPhoto({"id":6640527,"src":"windyday_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6640527.html","width":130,"caption":"Part of a collection of greeting cards for general use. Woodcut on Japanese Kuzo paper with intaglio inks.","height":179});
															thumbnails[6654542] = clik.newPhoto({"id":6654542,"src":"abbaro_b_27_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_6654542.html","width":130,"caption":"Wine label for Sovio Red and White. The brief was to design a label for a new style wine with only 5.5% alcohol.","height":310});
															thumbnails[6673718] = clik.newPhoto({"id":6673718,"src":"oracle-nightmain_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6673718.html","width":130,"caption":"Book jacket idea for Paul Auster's Oracle Night. woodcut print with gouache painting.","height":204});
															thumbnails[6673723] = clik.newPhoto({"id":6673723,"src":"the-great-railway-bazaar2_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6673723.html","width":130,"caption":"Book jacket illustration. Found plywood print overpainted with acrylic.","height":195});
															thumbnails[6673752] = clik.newPhoto({"id":6673752,"src":"thoughtgang_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6673752.html","width":130,"caption":"cover illustration idea for the excellent existentiallist crime bank robber novel,  <i>'The Thought Gang'<\/i>","height":205});
															thumbnails[6673755] = clik.newPhoto({"id":6673755,"src":"new_kite_runnerJuly-08_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6673755.html","width":130,"caption":"","height":198});
															thumbnails[6673801] = clik.newPhoto({"id":6673801,"src":"perfume5_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6673801.html","width":130,"caption":"","height":197});
															thumbnails[6725045] = clik.newPhoto({"id":6725045,"src":"size03_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6725045.html","width":130,"caption":"Size '0'. Illustration for editorial piece about the size 0 debate.","height":179});
															thumbnails[6751751] = clik.newPhoto({"id":6751751,"src":"tfl-comp2_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_6751751.html","width":130,"caption":"","height":143});
															thumbnails[6787667] = clik.newPhoto({"id":6787667,"src":"flaubert_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6787667.html","width":130,"caption":"","height":217});
															thumbnails[6787671] = clik.newPhoto({"id":6787671,"src":"bullet-park_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6787671.html","width":130,"caption":"","height":192});
															thumbnails[6873637] = clik.newPhoto({"id":6873637,"src":"BellTolls_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_6873637.html","width":130,"caption":"","height":181});
															thumbnails[6929413] = clik.newPhoto({"id":6929413,"src":"fir-trees2webversion_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6929413.html","width":130,"caption":"","height":182});
															thumbnails[6929445] = clik.newPhoto({"id":6929445,"src":"waders_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6929445.html","width":130,"caption":"","height":163});
															thumbnails[6929895] = clik.newPhoto({"id":6929895,"src":"windy-Val-finalwebversion_thumb.jpg","galleries_id":363779,"server_id":5,"link":"photo_6929895.html","width":130,"caption":"","height":193});
															thumbnails[6974197] = clik.newPhoto({"id":6974197,"src":"water-label2_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_6974197.html","width":130,"caption":"","height":46});
															thumbnails[7070852] = clik.newPhoto({"id":7070852,"src":"farewell-to-arms_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_7070852.html","width":130,"caption":"","height":200});
															thumbnails[7070879] = clik.newPhoto({"id":7070879,"src":"a-good-argument_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7070879.html","width":130,"caption":"","height":179});
															thumbnails[7070884] = clik.newPhoto({"id":7070884,"src":"howtocontroltime_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7070884.html","width":130,"caption":"","height":93});
															thumbnails[7398483] = clik.newPhoto({"id":7398483,"src":"Blogs-se-Hacen-Mini4_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7398483.html","width":130,"caption":"","height":164});
															thumbnails[7596790] = clik.newPhoto({"id":7596790,"src":"abbaro_b30_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_7596790.html","width":130,"caption":"","height":178});
															thumbnails[7596795] = clik.newPhoto({"id":7596795,"src":"abbaro_b31_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_7596795.html","width":130,"caption":"*SHORTLISTED for SERCO prize River Thames Competition for TFL","height":195});
															thumbnails[7626779] = clik.newPhoto({"id":7626779,"src":"budget_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7626779.html","width":130,"caption":"","height":179});
															thumbnails[7627537] = clik.newPhoto({"id":7627537,"src":"YoSoySoloYQue_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7627537.html","width":130,"caption":"","height":165});
															thumbnails[7627538] = clik.newPhoto({"id":7627538,"src":"TLS2_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_7627538.html","width":130,"caption":"","height":95});
															thumbnails[7865210] = clik.newPhoto({"id":7865210,"src":"UltachBook_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_7865210.html","width":130,"caption":"Final Book Jacket for Irish Short Stories","height":173});
															thumbnails[8297102] = clik.newPhoto({"id":8297102,"src":"spain-map_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_8297102.html","width":130,"caption":"","height":133});
															thumbnails[9059692] = clik.newPhoto({"id":9059692,"src":"PussinBoots_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_9059692.html","width":130,"caption":"Puss In Boots","height":193});
															thumbnails[9059693] = clik.newPhoto({"id":9059693,"src":"TheBloodyChamber_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_9059693.html","width":130,"caption":"","height":193});
															thumbnails[9059694] = clik.newPhoto({"id":9059694,"src":"TheCompanyWolves_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_9059694.html","width":130,"caption":"","height":189});
															thumbnails[9081172] = clik.newPhoto({"id":9081172,"src":"pomegranate_thumb.jpg","galleries_id":356684,"server_id":5,"link":"photo_9081172.html","width":130,"caption":"Drinks Label","height":171});
															thumbnails[8297093] = clik.newPhoto({"id":8297093,"src":"newyorktrilogy2_thumb.jpg","galleries_id":356673,"server_id":5,"link":"photo_8297093.html","width":130,"caption":"","height":183});
															thumbnails[6974060] = clik.newPhoto({"id":6974060,"src":"taboo_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6974060.html","width":130,"caption":"","height":179});
															thumbnails[6974159] = clik.newPhoto({"id":6974159,"src":"Winemeasures_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6974159.html","width":130,"caption":"","height":184});
															thumbnails[6615745] = clik.newPhoto({"id":6615745,"src":"MHP_Oct_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6615745.html","width":130,"caption":"","height":143});
															thumbnails[6503210] = clik.newPhoto({"id":6503210,"src":"judgment_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6503210.html","width":130,"caption":"<i>'I'm Too Judgemental'<\/i> Editorial illustration.","height":179});
															thumbnails[6974133] = clik.newPhoto({"id":6974133,"src":"spanish-paper-usage_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6974133.html","width":130,"caption":"","height":179});
															thumbnails[6648886] = clik.newPhoto({"id":6648886,"src":"MHPselection_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6648886.html","width":130,"caption":"Cover Illustrations for Mental Health Practice Magazine - 2008","height":111});
															thumbnails[6579111] = clik.newPhoto({"id":6579111,"src":"MHPcoverJuly_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6579111.html","width":130,"caption":"","height":184});
															thumbnails[6579147] = clik.newPhoto({"id":6579147,"src":"polarbear_thumb.jpg","galleries_id":356674,"server_id":5,"link":"photo_6579147.html","width":130,"caption":"","height":194});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[356673] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"publishing","link":"gallery_356673.html","maxRecords":0.0,"photoIDs":[7364988.0,6557718.0,6640514.0,6673718.0,6673723.0,6673752.0,6673755.0,6673801.0,6787667.0,6787671.0,6873637.0,7070852.0,7865210.0,9059692.0,9059693.0,9059694.0,8297093.0],"skipIndex":0,"section_code":"gallery","featured_images":"9059694,9059693,9059692,8297093,7865210,7364988,7070852,6873637,6787671,6787667","id":356673,"singleSection":false});				  						galleries[356674] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"editorial","link":"gallery_356674.html","maxRecords":0.0,"photoIDs":[6557709.0,6578904.0,6725045.0,7070879.0,7070884.0,7398483.0,7626779.0,7627537.0,7627538.0,8297102.0,6974060.0,6974159.0,6615745.0,6503210.0,6974133.0,6648886.0,6579111.0,6579147.0],"skipIndex":0,"section_code":"gallery","featured_images":"8297102,7627538,7627537,7626779,7398483,7070884,7070879,6974159,6974133,6974060","id":356674,"singleSection":false});				  						galleries[356684] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"advertising","link":"gallery_356684.html","maxRecords":0.0,"photoIDs":[6640516.0,6654542.0,6751751.0,6974197.0,7596790.0,7596795.0,9081172.0],"skipIndex":0,"section_code":"gallery","featured_images":"9081172,7596795,7596790,6974197,6751751,6654542,6640516","id":356684,"singleSection":false});				  						galleries[363779] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"greeting cards","link":"gallery_363779.html","maxRecords":0.0,"photoIDs":[6556489.0,6557638.0,6562606.0,6562646.0,6592570.0,6640527.0,6929413.0,6929445.0,6929895.0],"skipIndex":0,"section_code":"gallery","featured_images":"6929895,6929445,6929413,6640527,6592570,6562646,6562606,6557638,6556489","id":363779,"singleSection":false});				  						galleries[442040] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"SHOP","link":"gallery_442040.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":442040,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8307044';
imageSets[3] = '9081172,9059694,9059693,9059692,8320497,8307044,8297102,8297093,7884423,7865210,7822222,7627538,7627537,7626779,7596795,7596790,7398554,7398483,7364988,7070884,7070879,7070852,7035301,6974197,6974159,6974133,6974060,6935583,6929895,6929445,6929413,6873637,6787671,6787667,6773853,6751751,6725045,6692355,6673801,6673776,6673755,6673752,6673723,6673718,6654542,6648886,6640527,6640516,6640514,6615745';
imageSets[245923] = '8320497,7884423';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/besheerabbaro/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/besheerabbaro/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 = 'BESHEER ABBARO ILLUSTRATOR';
			    }
        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="BESHEERABBARO">';
			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;
	}
}

			

