window.thumbnails = new Object();
												thumbnails[2330935] = new thumbnail(2330935,'','A and K Weddings','BGLogoAK2_thumb.jpg',130, 130,1,'							photo_2330935.html');
												thumbnails[2331301] = new thumbnail(2331301,'','','BGLogoAKWeddings_thumb.jpg',130, 37,1,'							photo_2331301.html');
												thumbnails[1853208] = new thumbnail(1853208,'151951','','Portfolio-4_thumb.jpg',130, 87,1,'							photo_1853208.html');
												thumbnails[1875211] = new thumbnail(1875211,'151951','','DSC_15122_thumb.jpg',130, 130,1,'							photo_1875211.html');
												thumbnails[1875216] = new thumbnail(1875216,'151951','','DSC_1528_thumb.jpg',130, 130,1,'							photo_1875216.html');
												thumbnails[1875230] = new thumbnail(1875230,'151951','','DSC_1596_thumb.jpg',130, 87,1,'							photo_1875230.html');
												thumbnails[3664063] = new thumbnail(3664063,'151951','','AK-2-2_thumb.jpg',130, 194,1,'							photo_3664063.html');
												thumbnails[3664069] = new thumbnail(3664069,'151951','','AK-2-3_thumb.jpg',130, 86,1,'							photo_3664069.html');
												thumbnails[3664070] = new thumbnail(3664070,'151951','','AK-2-4_thumb.jpg',130, 98,1,'							photo_3664070.html');
												thumbnails[3664072] = new thumbnail(3664072,'151951','','AK-2_thumb.jpg',130, 87,1,'							photo_3664072.html');
												thumbnails[3664073] = new thumbnail(3664073,'151951','','AK-3-2_thumb.jpg',130, 196,1,'							photo_3664073.html');
												thumbnails[3664074] = new thumbnail(3664074,'151951','','AK-3-3_thumb.jpg',130, 87,1,'							photo_3664074.html');
												thumbnails[3664075] = new thumbnail(3664075,'151951','','AK-3-4_thumb.jpg',130, 194,1,'							photo_3664075.html');
												thumbnails[3664077] = new thumbnail(3664077,'151951','','AK-3_thumb.jpg',130, 87,1,'							photo_3664077.html');
												thumbnails[3664078] = new thumbnail(3664078,'151951','','AK-4-2_thumb.jpg',130, 98,1,'							photo_3664078.html');
												thumbnails[3664079] = new thumbnail(3664079,'151951','','AK-4-3_thumb.jpg',130, 86,1,'							photo_3664079.html');
												thumbnails[3664080] = new thumbnail(3664080,'151951','','AK-4_thumb.jpg',130, 194,1,'							photo_3664080.html');
												thumbnails[3664082] = new thumbnail(3664082,'151951','','AK-5-2_thumb.jpg',130, 87,1,'							photo_3664082.html');
												thumbnails[3664083] = new thumbnail(3664083,'151951','','AK-5-3_thumb.jpg',130, 87,1,'							photo_3664083.html');
												thumbnails[3664084] = new thumbnail(3664084,'151951','','AK-5-4_thumb.jpg',130, 87,1,'							photo_3664084.html');
												thumbnails[3664085] = new thumbnail(3664085,'151951','','AK-6-2_thumb.jpg',130, 194,1,'							photo_3664085.html');
												thumbnails[3664086] = new thumbnail(3664086,'151951','','AK-6-3_thumb.jpg',130, 196,1,'							photo_3664086.html');
												thumbnails[3664089] = new thumbnail(3664089,'151951','','AK-6-4_thumb.jpg',130, 87,1,'							photo_3664089.html');
												thumbnails[3664090] = new thumbnail(3664090,'151951','','AK-6_thumb.jpg',130, 87,1,'							photo_3664090.html');
												thumbnails[3664091] = new thumbnail(3664091,'151951','','AK-7-2_thumb.jpg',130, 196,1,'							photo_3664091.html');
												thumbnails[3664092] = new thumbnail(3664092,'151951','','AK-7-3_thumb.jpg',130, 196,1,'							photo_3664092.html');
												thumbnails[3664094] = new thumbnail(3664094,'151951','','AK-7-4_thumb.jpg',130, 87,1,'							photo_3664094.html');
												thumbnails[3664095] = new thumbnail(3664095,'151951','','AK-7_thumb.jpg',130, 87,1,'							photo_3664095.html');
												thumbnails[3664096] = new thumbnail(3664096,'151951','','AK-8-2_thumb.jpg',130, 87,1,'							photo_3664096.html');
												thumbnails[3664097] = new thumbnail(3664097,'151951','','AK-8-3_thumb.jpg',130, 86,1,'							photo_3664097.html');
												thumbnails[3664098] = new thumbnail(3664098,'151951','','AK-8-4_thumb.jpg',130, 81,1,'							photo_3664098.html');
												thumbnails[3664099] = new thumbnail(3664099,'151951','','AK-8_thumb.jpg',130, 87,1,'							photo_3664099.html');
												thumbnails[3664100] = new thumbnail(3664100,'151951','','AK-9-2_thumb.jpg',130, 87,1,'							photo_3664100.html');
												thumbnails[3664101] = new thumbnail(3664101,'151951','','AK-9-3_thumb.jpg',130, 194,1,'							photo_3664101.html');
												thumbnails[3664102] = new thumbnail(3664102,'151951','','AK-9-31_thumb.jpg',130, 194,1,'							photo_3664102.html');
												thumbnails[3664103] = new thumbnail(3664103,'151951','','AK-9-4_thumb.jpg',130, 163,1,'							photo_3664103.html');
												thumbnails[3664105] = new thumbnail(3664105,'151951','','AK-9_thumb.jpg',130, 194,1,'							photo_3664105.html');
												thumbnails[3664106] = new thumbnail(3664106,'151951','','AK-10-2_thumb.jpg',130, 194,1,'							photo_3664106.html');
												thumbnails[3664107] = new thumbnail(3664107,'151951','','AK-10-3_thumb.jpg',130, 87,1,'							photo_3664107.html');
												thumbnails[3664109] = new thumbnail(3664109,'151951','','AK-10-4_thumb.jpg',130, 87,1,'							photo_3664109.html');
												thumbnails[3664110] = new thumbnail(3664110,'151951','','AK_thumb.jpg',130, 194,1,'							photo_3664110.html');
												thumbnails[3664112] = new thumbnail(3664112,'151951','','AK-46_thumb.jpg',130, 87,1,'							photo_3664112.html');
												thumbnails[3664113] = new thumbnail(3664113,'151951','','AK-42_thumb.jpg',130, 163,1,'							photo_3664113.html');
												thumbnails[3664114] = new thumbnail(3664114,'151951','','AK-41_thumb.jpg',130, 65,1,'							photo_3664114.html');
												thumbnails[3664115] = new thumbnail(3664115,'151951','','AK-38_thumb.jpg',130, 87,1,'							photo_3664115.html');
												thumbnails[3664116] = new thumbnail(3664116,'151951','','AK-34_thumb.jpg',130, 87,1,'							photo_3664116.html');
												thumbnails[3664117] = new thumbnail(3664117,'151951','','AK-17_thumb.jpg',130, 195,1,'							photo_3664117.html');
												thumbnails[3664118] = new thumbnail(3664118,'151951','','AK-13-2_thumb.jpg',130, 194,1,'							photo_3664118.html');
												thumbnails[3664119] = new thumbnail(3664119,'151951','','AK-12-3_thumb.jpg',130, 194,1,'							photo_3664119.html');
												thumbnails[3664120] = new thumbnail(3664120,'151951','','AK-12-2_thumb.jpg',130, 86,1,'							photo_3664120.html');
												thumbnails[3664121] = new thumbnail(3664121,'151951','','AK-21_thumb.jpg',130, 87,1,'							photo_3664121.html');
												thumbnails[3664122] = new thumbnail(3664122,'151951','','AK-12_thumb.jpg',130, 194,1,'							photo_3664122.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[151951] = new gallery(151951,'3664122,3664121,3664120,3664119,3664118,3664117,3664116,3664115,3664114,3664113','Wedding Gallery','gallery',[1853208,1875211,1875216,1875230,3664063,3664069,3664070,3664072,3664073,3664074,3664075,3664077,3664078,3664079,3664080,3664082,3664083,3664084,3664085,3664086,3664089,3664090,3664091,3664092,3664094,3664095,3664096,3664097,3664098,3664099,3664100,3664101,3664102,3664103,3664105,3664106,3664107,3664109,3664110,3664112,3664113,3664114,3664115,3664116,3664117,3664118,3664119,3664120,3664121,3664122],0, 0, '', '																																																																																																																																	gallery.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2330935,1875211';
imageSets[2] = '2330935';
imageSets[3] = '3664122,3664121,3664120,3664119,3664118,3664117,3664116,3664115,3664114,3664113,3664112,3664110,3664109,3664107,3664106,3664105,3664103,3664102,3664101,3664100,3664099,3664098,3664097,3664096,3664095,3664094,3664092,3664091,3664090,3664089,3664086,3664085,3664084,3664083,3664082,3664080,3664079,3664078,3664077,3664075,3664074,3664073,3664072,3664070,3664069,3664063,2331301,2330935,1875230,1875216';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/AandKWeddings/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/AandKWeddings/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));		}, 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 = 'A & K Weddings: ' + 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> 				&pound;' + (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="">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	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="">';
	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;
	}
}

		

