function WeeMenu(c){var k=this;var e=c.find(".edit-menu");var h=c.find("a.edit");var l=false;var a=c.closest(".charcoalBg");var b=c.find("li");this.MENU_ITEM_CLICKED="menuItemClicked";e.append($("<div />").addClass("tail"));j();o();function o(){h.bind("mouseenter",d);c.find("li").bind("click",function(){$(k).trigger({type:k.MENU_ITEM_CLICKED,originalTarget:$(this),originalParent:a})})}function d(){h.unbind("mouseenter",d);h.bind("mouseleave",g);e.bind("mouseenter",i);n()}function g(p){h.bind("mouseenter",d);h.unbind("mouseleave",g);setTimeout(f,500)}function i(p){e.unbind("mouseenter",i);e.bind("mouseleave",m);l=true;e.bind("mouseleave",m)}function m(p){e.unbind("mouseleave",m);l=false;j()}function n(){e.css("display","block");$("body").append(e);e.css({top:h.offset().top+40,left:h.offset().left-(e.width()/2)})}function j(){e.css("display","none")}function f(){e.unbind("mouseenter",i);if(l==false){j()}clearTimeout(f)}return k};var accordianImage=".accordianImage";var accordianArea=".accordianArea";function runAccordian(){globalFunc={};jQuery(accordianArea).hide();jQuery(".accordianImage .thumb").show();jQuery(accordianArea).show();jQuery.fn.accordianStart();jQuery.fn.thumbOrder();jQuery(accordianArea).each(function(){jQuery("h3",this).each(function(a){jQuery(this).addClass("link"+a).hover(function(){jQuery(this).parents(".accordianArea").siblings(".thumb").children("img").hide();jQuery(this).parents(".accordianArea").siblings(".thumb").children(".thumb"+a).show()},function(){})})})}function showOnMap(){var b=jQuery("#showOnMap");var c=jQuery("#backToItem");var d=jQuery("#itemOnMap");var a=jQuery("#itemDetail .mediaPanel");b.show();c.hide();jQuery(b).live("click",function(){jQuery(b).hide();jQuery(c).show();jQuery(a).hide();jQuery(d).css({position:"relative",left:"0"}).fadeIn("slow")});jQuery(c).live("click",function(){jQuery(c).hide();jQuery(b).show();jQuery(d).hide();jQuery(a).fadeIn("slow")})}function showEventOnMap(){var b=jQuery("#showOnMap");var c=jQuery("#backToEvent");var d=jQuery("#eventOnMap");var a=jQuery("#event_detail .mediaPanel");b.show();c.hide();d.hide();jQuery(b).live("click",function(){jQuery(b).hide();jQuery(c).show();jQuery(a).hide();jQuery(d).css({position:"relative",left:"0"}).fadeIn("slow")});jQuery(c).live("click",function(){jQuery(c).hide();jQuery(b).show();jQuery(d).hide();jQuery(a).fadeIn("slow")})}jQuery.fn.accordianStart=function(){jQuery(".accordianArea").accordion({header:"h3",autoHeight:false,selectedClass:"open",event:"mouseover",alwaysShow:false})};jQuery.fn.thumbOrder=function(){jQuery(accordianImage).each(function(){jQuery(".thumb img",this).each(function(a){jQuery(this).hide();jQuery(this).addClass("thumb"+a);jQuery("img.thumb0").show()})})};function featuredContent(){jQuery("#bannerNav").fadeIn("fast");jQuery(".bgImg").cycle({fx:"scrollHorz",speed:800,timeout:0,easing:"easeOutQuad",pager:"#bannerNav ul"})}jQuery.fn.clearField=function(){return this.focus(function(){if(this.value==this.defaultValue){this.value=""}}).blur(function(){if(!this.value.length){this.value=this.defaultValue}})};jQuery(document).ready(function(){jQuery(".clearField").clearField()});function mycarousel_initCallback1(a){jQuery("#firstCarousel .nextExploreBy").bind("click",function(){a.next();return false});jQuery("#firstCarousel .prevExploreBy").bind("click",function(){a.prev();return false})}function mycarousel_initCallback2(a){jQuery("#secondCarousel .nextExploreBy").bind("click",function(){a.next();return false});jQuery("#secondCarousel .prevExploreBy").bind("click",function(){a.prev();return false})}function mycarousel_initCallback3(a){jQuery("#thirdCarousel .nextExploreBy").bind("click",function(){a.next();return false});jQuery("#thirdCarousel .prevExploreBy").bind("click",function(){a.prev();return false})}function runExploreBy(){jQuery(".exploreByInvisible").removeClass();jQuery("#firstCarousel ul").jcarousel({scroll:2,initCallback:mycarousel_initCallback1,buttonNextHTML:null,buttonPrevHTML:null,start:5,offset:1});jQuery("#secondCarousel ul").jcarousel({scroll:2,initCallback:mycarousel_initCallback2,buttonNextHTML:null,buttonPrevHTML:null,start:5,offset:1});jQuery("#thirdCarousel ul").jcarousel({scroll:2,initCallback:mycarousel_initCallback3,buttonNextHTML:null,buttonPrevHTML:null,start:5,offset:1});jQuery("#exploreBy ul li img").mouseenter(function(c){var f=jQuery(this).parent().offset();var d=(f.left+0)+"px";var b=(f.top+-59)+"px";var a=jQuery(this).parents("li").children(".exploreHover").html();jQuery(".smlHoverPopup").html(a).css("left",d).css("top",b).fadeIn("fast")}).mouseleave(function(){jQuery(".smlHoverPopup").hide()})}function runGroupAccessPopup(){jQuery("#groupAccessDescriptionPopup").hide();jQuery("#groupAccess").mouseenter(function(c){var f=jQuery(this).offset();var d=(f.left+0)+"px";var b=(f.top+-40)+"px";var a=jQuery("#groupAccessDescriptionPopup",this).html();jQuery(".smlHoverPopup").html(a).css("left",d).css("top",b).fadeIn("fast")}).mouseleave(function(){jQuery(".smlHoverPopup").hide()})}function runActivityPopup(){jQuery("span.notificationHover").addClass("notificationHoverJS");jQuery(".notification").mouseenter(function(c){var f=jQuery(this).offset();var d=(f.left-50)+"px";var b=(f.top+-50)+"px";var a=jQuery(".notificationHover",this).html();jQuery(".smlHoverPopup").html(a).css({width:"200px",left:d,top:b}).fadeIn("fast")}).mouseleave(function(){jQuery(".smlHoverPopup").hide()})};jQuery(document).ready(function(){jQuery("input.storyLoad").click(function(a){a.preventDefault();jQuery(".storyBuilder").modal({opacity:"90"})});jQuery("a[modalloc]").click(function(){var a=jQuery.browser;if(a.msie&&parseInt(a.version)<7){return true}else{jQuery.modal('<iframe src="'+jQuery(this).attr("modalloc")+'" height="400" width="600" style="border:0">');return false}})});jQuery.fn.centerDiv=function(){this.css("position","absolute");this.css("top",($(".ajax_pagination_holder").height()-this.height())/2+$(".ajax_pagination_holder").scrollTop()+"px");this.css("left",($(".ajax_pagination_holder").width()-this.width())/2+$(".ajax_pagination_holder").scrollLeft()+"px");return this};function startAjax(){jQuery("body").ajaxStart(function(){jQuery(this).css("cursor","progress")}).ajaxStop(function(){jQuery(this).css("cursor","default")})}function addLastRowToTheme(){jQuery(".themeRow:last").addClass("lastRow")}jQuery.fn.center=function(a){return this.each(function(){var b=jQuery(this);b.css({position:a?"absolute":"fixed",left:"50%",top:"50%",zIndex:"10000"}).css({marginLeft:"-"+(b.outerWidth()/2)+"px",marginTop:"-"+(b.outerHeight()/2)+"px"});if(a){b.css({marginTop:parseInt(b.css("marginTop"),10)+jQuery(window).scrollTop(),marginLeft:parseInt(b.css("marginLeft"),10)+jQuery(window).scrollLeft()})}})};function fullScreenMap(c,d,b,a){$("#map_search_controls").hide();$("#fullScreenMap").show();$("#lnkHistoric").live("click",function(){fullScreenMapClick(d,c)});$("#fullScreenMap a").live("click",function(){fullScreenMapClick(d,c)});$("#normalMap a").live("click",function(){normalMapClick(a,b)})}function fullScreenMapClick(b,a){$("#map_search_controls").appendTo("#fullScreenMapHolder").show();$("#fullScreenMap").hide();$("#normalMap").show();$("body").addClass("fsMap");$("html, body").animate({scrollTop:0},"slow");$("#mapBoxWrapper .boxHeader").appendTo("#fullScreenMapHolder");$("#mapBoxWrapper #browser_map_wrapper").appendTo("#fullScreenMapHolder");$("#browser_map_wrapper").width(b).height(a);$("#map").width(b).height(a);$("#fullScreenMapHolder").show();map.controls[2].maximizeControl();map.updateSize()}function normalMapClick(b,a){$("#map_search_controls").hide();$("#fullScreenMap").show();$("#normalMap").hide();$("#fullScreenMapHolder").hide();$("body").removeClass("fsMap");$("#fullScreenMapHolder .boxHeader").insertBefore("#mapBoxWrapper #map_canvas");$("#fullScreenMapHolder #browser_map_wrapper").appendTo("#mapBoxWrapper #map_canvas");$("#browser_map_wrapper").width(b).height(a);$("#map").width(b).height(a);map.controls[2].minimizeControl();map.updateSize()}function addFromMap(){$("a#submitLocationLink").live("click",function(){var a=jQuery("#locationnametextbox").val();$(".locationInput").val(a);$(".formLeft").removeClass("minMapHeight");$(".mapLocationSelect").removeClass("showTheMap");return false});$(".useAmap").live("click",function(){$(".mapLocationSelect").addClass("showTheMap")});jQuery("#closeMap").live("click",function(){jQuery(".mapLocationSelect").removeClass("showTheMap")})}function timeline_key(){jQuery("#timeline_key").css({top:"0"});jQuery("#timeline_mask").css({height:"0"});jQuery("#timeline_btn").addClass("closed");jQuery("#timeline_btn").click(function(){if(jQuery(this).hasClass("closed")){jQuery("#timeline_mask").animate({top:"-200",height:"200"},1000);jQuery("#timeline_btn").animate({top:"-=200"},1000);jQuery(this).addClass("open").removeClass("closed");jQuery("#timeline_btn .icon").css({"background-position":"0 -16px"})}else{jQuery("#timeline_btn").animate({top:"+=200"},1000);jQuery("#timeline_mask").animate({top:"0",height:"0"},1000);jQuery(this).addClass("closed").removeClass("open");jQuery("#timeline_btn .icon").css({"background-position":"0 0"})}return false})}function orderbyDropDown(){var a=jQuery(".orderby");var c=jQuery(".orderby ul");a.css();c.addClass("jsDropDown");var d=0;jQuery(".orderby ul li").each(function(){if(jQuery(this).children("a").hasClass("active")){var g=jQuery(this).children("a");var h=g.attr("href");var i=g.text();c.prepend('<li><a href="'+h+'" id="selected">'+i+"</a></li>");d=1}jQuery(this).hide()});if(d!=1){var f=jQuery(".orderby ul li:first").children("a");var e=f.attr("href");var b=f.text();c.prepend('<li><a href="'+e+'" id="selected">'+b+"</a></li>");jQuery(".orderby ul li:first").next("li").children("a").addClass("active")}jQuery(".orderby ul").hover(function(){jQuery("#selected").parent().siblings().show()},function(){jQuery("#selected").parent().siblings().hide()})}function stripBorder(a){jQuery(a).css("border","0")}function stripBg(a){jQuery(a).css("background","none")}function familyTreeFix(a){className="firstListItem";jQuery(a).addClass(className)}jQuery.fn.modalpop=function(d){var a={speed:500,center:false};var d=$.extend(a,d);var c=$(window).width();var b=$("body").height();jQuery("body").append("<div id='mask'></div>");jQuery("#mask").css("height",b);jQuery("#mask").css("width",c);jQuery("#mask").css("opacity","0.8");jQuery("body").append("<div id='modalpop'></div>");return this.each(function(){jQuery(this).click(function(){$this=jQuery(this);jQuery("html, body").animate({scrollTop:0},"slow");var g=jQuery("#modalpop");var e=$("body").height();var f=$(window).width();if(a.center==true){$(g).css("top",e/2-$(g).height()/2)}else{$(g).css("top",200)}$(g).css("left",f/2-$(g).width()/2);jQuery("#mask").fadeIn(a.speed);jQuery(g).fadeIn(a.speed);return false});jQuery("#mask").click(function(){jQuery(this).fadeOut(a.speed);jQuery("#modalpop").empty();jQuery("#modalpop").fadeOut(a.speed)})})};function stripText(a,b){jQuery(a).each(function(){var c=jQuery(this).text();jQuery(this).html(c)})}var searchModel={updateSearch:function(){var a=jQuery(".langChange a").html();if(a=="Cymraeg"){jQuery("#header .searchBox").attr("value","What are you looking for?");return true}else{jQuery("#header .searchBox").attr("value","Am beth ydych chi'n edrych?");return true}},blur:function(a){if(typeof a==="object"){jQuery(a).attr("value"," ")}}};toto.prototype=new function(){this.a=function(){Print(456)}};function toto(){this.a=function(){Print(123);toto.prototype.a.call(this)}}jQuery("document").ready(function(){if(typeof document.getElementById("youmaynow")!=="undefined"){$("#youmaynow ul li").click(function(b){var c=$("#youmaynow ul li").index(this);window.location=$("#youmaynow ul li a").eq(c).attr("href")})}$(".upload-button input, #formSubmit input, #btn-finish input").val("");searchModel.updateSearch();jQuery("#header .searchBox").focus(function(){searchModel.blur(jQuery(this))});stripText("#popularPlaces select option","");if(jQuery("#genHolder").size()||jQuery("#genHolderHome").size()){stripBorder(".leftCol")}jQuery("#familytreelist li ul").parent("li").addClass("noBg");obj="#familytreelist li:eq(0)";if(jQuery("#familytreelist").size()){familyTreeFix(obj)}makeWelsh=function(){comp=jQuery(".langChange a").html();if(comp!="Cymraeg"){obj=jQuery("#OpenLayers_Control_MaximizeDiv img");obj2=jQuery("#OpenLayers_Control_MinimizeDiv img");obj.attr("src","images/btns/layer-switcher-maximize-cym.png");obj2.attr("src","images/btns/layer-switcher-minimize.png");obj.addClass("wider");obj2.addClass("wider");obj.show();obj2.show()}else{jQuery("#OpenLayers_Control_MaximizeDiv img").show();jQuery("#OpenLayers_Control_MinimizeDiv img").show()}};count=0;if(count<5){myInterval=setInterval(makeWelsh,2000);count+=1}else{clearInterval(myInterval)}$("li.edit").each(function(){var b=new WeeMenu($(this));$(b).bind(b.MENU_ITEM_CLICKED,function(f){var d=true;var c=f.originalTarget.find("a");if(c.hasClass("downloadLink")){a(f.originalParent.find(".copyrightConfirm"));f.preventDefault()}else{if(c.hasClass("collectionAddLink")){a(f.originalParent.find(".addToCollection"));f.preventDefault()}}})});function a(c){var b=c.parent();$("body").append(c);c.css({display:"block",position:"fixed",zIndex:"1000",textAlign:"left",top:(($(window).height()/2)-(c.outerHeight(true)/2)-100+"px"),left:(($(window).width()/2)-(c.outerWidth(true)/2)+"px")});c.find(".closebtn").bind("click",function(d){$(b).append(c);d.preventDefault();c.css({display:"none"});return false})}});function jsChapters(){var d=0;var a=jQuery("#chapterSelect");var b=jQuery("#chapterSelect li");var e=jQuery("#chapterSelect li a");var f=jQuery("#chapterSelect li:first");var f=jQuery("#chapterSelect li:first");jQuery(a).addClass("jsChapters");jQuery(e).each(function(){if(jQuery(this).width()>d){d=parseInt(jQuery(this).width())+26}jQuery(e).width(d)}).css("color","#3b3b3b");if(d>165){var c=d+46;jQuery("#chapter_menu").css({"min-width":c,width:c})}jQuery(f).clone().insertAfter(f).removeClass("selectedChapter");jQuery(f).addClass("selectedChapter").siblings().hide();jQuery(f).next().children("a").addClass("bold");jQuery(a).hover(function(){jQuery(f).siblings().show()},function(){jQuery(f).siblings().hide()})}function chapterClick(){var a=" #chapterHolder";var b="#chapterDiv";jQuery("#chapterSelect a,#storyPagination a").live("click",function(){jQuery("#chapterSelect a").removeClass("bold");jQuery(this).addClass("bold");var c=jQuery(this).attr("href");getChapter(c,a,b);jQuery(this).parents("#chapterSelect").children(".selectedChapter").html(jQuery(this).parent().html());return false})}function getChapter(b,a,c){jQuery.ajax({url:b,cache:false,dataType:"html",error:function(d){alert(Error-d)},success:function(e){var d=jQuery(c,e);jQuery(c).fadeOut().remove();jQuery(a).fadeIn("slow").append(d);jQuery("#storyPagination").html(jQuery("#storyPagination",e).html())}})};function filterClick(){var b=" #groups";var a="#groups";jQuery("#filter a").click(function(){jQuery("a").removeClass("active");jQuery(this).addClass("active");var c=jQuery(this).attr("href");getFilter(c,b,a);return false})}function getFilter(b,a,c){jQuery.ajax({url:b,cache:false,dataType:"html",error:function(d){alert(Error-d)},success:function(e){var d=jQuery(c,e);jQuery(c).fadeIn("slow").replaceWith(d)}})};var pageIndexes={};function runPagination(){runPaginationWithCallback(null)}function runPaginationWithCallback(a){if(jQuery.browser.msie&&jQuery.browser.version<=6){return false}else{jQuery("div.paginationScroll a.current").live("click",function(){return false});jQuery("div.paginationScroll a").live("click",function(){if(this.href==null||this.href.length==0){return false}var d=jQuery(this).parent();jQuery("div.paginationScroll").removeClass("pagClicked");d.addClass("pagClicked");var c=jQuery(this).parents(".paging").attr("id");var b=1;if(jQuery(this).children().size()>0){if(jQuery(this).hasClass("firstLink")){b=d.find(".hidFirstPage").val()}if(jQuery(this).hasClass("lastLink")){b=d.find(".hidLastPage").val()}if(jQuery(this).hasClass("prevLink")){b=d.find(".hidPreviousPage").val()}if(jQuery(this).hasClass("nextLink")){b=d.find(".hidNextPage").val()}}else{b=jQuery(this).text()}jQuery.cookie(c+"|"+window.location,b+"|"+this.href);d.children("a").removeClass("current");replacePaginationHtml(this.href,c,b,a);jQuery(this).addClass("current");return false});jQuery(".paging").each(function(){var b=jQuery(this).attr("id");var d=b+"|"+window.location;if(jQuery.cookie(d)){var c=jQuery.cookie(d).split("|");replacePaginationHtml(c[1],b,c[0],a)}})}}function replacePaginationHtml(b,a,e,f){if(!jQuery("#"+a+" .ajax_pagination_slider").html()){jQuery("#"+a+" .repeaterData").hide()}var d=1;if(pageIndexes[a]){d=pageIndexes[a]}pageIndexes[a]=e;var c=e-d;jQuery.get(b,{},function(i){jQuery("input[id^=__]").each(function(){jQuery(this).val(jQuery("#"+this.id,i).val())});var g=jQuery("#"+a,i);var j=jQuery("#"+a);if(!jQuery(".ajax_pagination_slider",j).html()){var n=jQuery("#"+a).parents("div.box");jQuery.scrollTo(n,0,{});jQuery(".repeaterData",j).html(jQuery(".repeaterData",g).html()).show()}else{var l=jQuery(".ajax_pagination_slider",j);var k=jQuery(".ajax_pagination_slide",j);var m=jQuery(".ajax_pagination_slide",g);var h=l.width();if(c>0){h=-h}m.css({position:"absolute",top:0,left:-h,width:Math.abs(h)});l.animate({left:h},1000,null,function(){l.css("left",0);m.css({position:"static",top:0,left:0});k.remove();runToolTip()});l.append(m)}jQuery(".paginationScroll",j).html(jQuery(".paginationScroll",g).html());if(f){f()}},"html")};function runTabs(){jQuery("#categoryTabs").addClass("jsTabs");jQuery("#categoryTabs li.active").prev().children("a").addClass("prevActive");jQuery("#categoryTabs li.active").prev(".cornerTab").addClass("activeCorner");jQuery("#categoryTabs li.active a").addClass("activeAnchor");jQuery("#categoryTabs li").hover(function(){jQuery(this).addClass("liTabHover");jQuery(this).prev().children("a").addClass("jsTabHover")},function(){jQuery(this).removeClass("liTabHover");jQuery(this).prev().children("a").removeClass("jsTabHover")});jQuery("li.firstTab").hover(function(){jQuery(this).prev().addClass("cornerTabhover")},function(){jQuery(this).prev().removeClass("cornerTabhover")})};jQuery(document).ready(function(){jQuery(".loginLink a").click(function(){jQuery("#loginPopUp").fadeIn("fast");jQuery("#loginPopUp .hide").show();jQuery("input.loginTxtUserName").focus();jQuery(".cancelBtn").click(function(){jQuery("#loginPopUp").fadeOut("fast")});return false});$(document).keydown(function(a){if(a.which==27){$("#loginPopUp").fadeOut("fast")}})});function runAddAnItem(){jQuery("#addBtnsLeft .AspNet-CheckBoxList").jcarousel({vertical:true,scroll:3});jQuery("#addBtnsRight .AspNet-CheckBoxList").jcarousel({vertical:true,scroll:3});jQuery(".jcarousel-prev-vertical").hover(function(){jQuery(this).addClass("jcarousel-prev-vertical-hover")},function(){jQuery(this).removeClass("jcarousel-prev-vertical-hover")});jQuery(".jcarousel-next-vertical").hover(function(){jQuery(this).addClass("jcarousel-next-vertical-hover")},function(){jQuery(this).removeClass("jcarousel-next-vertical-hover")});jQuery("#addToWhere .AspNet-CheckBoxList li").addClass("jsOn");jQuery("#addToWhere .AspNet-CheckBoxList li input").addClass("notChecked");jQuery("#addToWhere .AspNet-CheckBoxList li input:checkbox:checked").addClass("checked");jQuery("#addToWhere .AspNet-CheckBoxList li input.checked").each(function(){jQuery(this).parents("li").addClass("checkTick")});jQuery("#addToWhere .AspNet-CheckBoxList li").click(function(){if(jQuery("input",this).is(":checked")){jQuery("input",this).attr("checked",false);jQuery(this).removeClass("checkTick")}else{jQuery("input",this).attr("checked",true);jQuery(this).addClass("checkTick")}});jQuery("#originator").click(function(){if(jQuery("input",this).is(":checked")){jQuery(this).prev().attr("disabled",true)}else{jQuery(this).prev().attr("disabled",false)}})};function runInlineEdit(f,e){var g;var b=jQuery("#"+f);var a=b.find(".divDisplay");var d=b.find(".divEditor");var c=b.find(".divSaving");a.show();d.hide();a.find(".btnEdit").click(function(){jQuery(".editor").hide();var h=d.find(".editor");var i=a.find(".divContent").html();h.html(i);g=CKEDITOR.replace(h.attr("id"));a.hide();d.show()});d.find(".btnCancel").click(function(){a.show();d.hide();g.destroy();g=null});d.find(".btnSave").click(function(){var i=jQuery(d.find(".textKey"));jQuery(".textKey").not(i).attr("name","NA");i.attr("name","textKey");var h=i.next();$(".textValue").not(h).attr("name","NA");h.attr("name","textValue");h.val(g.getData());$("form").ajaxSubmit({url:e,complete:function(j){a.find(".divContent").html(j.responseText);h.val("");g.destroy();g=null;c.hide();d.hide();a.show()},beforeSubmit:function(j,l,m){c.show();for(var k=0;k<j.length;k++){if(j[k]["name"]=="__VIEWSTATE"){j[k]["name"]="NA";j[k]["value"]=""}}}})})};(function(a){a.imageZoom={defaults:{zoomSize:104}};a.fn.extend({imageZoom:function(k){var k=a.extend({},a.imageZoom.defaults,k);var h=this.clone();var e=document.createElement("span");this.replaceWith(e);var f=a(e);f.addClass("imageZoomWrap");var b=a('<a href="'+h.attr("imageZoomUrl")+'" class="fancybox"></a>');b.append(h);b.append('<span class="imageZoomMover"><span class="imageZoomLarge"><img alt="" src="" /></span></span>');f.append(b);var m=f.find("[imageZoomUrl]");var d=f.find(".imageZoomMover");var i=f.find(".imageZoomLarge");var j=i.find("img");var l={x:0,y:0};var c=k.zoomSize/2;var n=true;j.load(function(){if(m.width()>=j.width()||m.height()>=j.height()){n=false;d.hide()}else{d.css({left:-10000}).show();l.x=j.width()/m.width();l.y=j.height()/m.height();d.hide()}});f.mousemove(function(o){if(!g(o,m)){d.hide()}else{if(!n){return}if(!j.attr("src")){j.attr("src",h.attr("imageZoomUrl"))}d.css({left:o.pageX-f.offset().left-c,top:o.pageY-f.offset().top-c});i.css({left:(-1*(o.pageX-m.offset().left)*l.x)+c,top:(-1*(o.pageY-m.offset().top)*l.y)+c});d.show()}});f.find("a.fancybox").fancybox({transitionIn:"elastic",transitionOut:"elastic",easingIn:"easeOutBack",easingOut:"easeInBack",hideOnContentClick:true,showCloseButton:false,overlayOpacity:0.7});function g(o,p){if(o.pageX<p.offset().left){return false}if(o.pageX>p.offset().left+p.width()){return false}if(o.pageY<p.offset().top){return false}if(o.pageY>p.offset().top+p.height()){return false}return true}return f}})})(jQuery);function ToolTip(a){var b=a.find(".toolTipTarget");var d=a.find(".toolTipText").html();var a=$("body");var c=function(){var f=b.offset();$(".tooltip").remove();a.append('<div class="tooltip">'+d+'<div class="tail"></div></div>');$(".tooltip .tail").css("top",$(".tooltip").outerHeight());$(".tooltip").css("top",f.top-($(".tooltip").outerHeight()+10)).css("left",f.left);if(b.find(".toolTipHint").css("float")=="left"){$(".tooltip").css("left",f.left-b.width())}if($.browser.msie){$(".tooltip").css("top",parseInt($(".tooltip").css("top"))-15)}else{$(".tooltip").animate({opacity:"1",top:"-=5"},200)}};var e=function(){if($.browser.msie){$(".tooltip").remove()}else{$(".tooltip").animate({opacity:"0",top:"+=5"},200,function(){$(this).remove()})}};b.hover(function(){c()},function(){e()})}$(function(){runToolTip()});function runToolTip(){$(".toolTipContainer").each(function(){ToolTip($(this))})};if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());var casgliadLogger=1;function logItemViews(a){doLog(a,"Views")}function logStoryBuilderUses(a){doLog(a,"StoryBuilderUses")}function logLearningUses(a){doLog(a,"LearningUses")}function logTripUses(a){doLog(a,"TripUses")}function logTrailUses(a){doLog(a,"TrailUses")}function logCollectionUses(a){doLog(a,"CollectionUses")}function doLog(b,a){var c={id:b};doLogStats("aggregate",a,c)}function doLogStats(d,c,e){if(typeof(e)!="undefined"){if(typeof(navigator.userAgent)!="undefined"){e.browser=navigator.userAgent}if(typeof(document.location.href)!="undefined"){e.referrer=document.location.href}}var b={category:c,adhoc:e};if(e!=null){b.adhoc=e}var a;try{a=JSON.stringify(b);$.post("/Service/Ajax/Log/"+d,a);return false}catch(f){if(typeof(console)!="undefined"){console.log(f)}}};(function(){var b,a;var c=function(d,e){return function(){return d.apply(e,arguments)}};if((a=window.App)==null){window.App={}}b=jQuery;App.Carousel=(function(){function d(e,f){this.find=c(this.find,this);this.onAnimationComplete=c(this.onAnimationComplete,this);this.drag=c(this.drag,this);this.onTouchMove=c(this.onTouchMove,this);this.onTouchEnd=c(this.onTouchEnd,this);this.onTouchStart=c(this.onTouchStart,this);this.bindUIEvents=c(this.bindUIEvents,this);this.settings={};this.container=e;this.outer={};this.inner={};this.uiParent={};this.prevBtn={};this.nextBtn={};this.slides={};this.slideWidth=0;this.totalWidth=0;this.currentIndex=0;this.numSlides=0;this.currentSlide={};this.isMoving=false;this.pagination={};this.dotNav={};this.container.addClass("carousel");this.applySettings(f);this.bindToDOM();this.initUI();this.initSlides();this.bindUIEvents();this.goTo(0,true)}d.prototype.applySettings=function(e){this.settings={animationMethod:"jQuery",animationType:"slide",slideshow:true,transitionDelay:2000,transitionSpeed:1000,transitionStep:2,hasDotNav:false,hasPagination:false,touchEnabled:false,infinite:true,loop:true,preloadImages:true,selectors:{slide:".slide",outer:".outerC",inner:".innerC",prev:".prevBtn",next:".nextBtn",uiParent:"",paginationContainer:"",paginationNav:".dot_nav",pagination:".pagination",paginationCurrent:".currentPage",paginationTotal:".total"},callBacks:{onChange:function(){},onChangeComplete:function(){}}};return b.extend(true,this.settings,e)};d.prototype.bindToDOM=function(){this.outer=this.find("outer");this.inner=this.find("inner");this.slides=this.find("slide");return this.numSlides=this.slides.length};d.prototype.initSlides=function(){if(this.settings.infinite){this.appendClonedSlides();this.slides=this.find("slide");this.numSlides=this.slides.length}if(this.settings.preloadImages){this.preload()}this.applyStyles();if(this.numSlides<this.settings.transitionStep){return this.removeUI()}};d.prototype.appendClonedSlides=function(){this.inner.append(this.slides.eq(0).clone().addClass("clone").css({"float":"left"}));return this.inner.prepend(this.slides.eq(this.numSlides-1).clone().addClass("clone").css({"float":"left"}))};d.prototype.applyStyles=function(){var e;var f=this;e=this.find("slide");e.each(function(h,g){return f.totalWidth+=b(g).outerWidth(true)});this.inner.css({width:this.totalWidth});this.slideWidth=e.eq(0).outerWidth(true);this.outer.css({width:this.slideWidth*this.settings.transitionStep,overflow:"hidden"});this.slides.css({"float":"left"});return this.inner.css({position:"relative",overflow:"hidden"})};d.prototype.preload=function(){this.container.css("visibility","visible");return this.inner.fadeOut(0).fadeIn("500")};d.prototype.initUI=function(){this.uiParent=this.getContainer("uiParent",this.container);this.nextBtn=this.find("next");this.prevBtn=this.find("prev");if(this.settings.hasDotNav){this.dotNav=new App.DotNav(this.getContainer("paginationContainer",this.uiParent))}if(this.settings.hasPagination){return this.pagination=new App.Pagination(this.getContainer("paginationContainer",this.uiParent),this.getSelector("pagination"),this.getSelector("paginationCurrent"),this.getSelector("paginationTotal"),this.numSlides)}};d.prototype.removeUI=function(){this.nextBtn.remove();return this.prevBtn.remove()};d.prototype.bindUIEvents=function(){var e=this;this.nextBtn.bind("click",function(f){f.preventDefault();return e.next()});this.prevBtn.bind("click",function(f){f.preventDefault();return e.prev()});if(this.settings.touchEnabled){return this.inner.bind("touchstart",this.onTouchStart)}};d.prototype.onTouchStart=function(f){this.innerLeft=parseInt(this.inner.css("left"));this.startX=f.originalEvent.touches[0].pageX;this.inner.bind("touchend",this.onTouchEnd);this.inner.bind("touchmove",this.onTouchMove);return this.drag(f.originalEvent)};d.prototype.onTouchEnd=function(g){var f;this.inner.unbind("touchend",this.onTouchEnd);f=this.startX-this.endX;if(f>50){return this.next()}else{if(f<-50){return this.prev()}else{return this.goTo(this.currentIndex)}}};d.prototype.onTouchMove=function(f){return this.drag(f.originalEvent)};d.prototype.drag=function(f){this.endX=f.touches[0].pageX;return this.inner.css({left:this.innerLeft-(this.startX-this.endX)})};d.prototype.goTo=function(f,e){if(this.isMoving){return false}this.currentIndex=f;if(!e){this.isMoving=true}App.Tween.To({target:this.inner,props:{left:0-(this.currentIndex+1)*this.slideWidth},duration:e?0:this.settings.transitionSpeed,complete:this.onAnimationComplete});if(this.currentIndex<0){return this.pagination.setPage(this.numSlides-2)}else{if(this.currentIndex>(this.numSlides-3)){return this.pagination.setPage(1)}else{return this.pagination.setPage(this.currentIndex+1)}}};d.prototype.prev=function(){return this.goTo(this.currentIndex-1,false)};d.prototype.next=function(){return this.goTo(this.currentIndex+1,false)};d.prototype.onAnimationComplete=function(){this.isMoving=false;if(this.currentIndex===-1){return this.goTo(this.numSlides-3,true)}else{if(this.currentIndex===this.numSlides-2){return this.goTo(0,true)}}};d.prototype.find=function(g){var e;e=this.container.find(this.settings.selectors[g]);if(e.length===0){return undefined}else{return e}};d.prototype.getContainer=function(e,f){if(this.settings.selectors[e]===""){return f}else{return this.find(e)}};d.prototype.getSelector=function(e){var f;f=this.settings.selectors[e];return f.slice(1,f.length)};return d})();App.DotNav=(function(){d.prototype.dotNav={};function d(e){this.dotNav=e}d.prototype.initPaginationNav=function(){var j,e,f,g,h;this.dotNav.append("<ol class='"+(this.getSelector("dotNav"))+"'></ol>");g=this.slides;h=[];for(j=0,f=g.length;j<f;j++){e=g[j];h.push(this.dotNav.append("<li>"+j+"</li>"))}return h};return d})();App.Pagination=(function(){d.prototype.paginationCurrent={};d.prototype.paginationTotal={};function d(g,j,i,e,h){var f;f=b("<div />").addClass(j).append(this.paginationCurrent=b("<span />").addClass(i),this.paginationTotal=b("<span />").addClass(e).html("/0"+h));g.append(f)}d.prototype.setPage=function(e){this.paginationCurrent.html("");return b("<div />").html("0"+e)};App.Tween=(function(){var f=this;function e(){}e.To=function(g){if(App.CSS3Detection.GetProp("Transition")!=null){return e.css3Animate(g)}else{return e.jqAnimate(g)}};e.jqAnimate=function(g){return g.target.animate(g.props,{duration:g.duration,complete:g.complete})};e.css3Animate=function(h){var j,m,k,l,g,i;j=App.CSS3Detection.GetProp;l={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"msTransitionEnd",transition:"transitionEnd"};k=h.target.get(0);k.addEventListener(l[j("Transition")],h.complete,false);i=h.props;for(m in i){g=i[m];k.style[""+(j("TransitionProperty"))]=m;k.style[m]=""+(g+this.pxMap(m))}k.style[""+(j("TransitionDuration"))]=""+(h.duration/1000)+"s";return k.style[""+(j("TransitionTimingFunction"))]="ease-in-out"};e.pxMap=function(k){var j,i,g,h;h=["left","right","top","bottom","width","height"];for(i=0,g=h.length;i<g;i++){j=h[i];if(k===j){return"px"}else{return""}}};return e}).call(this);return d}).call(this);App.CSS3Detection=(function(){var e;function d(){}e=["","Webkit","Moz","O","ms","Khtml"];d.GetProp=function(j){var i,h,g,f;for(g=0,f=e.length;g<f;g++){h=e[g];i=""+h+j;if(document.body.style[i]!=null){return i}}};d.GetVendorPrefix=function(i){var h,g,f;for(g=0,f=e.length;g<f;g++){h=e[g];if(document.body.style[""+h+i]!=null){return"-"+h+"-"}}};return d})()}).call(this);
