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[5352142]=new thumbnail(5352142,"","","Homepage1_thumb.jpg",130,138,15);thumbnails[5352227]=new thumbnail(5352227,"","","Homepage2_thumb.jpg",130,138,15);thumbnails[5352228]=new thumbnail(5352228,"","","Homepage3_thumb.jpg",130,138,15);thumbnails[5748315]=new thumbnail(5748315,"","","Homepage4_thumb.jpg",130,138,15);thumbnails[3711917]=new thumbnail(3711917,"72792","","BL0013_thumb.jpg",130,83,15);thumbnails[3711876]=new thumbnail(3711876,"72792","","BL0011_thumb.jpg",130,99,15);thumbnails[3711888]=new thumbnail(3711888,"72792","","BL0012_thumb.jpg",130,194,15);thumbnails[1202100]=new thumbnail(1202100,"72792","","CastleStairCase_thumb.jpg",130,173,15);thumbnails[1202096]=new thumbnail(1202096,"72792","","CastleEntrance1_thumb.jpg",130,147,15);thumbnails[1202108]=new thumbnail(1202108,"72792","","FotheringhayChurch2_thumb.jpg",130,98,15);thumbnails[1202123]=new thumbnail(1202123,"72792","","NorthernIrelandLookOutTower_thumb.jpg",130,83,15);thumbnails[1202105]=new thumbnail(1202105,"72792","","FotheringhayChurch1_thumb.jpg",130,87,15);thumbnails[1202016]=new thumbnail(1202016,"72792","","IrelandCastleTrack_thumb.jpg",130,76,15);thumbnails[1202129]=new thumbnail(1202129,"72792","","SilentValleyNorthernIreland_thumb.jpg",130,69,15);thumbnails[1291297]=new thumbnail(1291297,"72792","","WillyLottsCottage_thumb.jpg",130,88,15);thumbnails[1304733]=new thumbnail(1304733,"72792","","HaywainView_thumb.jpg",130,87,15);thumbnails[3709626]=new thumbnail(3709626,"86254","","AN0001_thumb.jpg",130,92,15);thumbnails[3709629]=new thumbnail(3709629,"86254","","AN0002_thumb.jpg",130,92,15);thumbnails[3709631]=new thumbnail(3709631,"86254","","AN0003_thumb.jpg",130,92,15);thumbnails[3709633]=new thumbnail(3709633,"86254","","AN0004_thumb.jpg",130,78,15);thumbnails[3709636]=new thumbnail(3709636,"86254","","AN0005_thumb.jpg",130,98,15);thumbnails[3709638]=new thumbnail(3709638,"86254","","AN0006_thumb.jpg",130,86,15);thumbnails[3709639]=new thumbnail(3709639,"86254","","AN0007_thumb.jpg",130,86,15);thumbnails[3709641]=new thumbnail(3709641,"86254","","AN0008_thumb.jpg",130,82,15);thumbnails[3709643]=new thumbnail(3709643,"86254","","AN0009_thumb.jpg",130,67,15);thumbnails[3709645]=new thumbnail(3709645,"86254","","AN0010_thumb.jpg",130,89,15);thumbnails[3709646]=new thumbnail(3709646,"86254","","AN0011_thumb.jpg",130,124,15);thumbnails[3709648]=new thumbnail(3709648,"86254","","AN0012_thumb.jpg",130,110,15);thumbnails[3709655]=new thumbnail(3709655,"86254","","AN0013_thumb.jpg",130,70,15);thumbnails[3709657]=new thumbnail(3709657,"86254","","AN0014_thumb.jpg",130,113,15);thumbnails[3709659]=new thumbnail(3709659,"86254","","AN0015_thumb.jpg",130,79,15);thumbnails[3709661]=new thumbnail(3709661,"86254","","AN0016_thumb.jpg",130,75,15);thumbnails[3709685]=new thumbnail(3709685,"86257","","PL0001_thumb.jpg",130,104,15);thumbnails[3709687]=new thumbnail(3709687,"86257","","PL0002_thumb.jpg",130,87,15);thumbnails[3709689]=new thumbnail(3709689,"86257","","PL0003_thumb.jpg",130,129,15);thumbnails[3709690]=new thumbnail(3709690,"86257","","PL0004_thumb.jpg",130,102,15);thumbnails[3709691]=new thumbnail(3709691,"86257","","PL0005_thumb.jpg",130,88,15);thumbnails[3709693]=new thumbnail(3709693,"86257","","PL0006_thumb.jpg",130,93,15);thumbnails[5919618]=new thumbnail(5919618,"86257","","PL0131_thumb.jpg",130,98,15);thumbnails[5919621]=new thumbnail(5919621,"86257","","PL0132_thumb.jpg",130,88,15);thumbnails[5919623]=new thumbnail(5919623,"86257","","PL0133_thumb.jpg",130,88,15);thumbnails[1206138]=new thumbnail(1206138,"86257","","WaterLilly_thumb.jpg",130,129,15);thumbnails[1202164]=new thumbnail(1202164,"86257","","FlowerAndTheBee_thumb.jpg",130,129,15);thumbnails[1202163]=new thumbnail(1202163,"86257","","Dandelion_thumb.jpg",130,105,15);thumbnails[1202161]=new thumbnail(1202161,"86257","","ButterCups_thumb.jpg",130,67,15);thumbnails[1291472]=new thumbnail(1291472,"86257","","HeartCarvedTree_thumb.jpg",130,188,15);thumbnails[1291481]=new thumbnail(1291481,"86257","","TreesSkyWard_thumb.jpg",130,89,15);thumbnails[5128357]=new thumbnail(5128357,"86257","","PL0130_thumb.jpg",130,87,15);thumbnails[3838787]=new thumbnail(3838787,"91600","","LS002_thumb.jpg",130,130,15);thumbnails[3838803]=new thumbnail(3838803,"91600","","LS0003_thumb.jpg",130,98,15);thumbnails[3838816]=new thumbnail(3838816,"91600","","LS0004_thumb.jpg",130,88,15);thumbnails[3838826]=new thumbnail(3838826,"91600","","LS0005_thumb.jpg",130,88,15);thumbnails[3838844]=new thumbnail(3838844,"91600","","LS0006_thumb.jpg",130,103,15);thumbnails[4334963]=new thumbnail(4334963,"91600","","LS0009_thumb.jpg",130,98,15);thumbnails[4335057]=new thumbnail(4335057,"91600","","LS0010_thumb.jpg",130,92,15);thumbnails[4335059]=new thumbnail(4335059,"91600","","LS0011_thumb.jpg",130,185,15);thumbnails[4335061]=new thumbnail(4335061,"91600","","LS0012_thumb.jpg",130,87,15);thumbnails[4335380]=new thumbnail(4335380,"91600","","LS0013_thumb.jpg",130,160,15);thumbnails[4335384]=new thumbnail(4335384,"91600","","LS0014_thumb.jpg",130,159,15);thumbnails[4257030]=new thumbnail(4257030,"91600","","LS0007_thumb.jpg",130,167,15);thumbnails[4257043]=new thumbnail(4257043,"91600","","LS0008_thumb.jpg",130,84,15);thumbnails[1291491]=new thumbnail(1291491,"91600","","BlueRowBoat_thumb.jpg",130,124,15);thumbnails[5128229]=new thumbnail(5128229,"91600","","LS0015_thumb.jpg",130,83,15);thumbnails[5128238]=new thumbnail(5128238,"91600","","LS0016_thumb.jpg",130,68,15);thumbnails[3709700]=new thumbnail(3709700,"226686","","AU0004_thumb.jpg",130,83,15);thumbnails[3709702]=new thumbnail(3709702,"226686","","AU0003_thumb.jpg",130,83,15);thumbnails[3709703]=new thumbnail(3709703,"226686","","AU0001_thumb.jpg",130,104,15);thumbnails[3709705]=new thumbnail(3709705,"226686","","AU0002_thumb.jpg",130,86,15);thumbnails[3709708]=new thumbnail(3709708,"226686","","AU0005_2_thumb.jpg",130,104,15);thumbnails[3709711]=new thumbnail(3709711,"226686","","AU0006_thumb.jpg",130,83,15);thumbnails[3709712]=new thumbnail(3709712,"226686","","AU0007_thumb.jpg",130,101,15);thumbnails[3855191]=new thumbnail(3855191,"226686","","AU0008_thumb.jpg",130,86,15);thumbnails[3862262]=new thumbnail(3862262,"226686","","AU0009_thumb.jpg",130,87,15);thumbnails[3864759]=new thumbnail(3864759,"226686","","AU0010_thumb.jpg",130,101,15);thumbnails[4257080]=new thumbnail(4257080,"251877","","MO0001_thumb.jpg",130,113,15);thumbnails[4257083]=new thumbnail(4257083,"251877","","MO0002_thumb.jpg",130,168,15);thumbnails[4257145]=new thumbnail(4257145,"251877","","MO0003_thumb.jpg",130,168,15);thumbnails[4257146]=new thumbnail(4257146,"251877","","MO0004_thumb.jpg",130,192,15);thumbnails[4335397]=new thumbnail(4335397,"251877","","MO005_thumb.jpg",130,159,15);thumbnails[4335431]=new thumbnail(4335431,"251877","","MO006_thumb.jpg",130,87,15);thumbnails[4335456]=new thumbnail(4335456,"251877","","MO007_thumb.jpg",130,94,15);thumbnails[4335524]=new thumbnail(4335524,"251877","","MO008_thumb.jpg",130,99,15);thumbnails[4335648]=new thumbnail(4335648,"251877","","MO009_thumb.jpg",130,92,15);thumbnails[4336147]=new thumbnail(4336147,"251877","","MO010_thumb.jpg",130,87,15);thumbnails[4360744]=new thumbnail(4360744,"251877","","MO011_thumb.jpg",130,195,15);thumbnails[4360746]=new thumbnail(4360746,"251877","","MO012_thumb.jpg",130,150,15);var galleries=new Object();galleries[72792]=new gallery(72792,"3711917,3711876","Architecture","gallery",[3711917,3711876,3711888,1202100,1202096,1202108,1202123,1202105,1202016,1202129,1291297,1304733]);galleries[86254]=new gallery(86254,"3709646","Wildlife","gallery",[3709626,3709629,3709631,3709633,3709636,3709638,3709639,3709641,3709643,3709645,3709646,3709648,3709655,3709657,3709659,3709661]);galleries[86257]=new gallery(86257,"3709685","Nature","gallery",[3709685,3709687,3709689,3709690,3709691,3709693,5919618,5919621,5919623,1206138,1202164,1202163,1202161,1291472,1291481,5128357]);galleries[91600]=new gallery(91600,"5128238,5128229,4335384,4335380,4335061,4335059,4335057,4334963,4257043,4257030","Landscapes","gallery",[3838787,3838803,3838816,3838826,3838844,4334963,4335057,4335059,4335061,4335380,4335384,4257030,4257043,1291491,5128229,5128238]);galleries[226686]=new gallery(226686,"3709700","Automotive","gallery",[3709700,3709702,3709703,3709705,3709708,3709711,3709712,3855191,3862262,3864759]);galleries[251877]=new gallery(251877,"4360746,4360744,4336147,4335648,4335524,4335456,4335431,4335397,4257146,4257145","Mono","gallery",[4257080,4257083,4257145,4257146,4335397,4335431,4335456,4335524,4335648,4336147,4360744,4360746]);var imageSets=new Object();imageSets[1]="5748315,5352228,5352227,5352142";imageSets[2]="3711917,3711876,3709700,3709685,3709646";imageSets[3]="5919623,5919621,5919618,5748315,5352228,5352227,5352142,5128357,5128238,5128229,4360746,4360744,4336147,4335648,4335524,4335456,4335431,4335397,4335384,4335380,4335061,4335059,4335057,4334963,4257146,4257145,4257083,4257080,4257043,4257030,3864759,3862262,3855191,3838844,3838826,3838816,3838803,3838787,3711917,3711888,3711876,3709712,3709711,3709708,3709705,3709703,3709702,3709700,3709693,3709691";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/stuartgloch/images";break}switch(a){case 1:b="http://www1.clikpic.com/stuartgloch/images";break}switch(a){case 2:b="http://admin.clikpic.com/stuartgloch/images";break}switch(a){case 24:b="http://tpc15/clikpic/stuartgloch/images";break}switch(a){case 4:b="http://www.clikchurch.com/stuartgloch/images";break}switch(a){case 5:b="http://www2.clikpic.com/stuartgloch/images";break}switch(a){case 22:b="http://tpc5/clikpic/stuartgloch/images";break}switch(a){case 23:b="http://tpc10/clikpic/stuartgloch/images";break}switch(a){case 25:b="http://tpc16/clikpic/stuartgloch/images";break}switch(a){case 15:b="http://www3.clikpic.com/stuartgloch/images";break}switch(a){case 18:b="http://www4.clikpic.com/stuartgloch/images";break}switch(a){case 19:b="http://www5.clikpic.com/stuartgloch/images";break}switch(a){case 31:b="http://www7.clikpic.com/stuartgloch/images";break}switch(a){case 32:b="http://admin2.clikpic.com/stuartgloch/images";break}switch(a){case 33:b="http://www8.clikpic.com/stuartgloch/images";break}switch(a){case 34:b="http://www9.clikpic.com/stuartgloch/images";break}switch(a){case 35:b="http://admin3.clikpic.com/stuartgloch/images";break}switch(a){case 37:b="http://admin4.clikpic.com/stuartgloch/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="Stuart G Loch: "+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>Northamptonshire </strong>'+photos[b].location+"</p>"}if(photos[b].photographer!=""){a=a+'<p class="imageinfo" id="imagePhotographer"><strong>Stuart G Loch </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> 				&pound;"+(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+'")'})}}};