window.thumbnails = new Object();
												thumbnails[815970] = new thumbnail(815970,'','','eu_thumb.jpg',130, 194,18,'#');
												thumbnails[1730681] = new thumbnail(1730681,'','','wppi_logo2_thumb.jpg',130, 78,18,'#');
												thumbnails[1735678] = new thumbnail(1735678,'','','napplogo3_thumb.png',130, 111,18,'#');
												thumbnails[1737801] = new thumbnail(1737801,'','','qualified_thumb.gif',130, 54,18,'#');
												thumbnails[6837803] = new thumbnail(6837803,'','','003_6E0C6F61-1D09-001F-99113FF663764C58_thumb.jpg',130, 194,18,'#');
												thumbnails[6837804] = new thumbnail(6837804,'','','008_thumb.jpg',130, 174,18,'#');
												thumbnails[6837805] = new thumbnail(6837805,'','','013_x3_thumb.jpg',130, 174,18,'#');
												thumbnails[6837806] = new thumbnail(6837806,'','','014_thumb.jpg',130, 97,18,'#');
												thumbnails[6837807] = new thumbnail(6837807,'','','016_thumb.jpg',130, 174,18,'#');
												thumbnails[6837809] = new thumbnail(6837809,'','','019_thumb.jpg',130, 174,18,'#');
												thumbnails[1279068] = new thumbnail(1279068,'61943','','Pan006_thumb.jpg',130, 52,18,'photo_1279068.html');
												thumbnails[1312258] = new thumbnail(1312258,'61943','','003_thumb.jpg',130, 174,18,'photo_1312258.html');
												thumbnails[1672631] = new thumbnail(1672631,'61943','','005B_thumb.jpg',130, 97,18,'photo_1672631.html');
												thumbnails[1855669] = new thumbnail(1855669,'61943','','IMG_6037_thumb.jpg',130, 97,18,'photo_1855669.html');
												thumbnails[2155144] = new thumbnail(2155144,'61943','','107_thumb.jpg',130, 87,18,'photo_2155144.html');
												thumbnails[2155166] = new thumbnail(2155166,'61943','','130_thumb.jpg',130, 174,18,'photo_2155166.html');
												thumbnails[2178285] = new thumbnail(2178285,'54258','','1179_thumb.jpg',130, 97,18,'photo_2178285.html');
												thumbnails[2869888] = new thumbnail(2869888,'61943','','52-copy_thumb.jpg',130, 173,18,'photo_2869888.html');
												thumbnails[2869889] = new thumbnail(2869889,'61943','','0211_thumb.jpg',130, 97,18,'photo_2869889.html');
												thumbnails[2869890] = new thumbnail(2869890,'54258','','014-copy_thumb.jpg',130, 97,18,'photo_2869890.html');
												thumbnails[2869891] = new thumbnail(2869891,'61943','','034B_thumb.jpg',130, 173,18,'photo_2869891.html');
												thumbnails[2869892] = new thumbnail(2869892,'61943','','054Sepia_thumb.jpg',130, 97,18,'photo_2869892.html');
												thumbnails[2869893] = new thumbnail(2869893,'61943','','083-copy_thumb.jpg',130, 97,18,'photo_2869893.html');
												thumbnails[2869894] = new thumbnail(2869894,'61943','','192_thumb.jpg',130, 173,18,'photo_2869894.html');
												thumbnails[2869897] = new thumbnail(2869897,'54258','','229_thumb.jpg',130, 173,18,'photo_2869897.html');
												thumbnails[2869901] = new thumbnail(2869901,'54258','','825_thumb.jpg',130, 173,18,'photo_2869901.html');
												thumbnails[2869903] = new thumbnail(2869903,'54258','','0837_thumb.jpg',130, 97,18,'photo_2869903.html');
												thumbnails[2869905] = new thumbnail(2869905,'54258','','0939_thumb.jpg',130, 173,18,'photo_2869905.html');
												thumbnails[2869906] = new thumbnail(2869906,'54258','','970PB_thumb.jpg',130, 173,18,'photo_2869906.html');
												thumbnails[2869907] = new thumbnail(2869907,'54258','','1057_thumb.jpg',130, 173,18,'photo_2869907.html');
												thumbnails[2869908] = new thumbnail(2869908,'61943','','6746_thumb.jpg',130, 97,18,'photo_2869908.html');
												thumbnails[2869909] = new thumbnail(2869909,'61943','','IMG_3673_thumb.jpg',130, 173,18,'photo_2869909.html');
												thumbnails[2869912] = new thumbnail(2869912,'61943','','Untitled-1_thumb.jpg',130, 173,18,'photo_2869912.html');
												thumbnails[2869913] = new thumbnail(2869913,'61943','','127_thumb.jpg',130, 97,18,'photo_2869913.html');
												thumbnails[2869915] = new thumbnail(2869915,'61943','','IMG_9733_thumb.jpg',130, 97,18,'photo_2869915.html');
												thumbnails[2869916] = new thumbnail(2869916,'61943','','IMG_9744_thumb.jpg',129, 194,18,'photo_2869916.html');
												thumbnails[5798219] = new thumbnail(5798219,'61943','','121_thumb.jpg',130, 174,18,'photo_5798219.html');
												thumbnails[6837539] = new thumbnail(6837539,'54258','','1241_thumb.jpg',130, 97,18,'photo_6837539.html');
												thumbnails[6837561] = new thumbnail(6837561,'54258','','318_thumb.jpg',130, 97,18,'photo_6837561.html');
												thumbnails[6837581] = new thumbnail(6837581,'54258','','0715_thumb.jpg',130, 97,18,'photo_6837581.html');
												thumbnails[6837584] = new thumbnail(6837584,'54258','','0813_thumb.jpg',130, 97,18,'photo_6837584.html');
												thumbnails[6837586] = new thumbnail(6837586,'54258','','192_6DC63E33-1D09-001F-994B1EAA579C192F_thumb.jpg',130, 174,18,'photo_6837586.html');
												thumbnails[6837588] = new thumbnail(6837588,'54258','','3171_thumb.jpg',130, 174,18,'photo_6837588.html');
												thumbnails[6837591] = new thumbnail(6837591,'54258','','1087_thumb.jpg',130, 97,18,'photo_6837591.html');
												thumbnails[6837595] = new thumbnail(6837595,'54258','','1096_thumb.jpg',130, 174,18,'photo_6837595.html');
												thumbnails[6837598] = new thumbnail(6837598,'54258','','1101_thumb.jpg',130, 97,18,'photo_6837598.html');
												thumbnails[6837608] = new thumbnail(6837608,'54258','','1265_thumb.jpg',130, 174,18,'photo_6837608.html');
												thumbnails[6837622] = new thumbnail(6837622,'61939','','IMG_0149_thumb.jpg',130, 97,18,'photo_6837622.html');
												thumbnails[6837624] = new thumbnail(6837624,'61939','','IMG_0165_thumb.jpg',130, 174,18,'photo_6837624.html');
												thumbnails[6837625] = new thumbnail(6837625,'61939','','IMG_0177_thumb.jpg',130, 97,18,'photo_6837625.html');
												thumbnails[6837628] = new thumbnail(6837628,'61939','','IMG_0213_thumb.jpg',130, 97,18,'photo_6837628.html');
												thumbnails[6837629] = new thumbnail(6837629,'61939','','IMG_0218_thumb.jpg',130, 97,18,'photo_6837629.html');
												thumbnails[6837632] = new thumbnail(6837632,'61939','','IMG_0257_thumb.jpg',130, 97,18,'photo_6837632.html');
												thumbnails[6837633] = new thumbnail(6837633,'61939','','IMG_0382_thumb.jpg',130, 97,18,'photo_6837633.html');
												thumbnails[6837664] = new thumbnail(6837664,'61939','','IMG_0456_thumb.jpg',130, 174,18,'photo_6837664.html');
												thumbnails[6837665] = new thumbnail(6837665,'61939','','IMG_0470_thumb.jpg',130, 174,18,'photo_6837665.html');
												thumbnails[6837667] = new thumbnail(6837667,'61939','','IMG_0475_thumb.jpg',130, 97,18,'photo_6837667.html');
												thumbnails[6837707] = new thumbnail(6837707,'61939','','IMG_1975_thumb.jpg',130, 174,18,'photo_6837707.html');
												thumbnails[6837710] = new thumbnail(6837710,'61939','','IMG_2025_thumb.jpg',130, 97,18,'photo_6837710.html');
												thumbnails[6837711] = new thumbnail(6837711,'61939','','IMG_2054_thumb.jpg',130, 97,18,'photo_6837711.html');
												thumbnails[6837712] = new thumbnail(6837712,'61939','','IMG_2065_thumb.jpg',130, 97,18,'photo_6837712.html');
												thumbnails[6837713] = new thumbnail(6837713,'61939','','IMG_2094_thumb.jpg',130, 174,18,'photo_6837713.html');
												thumbnails[6837714] = new thumbnail(6837714,'61939','','IMG_2141_thumb.jpg',130, 97,18,'photo_6837714.html');
												thumbnails[6837716] = new thumbnail(6837716,'61939','','IMG_2209_thumb.jpg',130, 97,18,'photo_6837716.html');
												thumbnails[6837717] = new thumbnail(6837717,'61939','','IMG_2263_thumb.jpg',130, 97,18,'photo_6837717.html');
												thumbnails[6837718] = new thumbnail(6837718,'61939','','IMG_2349_thumb.jpg',130, 97,18,'photo_6837718.html');
												thumbnails[6837720] = new thumbnail(6837720,'61939','','IMG_2354_thumb.jpg',130, 174,18,'photo_6837720.html');
												thumbnails[6837725] = new thumbnail(6837725,'61939','','IMG_6654_thumb.jpg',130, 97,18,'photo_6837725.html');
												thumbnails[6837726] = new thumbnail(6837726,'61939','','IMG_6667_thumb.jpg',130, 97,18,'photo_6837726.html');
												thumbnails[6837727] = new thumbnail(6837727,'61939','','IMG_6670_thumb.jpg',130, 97,18,'photo_6837727.html');
												thumbnails[6837728] = new thumbnail(6837728,'61939','','IMG_6687_thumb.jpg',130, 97,18,'photo_6837728.html');
												thumbnails[6837731] = new thumbnail(6837731,'61939','','IMG_6720_thumb.jpg',130, 174,18,'photo_6837731.html');
												thumbnails[6837733] = new thumbnail(6837733,'61939','','IMG_6771_thumb.jpg',130, 174,18,'photo_6837733.html');
												thumbnails[6837736] = new thumbnail(6837736,'61939','','IMG_6808_thumb.jpg',130, 174,18,'photo_6837736.html');
												thumbnails[6837739] = new thumbnail(6837739,'61939','','IMG_6827_thumb.jpg',130, 97,18,'photo_6837739.html');
												thumbnails[6837749] = new thumbnail(6837749,'61939','','177_thumb.jpg',130, 97,18,'photo_6837749.html');
												thumbnails[6837750] = new thumbnail(6837750,'61939','','293_thumb.jpg',130, 97,18,'photo_6837750.html');
												thumbnails[6837751] = new thumbnail(6837751,'61939','','341_thumb.jpg',130, 174,18,'photo_6837751.html');
												thumbnails[6837752] = new thumbnail(6837752,'61939','','471_thumb.jpg',130, 97,18,'photo_6837752.html');
												thumbnails[6837754] = new thumbnail(6837754,'61939','','501_thumb.jpg',130, 97,18,'photo_6837754.html');
												thumbnails[6837755] = new thumbnail(6837755,'61939','','558_thumb.jpg',130, 174,18,'photo_6837755.html');
												thumbnails[6837759] = new thumbnail(6837759,'61939','','569_thumb.jpg',130, 97,18,'photo_6837759.html');
												thumbnails[6837761] = new thumbnail(6837761,'61939','','583_thumb.jpg',130, 97,18,'photo_6837761.html');
												thumbnails[6837764] = new thumbnail(6837764,'61939','','600_thumb.jpg',130, 97,18,'photo_6837764.html');
												thumbnails[6837765] = new thumbnail(6837765,'61939','','634_thumb.jpg',130, 97,18,'photo_6837765.html');
												thumbnails[6837778] = new thumbnail(6837778,'61943','','026_thumb.jpg',130, 174,18,'photo_6837778.html');
												thumbnails[6837780] = new thumbnail(6837780,'61943','','026B_thumb.jpg',130, 174,18,'photo_6837780.html');
												thumbnails[6837781] = new thumbnail(6837781,'61943','','087_thumb.jpg',130, 97,18,'photo_6837781.html');
												thumbnails[6837782] = new thumbnail(6837782,'61943','','099_thumb.jpg',130, 174,18,'photo_6837782.html');
												thumbnails[6837811] = new thumbnail(6837811,'61943','','019B_thumb.jpg',130, 98,18,'photo_6837811.html');
												thumbnails[6837812] = new thumbnail(6837812,'61943','','022_thumb.jpg',130, 97,18,'photo_6837812.html');
												thumbnails[6837813] = new thumbnail(6837813,'61943','','034_thumb.jpg',130, 174,18,'photo_6837813.html');
												thumbnails[6837815] = new thumbnail(6837815,'61943','','029_PB_thumb.jpg',130, 174,18,'photo_6837815.html');
												thumbnails[6837816] = new thumbnail(6837816,'61943','','036_thumb.jpg',130, 174,18,'photo_6837816.html');
												thumbnails[6837817] = new thumbnail(6837817,'61943','','044_thumb.jpg',130, 174,18,'photo_6837817.html');
												thumbnails[6837818] = new thumbnail(6837818,'61943','','053_thumb.jpg',130, 97,18,'photo_6837818.html');
												thumbnails[6837819] = new thumbnail(6837819,'61943','','081_thumb.jpg',130, 174,18,'photo_6837819.html');
												thumbnails[6837821] = new thumbnail(6837821,'61943','','090B_thumb.jpg',130, 97,18,'photo_6837821.html');
												thumbnails[6837822] = new thumbnail(6837822,'61943','','055_thumb.jpg',130, 97,18,'photo_6837822.html');
												thumbnails[6837824] = new thumbnail(6837824,'61943','','096_thumb.jpg',130, 174,18,'photo_6837824.html');
												thumbnails[6837825] = new thumbnail(6837825,'61943','','172_thumb.jpg',130, 97,18,'photo_6837825.html');
												thumbnails[6837826] = new thumbnail(6837826,'61943','','136_thumb.jpg',130, 173,18,'photo_6837826.html');
												thumbnails[6837827] = new thumbnail(6837827,'61943','','149_thumb.jpg',130, 174,18,'photo_6837827.html');
												thumbnails[6837828] = new thumbnail(6837828,'61943','','204_thumb.jpg',130, 97,18,'photo_6837828.html');
												thumbnails[6837830] = new thumbnail(6837830,'61943','','IMG_9049_thumb.jpg',130, 174,18,'photo_6837830.html');
												thumbnails[6837831] = new thumbnail(6837831,'61943','','IMG_9143_thumb.jpg',130, 97,18,'photo_6837831.html');
												thumbnails[6837832] = new thumbnail(6837832,'61943','','IMG_9160_thumb.jpg',130, 174,18,'photo_6837832.html');
												thumbnails[6837833] = new thumbnail(6837833,'61943','','IMG_9197_thumb.jpg',130, 97,18,'photo_6837833.html');
												thumbnails[6837863] = new thumbnail(6837863,'61943','','10_thumb.jpg',130, 174,18,'photo_6837863.html');
												thumbnails[6837865] = new thumbnail(6837865,'61943','','36_thumb.jpg',130, 97,18,'photo_6837865.html');
												thumbnails[6837866] = new thumbnail(6837866,'61943','','56_thumb.jpg',130, 97,18,'photo_6837866.html');
												thumbnails[6837868] = new thumbnail(6837868,'61943','','062_thumb.jpg',130, 97,18,'photo_6837868.html');
												thumbnails[7506668] = new thumbnail(7506668,'54258','','137_thumb.jpg',130, 174,18,'photo_7506668.html');
												thumbnails[7506669] = new thumbnail(7506669,'54258','','1146_thumb.jpg',130, 97,18,'photo_7506669.html');
												thumbnails[7506671] = new thumbnail(7506671,'54258','','1320_thumb.jpg',130, 97,18,'photo_7506671.html');
												thumbnails[7506673] = new thumbnail(7506673,'54258','','1669_thumb.jpg',130, 97,18,'photo_7506673.html');
												thumbnails[7506674] = new thumbnail(7506674,'54258','','IMG_5793_thumb.jpg',130, 97,18,'photo_7506674.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[54258] = new gallery(54258,'7506674,7506673,7506671,7506669,7506668,6837608,6837598,6837595,6837591,6837588','<big><strong>Casamentos</strong></big>','gallery',[2178285,2869890,2869897,2869901,2869903,2869905,2869906,2869907,6837539,6837561,6837581,6837584,6837586,6837588,6837591,6837595,6837598,6837608,7506668,7506669,7506671,7506673,7506674],0, 0, '', 'gallery_54258.html',0,0);
				  					galleries[61939] = new gallery(61939,'6837765,6837764,6837761,6837759,6837755,6837754,6837752,6837751,6837750,6837749','<big><strong>Namoro</strong></big>','gallery',[6837622,6837624,6837625,6837628,6837629,6837632,6837633,6837664,6837665,6837667,6837707,6837710,6837711,6837712,6837713,6837714,6837716,6837717,6837718,6837720,6837725,6837726,6837727,6837728,6837731,6837733,6837736,6837739,6837749,6837750,6837751,6837752,6837754,6837755,6837759,6837761,6837764,6837765],0, 0, '', 'gallery_61939.html',0,0);
				  					galleries[61943] = new gallery(61943,'6837868,6837866,6837865,6837863,6837833,6837832,6837831,6837830,6837828,6837827','<big><strong>Estudio</strong></big>','gallery',[1279068,1312258,1672631,1855669,2155144,2155166,2869888,2869889,2869891,2869892,2869893,2869894,2869908,2869909,2869912,2869913,2869915,2869916,5798219,6837778,6837780,6837781,6837782,6837811,6837812,6837813,6837815,6837816,6837817,6837818,6837819,6837821,6837822,6837824,6837825,6837826,6837827,6837828,6837830,6837831,6837832,6837833,6837863,6837865,6837866,6837868],0, 0, '', 'gallery_61943.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6837868,6837866,6837865,6837863,6837833,6837832,6837831,6837830,6837828,6837827,6837826,6837825,6837824,6837822,6837821,6837819,6837818,6837817,6837816,6837815,6837813,6837812,6837811,6837809,6837807,6837806,6837805,6837804,6837803,6837782,6837781,6837780,6837778,6837765,6837764,6837761,6837759,6837755,6837754,6837752,6837751,6837750,6837749,6837739,6837736,6837733,6837731,6837728,6837727,6837726';
imageSets[3] = '6837868,6837866,6837865,6837863,6837833,6837832,6837831,6837830,6837828,6837827,6837826,6837825,6837824,6837822,6837821,6837819,6837818,6837817,6837816,6837815,6837813,6837812,6837811,6837809,6837807,6837806,6837805,6837804,6837803,6837782,6837781,6837780,6837778,6837765,6837764,6837761,6837759,6837755,6837754,6837752,6837751,6837750,6837749,6837739,6837736,6837733,6837731,6837728,6837727,6837726';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/velfoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/velfoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/velfoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/velfoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/velfoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/velfoto/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:'',
                    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));		  $('body').trigger('clikUpdate');		}, 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 = 'Jorge Velez - Fotógrafo: ' + 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));      $('body').trigger('clikUpdate');    }        
    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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &euro;' + (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="velfoto@gmail.com">';
	temp = temp + '<input type="hidden" name="currency_code" value="EUR">';
	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="velfoto@gmail.com">';
	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;
	}
}

			

