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[323054]=new thumbnail(323054,"27474","Anne Wilson - Boating Station, Pitlochry","Anne Wilson - Boating Station, Faskally Loch, Pitlochry_thumb..jpg",130,85,18);thumbnails[334806]=new thumbnail(334806,"27474","St Monan's Kirk by Jim Bowman","St_thumb.Monan's Kirk by Jim Bowman.jpg",130,93,18);thumbnails[340121]=new thumbnail(340121,"27474","Crathie Kirk by Jim Bowman","Crathie Kirk by Jim Bowman_thumb.jpg",130,94,18);thumbnails[345346]=new thumbnail(345346,"27474","His & Hers by Ron Forbes","His & Hers Ron Forbes_thumb.jpg",130,93,18);thumbnails[1030488]=new thumbnail(1030488,"27474","Field Edge","MFS Lg Poppy Group copy_thumb.jpg",130,167,18);thumbnails[1498943]=new thumbnail(1498943,"27474","Inveroran<br>\r\nby Pat Gibb","Inveroran_thumb.jpg",130,94,18);thumbnails[5757152]=new thumbnail(5757152,"27472","Pitlochry Gallery","037_thumb.JPG",130,86,18);thumbnails[334805]=new thumbnail(334805,"27474","Holyrood Palace by Jim Bowman","_Holyrood Palace by Jim Bowman_thumb.jpg",130,94,18);thumbnails[363677]=new thumbnail(363677,"27474","Bobby in Greyfriar's Churchyard","_7170776_thumb.jpg",130,95,18);thumbnails[340119]=new thumbnail(340119,"27472","Atholl Centre Entrance","Atholl Centre Entrance_thumb.jpg",130,97,18);thumbnails[342993]=new thumbnail(342993,"27474","Festival Theatre & Dam, Pitlochry. Anne Wilson","Festival Theatre & Dam, Pitlochry_thumb. Anne Wilson.jpg",130,96,18);thumbnails[1030480]=new thumbnail(1030480,"27474","Meconopsis (multi heads)","Multi Mecon WEB_thumb.jpg",130,93,18);thumbnails[345360]=new thumbnail(345360,"27474","Soup Kitchen","untitled Ron Forbes_thumb.jpg",130,91,18);thumbnails[1030470]=new thumbnail(1030470,"27474","Redheads","MFS Redheads_thumb.jpg",130,172,18);thumbnails[323065]=new thumbnail(323065,"27474","Sharon MacDonald    Kintyre,June","kintyrejune 2006_thumb.Linda Lincoln.jpg",130,97,18);thumbnails[341482]=new thumbnail(341482,"27474","Mallards by Sharon MacDonald","mallardswatercolour_thumb.jpg",130,96,18);thumbnails[1498942]=new thumbnail(1498942,"27474","Sunset over Holy Isle, Arran<br>\r\nby Pat Gibb","Sunset over Holy Isle, Arran_thumb.jpg",130,129,18);thumbnails[2359276]=new thumbnail(2359276,"27474","Eilean Donan Castle<br>\r\n<br>\r\nby Sharon MacDonald","DSC00315_thumb.jpg",130,98,18);thumbnails[323062]=new thumbnail(323062,"27474","Anne Wilson - Pennan,Cullykhan Bay","Anne Wilson - Pennan,Cullykhan Bay_thumb.jpg",130,103,18);thumbnails[340120]=new thumbnail(340120,"27474","Loch an Eilean by Jim Bowman","Loch an Eilean by Jim Bowman_thumb.jpg",130,99,18);thumbnails[363682]=new thumbnail(363682,"27474","Highland Cattle on Skye by Ron Forbes","_7170806_thumb.jpg",130,96,18);thumbnails[323063]=new thumbnail(323063,"27475","Linda Lincoln - Moray Coast","Moray Coast - Acrylic_thumb. Linda Lincoln.jpg",130,88,18);thumbnails[478398]=new thumbnail(478398,"27475","Blue Studio by Peter Green","Blue Studio by Peter Green_thumb.jpg",130,130,18);thumbnails[478404]=new thumbnail(478404,"27475","Lunch at the Studio by Peter Green","Lunch at the studio by Peter Green_thumb.jpg",130,181,18);thumbnails[345300]=new thumbnail(345300,"27475","Still Life with Fruit by Ron Forbes","Still Life with Fruit Ron Forbes_thumb.jpg",130,91,18);thumbnails[363683]=new thumbnail(363683,"27475","Festival Theatre, Pitlochy - Philip Greene","_7170823_thumb.jpg",130,96,18);thumbnails[2359274]=new thumbnail(2359274,"27475","Kintyre Shore<br>\r\n<br>\r\nby Sharon MacDonald","2007-11-26-1814-55_thumb.jpg",130,95,18);thumbnails[345123]=new thumbnail(345123,"27475","Gentle Giant by Ron Forbes-Oil","Gentle Giant Ron Forbes copy_thumb.jpg",130,107,18);thumbnails[342998]=new thumbnail(342998,"27475","Still Life (blue table) by Kate Kirby","Still Life2 by Kate Kirby_thumb.jpg",130,98,18);thumbnails[348605]=new thumbnail(348605,"27475","Charlie by Dawn Brooks","charlie_thumb.jpg",130,103,18);thumbnails[5818611]=new thumbnail(5818611,"27476","Proud Mother by Trevor Taylor","Proud_Mother_thumb.jpg",130,205,18);thumbnails[5818613]=new thumbnail(5818613,"27476","Stallion by Trevor Taylor","Stallion_thumb.jpg",130,114,18);thumbnails[5818615]=new thumbnail(5818615,"27476","Torrin, Isle of Sky by Trevor Taylor","Torrin_thumb.jpg",130,97,18);thumbnails[494867]=new thumbnail(494867,"27476","One Man in his Time<br>\r\nby Jim Bowman","OMIHT_thumb.jpg",130,179,18);thumbnails[363686]=new thumbnail(363686,"27476","Garden Door with Irises by Karin D. Scott","_7170834_thumb.jpg",130,118,18);thumbnails[363687]=new thumbnail(363687,"27476","Green Lane, Yorkshire by Karin D. Scott","_7170836_thumb.jpg",130,93,18);thumbnails[1030474]=new thumbnail(1030474,"27476","Golden Eagle","Golden Eagle MFS_thumb.jpg",130,121,18);thumbnails[478411]=new thumbnail(478411,"27476","The Salmon Leap & Falls of Tummel<br>\r\nGraphite drawing by Alfred Marsh","The Salmon Leap & Falls of Tummel_thumb.jpg",130,93,18);thumbnails[1030483]=new thumbnail(1030483,"27476","Osprey Head","Osprey Head_thumb.jpg",130,158,18);thumbnails[6437763]=new thumbnail(6437763,"27477","Fernsheart by Jo Cound","Fernsheart_thumb.jpg",130,181,18);thumbnails[6437771]=new thumbnail(6437771,"27477","Hermitage-Falls Braan by Jo Cound","Hermitage-FallsBraan_thumb.jpg",130,88,18);thumbnails[6437776]=new thumbnail(6437776,"27477","Ink Cap & Acer","InkCapAcer_thumb.jpg",130,180,18);thumbnails[348612]=new thumbnail(348612,"27477","Old Course in Winter<br>\r\nStan Farrow Photography","OLDCOURSEINWINTER_thumb.jpg",130,89,18);thumbnails[478401]=new thumbnail(478401,"27477","The Birks of Aberfeldy<br>\r\nStan Farrow Photography","Birksforweb_thumb.jpg",130,194,18);thumbnails[478407]=new thumbnail(478407,"27477","Lion at the Gate<br>\r\nMains of Edradour<br>\r\nPhotograph by Jan Moles","Lion at the gate, Mains of Edradour_thumb.JPG",130,173,18);thumbnails[1062549]=new thumbnail(1062549,"27477","First Light","FIRSTLIGHT_thumb.jpg",130,77,18);thumbnails[1062550]=new thumbnail(1062550,"27477","Nocturne","NOCTURNE_thumb.jpg",130,64,18);thumbnails[1062551]=new thumbnail(1062551,"27477","Solitude","SOLITUDE_thumb.jpg",130,73,18);thumbnails[351464]=new thumbnail(351464,"27477","Delphinium Head (buds) Jan Moles","Delphinium Head (buds) Jan Moles_thumb.jpg",130,173,18);thumbnails[334811]=new thumbnail(334811,"27478","Photographic Greeting Cards by Jan Moles","Acrylic Display_thumb.jpg",130,112,18);thumbnails[5757083]=new thumbnail(5757083,"27478","Station Cat Pottery - Fiona Gordon","stationcatsandbrooches_thumb.jpg",130,132,18);thumbnails[5757139]=new thumbnail(5757139,"27478","Knitwear by Na'an Meikleour","019_thumb.JPG",130,86,18);thumbnails[5757143]=new thumbnail(5757143,"27478","Produce by: Scottish Preserves","026_thumb.JPG",130,93,18);thumbnails[5757148]=new thumbnail(5757148,"27478","Crafts by: Peter Leigh","030_thumb.JPG",130,96,18);thumbnails[5757150]=new thumbnail(5757150,"27478","Handmade Greetings Cards by: Helen Porter","033_thumb.JPG",130,73,18);thumbnails[5757194]=new thumbnail(5757194,"27478","Handmade Greetings Cards by Helen Porter","H110F_thumb.JPG",130,130,18);thumbnails[5757200]=new thumbnail(5757200,"27478","Station Cat Pottery by Fiona Gordon","101_0250-21_thumb.jpg",130,174,18);thumbnails[1076386]=new thumbnail(1076386,"27478","Bargello Jewellery Box<br>\r\nby Karl Peet","Peet - Bargello Jewellery Box_thumb.jpg",130,98,18);thumbnails[1076582]=new thumbnail(1076582,"27478","Pyrography and engraved glass<br>\r\nby Jim Waite","Jim Waite - Glass & Pyrography_thumb.jpg",130,173,18);thumbnails[1076425]=new thumbnail(1076425,"27478","Industrial Art Jewellery Box <br>\r\nby Karl Peet","Peet - Industrial Art - Jewellery Box_thumb.JPG",130,98,18);thumbnails[1076431]=new thumbnail(1076431,"27478","Keepsake Box in Yew<br>\r\nby Karl Peet","Peet - Keepdake box in Yew_thumb.jpg",130,98,18);thumbnails[1076581]=new thumbnail(1076581,"27478","Engraved Glass by Jim Waite","Jim Waite - Engraved Glass_thumb.jpg",130,193,18);thumbnails[1076583]=new thumbnail(1076583,"27478","Jewellery by Julie Hay","Julie Hay - Jules Jewellery_thumb.jpg",130,84,18);thumbnails[351489]=new thumbnail(351489,"27478","Yvonne Arton, Blairgowrie","Yvonne Arton Blairgowrie_2_thumb.jpg",130,148,18);thumbnails[351490]=new thumbnail(351490,"27478","Yvonne Arton, Blairgowrie","Yvonne Arton Blairgowrie_thumb.jpg",130,211,18);thumbnails[6437754]=new thumbnail(6437754,"27478","Knitwear by Pandora Gill","DSC_5121croppedcompressed_thumb.jpg",130,159,18);var galleries=new Object();galleries[27472]=new gallery(27472,"5757152,340119","Summer/Autumn Exhibitions","gallery",[5757152,340119]);galleries[27474]=new gallery(27474,"1030488,1030480,1030470,363682,345346,341482,334805,323062,323054","Watercolour - Gallery 1","gallery",[323054,334806,340121,345346,1030488,1498943,334805,363677,342993,1030480,345360,1030470,323065,341482,1498942,2359276,323062,340120,363682]);galleries[27475]=new gallery(27475,"2359274,478398,363683,348605,345300,345123,342998,323063","Acrylic & Oil - Gallery 2","gallery",[323063,478398,478404,345300,363683,2359274,345123,342998,348605]);galleries[27476]=new gallery(27476,"1030483,1030474,494867,478411,363686","Mixed Media - Gallery 3","gallery",[5818611,5818613,5818615,494867,363686,363687,1030474,478411,1030483]);galleries[27477]=new gallery(27477,"6437763,1062550,1062549,478407,351464,348612","Photography - Gallery 4","gallery",[6437763,6437771,6437776,348612,478401,478407,1062549,1062550,1062551,351464]);galleries[27478]=new gallery(27478,"1076583,1076582,1076431,1076386,351490,351489,334811","Crafts - Gallery 5","gallery",[334811,5757083,5757139,5757143,5757148,5757150,5757194,5757200,1076386,1076582,1076425,1076431,1076581,1076583,351489,351490,6437754]);var imageSets=new Object();imageSets[1]="6437771,2359274,1076583,1076431,1062551,1062549,1030488,1030480,1030474,1030470,494867,478411,478404,478401,478398,363687,363686,363683,363682,363677,351490,348612,345346,345300,345123,342998,342993,341482,334805,323065,323063,323062,323054";imageSets[2]="6437763,2359274,1076583,1076582,1076431,1076386,1062550,1062549,1030488,1030483,1030480,1030474,1030470,494867,478411,478407,478398,363686,363683,363682,351490,351489,351464,348612,348605,345346,345300,345123,342998,341482,334811,334805,323063,323062,323054";imageSets[3]="6437776,6437771,6437763,6437754,5818615,5818613,5818611,5757200,5757194,5757152,5757150,5757148,5757143,5757139,5757083,2359276,2359274,1498943,1498942,1076583,1076582,1076581,1076431,1076425,1076386,1062551,1062550,1062549,1030488,1030483,1030480,1030474,1030470,494867,478411,478407,478404,478401,478398,363687,363686,363683,363682,363677,351490,351489,351464,348612,348605,345360";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 21:b="http://www6.clikpic.com/pgallery/images";break}switch(a){case 1:b="http://www1.clikpic.com/pgallery/images";break}switch(a){case 2:b="http://admin.clikpic.com/pgallery/images";break}switch(a){case 24:b="http://tpc15/clikpic/pgallery/images";break}switch(a){case 4:b="http://www.clikchurch.com/pgallery/images";break}switch(a){case 5:b="http://www2.clikpic.com/pgallery/images";break}switch(a){case 22:b="http://tpc5/clikpic/pgallery/images";break}switch(a){case 23:b="http://tpc10/clikpic/pgallery/images";break}switch(a){case 25:b="http://tpc16/clikpic/pgallery/images";break}switch(a){case 15:b="http://www3.clikpic.com/pgallery/images";break}switch(a){case 18:b="http://www4.clikpic.com/pgallery/images";break}switch(a){case 19:b="http://www5.clikpic.com/pgallery/images";break}switch(a){case 31:b="http://www7.clikpic.com/pgallery/images";break}switch(a){case 32:b="http://admin2.clikpic.com/pgallery/images";break}switch(a){case 33:b="http://www8.clikpic.com/pgallery/images";break}switch(a){case 34:b="http://www9.clikpic.com/pgallery/images";break}switch(a){case 35:b="http://admin3.clikpic.com/pgallery/images";break}switch(a){case 37:b="http://admin4.clikpic.com/pgallery/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="'+escape(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="Pitlochry Gallery Association: "+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({centre:true});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(b,a){imageID=randomListVal(galleries[b].featured_images);if(imageID!=0){a.src=thumbnails[imageID].src;a.width=thumbnails[imageID].width;a.height=thumbnails[imageID].height}}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+'")'})}}};