function thumbnail(g,e,b,f,d,a,c){this.id=g;this.galleries_id=e;this.caption=b;this.src=getServerPath(c)+"/"+f;this.width=d;this.height=a}function gallery(e,c,d,b,a){this.id=e;this.featured_images=c;this.title=d;this.section_code=b;this.photoIDs=a}var thumbnails=new Object();thumbnails[3859888]=new thumbnail(3859888,"228797","Prince William","0151_thumb.JPG",130,85,15);thumbnails[3862368]=new thumbnail(3862368,"228797","Lanyon Quoit","030_thumb.JPG",130,87,15);thumbnails[3862381]=new thumbnail(3862381,"228797","St Michaels Mount","DSCF3923_thumb.JPG",130,87,15);thumbnails[3862388]=new thumbnail(3862388,"228797","Pednvounder","pedn_015_thumb.JPG",130,87,15);thumbnails[3866760]=new thumbnail(3866760,"228797","Pednvounder","Porthcurno_009_thumb.JPG",130,87,15);thumbnails[3866832]=new thumbnail(3866832,"228797","Porthcurno","Porthcurno_018_thumb.JPG",130,205,15);thumbnails[3867511]=new thumbnail(3867511,"228797","Ripple","newlyn_001_thumb.JPG",130,170,15);thumbnails[3867537]=new thumbnail(3867537,"228797","Mousehole","IMG_1394_thumb.jpg",130,87,15);thumbnails[3867842]=new thumbnail(3867842,"228797","Enys Dodman","020_thumb.JPG",130,87,15);thumbnails[3881245]=new thumbnail(3881245,"228797","Crowns Mine Botallack","IMG_0475_thumb.jpg",130,87,15);thumbnails[3881276]=new thumbnail(3881276,"228797","Crowns","IMG_0480_thumb.jpg",130,195,15);thumbnails[3890301]=new thumbnail(3890301,"228797","Lanyon Quoit","IMG_0042_thumb.jpg",130,87,15);thumbnails[3893763]=new thumbnail(3893763,"228797","Porth Nanven","IMG_3562_thumb.jpg",130,195,15);thumbnails[3893765]=new thumbnail(3893765,"228797","Sennen Cove","IMG_8630_thumb.JPG",130,87,15);thumbnails[3902715]=new thumbnail(3902715,"228797","A windy day in Porthleven","DSCF5679_thumb.JPG",130,87,15);thumbnails[3910684]=new thumbnail(3910684,"228797","Helford","DSCF5805_thumb.JPG",130,194,15);thumbnails[3953624]=new thumbnail(3953624,"228797","Kynance Cove","IMG_0019-1-1_edited-1_thumb.jpg",130,87,15);thumbnails[3961139]=new thumbnail(3961139,"228797","Penberth","DSCF6221_thumb.JPG",130,87,15);thumbnails[3961144]=new thumbnail(3961144,"228797","Penberth","DSCF6226_thumb.JPG",130,87,15);thumbnails[4205950]=new thumbnail(4205950,"228797","Drift Dam","IMG_9328_thumb.JPG",130,103,15);thumbnails[4234856]=new thumbnail(4234856,"228797","Sea Cloud 11","IMG_0023_thumb.JPG",130,87,15);thumbnails[4420719]=new thumbnail(4420719,"228797","","DSCF8589_thumb.JPG",130,87,15);thumbnails[4420733]=new thumbnail(4420733,"228797","","DSCF1639_thumb.JPG",130,80,15);thumbnails[4566735]=new thumbnail(4566735,"228797","Mousehole","DSCF93321_thumb.JPG",130,87,15);thumbnails[4611686]=new thumbnail(4611686,"228797","Porth Nanven","DSCF9585_thumb.JPG",130,87,15);thumbnails[4611705]=new thumbnail(4611705,"228797","Porth Nanven","DSCF9596_thumb.JPG",130,87,15);thumbnails[4922023]=new thumbnail(4922023,"228797","Porthcurno","IMG_4998_thumb.JPG",130,87,15);thumbnails[4922026]=new thumbnail(4922026,"228797","Porthcurno","IMG_5042_thumb.JPG",130,196,15);thumbnails[5180072]=new thumbnail(5180072,"228797","Porthleven","IMG_6091_thumb.JPG",130,86,15);thumbnails[5180075]=new thumbnail(5180075,"228797","Stormy Porthleven","IMG_6096_thumb.JPG",130,87,15);thumbnails[3881250]=new thumbnail(3881250,"235758","Tresco Isles of Scilly","IMG_0170_thumb.jpg",130,87,15);thumbnails[3881279]=new thumbnail(3881279,"235758","Early morning on Bryher","bryher_Morning2_thumb.jpg",130,72,15);thumbnails[3882440]=new thumbnail(3882440,"235758","Bryher","IMG_1969_thumb.jpg",130,195,15);thumbnails[3882446]=new thumbnail(3882446,"235758","Tresco","IMG_2386_thumb.jpg",130,87,15);thumbnails[3953609]=new thumbnail(3953609,"235758","Sunset over Samson","DSCF5027_thumb.JPG",130,87,15);thumbnails[3953615]=new thumbnail(3953615,"235758","Hell Bay,  Bryher","DSCF5010_thumb.JPG",130,87,15);thumbnails[4205930]=new thumbnail(4205930,"235758","Tresco","DSCF7503_thumb.JPG",130,194,15);thumbnails[4205934]=new thumbnail(4205934,"235758","Isles of Scilly","DSCF7552_thumb.JPG",130,87,15);thumbnails[4205940]=new thumbnail(4205940,"235758","Punts on Bryher","DSCF7583_thumb.JPG",130,87,15);thumbnails[4205943]=new thumbnail(4205943,"235758","Sunset over Bryher","DSCF7709_thumb.JPG",130,87,15);thumbnails[3876471]=new thumbnail(3876471,"228269","St Michael's Mount","DSCF5061_thumb.JPG",130,87,15);thumbnails[3876537]=new thumbnail(3876537,"228269","Old Tom","IMG_1313_thumb.JPG",130,87,15);thumbnails[3876538]=new thumbnail(3876538,"228269","Newlyn","DSCF1691_thumb.JPG",130,194,15);thumbnails[3876541]=new thumbnail(3876541,"228269","St Michael's Mount","DSCF5103_thumb.JPG",130,87,15);thumbnails[3876544]=new thumbnail(3876544,"228269","Marazion Marsh","IMG_2454_thumb.JPG",130,195,15);thumbnails[3876938]=new thumbnail(3876938,"228269","Lands End","DSCF4017_thumb.JPG",130,87,15);thumbnails[3876982]=new thumbnail(3876982,"228269","Botallack","DSCF3591_thumb.JPG",130,87,15);thumbnails[3882436]=new thumbnail(3882436,"228269","Pendeen Watch","pendeen_watch_thumb.jpg",130,195,15);thumbnails[3945386]=new thumbnail(3945386,"228269","Wheal Owles","DSCF6116_thumb.JPG",130,194,15);thumbnails[4022898]=new thumbnail(4022898,"228269","Crowns","DSCF6728_thumb.JPG",130,87,15);thumbnails[4922021]=new thumbnail(4922021,"228269","Porth Nanvan","IMG_3865_thumb.JPG",130,87,15);thumbnails[4942278]=new thumbnail(4942278,"228269","Botallack","IMG_4903_thumb.JPG",130,87,15);thumbnails[3866888]=new thumbnail(3866888,"228268","","DSCF4195_thumb.JPG",130,80,15);thumbnails[3866889]=new thumbnail(3866889,"228268","","DSCF4193_thumb.JPG",130,79,15);thumbnails[3866995]=new thumbnail(3866995,"228268","","DSCF4191_thumb.JPG",130,84,15);thumbnails[3866998]=new thumbnail(3866998,"228268","","DSCF4186_thumb.JPG",130,82,15);thumbnails[3894901]=new thumbnail(3894901,"228268","","086_thumb.JPG",130,187,15);thumbnails[4020552]=new thumbnail(4020552,"228268","Young Badger","DSCF6809_thumb.JPG",130,194,15);thumbnails[4020556]=new thumbnail(4020556,"228268","Badger","DSCF6851_thumb.JPG",130,81,15);thumbnails[4206011]=new thumbnail(4206011,"228268","","013_thumb.JPG",130,176,15);thumbnails[5180102]=new thumbnail(5180102,"228268","In Our Garden","IMG_0006_thumb.JPG",130,183,15);thumbnails[3893745]=new thumbnail(3893745,"236473","Magnolia sargentiana","DSCF2960-1_thumb.JPG",130,194,15);thumbnails[3893746]=new thumbnail(3893746,"236473","Trewidden Belle","0301_thumb.JPG",130,87,15);thumbnails[3893747]=new thumbnail(3893747,"236473","Golitha Falls","IMG_3996_thumb.jpg",130,87,15);thumbnails[3893748]=new thumbnail(3893748,"236473","Golitha Falls","IMG_4027_thumb.jpg",130,87,15);thumbnails[3893799]=new thumbnail(3893799,"236473","Magnolia sargentiana","tw_mag_thumb.JPG",130,87,15);thumbnails[3982849]=new thumbnail(3982849,"236473","","DSCF6350_thumb.JPG",130,87,15);thumbnails[4205993]=new thumbnail(4205993,"236473","","DSCF7529-1_thumb.JPG",130,88,15);thumbnails[4205996]=new thumbnail(4205996,"236473","Flowers Bryher","DSCF7577_thumb.JPG",130,87,15);thumbnails[4944227]=new thumbnail(4944227,"281256","Green Burrow","DSCF1139_thumb.JPG",130,87,15);thumbnails[4944233]=new thumbnail(4944233,"281256","Trengwainton","DSCF1173_thumb.JPG",130,87,15);thumbnails[4944240]=new thumbnail(4944240,"281256","","DSCF1156_thumb.JPG",130,87,15);thumbnails[4944248]=new thumbnail(4944248,"281256","Castle Gate","DSCF1125_thumb.JPG",130,87,15);thumbnails[4944254]=new thumbnail(4944254,"281256","Green Burrow","DSCF1138_thumb.JPG",130,194,15);thumbnails[4966666]=new thumbnail(4966666,"281256","","DSCF1385_thumb.JPG",130,194,15);thumbnails[4966669]=new thumbnail(4966669,"281256","","DSCF1388_thumb.JPG",130,87,15);thumbnails[4566577]=new thumbnail(4566577,"264840","Penlee Lifeboat","DSCF9392_thumb.JPG",130,79,15);thumbnails[4566583]=new thumbnail(4566583,"264840","Ripple","IMG_0048_thumb.JPG",130,87,15);thumbnails[4566588]=new thumbnail(4566588,"264840","Imogen","DSCF0399_thumb.JPG",130,194,15);thumbnails[4566592]=new thumbnail(4566592,"264840","Misty Blue","boating_014_thumb.JPG",130,197,15);thumbnails[4566622]=new thumbnail(4566622,"264840","Lady Lauren","simon_199_thumb.JPG",130,195,15);thumbnails[4566708]=new thumbnail(4566708,"264840","Porthleven","IMG_0985_thumb.jpg",130,87,15);thumbnails[4566709]=new thumbnail(4566709,"264840","Porthleven","IMG_0996_thumb.jpg",130,87,15);var galleries=new Object();galleries[228797]=new gallery(228797,"5180075,5180072,4922026,4922023,4611705,4611686,4566735,4420733,4420719,4234856","West Penwith","gallery",[3859888,3862368,3862381,3862388,3866760,3866832,3867511,3867537,3867842,3881245,3881276,3890301,3893763,3893765,3902715,3910684,3953624,3961139,3961144,4205950,4234856,4420719,4420733,4566735,4611686,4611705,4922023,4922026,5180072,5180075]);galleries[235758]=new gallery(235758,"4205943,4205940,4205934,4205930,3953615,3953609,3882446,3882440,3881279,3881250","Isles of Scilly","gallery",[3881250,3881279,3882440,3882446,3953609,3953615,4205930,4205934,4205940,4205943]);galleries[228269]=new gallery(228269,"4942278,4922021,4022898,3945386,3882436,3876982,3876938,3876544,3876541,3876538","Sunrise and Sunsets","gallery",[3876471,3876537,3876538,3876541,3876544,3876938,3876982,3882436,3945386,4022898,4922021,4942278]);galleries[228268]=new gallery(228268,"5180102,4206011,4020556,4020552,3894901,3866998,3866995,3866889,3866888","Nature","gallery",[3866888,3866889,3866995,3866998,3894901,4020552,4020556,4206011,5180102]);galleries[236473]=new gallery(236473,"4205996,4205993,3982849,3893799,3893748,3893747,3893746,3893745","Woodland and Flowers","gallery",[3893745,3893746,3893747,3893748,3893799,3982849,4205993,4205996]);galleries[281256]=new gallery(281256,"4966669,4966666,4944254,4944248,4944240,4944233,4944227","Winter Scenes","gallery",[4944227,4944233,4944240,4944248,4944254,4966666,4966669]);galleries[264840]=new gallery(264840,"4566709,4566708,4566622,4566592,4566588,4566583,4566577","Sea and Sail","gallery",[4566577,4566583,4566588,4566592,4566622,4566708,4566709]);var imageSets=new Object();imageSets[1]="5180102,5180075,5180072,4966669,4966666,4944254,4944248,4944240,4944233,4944227,4942278,4922026,4922023,4922021,4611705,4611686,4566735,4566709,4566708,4566622,4566592,4566588,4566583,4566577,4420733,4420719,4234856,4206011,4205996,4205993,4205950,4205943,4205940,4205934,4205930,4022898,4020556,4020552,3982849,3961144,3961139,3953624,3953615,3953609,3945386,3910684,3902715,3894901,3893799,3893765";imageSets[3]="5180102,5180075,5180072,4966669,4966666,4944254,4944248,4944240,4944233,4944227,4942278,4922026,4922023,4922021,4611705,4611686,4566735,4566709,4566708,4566622,4566592,4566588,4566583,4566577,4420733,4420719,4234856,4206011,4205996,4205993,4205950,4205943,4205940,4205934,4205930,4022898,4020556,4020552,3982849,3961144,3961139,3953624,3953615,3953609,3945386,3910684,3902715,3894901,3893799,3893765";function randomListVal(a){arrayVals=a.split(",");if(arrayVals.length){pos=Math.round(Math.random()*(arrayVals.length-1));val=arrayVals[pos]}else{val=0}return val}function getServerPath(a){var b=-1;switch(a){case 34:b="http://www9.clikpic.com/kahargreaves/images";break}switch(a){case 1:b="http://www1.clikpic.com/kahargreaves/images";break}switch(a){case 2:b="http://admin.clikpic.com/kahargreaves/images";break}switch(a){case 4:b="http://www.clikchurch.com/kahargreaves/images";break}switch(a){case 5:b="http://www2.clikpic.com/kahargreaves/images";break}switch(a){case 15:b="http://www3.clikpic.com/kahargreaves/images";break}switch(a){case 21:b="http://www6.clikpic.com/kahargreaves/images";break}switch(a){case 18:b="http://www4.clikpic.com/kahargreaves/images";break}switch(a){case 19:b="http://www5.clikpic.com/kahargreaves/images";break}switch(a){case 22:b="http://tpc5/clikpic/kahargreaves/images";break}switch(a){case 23:b="http://tpc10/clikpic/kahargreaves/images";break}switch(a){case 24:b="http://tpc15/clikpic/kahargreaves/images";break}switch(a){case 25:b="http://tpc16/clikpic/kahargreaves/images";break}switch(a){case 31:b="http://www7.clikpic.com/kahargreaves/images";break}switch(a){case 32:b="http://admin2.clikpic.com/kahargreaves/images";break}switch(a){case 33:b="http://www8.clikpic.com/kahargreaves/images";break}return b}function showHomeImage(a){imageID=randomListVal("");if(!basic){a.src=photos[imageID].src;a.width=photos[imageID].width;a.height=photos[imageID].height}else{newImage=new Image(photos[imageID].width,photos[imageID].height);newImage.src=photos[imageID].src;document.images[a.name]=newImage}}function showHomeImageInline(){html="";imageID=randomListVal(imageSets[1]);if("gallery"!=""){if(backgrounds[imageID].galleries_id!=""){html+='<a href="'+backgrounds[imageID].section_code+"_"+backgrounds[imageID].galleries_id+'.html">'}else{html+='<a href="gallery.html">'}}html+='<img src="'+backgrounds[imageID].src+'" width="'+backgrounds[imageID].width+'" height="'+backgrounds[imageID].height+'" class="mainhomepageimage photo" id="mainSample" name="mainSample" alt="'+backgrounds[imageID].caption+'" border="0">';if("gallery"!=""){html+="</a>"}$("#homepageimage").html(html)}function getNextId(b,d,a){var c=getArrayPos(d,b);if(a){if(c==0){nextImgPos=d.length-1}else{nextImgPos=c-1}}else{if(c==d.length-1){nextImgPos=0}else{nextImgPos=c+1}}nextImg=d[nextImgPos];return nextImg}function next(d,b){var c=d.value;var a=galleries[photos[c].galleries_id].photoIDs;nextImg=getNextId(c,a);if(nextImg!=-1){updateImage(nextImg,d,b)}}function updateImage(f,e,b){if(!basic){document.getElementById("imagePhoto").innerHTML='<img class="mainphoto photo" src="'+photos[f].src+' " id="mainPic" name="mainPic" width="'+photos[f].width+'" height="'+photos[f].height+'" alt="'+photos[f].caption+'">';e.value=photos[f].id;$("#imageTitle").html(photos[f].caption);document.title="West Cornwall Photos: "+photos[f].caption;if(photos[f].caption==""){document.getElementById("imageTitle").style.display="none"}else{document.getElementById("imageTitle").style.display="block"}var a=fnGetImageDetails(f);if(a==""){document.getElementById("imageDetails").style.display="none";var c=document.getElementById("infoWrap");var d=document.getElementById("photoInfo");if(photos[f].caption==""){if(c!=null){c.className="empty"}if(d!=null){d.className="empty"}}else{if(c!=null){c.className="noinfo"}if(d!=null){d.className="noinfo"}}}else{document.getElementById("imageDetails").style.display="block";var c=document.getElementById("infoWrap");if(c!=null){c.className="normal"}var d=document.getElementById("photoInfo");if(d!=null){d.className="normal"}}document.getElementById("imageDetails").innerHTML=a;toggleAddToCartConfirm()}else{window.location="photo_"+photos[f].id+".html"}}function toggleAddToCartConfirm(){if($("#paymentConfirm").size()){$("#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,photos,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()}}else{$("#paymentConfirm").text("Item not added - check cookies are enabled in your browser.").fadeIn()}})}}function fnGetImageDetails(b){var a="";if(photos[b].description!=""){a=a+'<p id="imageDescription">'+photos[b].description+"</p>"}if(photos[b].photo_ref!=""){a=a+'<p class="imageinfo" id="imageRef"><strong>Ref: </strong>'+photos[b].photo_ref+"</p>"}if(photos[b].takendate!=""){a=a+'<p class="imageinfo" id="imageDate"><strong>Date: </strong>'+photos[b].takendate+"</p>"}if(photos[b].location!=""){a=a+'<p class="imageinfo" id="imageLocation"><strong>Location: </strong>'+photos[b].location+"</p>"}if(photos[b].photographer!=""){a=a+'<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>'+photos[b].photographer+"</p>"}if(a!=""){a=a+'<div class="spacer"></div>'}return a}function fnGetPaymentInfo(c){var b="";if(c.item_price!==""){b=b+"<p>Order this print:</p>";b=b+'<p class="imageinfo" id="imagePrice"><strong>'+c.purchase_instruction+"</strong> 							"+(c.item_price).toFixed(2)+"</p>";var e=c.purchase_instruction;var d=(c.item_price).toFixed(2);var a=0}else{if(c.payment_groups_id!==""){b=b+"<p>Buy this print online:</p>";b=b+'<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';b=b+'<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);">';b=b+getPaymentOptions(c.payment_groups_id);b=b+"</select>";b=b+"</form>";var a=paymentGroups[c.payment_groups_id].options[0];if(paymentOptions[a]){var e=paymentOptions[a].payment_option;var d=paymentOptions[a].price}}else{}}if(c.item_price!==""||c.payment_groups_id!==""){b=b+'<div class="clearing">&nbsp;</div>'}return b}function previous(d,b){var c=d.value;var a=galleries[photos[c].galleries_id].photoIDs;nextImg=getNextId(c,a,1);if(nextImg!=-1){updateImage(nextImg,d,b)}}function showGalleryImage(c,b){imageID=randomListVal(galleries[c].featured_images);if(imageID!=0){b.src=thumbnails[imageID].src;b.width=thumbnails[imageID].width;b.height=thumbnails[imageID].height;if(b.width<130){var f=$("img#gallery"+c);f.parents(".thumbWrap").width(b.width);var a=f.siblings("h3").size()==1?f.siblings("h3"):f.parent(".thumbWrap").siblings("h3");var g=parseInt(a.css("padding-left"))+parseInt(a.css("padding-right"));var d=parseInt(a.css("border-left-width"))+parseInt(a.css("border-right-width"));var e=parseInt(f.parents(".thumbWrap").css("border-left-width"))+parseInt(f.parents(".thumbWrap").css("border-right-width"));a.width(f.outerWidth(true)-g-d+e)}}}function showGalleries(a){if(!basic){temp="";for(i=0;i<galleries.length;i++){if(galleries[i].id!=a){if(temp!=""){temp=temp+" | "}temp=temp+'<a href="gallery_'+galleries[i].id+'.html">'+galleries[i].title+"</a>"}}document.all.galleryLinks.innerHTML="Other galleries: "+temp}}function resizePhotoInfo(n){var b=$.extend({centre:false},n||{});var d=3;$("div#photoPanelOuter").height("auto");$("div#infoWrap").width(200);$("div#photoDetail").css("width","auto");var h=$("div#maincolContent").width();var j=$("div#photoWrap").outerWidth(true);var m=$("div#infoWrap").outerWidth(true);var k=$("div#photoWrap").outerHeight();var f=$("div#infoWrap").outerHeight();var c=$("div#infoWrap").hasClass("empty");floatDrop=0;var g=j;if(!c){if(h<(j+m)){floatDrop=1}if(!floatDrop){var a=$("div#infoWrap").innerWidth();$("div#infoWrap").width(a+(h-j-m-d));m=$("div#infoWrap").outerWidth(true);g=j+m;if(k>f){var e=$("div#photoPanelOuter").height();$("div#photoPanelOuter").height(e+(k-f));var f=$("div#infoWrap").outerHeight()}}else{var l=$("div#photoWrap").outerWidth();$("div#infoWrap").width(l)}}if(b.centre){$("div#photoDetail").width(g);$("div#photoDetail").css("margin-left","auto");$("div#photoDetail").css("margin-right","auto")}else{$("div#photoDetail").css("margin-left","0");$("div#photoDetail").css("margin-right","0")}}function getArrayPos(c,b){for(var a=0;a<c.length;a++){if(c[a]==b){return a}}return -1}function changeBgImg(a,e){var c=randomListVal(imageSets[e]);var d=backgrounds[c].src;var b=$(a);if(b.size()>0){if(/\bimg$/.test(a)){b.attr({src:d})}else{b.css({"background-image":'url("'+d+'")'})}}};