window.thumbnails = new Object();
												thumbnails[288644] = new thumbnail(288644,'40447','','Dubai-Tourist_thumb.jpg',130, 65,15,'																			photo_288644.html');
												thumbnails[1753438] = new thumbnail(1753438,'40060','','CI009_thumb.jpg',130, 87,15,'																			photo_1753438.html');
												thumbnails[523926] = new thumbnail(523926,'40447','','Canon1_thumb.jpg',130, 87,15,'																			photo_523926.html');
												thumbnails[1753592] = new thumbnail(1753592,'40060','CI001','CI0011_thumb.jpg',130, 104,15,'																			photo_1753592.html');
												thumbnails[1753669] = new thumbnail(1753669,'40060','CI020','CI0201_thumb.jpg',87, 130,15,'																			photo_1753669.html');
												thumbnails[1754576] = new thumbnail(1754576,'40223','CI030','CI0301_thumb.jpg',130, 130,15,'																			photo_1754576.html');
												thumbnails[1753593] = new thumbnail(1753593,'40060','CI002','CI002_thumb.jpg',65, 130,15,'																			photo_1753593.html');
												thumbnails[1753670] = new thumbnail(1753670,'40060','CI021','CI0211_thumb.jpg',130, 130,15,'																			photo_1753670.html');
												thumbnails[1754577] = new thumbnail(1754577,'40223','CI031','CI0311_thumb.jpg',130, 130,15,'																			photo_1754577.html');
												thumbnails[1753594] = new thumbnail(1753594,'40060','CI003','CI0031_thumb.jpg',87, 130,15,'																			photo_1753594.html');
												thumbnails[1753671] = new thumbnail(1753671,'40060','CI022','CI0221_thumb.jpg',87, 130,15,'																			photo_1753671.html');
												thumbnails[1754578] = new thumbnail(1754578,'40223','CI032','CI0321_thumb.jpg',130, 87,15,'																			photo_1754578.html');
												thumbnails[1753595] = new thumbnail(1753595,'40060','CI004','CI004_thumb.jpg',87, 130,15,'																			photo_1753595.html');
												thumbnails[1754579] = new thumbnail(1754579,'40223','CI033','CI0331_thumb.jpg',130, 104,15,'																			photo_1754579.html');
												thumbnails[1753596] = new thumbnail(1753596,'40060','CI005','CI005_thumb.jpg',130, 87,15,'																			photo_1753596.html');
												thumbnails[1754580] = new thumbnail(1754580,'40223','CI034','CI0341_thumb.jpg',87, 130,15,'																			photo_1754580.html');
												thumbnails[1753597] = new thumbnail(1753597,'40060','CI006','CI006_thumb.jpg',130, 87,15,'																			photo_1753597.html');
												thumbnails[1754581] = new thumbnail(1754581,'40223','CI035','CI0351_thumb.jpg',87, 130,15,'																			photo_1754581.html');
												thumbnails[1753598] = new thumbnail(1753598,'40060','CI007','CI0071_thumb.jpg',87, 130,15,'																			photo_1753598.html');
												thumbnails[1754582] = new thumbnail(1754582,'40223','CI036','CI0361_thumb.jpg',87, 130,15,'																			photo_1754582.html');
												thumbnails[1753599] = new thumbnail(1753599,'40060','CI008','CI008_thumb.jpg',87, 130,15,'																			photo_1753599.html');
												thumbnails[1754583] = new thumbnail(1754583,'40223','CI037','CI0371_thumb.jpg',87, 130,15,'																			photo_1754583.html');
												thumbnails[1753600] = new thumbnail(1753600,'40060','CI009','CI0091_thumb.jpg',130, 87,15,'																			photo_1753600.html');
												thumbnails[1754584] = new thumbnail(1754584,'40223','CI038','CI038_thumb.jpg',87, 130,15,'																			photo_1754584.html');
												thumbnails[1753601] = new thumbnail(1753601,'40060','CI010','CI010_thumb.jpg',130, 87,15,'																			photo_1753601.html');
												thumbnails[1754585] = new thumbnail(1754585,'40223','CI039','CI039_thumb.jpg',130, 130,15,'																			photo_1754585.html');
												thumbnails[1753602] = new thumbnail(1753602,'40060','CI011','CI011_thumb.jpg',87, 130,15,'																			photo_1753602.html');
												thumbnails[1753603] = new thumbnail(1753603,'40060','CI012','CI012_thumb.jpg',130, 130,15,'																			photo_1753603.html');
												thumbnails[1753604] = new thumbnail(1753604,'40060','CI014','CI014_thumb.jpg',130, 130,15,'																			photo_1753604.html');
												thumbnails[1754588] = new thumbnail(1754588,'40447','CI042','CI042_thumb.jpg',87, 130,15,'																			photo_1754588.html');
												thumbnails[1753605] = new thumbnail(1753605,'40060','CI015','CI015_thumb.jpg',130, 87,15,'																			photo_1753605.html');
												thumbnails[1754589] = new thumbnail(1754589,'40447','CI043','CI043_thumb.jpg',130, 87,15,'																			photo_1754589.html');
												thumbnails[1753606] = new thumbnail(1753606,'40060','CI016','CI016_thumb.jpg',87, 130,15,'																			photo_1753606.html');
												thumbnails[1754590] = new thumbnail(1754590,'40447','CI044','CI044_thumb.jpg',87, 130,15,'																			photo_1754590.html');
												thumbnails[1753607] = new thumbnail(1753607,'40060','CI017','CI017_thumb.jpg',130, 87,15,'																			photo_1753607.html');
												thumbnails[1754591] = new thumbnail(1754591,'40447','CI045','CI045_thumb.jpg',130, 87,15,'																			photo_1754591.html');
												thumbnails[1753608] = new thumbnail(1753608,'40060','CI018','CI018_thumb.jpg',130, 87,15,'																			photo_1753608.html');
												thumbnails[1754592] = new thumbnail(1754592,'40447','CI046','CI046_thumb.jpg',87, 130,15,'																			photo_1754592.html');
												thumbnails[1753609] = new thumbnail(1753609,'40060','CI019','CI019_thumb.jpg',87, 130,15,'																			photo_1753609.html');
												thumbnails[1753612] = new thumbnail(1753612,'40060','CI022','CI022_thumb.jpg',87, 130,15,'																			photo_1753612.html');
												thumbnails[1753613] = new thumbnail(1753613,'40060','CI023','CI023_thumb.jpg',130, 87,15,'																			photo_1753613.html');
												thumbnails[1753614] = new thumbnail(1753614,'40060','CI024','CI024_thumb.jpg',87, 130,15,'																			photo_1753614.html');
												thumbnails[1753615] = new thumbnail(1753615,'40060','CI025','CI025_thumb.jpg',130, 87,15,'																			photo_1753615.html');
												thumbnails[1753616] = new thumbnail(1753616,'40060','CI026','CI026_thumb.jpg',87, 130,15,'																			photo_1753616.html');
												thumbnails[1753617] = new thumbnail(1753617,'40060','CI027','CI027_thumb.jpg',130, 87,15,'																			photo_1753617.html');
												thumbnails[1753618] = new thumbnail(1753618,'40060','CI028','CI028_thumb.jpg',130, 87,15,'																			photo_1753618.html');
												thumbnails[1753619] = new thumbnail(1753619,'40060','CI029','CI029_thumb.jpg',130, 104,15,'																			photo_1753619.html');
												thumbnails[1753620] = new thumbnail(1753620,'40060','CI030','CI030_thumb.jpg',130, 43,15,'																			photo_1753620.html');
												thumbnails[1753621] = new thumbnail(1753621,'40060','CI031','CI031_thumb.jpg',130, 65,15,'																			photo_1753621.html');
												thumbnails[1753622] = new thumbnail(1753622,'40060','CI032','CI032_thumb.jpg',65, 130,15,'																			photo_1753622.html');
												thumbnails[1753623] = new thumbnail(1753623,'40060','CI033','CI033_thumb.jpg',104, 130,15,'																			photo_1753623.html');
												thumbnails[1753624] = new thumbnail(1753624,'40060','CI034','CI034_thumb.jpg',130, 74,15,'																			photo_1753624.html');
												thumbnails[1753625] = new thumbnail(1753625,'40060','CI035','CI035_thumb.jpg',130, 104,15,'																			photo_1753625.html');
												thumbnails[1753626] = new thumbnail(1753626,'40060','CI036','CI036_thumb.jpg',130, 87,15,'																			photo_1753626.html');
												thumbnails[1753627] = new thumbnail(1753627,'40060','CI037','CI037_thumb.jpg',130, 87,15,'																			photo_1753627.html');
												thumbnails[275446] = new thumbnail(275446,'24462','','hannah-look_thumb.jpg',130, 87,15,'																			photo_275446.html');
												thumbnails[288643] = new thumbnail(288643,'24464','','Canon_thumb.jpg',130, 87,15,'																			photo_288643.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[24464] = new gallery(24464,'288643','Commercial','gallery',[288643],0, 0, '', '																																																																																																							gallery_24464.html',0,0);
				  					galleries[24461] = new gallery(24461,'','Weddings','gallery',[],0, 0, '', '																																																																																																							gallery_24461.html',0,0);
				  					galleries[40060] = new gallery(40060,'1753608,1753598,1753596,1753592','Example Wedding Images ','section61995',[1753438,1753592,1753669,1753593,1753670,1753594,1753671,1753595,1753596,1753597,1753598,1753599,1753600,1753601,1753602,1753603,1753604,1753605,1753606,1753607,1753608,1753609,1753612,1753613,1753614,1753615,1753616,1753617,1753618,1753619,1753620,1753621,1753622,1753623,1753624,1753625,1753626,1753627],0, 0, '', '																																																																																																							section61995_40060.html',0,0);
				  					galleries[40223] = new gallery(40223,'1754585,1754584,1754583,1754582,1754581,1754580,1754579,1754578,1754577,1754576','Example Portrait shots','section61995',[1754576,1754577,1754578,1754579,1754580,1754581,1754582,1754583,1754584,1754585],0, 0, '', '																																																																																																							section61995_40223.html',0,0);
				  					galleries[24462] = new gallery(24462,'275446','Portraits','gallery',[275446],0, 0, '', '																																																																																																							gallery_24462.html',0,0);
				  					galleries[40447] = new gallery(40447,'1754592,1754591,1754590,1754589,1754588,523926,288644','Commercial examples','section61995',[288644,523926,1754588,1754589,1754590,1754591,1754592],0, 0, '', '																																																																																																							section61995_40447.html',0,0);
				  					galleries[117657] = new gallery(117657,'','Ben & Catherine','section153655',[],0, 0, '', '																																																																																																							section153655_117657.html',0,0);
				  					galleries[117656] = new gallery(117656,'','Clive & Lyn','section153655',[],0, 0, '', '																																																																																																							section153655_117656.html',0,0);
				  					galleries[117655] = new gallery(117655,'','Matt & Lianne','section153655',[],0, 0, '', '																																																																																																							section153655_117655.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1753671,1753670,1753612,1753608,1753600,1753598,1753596';
imageSets[2] = '1753608,1753598,1753596,1753592,288643,275446';
imageSets[3] = '1754592,1754591,1754590,1754589,1754588,1754585,1754584,1754583,1754582,1754581,1754580,1754579,1754578,1754577,1754576,1753671,1753670,1753669,1753627,1753626,1753625,1753624,1753623,1753622,1753621,1753620,1753619,1753618,1753617,1753616,1753615,1753614,1753613,1753612,1753609,1753608,1753607,1753606,1753605,1753604,1753603,1753602,1753601,1753600,1753599,1753598,1753597,1753596,1753595,1753594';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Cinimodimages/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Cinimodimages/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 += 'section61995.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 && 'section61995' != '') {
					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 = 'Cinimod Images: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:220};	    	      	      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 + '<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;
	}
}

			

