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[5501677]=new thumbnail(5501677,"311567","","Ciara_013a_thumb.jpg",130,195,5);thumbnails[5501678]=new thumbnail(5501678,"311567","","Ciara_012a_thumb.jpg",130,195,5);thumbnails[5501679]=new thumbnail(5501679,"311567","","Lorna_small_thumb.jpg",130,163,5);thumbnails[5550176]=new thumbnail(5550176,"314542","","Horses_small_2_thumb.jpg",130,195,5);thumbnails[5550184]=new thumbnail(5550184,"314542","","Horses_small_thumb.jpg",130,195,5);thumbnails[5550186]=new thumbnail(5550186,"314542","","Horses_small_3_thumb.jpg",130,195,5);thumbnails[5551465]=new thumbnail(5551465,"314542","","Badminton_2009_017_thumb.JPG",130,195,5);thumbnails[5551648]=new thumbnail(5551648,"314542","","Trees_show_129a_thumb.jpg",130,204,5);thumbnails[5551690]=new thumbnail(5551690,"314542","","red_rosette_thumb.jpg",130,100,5);thumbnails[5551692]=new thumbnail(5551692,"314542","","Rosie_thumb.jpg",130,195,5);thumbnails[5551694]=new thumbnail(5551694,"314542","","Rosie_and_Liam2_thumb.jpg",130,166,5);thumbnails[5551697]=new thumbnail(5551697,"314542","","PollyA_thumb.jpg",130,185,5);thumbnails[5551799]=new thumbnail(5551799,"314542","","Broomes_039A_thumb.jpg",130,87,5);thumbnails[5618128]=new thumbnail(5618128,"318408","","Lorna_1_thumb.jpg",130,195,5);thumbnails[5618310]=new thumbnail(5618310,"318408","","Models_121_thumb.JPG",130,195,5);thumbnails[5618317]=new thumbnail(5618317,"318408","","Models_133_thumb.JPG",130,195,5);thumbnails[5618373]=new thumbnail(5618373,"318408","","Model_1_thumb.jpg",130,195,5);thumbnails[5618404]=new thumbnail(5618404,"318408","","model_3_thumb.jpg",130,87,5);thumbnails[5618409]=new thumbnail(5618409,"318408","","model_4_thumb.jpg",130,195,5);thumbnails[5865513]=new thumbnail(5865513,"318408","","Amanda4_small_thumb.jpg",130,195,5);thumbnails[5868614]=new thumbnail(5868614,"318408","","Amanda5_small_thumb.jpg",130,195,5);thumbnails[5868852]=new thumbnail(5868852,"318408","","Amanda12_thumb.jpg",130,195,5);thumbnails[6395259]=new thumbnail(6395259,"311567","","Pam_1_thumb.jpg",130,182,5);thumbnails[6395261]=new thumbnail(6395261,"311567","","Alyn_1_thumb.jpg",130,182,5);thumbnails[6483201]=new thumbnail(6483201,"318408","","Amanda_edited_thumb.jpg",130,195,5);thumbnails[6483206]=new thumbnail(6483206,"357119","","Cardiff_bay_small_thumb.jpg",130,55,5);thumbnails[6483220]=new thumbnail(6483220,"357119","","cardiff_bay_small_3_thumb.jpg",130,87,5);thumbnails[6483237]=new thumbnail(6483237,"357119","","The_Bay1_thumb.jpg",130,87,5);thumbnails[6483254]=new thumbnail(6483254,"357119","","penarth_pier_thumb.jpg",130,87,5);thumbnails[6483317]=new thumbnail(6483317,"357119","","Cardiff_bay_b_thumb.jpg",130,87,5);thumbnails[6483320]=new thumbnail(6483320,"357119","","cardiff_bay_a_thumb.jpg",130,87,5);thumbnails[6483322]=new thumbnail(6483322,"357119","","Cwmcarn_021_thumb.jpg",130,65,5);thumbnails[6483323]=new thumbnail(6483323,"357119","","Cwmcarn_025_thumb.jpg",130,87,5);thumbnails[6483325]=new thumbnail(6483325,"357119","","cwmcarn_thumb.jpg",130,87,5);thumbnails[5291301]=new thumbnail(5291301,"297618","","Bridal_shoot_132_thumb.JPG",130,195,5);thumbnails[5291303]=new thumbnail(5291303,"297618","","Bridal_shoot_116_thumb.JPG",130,195,5);thumbnails[5291434]=new thumbnail(5291434,"297618","","Kathy_and_Rob_wedding_52a_thumb.jpg",130,195,5);thumbnails[5291442]=new thumbnail(5291442,"297618","","Kathy_and_Rob_wedding_54a_thumb.jpg",130,195,5);thumbnails[5291458]=new thumbnail(5291458,"297618","","Kathy_and_Rob_wedding_57a_thumb.jpg",130,87,5);thumbnails[5291475]=new thumbnail(5291475,"297618","","Kathy_and_Rob_wedding_62_thumb.JPG",130,195,5);thumbnails[5291477]=new thumbnail(5291477,"297618","","Cathy_and_Rob_wedding_390b_thumb.jpg",130,87,5);thumbnails[5291783]=new thumbnail(5291783,"297618","","Cathy_and_Rob_wedding_064_thumb.JPG",130,195,5);thumbnails[5291784]=new thumbnail(5291784,"297618","","Cathy_and_Rob_wedding_321a_thumb.jpg",130,87,5);thumbnails[5810299]=new thumbnail(5810299,"297618","","Lucy_and_Wesleys_wedding_105_thumb.JPG",130,195,5);thumbnails[5810815]=new thumbnail(5810815,"297618","","Lucy_and_Wesleys_wedding_113_thumb.JPG",130,195,5);thumbnails[5292623]=new thumbnail(5292623,"297709","","Mel_and_James_wedding_343a1_thumb.jpg",130,87,5);thumbnails[5292687]=new thumbnail(5292687,"297709","","Mel_and_James_wedding_472a_thumb.jpg",130,87,5);thumbnails[5292715]=new thumbnail(5292715,"297709","","Mel_and_James_wedding_474a_thumb.jpg",130,87,5);thumbnails[5292717]=new thumbnail(5292717,"297709","","Mel_and_James_wedding_492a_thumb.jpg",130,195,5);thumbnails[5292720]=new thumbnail(5292720,"297709","","Mel_and_James_wedding_505a_thumb.jpg",130,195,5);var galleries=new Object();galleries[314542]=new gallery(314542,"5551799,5551697,5551694,5551692,5551690,5551648,5551465,5550186,5550184,5550176","Equine","section376992",[5550176,5550184,5550186,5551465,5551648,5551690,5551692,5551694,5551697,5551799]);galleries[318408]=new gallery(318408,"6483201,5868852,5868614,5865513,5618409,5618404,5618373,5618317,5618310,5618128","Fashion","section381823",[5618128,5618310,5618317,5618373,5618404,5618409,5865513,5868614,5868852,6483201]);galleries[311567]=new gallery(311567,"6395261,6395259,5501679,5501678,5501677","Headshots","section373262",[5501677,5501678,5501679,6395259,6395261]);galleries[357119]=new gallery(357119,"6483325,6483323,6483322,6483320,6483317,6483254,6483237,6483220,6483206","Landscapes","section425752",[6483206,6483220,6483237,6483254,6483317,6483320,6483322,6483323,6483325]);galleries[297618]=new gallery(297618,"5810815,5810299,5291784,5291783,5291477,5291475,5291458,5291442,5291434,5291303","Weddings","gallery",[5291301,5291303,5291434,5291442,5291458,5291475,5291477,5291783,5291784,5810299,5810815]);galleries[297709]=new gallery(297709,"5292720,5292717,5292715,5292687,5292623","Portraits","gallery",[5292623,5292687,5292715,5292717,5292720]);var imageSets=new Object();imageSets[233843]="5550186,5550184,5550176";imageSets[1]="5550186,5550184,5550176,5501679,5501677,5291434,5291301";imageSets[3]="6483325,6483323,6483322,6483320,6483317,6483254,6483237,6483220,6483206,6483201,6395261,6395259,5868852,5868614,5865513,5810815,5810299,5618409,5618404,5618373,5618317,5618310,5618128,5551799,5551697,5551694,5551692,5551690,5551648,5551465,5550186,5550184,5550176,5501679,5501678,5501677,5292720,5292717,5292715,5292687,5292623,5291784,5291783,5291477,5291475,5291458,5291442,5291434,5291303,5291301";imageSets[234806]="5291434,5291301";imageSets[234661]="5501679,5501678,5501677";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/Sianlewis/images";break}switch(a){case 1:b="http://www1.clikpic.com/Sianlewis/images";break}switch(a){case 2:b="http://admin.clikpic.com/Sianlewis/images";break}switch(a){case 24:b="http://tpc15/clikpic/Sianlewis/images";break}switch(a){case 4:b="http://www.clikchurch.com/Sianlewis/images";break}switch(a){case 5:b="http://www2.clikpic.com/Sianlewis/images";break}switch(a){case 22:b="http://tpc5/clikpic/Sianlewis/images";break}switch(a){case 23:b="http://tpc10/clikpic/Sianlewis/images";break}switch(a){case 25:b="http://tpc16/clikpic/Sianlewis/images";break}switch(a){case 15:b="http://www3.clikpic.com/Sianlewis/images";break}switch(a){case 18:b="http://www4.clikpic.com/Sianlewis/images";break}switch(a){case 19:b="http://www5.clikpic.com/Sianlewis/images";break}switch(a){case 31:b="http://www7.clikpic.com/Sianlewis/images";break}switch(a){case 32:b="http://admin2.clikpic.com/Sianlewis/images";break}switch(a){case 33:b="http://www8.clikpic.com/Sianlewis/images";break}switch(a){case 34:b="http://www9.clikpic.com/Sianlewis/images";break}switch(a){case 35:b="http://admin3.clikpic.com/Sianlewis/images";break}switch(a){case 37:b="http://admin4.clikpic.com/Sianlewis/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="Sian Lewis 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;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).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="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="SIANLEWIS">';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<100){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+'")'})}}};