window.thumbnails = new Object();
												thumbnails[6059631] = new thumbnail(6059631,'340386','','IMG_0038book1222_thumb.JPG',130, 87,15,'							photo_6059631.html');
												thumbnails[6059632] = new thumbnail(6059632,'340386','','IMG_0066book1222_thumb.JPG',130, 87,15,'							photo_6059632.html');
												thumbnails[6059679] = new thumbnail(6059679,'340386','','60000034_thumb.JPG',130, 87,15,'							photo_6059679.html');
												thumbnails[6059681] = new thumbnail(6059681,'340386','','60000043_thumb.JPG',130, 87,15,'							photo_6059681.html');
												thumbnails[6059682] = new thumbnail(6059682,'340386','','Copy_of_IMG_3795_thumb.JPG',130, 87,15,'							photo_6059682.html');
												thumbnails[6059691] = new thumbnail(6059691,'340386','','IMG_5378_thumb.JPG',130, 87,15,'							photo_6059691.html');
												thumbnails[6059692] = new thumbnail(6059692,'340386','','IMG_5437crop_thumb.JPG',130, 87,15,'							photo_6059692.html');
												thumbnails[6059693] = new thumbnail(6059693,'340386','','IMG_5474_thumb.JPG',130, 87,15,'							photo_6059693.html');
												thumbnails[6059694] = new thumbnail(6059694,'340386','','IMG_5613_thumb.JPG',130, 87,15,'							photo_6059694.html');
												thumbnails[6059695] = new thumbnail(6059695,'340386','','IMG_5904_thumb.JPG',130, 87,15,'							photo_6059695.html');
												thumbnails[6059696] = new thumbnail(6059696,'340386','','IMG_5937ok_thumb.JPG',130, 87,15,'							photo_6059696.html');
												thumbnails[6059697] = new thumbnail(6059697,'340386','','IMG_6055_thumb.JPG',130, 87,15,'							photo_6059697.html');
												thumbnails[6059699] = new thumbnail(6059699,'340386','','IMG_6079_thumb.JPG',130, 87,15,'							photo_6059699.html');
												thumbnails[6059701] = new thumbnail(6059701,'340386','','IMG_6854_thumb.JPG',130, 87,15,'							photo_6059701.html');
												thumbnails[6059702] = new thumbnail(6059702,'340386','','IMG_6909_thumb.JPG',130, 87,15,'							photo_6059702.html');
												thumbnails[6059703] = new thumbnail(6059703,'340386','','IMG_6925_thumb.JPG',130, 87,15,'							photo_6059703.html');
												thumbnails[6059704] = new thumbnail(6059704,'340386','','IMG_8194_thumb.JPG',130, 87,15,'							photo_6059704.html');
												thumbnails[6059705] = new thumbnail(6059705,'340386','','IMG_8274_thumb.JPG',130, 87,15,'							photo_6059705.html');
												thumbnails[6059706] = new thumbnail(6059706,'340386','','IMG_8510_thumb.JPG',130, 87,15,'							photo_6059706.html');
												thumbnails[6059708] = new thumbnail(6059708,'340386','','IMG_8804book1222_thumb.JPG',130, 87,15,'							photo_6059708.html');
												thumbnails[6059709] = new thumbnail(6059709,'340386','','IMG_8841_thumb.JPG',130, 87,15,'							photo_6059709.html');
												thumbnails[6059710] = new thumbnail(6059710,'340386','','IMG_9058_thumb.JPG',130, 87,15,'							photo_6059710.html');
												thumbnails[6059711] = new thumbnail(6059711,'340386','','IMG_9137_thumb.JPG',130, 87,15,'							photo_6059711.html');
												thumbnails[6059712] = new thumbnail(6059712,'340386','','IMG_9152_thumb.JPG',130, 87,15,'							photo_6059712.html');
												thumbnails[6059713] = new thumbnail(6059713,'340386','','IMG_9210book1222_thumb.JPG',130, 87,15,'							photo_6059713.html');
												thumbnails[6059714] = new thumbnail(6059714,'340386','','IMG_9382book1222_thumb.JPG',130, 87,15,'							photo_6059714.html');
												thumbnails[6059715] = new thumbnail(6059715,'340386','','IMG_9521_thumb.JPG',130, 87,15,'							photo_6059715.html');
												thumbnails[6059716] = new thumbnail(6059716,'340386','','IMG_9625_thumb.JPG',130, 87,15,'							photo_6059716.html');
												thumbnails[6059717] = new thumbnail(6059717,'340386','','IMG_9734_thumb.JPG',130, 87,15,'							photo_6059717.html');
												thumbnails[6059718] = new thumbnail(6059718,'340386','','IMG_9867_thumb.JPG',130, 87,15,'							photo_6059718.html');
												thumbnails[6059719] = new thumbnail(6059719,'340386','','IMG_9904_thumb.JPG',130, 87,15,'							photo_6059719.html');
												thumbnails[6059720] = new thumbnail(6059720,'340386','','IMG_9934_thumb.JPG',130, 87,15,'							photo_6059720.html');
												thumbnails[6059721] = new thumbnail(6059721,'340386','','IMG_9953_thumb.JPG',130, 87,15,'							photo_6059721.html');
												thumbnails[6059778] = new thumbnail(6059778,'340386','','007101_thumb.JPG',130, 87,15,'							photo_6059778.html');
												thumbnails[6059779] = new thumbnail(6059779,'340386','','007096_thumb.JPG',130, 87,15,'							photo_6059779.html');
												thumbnails[6059780] = new thumbnail(6059780,'340386','','007097_thumb.JPG',130, 87,15,'							photo_6059780.html');
												thumbnails[7170261] = new thumbnail(7170261,'340386','','IMG_1776crp_thumb.jpg',130, 87,15,'							photo_7170261.html');
												thumbnails[7170268] = new thumbnail(7170268,'340386','','IMG_0249bw4_thumb.jpg',130, 130,15,'							photo_7170268.html');
												thumbnails[6059749] = new thumbnail(6059749,'340397','','IMG_0794web1_thumb.JPG',130, 87,15,'							photo_6059749.html');
												thumbnails[6059750] = new thumbnail(6059750,'340397','','IMG_0718web1_thumb.JPG',130, 87,15,'							photo_6059750.html');
												thumbnails[6059752] = new thumbnail(6059752,'340397','','IMG_14981_thumb.JPG',130, 87,15,'							photo_6059752.html');
												thumbnails[6059753] = new thumbnail(6059753,'340397','','IMG_1586_thumb.JPG',130, 87,15,'							photo_6059753.html');
												thumbnails[6059754] = new thumbnail(6059754,'340397','','IMG_8533_thumb.JPG',130, 87,15,'							photo_6059754.html');
												thumbnails[6059755] = new thumbnail(6059755,'340397','','IMG_8645_thumb.JPG',130, 87,15,'							photo_6059755.html');
												thumbnails[6059756] = new thumbnail(6059756,'340397','','IMG_9277_thumb.JPG',130, 87,15,'							photo_6059756.html');
												thumbnails[6059757] = new thumbnail(6059757,'340397','','IMG_86471_thumb.JPG',130, 87,15,'							photo_6059757.html');
												thumbnails[6059758] = new thumbnail(6059758,'340397','','IMG_8415_thumb.JPG',130, 87,15,'							photo_6059758.html');
												thumbnails[6059759] = new thumbnail(6059759,'340397','','IMG_8097_thumb.JPG',130, 87,15,'							photo_6059759.html');
												thumbnails[6059760] = new thumbnail(6059760,'340397','','IMG_7992_thumb.JPG',130, 87,15,'							photo_6059760.html');
												thumbnails[6059761] = new thumbnail(6059761,'340397','','IMG_7821colour_thumb.JPG',130, 87,15,'							photo_6059761.html');
												thumbnails[6059763] = new thumbnail(6059763,'340397','','IMG_7766book1_thumb.JPG',130, 87,15,'							photo_6059763.html');
												thumbnails[6059764] = new thumbnail(6059764,'340397','','IMG_6612book1_thumb.JPG',130, 87,15,'							photo_6059764.html');
												thumbnails[6059765] = new thumbnail(6059765,'340397','','IMG_6563_thumb.JPG',130, 87,15,'							photo_6059765.html');
												thumbnails[6059766] = new thumbnail(6059766,'340397','','IMG_6354kor_thumb.JPG',130, 87,15,'							photo_6059766.html');
												thumbnails[6059767] = new thumbnail(6059767,'340397','','IMG_6019_thumb.JPG',130, 87,15,'							photo_6059767.html');
												thumbnails[6059768] = new thumbnail(6059768,'340397','','IMG_5689_thumb.JPG',130, 87,15,'							photo_6059768.html');
												thumbnails[6059769] = new thumbnail(6059769,'340397','','IMG_5577_thumb.JPG',130, 87,15,'							photo_6059769.html');
												thumbnails[6059770] = new thumbnail(6059770,'340397','','IMG_5489_thumb.JPG',130, 87,15,'							photo_6059770.html');
												thumbnails[6059771] = new thumbnail(6059771,'340397','','IMG_5469_thumb.JPG',130, 87,15,'							photo_6059771.html');
												thumbnails[6059773] = new thumbnail(6059773,'340397','','IMG_3615_thumb.JPG',130, 195,15,'							photo_6059773.html');
												thumbnails[6059775] = new thumbnail(6059775,'340397','','007095_thumb.JPG',130, 87,15,'							photo_6059775.html');
												thumbnails[6059777] = new thumbnail(6059777,'340397','','007100_thumb.JPG',130, 87,15,'							photo_6059777.html');
												thumbnails[6371181] = new thumbnail(6371181,'340397','','IMG_5603_thumb.JPG',130, 87,15,'							photo_6371181.html');
												thumbnails[6860654] = new thumbnail(6860654,'340397','','IMG_5658finish_thumb.JPG',130, 130,15,'							photo_6860654.html');
												thumbnails[6860656] = new thumbnail(6860656,'340397','','IMG_7612PRINT_thumb.JPG',130, 87,15,'							photo_6860656.html');
												thumbnails[6968212] = new thumbnail(6968212,'340397','','IMG_9562_thumb.JPG',130, 87,15,'							photo_6968212.html');
												thumbnails[6059791] = new thumbnail(6059791,'340400','','0070961_thumb.JPG',130, 87,15,'							photo_6059791.html');
												thumbnails[6059795] = new thumbnail(6059795,'340400','','007124_thumb.JPG',130, 87,15,'							photo_6059795.html');
												thumbnails[6059796] = new thumbnail(6059796,'340400','','0071001_thumb.JPG',130, 87,15,'							photo_6059796.html');
												thumbnails[6059797] = new thumbnail(6059797,'340400','','007102_thumb.JPG',130, 87,15,'							photo_6059797.html');
												thumbnails[6059798] = new thumbnail(6059798,'340400','','007099_thumb.JPG',130, 87,15,'							photo_6059798.html');
												thumbnails[6059800] = new thumbnail(6059800,'340400','','007103_thumb.JPG',130, 87,15,'							photo_6059800.html');
												thumbnails[6059802] = new thumbnail(6059802,'340400','','007108_thumb.JPG',130, 87,15,'							photo_6059802.html');
												thumbnails[6059806] = new thumbnail(6059806,'340400','','0070981_thumb.JPG',130, 87,15,'							photo_6059806.html');
												thumbnails[6059808] = new thumbnail(6059808,'340400','','007109_thumb.JPG',130, 87,15,'							photo_6059808.html');
												thumbnails[6059811] = new thumbnail(6059811,'340400','','007110_thumb.JPG',130, 87,15,'							photo_6059811.html');
												thumbnails[6059814] = new thumbnail(6059814,'340400','','IMG_62511_thumb.JPG',130, 87,15,'							photo_6059814.html');
												thumbnails[6059816] = new thumbnail(6059816,'340400','','0070982_thumb.JPG',130, 87,15,'							photo_6059816.html');
												thumbnails[6059824] = new thumbnail(6059824,'340400','','IMG_78131_thumb.JPG',130, 87,15,'							photo_6059824.html');
												thumbnails[6078693] = new thumbnail(6078693,'340400','','IMG_20591_thumb.JPG',130, 87,15,'							photo_6078693.html');
												thumbnails[6968219] = new thumbnail(6968219,'340400','','IMG_9256_thumb.JPG',130, 195,15,'							photo_6968219.html');
												thumbnails[1701544] = new thumbnail(1701544,'114417','Talisman Sabre 2007 Protest','Byfield_22nd_July_2007_thumb.jpg',130, 85,15,'							photo_1701544.html');
												thumbnails[1701557] = new thumbnail(1701557,'114417','Stop Cheney Sydney Feb 2007','cheneyfriday_thumb.jpg',130, 87,15,'							photo_1701557.html');
												thumbnails[1827948] = new thumbnail(1827948,'114417','Cheney visit to Sydney','007cheney_thumb.jpg',130, 86,15,'							photo_1827948.html');
												thumbnails[1827951] = new thumbnail(1827951,'114417','National Day of Action For Aboriginal Justice. Brisbane','DPP_083_thumb.jpg',130, 87,15,'							photo_1827951.html');
												thumbnails[1827953] = new thumbnail(1827953,'114417','Police Conga Line APEC 2007 Sydney','DPP_0165_thumb.jpg',130, 87,15,'							photo_1827953.html');
												thumbnails[1827966] = new thumbnail(1827966,'114417','APEC 2007. Sydney','DPP_180_thumb.jpg',130, 87,15,'							photo_1827966.html');
												thumbnails[2536939] = new thumbnail(2536939,'114417','The Western Shogdun Society','ready03_thumb.jpg',130, 87,15,'							photo_2536939.html');
												thumbnails[2536942] = new thumbnail(2536942,'114417','Tibetan Ptotesters, Olympic Torch Relay. Canberra','ready05_thumb.jpg',130, 93,15,'							photo_2536942.html');
												thumbnails[2536945] = new thumbnail(2536945,'114417','Bums not Bombs Protest. APEC Sydney','DPP_131web_thumb.JPG',130, 87,15,'							photo_2536945.html');
												thumbnails[2536948] = new thumbnail(2536948,'114417','ClimateCamp Australia 08','ready04_thumb.jpg',130, 87,15,'							photo_2536948.html');
												thumbnails[2536961] = new thumbnail(2536961,'114417',' Free Tibet.Tibetan Protester. Canberra','ready02_thumb.jpg',130, 130,15,'							photo_2536961.html');
												thumbnails[751980] = new thumbnail(751980,'58020','','IMG_0018_thumb.jpg',130, 87,15,'							photo_751980.html');
												thumbnails[751983] = new thumbnail(751983,'58020','','IMG_0105_thumb.jpg',130, 195,15,'							photo_751983.html');
												thumbnails[751984] = new thumbnail(751984,'58020','','IMG_0121_thumb.jpg',130, 87,15,'							photo_751984.html');
												thumbnails[751986] = new thumbnail(751986,'58020','','IMG_0134_thumb.jpg',130, 195,15,'							photo_751986.html');
												thumbnails[751988] = new thumbnail(751988,'58020','','IMG_0275_thumb.jpg',130, 87,15,'							photo_751988.html');
												thumbnails[751990] = new thumbnail(751990,'58020','','IMG_0280_thumb.jpg',130, 87,15,'							photo_751990.html');
												thumbnails[751991] = new thumbnail(751991,'58020','','IMG_0656_thumb.jpg',130, 195,15,'							photo_751991.html');
												thumbnails[751993] = new thumbnail(751993,'58020','','RA03_thumb.002.jpg',130, 87,15,'							photo_751993.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[114417] = new gallery(114417,'2536961,2536948,2536945,2536942,2536939,1827966,1827953,1827951,1827948,1701557','Aust Protest','section149889',[1701544,1701557,1827948,1827951,1827953,1827966,2536939,2536942,2536945,2536948,2536961],0, 0, '', '																																																																																																																																	section149889.html',0,1);
				  					galleries[340386] = new gallery(340386,'7170268,7170261,6059780,6059779,6059778,6059721,6059720,6059719,6059718,6059717','Street Photos -  B/W','section407216',[6059631,6059632,6059679,6059681,6059682,6059691,6059692,6059693,6059694,6059695,6059696,6059697,6059699,6059701,6059702,6059703,6059704,6059705,6059706,6059708,6059709,6059710,6059711,6059712,6059713,6059714,6059715,6059716,6059717,6059718,6059719,6059720,6059721,6059778,6059779,6059780,7170261,7170268],0, 0, '', '																																																																																																																																	section407216.html',0,1);
				  					galleries[340397] = new gallery(340397,'6968212,6860656,6860654,6371181,6059777,6059775,6059773,6059771,6059770,6059769','Street Photos - Colour','section407218',[6059749,6059750,6059752,6059753,6059754,6059755,6059756,6059757,6059758,6059759,6059760,6059761,6059763,6059764,6059765,6059766,6059767,6059768,6059769,6059770,6059771,6059773,6059775,6059777,6371181,6860654,6860656,6968212],0, 0, '', '																																																																																																																																	section407218.html',0,1);
				  					galleries[340400] = new gallery(340400,'6968219,6078693,6059824,6059816,6059814,6059811,6059808,6059806,6059802,6059800','Street Photos - Portraits','section407219',[6059791,6059795,6059796,6059797,6059798,6059800,6059802,6059806,6059808,6059811,6059814,6059816,6059824,6078693,6968219],0, 0, '', '																																																																																																																																	section407219.html',0,1);
				  					galleries[58020] = new gallery(58020,'751993,751991,751990,751988,751986,751984,751983,751980','Weddings','gallery',[751980,751983,751984,751986,751988,751990,751991,751993],0, 0, '', '																																																																																																																																	gallery.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7170268,7170261,6968219,6968212,6860656,6860654,6371181,6078693,6059824,6059816,6059814,6059811,6059808,6059806,6059802,6059800,6059798,6059797,6059796,6059795,6059791,6059780,6059779,6059778,6059777,6059775,6059773,6059771,6059770,6059769,6059768,6059767,6059766,6059765,6059764,6059763,6059761,6059760,6059759,6059758,6059757,6059756,6059755,6059754,6059753,6059752,6059750,6059749,6059721,6059720';
imageSets[3] = '7170268,7170261,6968219,6968212,6860656,6860654,6371181,6078693,6059824,6059816,6059814,6059811,6059808,6059806,6059802,6059800,6059798,6059797,6059796,6059795,6059791,6059780,6059779,6059778,6059777,6059775,6059773,6059771,6059770,6059769,6059768,6059767,6059766,6059765,6059764,6059763,6059761,6059760,6059759,6059758,6059757,6059756,6059755,6059754,6059753,6059752,6059750,6059749,6059721,6059720';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/allanmilnes/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/allanmilnes/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 += 'section407216.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 && 'section407216' != '') {
					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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Allan Milnes Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 				AU$' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="vjphoto@westnet.com.au">';
	temp = temp + '<input type="hidden" name="currency_code" value="AUD">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="vjphoto@westnet.com.au">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							temp = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

