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[296203]=new thumbnail(296203,"","Singing Birds","Caution_0325_thumb.jpg",130,196,18);thumbnails[296204]=new thumbnail(296204,"","Cow Gate","cowgate_0602_thumb.jpg",130,92,18);thumbnails[296205]=new thumbnail(296205,"","Wellies","wellies_0483_thumb.jpg",130,160,18);thumbnails[4363715]=new thumbnail(4363715,"256451","Barcaldine Castle","barcaldine_0714mono_thumb.jpg",130,92,18);thumbnails[4363721]=new thumbnail(4363721,"256451","Barcaldine Castle","BarcaldineCastleIR_2875_thumb.jpg",130,92,18);thumbnails[4363725]=new thumbnail(4363725,"256451","Carnasserie Castle ","carnasserie_1853monoA4_thumb.jpg",130,184,18);thumbnails[4363728]=new thumbnail(4363728,"256451","Dunstaffnage Castle","dunstaffnageir_2905A4_thumb.jpg",130,92,18);thumbnails[294548]=new thumbnail(294548,"178870","Loch Etive","etive_0052_thumb.jpg",130,92,18);thumbnails[510278]=new thumbnail(510278,"178870","Oban harbour from McCaig's Tower","oban_1012_thumb.jpg",130,87,18);thumbnails[510275]=new thumbnail(510275,"178870","Sunrays at Loch Fyne","fyne_3324_thumb.jpg",130,83,18);thumbnails[510276]=new thumbnail(510276,"178870","Misty Mull","mull_1690_thumb.jpg",130,87,18);thumbnails[524478]=new thumbnail(524478,"178870","Upper Loch Creran","creran_1283_thumb.jpg",130,92,18);thumbnails[294510]=new thumbnail(294510,"178870","Ardnave Point","ardnave_0629sft_thumb.jpg",130,92,18);thumbnails[294544]=new thumbnail(294544,"178870","View from Dunadd","dunadd_1948_thumb.jpg",130,92,18);thumbnails[316918]=new thumbnail(316918,"178870","Standing Stone","standingstone_0121_thumb.jpg",130,92,18);thumbnails[301774]=new thumbnail(301774,"178870","Creran dawn","creran-dawn_2829_thumb.jpg",130,92,18);thumbnails[294518]=new thumbnail(294518,"178870","Machir Bay","machirbay_0384_thumb.jpg",130,87,18);thumbnails[336526]=new thumbnail(336526,"178870","Tralee Bay at sunset","tralee_3136_thumb.jpg",130,87,18);thumbnails[294511]=new thumbnail(294511,"178870","Port Charlotte","charlotte_0389_thumb.jpg",130,83,18);thumbnails[431787]=new thumbnail(431787,"178870","Port A Muilinn","seil_1129_thumb.jpg",130,184,18);thumbnails[2882876]=new thumbnail(2882876,"178870","Oban harbour and McCaig's Tower","5d_mg_0039a_thumb.jpg",130,183,18);thumbnails[2882873]=new thumbnail(2882873,"178870","Barcaldine Castle","5D_MG_0715_thumb.jpg",130,183,18);thumbnails[2882848]=new thumbnail(2882848,"178874","Staithes harbour","e520-8310105_thumb.jpg",130,86,18);thumbnails[3458433]=new thumbnail(3458433,"178874","Gosford House sunset","e-3-90115_thumb.jpg",130,87,18);thumbnails[2882881]=new thumbnail(2882881,"178874","Staithes ","e520-9020240_thumb.jpg",130,86,18);thumbnails[1465173]=new thumbnail(1465173,"178874","Fidra, East Lothian","fidra-1903_thumb.jpg",130,92,18);thumbnails[311294]=new thumbnail(311294,"178874","Hardcastle Crags","hardcastle_0528_thumb.jpg",130,92,18);thumbnails[2882868]=new thumbnail(2882868,"178874","Honeysuckle Cottage","e-510-86648_1_thumb.jpg",130,183,18);thumbnails[2882870]=new thumbnail(2882870,"178874","Poppies","e-510_7096658__thumb.jpg",130,183,18);thumbnails[2882849]=new thumbnail(2882849,"178874","Steam train","e520-9020187_thumb.jpg",130,183,18);thumbnails[1789564]=new thumbnail(1789564,"120313","Stairs","e-510-80377stairs_thumb.jpg",130,173,18);thumbnails[1789544]=new thumbnail(1789544,"120313","Doorway","e-510-30412doorway_thumb.jpg",130,183,18);thumbnails[1789556]=new thumbnail(1789556,"120313","Stairwell","e-510-30452stairwell_thumb.jpg",130,183,18);thumbnails[1789559]=new thumbnail(1789559,"120313","Lavatory","e-510-30476hdr_thumb.jpg",130,183,18);thumbnails[1789562]=new thumbnail(1789562,"120313","Doorbell","e-510-30482hdr_thumb.jpg",130,173,18);thumbnails[1789549]=new thumbnail(1789549,"120313","Courtyard","e-510-30430courtyard_thumb.jpg",130,92,18);thumbnails[1789563]=new thumbnail(1789563,"120313","Kitchen courtyard","e-510-80359kitchencourt_thumb.jpg",130,92,18);thumbnails[1789552]=new thumbnail(1789552,"120313","Kitchen","e-510-30444kitchen_thumb.jpg",130,92,18);thumbnails[1789554]=new thumbnail(1789554,"120313","Corridor","e-510-30449corridor_thumb.jpg",130,92,18);thumbnails[280935]=new thumbnail(280935,"24869","Ardalanish Bay","ArdalanishBay_0557_thumb.jpg",130,44,18);thumbnails[280938]=new thumbnail(280938,"24869","View from Ben Lora","Benlora_2705_thumb.jpg",130,44,18);thumbnails[280940]=new thumbnail(280940,"24869","View from Dunadd","Dunadd_1956_thumb.jpg",130,44,18);thumbnails[280942]=new thumbnail(280942,"24869","Garbh Eilean","GarbhEilean_1696_thumb.jpg",130,44,18);thumbnails[280946]=new thumbnail(280946,"24869","Loch Creran","glencreran_0139_thumb.jpg",130,44,18);thumbnails[280949]=new thumbnail(280949,"24869","Paps of Jura","Jura_1989_thumb.jpg",130,44,18);thumbnails[280953]=new thumbnail(280953,"24869","Castle Stalker","Stalker3092_thumb.jpg",130,44,18);thumbnails[280955]=new thumbnail(280955,"24869","Stob Dearg","stobdearg_0074_thumb.jpg",130,44,18);thumbnails[280958]=new thumbnail(280958,"24869","Tobermory","Tobermory_2322_thumb.jpg",130,44,18);thumbnails[280961]=new thumbnail(280961,"24869","Tralee Bay","Tralee_2697_thumb.jpg",130,44,18);thumbnails[299977]=new thumbnail(299977,"24869","Oban harbours","oban_0940_thumb.jpg",130,44,18);thumbnails[301254]=new thumbnail(301254,"24869","Machair Beach, Islay","kintra_0607_thumb.jpg",130,44,18);thumbnails[510283]=new thumbnail(510283,"24869","Looking up Glen Etive","glen_etive_1268_thumb.jpg",130,43,18);thumbnails[510357]=new thumbnail(510357,"24869","Islay's east coast","islay_0590_thumb.jpg",130,43,18);thumbnails[1464676]=new thumbnail(1464676,"24869","Fidra and the Firth of Forth","fidra_1922_thumb.jpg",130,43,18);thumbnails[2882070]=new thumbnail(2882070,"24869","Staithes, North Yorkshire","staithes pano 0228_thumb.jpg",130,43,18);thumbnails[310998]=new thumbnail(310998,"24869","Oban by night","Oban_night_0041_thumb.jpg",130,43,18);thumbnails[2264226]=new thumbnail(2264226,"24869","Downpatrick Head","downpatrick head_thumb.jpg",130,44,18);thumbnails[495699]=new thumbnail(495699,"24869","Oban Corran Esplanade","oban-pano_3x1_2769_thumb.jpg",130,43,18);thumbnails[504738]=new thumbnail(504738,"24869","Glen Etive","glen_etive_p1265_thumb.jpg",130,43,18);var galleries=new Object();galleries[256451]=new gallery(256451,"4363728,4363715","Mono section","gallery",[4363715,4363721,4363725,4363728]);galleries[178870]=new gallery(178870,"524478,431787,336526,316918,301774,294548,294544,294510","Argyll","gallery",[294548,510278,510275,510276,524478,294510,294544,316918,301774,294518,336526,294511,431787,2882876,2882873]);galleries[178874]=new gallery(178874,"2882881,2882870,2882868,2882848,1465173,311294","Miscellany","gallery",[2882848,3458433,2882881,1465173,311294,2882868,2882870,2882849]);galleries[120313]=new gallery(120313,"1789564,1789563,1789562,1789559,1789556,1789554,1789552,1789549,1789544","Dereliction","gallery",[1789564,1789544,1789556,1789559,1789562,1789549,1789563,1789552,1789554]);galleries[24869]=new gallery(24869,"2882070,2264226,1464676,510357,510283,504738,495699,310998,301254,299977,280961,280958,280955,280953,280949,280946,280942,280940,280938,280935","Panoramas","gallery",[280935,280938,280940,280942,280946,280949,280953,280955,280958,280961,299977,301254,510283,510357,1464676,2882070,310998,2264226,495699,504738]);var imageSets=new Object();imageSets[1]="4363728,4363725,4363721,4363715,3458433,2882881,2882876,2882873,2882870,2882868,2882849,2882848,2882070,2264226,1789564,1789563,1789562,1789559,1789556,1789554,1789552,1789549,1789544,1465173,1464676,524478,510357,510283,510278,510276,510275,504738,495699,431787,336526,316918,311294,310998,301774,301254,299977,296205,296204,296203,294548,294544,294518,294511,294510,280961";imageSets[2]="4363728,4363715,2882881,2882870,2882868,2882848,2882070,2264226,1465173,1464676,524478,510357,510283,504738,495699,431787,336526,316918,311294,310998,301774,301254,299977,294548,294544,294510,280961,280958,280955,280953,280949,280946,280942,280940,280938,280935";imageSets[3]="4363728,4363725,4363721,4363715,2882881,2882070,2264226,1464676,510357,510283,504738,495699,431787,310998,301254,299977,280961,280958,280955,280953,280949,280946,280942,280940,280938,280935";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/stephenl/images";break}switch(a){case 1:b="http://www1.clikpic.com/stephenl/images";break}switch(a){case 2:b="http://admin.clikpic.com/stephenl/images";break}switch(a){case 4:b="http://www.clikchurch.com/stephenl/images";break}switch(a){case 5:b="http://www2.clikpic.com/stephenl/images";break}switch(a){case 15:b="http://www3.clikpic.com/stephenl/images";break}switch(a){case 21:b="http://www6.clikpic.com/stephenl/images";break}switch(a){case 18:b="http://www4.clikpic.com/stephenl/images";break}switch(a){case 19:b="http://www5.clikpic.com/stephenl/images";break}switch(a){case 22:b="http://tpc5/clikpic/stephenl/images";break}switch(a){case 23:b="http://tpc10/clikpic/stephenl/images";break}switch(a){case 24:b="http://tpc15/clikpic/stephenl/images";break}switch(a){case 25:b="http://tpc16/clikpic/stephenl/images";break}switch(a){case 31:b="http://www7.clikpic.com/stephenl/images";break}switch(a){case 32:b="http://admin2.clikpic.com/stephenl/images";break}switch(a){case 33:b="http://www8.clikpic.com/stephenl/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="Stephen Lee Photography: "+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;resizePhotoInfo();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>"}a=a+fnGetPaymentInfo(photos[b]);if(a!=""){a=a+'<div class="spacer"></div>'}return a}function fnGetPaymentInfo(c){var b="";if(c.item_price!==""){b=b+"<p>Buy now using PayPal:</p>";b=b+'<p class="imageinfo" id="imagePrice"><strong>'+c.purchase_instruction+"</strong> 				&pound;"+c.item_price+"</p>";var e=c.purchase_instruction;var d=c.item_price;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="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';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+'<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';b=b+'	<input type="hidden" name="item_option" value="'+a+'">';b=b+'	<input type="hidden" name="site" value="STEPHENL">';b=b+'	<input type="hidden" name="item_number" value="'+c.id+'">';b=b+'	<input type="hidden" name="quantity" value="1">';b=b+'	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button">';b=b+'	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';b=b+"</form>";b=b+'<div class="clearing">&nbsp;</div>';b=b+'<div id="confirmContainer">';b=b+'<div id="paymentConfirm">Item added to cart</div>';b=b+"</div>";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 e=$("img#gallery"+c);e.parents(".thumbWrap").width(b.width);var a=e.siblings("h3").size()==1?e.siblings("h3"):e.parent(".thumbWrap").siblings("h3");var f=parseInt(a.css("padding-left"))+parseInt(a.css("padding-right"));var d=parseInt(a.css("border-left-width"))+parseInt(a.css("border-right-width"));a.width(e.outerWidth(true)-f-d)}}}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+'")'})}}};