function messageCentreNotification(){if(newWindowOpen!=undefined&&newWindowOpen!=null&&(newWindowOpen.focus(),newWindowOpen.document!=undefined&&newWindowOpen.document!=null)){var n=newWindowOpen.document.getElementById("messageBody");n&&n.focus()}}function viewprofile(n,t){var i=t101.settings.v3PilotUrl,r=v3ProfilePage.replace("{urlBase}",i),u=t101.helpers.getLanguageFromCookie(),f=r.replace("{lang}",u);if(getProfileWindowDimensions(),t101.settings.featureflags.openProfileInV3=="True"){let i;i=t?n+"?version="+t:n;newWindowOpen=window.open(f+i,n,"resizable=yes,scrollbars=yes,status=0,width=1150,height="+xHeight)}else newWindowOpen=window.open("/"+profilepage+"?id="+n,n,"resizable=yes,scrollbars=yes,status=0,width="+xWidth+",height="+xHeight);giveWindowFocus(0)}function showEvent(n){newWindowOpen=window.open("/"+t101.helpers.getLanguageFromCookie()+"/Events/Calendar/Event/"+n,"wgm_main");giveWindowFocus(0)}function showInMainWindow(n){var t=window.location.host.split("."),i;t<3||(i=window.location.protocol+"//www."+t[t.length-2]+"."+t[t.length-1],newWindowOpen=window.open(i+n,"wgm_main"),giveWindowFocus(0))}function roundCorners(){jQuery(".corners_container .title, .corners_container .title_small").corner(settingsTop);jQuery(".corner_footer").corner(settingsBottom);jQuery(".corners_button_container").corner(settings);jQuery(".profile_container_title").corner(settingsTop);jQuery(".profile_container_footer").corner(settingsBottom);jQuery(".profile_container").corner(settings);jQuery(".generic_tabs .tab, .generic_tabs .tab_selected").corner(settingsTop);jQuery(".PullDownTabs LI").corner(settingsBottom);jQuery(".SiteTabs LI A, .SelectedSiteTab LI A").corner(settingsTop);jQuery(".tab").corner(settingsTop);jQuery(".tab_selected").corner(settingsTop)}function upgrade(){newWindowOpen=window.open(membershippage,"wgm_main");giveWindowFocus(0)}function getProfileWindowDimensions(){xHeight=900;xWidth=995;var n=navigator.userAgent;n.indexOf("MSIE")>-1?(xHeight=900,screen.height&&(n.indexOf("AOL")>-1?(screen.height<=1024&&(xHeight=757),screen.height<=800&&(xHeight=600),screen.height<=768&&(xHeight=550),screen.height<=600&&(xHeight=400),screen.height<=480&&(xHeight=300)):(screen.height<=1024&&(xHeight=757),screen.height<=800&&(xHeight=700),screen.height<=768&&(xHeight=640),screen.height<=600&&(xHeight=500),screen.height<=480&&(xHeight=400)))):(xHeight=900,screen.height&&(screen.height<=1024&&(xHeight=757),screen.height<=800&&(xHeight=680),screen.height<=768&&(xHeight=670),screen.height<=600&&(xHeight=500),screen.height<=480&&(xHeight=400)))}function giveWindowFocus(n){var t=n+1;if(n<5){if(newWindowOpen!=null){navigator.userAgent.indexOf("Chrom")>-1&&newWindowOpen.blur();newWindowOpen.focus();return}self.setTimeout("giveWindowFocus("+t+")",100)}}function openHelpWindow(n){var t=window.open(n,"Help","height=700, width=900, scrollbars=1, resizable=1");t.focus()}function openMessages(n){var t="";navigator.userAgent.indexOf("Firefox")>-1&&(t=",location");newWindowOpen=window.open(n,"messagec","resizable=1,scrollbars=1,status=0,width="+popupWidth+",height="+popupHeight+t);giveWindowFocus(0)}function Logout(){mcWindow=window.open("","messagec","resizable=no,scrollbars=no,status=0,width=500,height=440");mcWindow!=null&&mcWindow.close()}function getPage(){var n=window.location.pathname;return n.substring(n.lastIndexOf("/")+1)}function redirectLogin(){top.location.href="/?returnurl="+escape("/"+getPage()+window.location.search)}function jslog(){return!0}function getUserLocations(n){var u=n,t,f,r,i;if(n===undefined&&(u=mylocations),u.length>0){for(t=u.split(","),f=0,r=1;r<6;r++)emptybranch(r);for(i=1;i<=t.length-1;i++)populatebranch(i,f,t[i]),f=t[i];haschildren(t[t.length-1])&&populatebranch(t.length,t[t.length-1])}}function populatebranch(n,t,i){var r,u,f;if(locations){for(u=locations.length,emptybranch(n),r=0;r<u;r++)locations[r].ParentId==t&&jQuery("#branch"+n).append('<option value="'+locations[r].Id+'">'+locations[r].Name+"<\/option>");i&&jQuery("#branch"+n).val(i).removeClass("attribute_error");jQuery("#branch"+n).val()=="-1"&&jQuery("#branch"+n).addClass("attribute_error");f=getPage();jQuery("#branch"+n).unbind("change").bind("change",function(){locationchange(n);jQuery(this).val()==-1?jQuery(this).addClass("attribute_error"):jQuery(this).removeClass("attribute_error")});f==="ChooseYourLocation"?jQuery("#branch"+n).removeAttr("disabled"):jQuery("#branch"+n).show()}}function createGalleryListItem(n,t,i){i===0&&(i=siteimagesbaseurl+"/noimage.gif");var u=jQuery("<img />").css({width:"24px",height:"33px"}).attr("src",i),f=jQuery("<div><\/div>").addClass("gallery_thumb floatLeft").append(u),e=jQuery("<div><\/div>").addClass("gallery_text floatLeft white_text").text(t),r=jQuery("<div><\/div>").attr("id","gallery_"+n).addClass("gallery_button_off").append(f).append(e).css("cursor","pointer");r.click(function(){displayProfilePhoto(n)});jQuery("#gallerylist").append(r)}function loadGalleriesForProfile(){jslog("starting displayManageGalleriesForProfile");jQuery("#gallerylist").hide().empty();var n=0,t="";return global_thumbnail_images.length>0?global_thumbnail_images[0].Classification!=2&&global_thumbnail_images[0].Classification!=3?(n=recon_images.getImageUrl(global_thumbnail_images[0].Id,recon_images.imageSize.gallery),t=recon_images.getImageUrl(global_thumbnail_images[0].Id,recon_images.imageSize.gallery)):n=siteimagesbaseurl+"/noimage.gif":n=siteimagesbaseurl+"/noimage.gif",createGalleryListItem(0,recon_localisation.displayGalleriesForProfile,n,t),jQuery.each(global_galleries_list,function(){galleryimage=this.GalleryImageFilename!=""?recon_images.getImageUrl(this.GalleryImageFilename,recon_images.imageSize.gallery):this.ImageCount>0?siteimagesbaseurl+"/adult_gallery_content.jpg":siteimagesbaseurl+"/noimage.gif";createGalleryListItem(this.Id,this.Name,galleryimage,this.GalleryImageFilename)}),jQuery("#gallerylist").show(),!0}function highlightCurrentGallery(){jQuery('#gallerylist div[class="gallery_button_on"]').removeClass("gallery_button_on").addClass("gallery_button_off");jQuery("#gallery_"+current_gallery_id).removeClass("gallery_button_off").addClass("gallery_button_on")}function displayProfilePhoto(n){n===0?showProfileAndStats():showGallery(n);current_gallery_id=n;highlightCurrentGallery()}function displayGalleryThumbnailForProfile(n,t,i){function u(n){for(var u,r=0,t=0;t<n.length;t++)if(u=n[t],u.Id===i){r=t;break}return r}var r={profileId:n,galleryid:t};jQuery.ajax({type:"POST",url:"Services/Images.asmx/GetGallery",data:JSON.stringify(r),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){if(n.d!=null)if(n.d.LoggedIn){if(n.d.OwnProfile)showGalleryImages(n);else if(n.d.ProfileLevel==0)jQuery("#gallery_upsell").show(),jQuery("#main_image img").hide(),jQuery('#main_image div[class="profile_no_images"]').hide(),jQuery(".corners_container .title").corner(settingsTop),jQuery(".corner_footer").corner(settingsBottom),jQuery(".corners_button_container").corner(settings),jQuery("#standard-limitations-bottom").corner(settingsBottomRight),jQuery("#standardLimitationsUpgradeButton").attr("data-upgradesource","gallery"),hideImageBlock();else if(n.d.Images!=null&&n.d.Images.length>0){var t=n.d.Images;showGalleryImages(n,u(t))}}else redirectLogin()}})}function displayFirstImageForProfile(n){if(primaryimage!==""&&global_thumbnail_images&&global_thumbnail_images.length>0)for(var t=0;t<global_thumbnail_images.length;t++)if(global_thumbnail_images[t].hasOwnProperty("Id")&&primaryimage===global_thumbnail_images[t].Id){n&&displayImage(t,n);break}}function emptybranch(n){var i=recon_localisation.fillAttributesFirstOption,t;jQuery("#branch"+n).empty().append('<option value="-1">'+i+"<\/option>");t=getPage();t==="search.aspx"||t==="ChooseYourLocation"?$("#branch"+n).prop("disabled",!0):$("#branch"+n).hide()}function haschildren(n){for(var i=!1,r=locations.length,t=0;t<r;t++)if(locations[t].Id==n&&locations[t].HasChildren){i=!0;break}return i}function locationchange(n){for(var i=n+1,t=i;t<6;t++)emptybranch(t);haschildren($("#branch"+n).val())?(populatebranch(i,$("#branch"+n).val()),bBottomOfTree=!1):bBottomOfTree=!0}function resendEmailVerification(){var t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,n;ui.block();ui.showBusy();n=window.t101.SessionIdStorage.getSessionId();$.ajax({type:"POST",async:!0,cache:!1,data:null,headers:{"X-Language":t101.helpers.getLanguageFromCookie(),Authorization:"Bearer "+n},url:t+"/VerifyEmail/Resend",contentType:"application/json; charset=utf-8",dataType:"json",statusCode:{201:function(n){dialogEmailVerification(recon_localisation.EmailVerificationResendSuccessTitle,n[0].Value)}},success:function(){ui.hideBusy();ui.unblock()},error:function(n){dialogEmailVerification(recon_localisation.EmailVerificationResendFailureTitle,JSON.parse(n.responseText));ui.hideBusy()}})}function dialogEmailVerification(n,t){ui.resetDialog();$("#dialog_header").append(n);$("#dialog_text").html(t);$("#btnOk").click(function(){ui.cancelDialog();ui.unblock()}).show();ui.showDialog()}function openNewChat(n,t){var i="";navigator.userAgent.indexOf("Firefox")>-1&&(i=",location");newWindowOpen=window.open(n+"/StartChat/"+t,"messagec","resizable=no,scrollbars=no,responses=0,width="+popupWidth+",height="+popupHeight+i);giveWindowFocus(0)}function disableSlideShow(){$("#slideshow_left, #slideshow, #slideshow_right").addClass("button_greyed_out")}function enableSlideShow(){$("#slideshow_left, #slideshow, #slideshow_right").removeClass("button_greyed_out")}function showProfile(){t101.ads.refreshAdverts();$("#friends, #events").hide();$("#profilecontent").show();$("#tabProfile, #tabFriends, #tabEvents").removeClass("tab_open tab_closed");$("#tabFriends, #tabEvents").addClass("tab_closed").addClass("white_text");$("#tabProfile").addClass("tab_open").addClass("white_text");resetImageBlock()}function showProfileAndStats(){if($("#profile_images").empty(),$("#profile_images").removeClass("expanded"),$("#image_paging").hide(),$("#member_stats").show(),profileimages=global_thumbnail_images,currentimage=0,imagepagenum=-1,$("#gallery_upsell").hide(),profileimages!=null&&profileimages.length>0)displayFirstImageForProfile(!0);else{var n=new Image;$(n).load(function(){$("#main_image img").replaceWith(n)}).attr("src",t101.settings.paths.siteImages+"img_1x1.gif");$('div [class="profile_no_images"]').show()}}function cruiseProfile(n,t){var i=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,r=window.t101.SessionIdStorage.getSessionId();$.ajax({type:"POST",headers:{Authorization:"Bearer "+r},url:i+"/helpers/profileactions/cruisemember?profileid="+n+"&updatePrefs="+t,contentType:"application/json; charset=utf-8",error:function(t){if(t.status===401){redirectLogin();return}switch(t.responseJSON[0].Key){case"CruisedAlready":dialogHeader=recon_localisation.cruiseProfileAlreadyCruisedDialogHeader;dialogText=recon_localisation.cruiseProfileAlreadyCruisedDialogText;displayConfirmation(dialogHeader,dialogText);break;case"BlockedByThem":dialogHeader=recon_localisation.cruiseProfileBlockedByThemDialogHeader;dialogText=recon_localisation.cruiseProfileBlockedByThemDialogText;displayConfirmation(dialogHeader,dialogText);break;case"BlockedByYou":dialogHeader=recon_localisation.cruiseProfileBlockedByYouDialogHeader;dialogText=recon_localisation.cruiseProfileBlockedByYouDialogText;displayConfirmation(dialogHeader,dialogText);break;case"OptedOut":dialogHeader=recon_localisation.cruiseProfileOptedOutDialogHeader;dialogText=recon_localisation.cruiseProfileOptedOutDialogText;ui.resetDialog();ui.block();$("#dialog_header").text(dialogHeader);$("#dialog_text").html(dialogText).show();$("#btnYes").click(function(){cruiseProfile(n,!0)}).show();$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show();ui.dialogCss.width="286px";ui.showDialog();break;case"Hidden":dialogHeader=recon_localisation.cruiseProfileHiddenDialogHeader;dialogText=recon_localisation.cruiseProfileHiddenDialogText;ui.resetDialog();ui.block();$("#dialog_header").text(dialogHeader);$("#dialog_text").html(dialogText).show();$("#btnYes").click(function(){cruiseProfile(n,!0)}).show();$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show();ui.dialogCss.width="286px";ui.showDialog();break;case"Failed":dialogHeader=recon_localisation.cruiseProfileFailedDialogHeader;dialogText=recon_localisation.cruiseProfileFailedDialogText;displayConfirmation(dialogHeader,dialogText);break;case"NotLoggedIn":redirectLogin();return;case"HiddenAndOptedOut":dialogHeader=recon_localisation.cruiseProfileHiddenAndOptedOutDialogHeader;dialogText=recon_localisation.cruiseProfileHiddenAndOptedOutDialogText;ui.resetDialog();ui.block();$("#dialog_header").text(dialogHeader);$("#dialog_text").html(dialogText).show();$("#btnYes").click(function(){cruiseProfile(n,!0)}).show();$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show();ui.dialogCss.width="286px";ui.showDialog();break;case"Forbidden":dialogHeader=recon_localisation.EmailVerificationRequiredTitle;dialogText=t.responseJSON[0].Value;displayConfirmation(dialogHeader,dialogText)}},success:function(n){var i=recon_localisation.cruiseProfileSuccessfulDialogHeader,r=recon_localisation.cruiseProfileSuccessfulDialogText,t;n.Key=="SuccessPlaySound"&&playCruiseSound();t=parseInt($("#cruise_count").html(),10);$("#cruise_count").html(t+1);displayConfirmation(i,r);t101.analytics.trackEvent(t101.analytics.Kpis,t101.constants.gaKpis.MemberCruised,"Member cruised.")}})}function blockProfile(){var t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,i=window.t101.SessionIdStorage.getSessionId(),n;ui.resetDialog();ui.block();$("#dialog_header").text(recon_localisation.BlockReasonTitle);$("#dialog_text").append($("#dialog_blockoptions").clone().show()).show();n=Math.floor(Math.random()*2)+1;$("#option"+n).appendTo("#options-container");n=n==2?1:2;$("#option"+n).appendTo("#options-container");$("#otherReason").hide();$("#option3, #option1, #option2").change(function(){$("#rdOther").is(":checked")?$("#otherReason").show().focus():$("#otherReason").hide()});$("#btnOk").show().click(function(){var n="",r,u;$("#otherReason").val($("#otherReason").val().trim());!$("input[name='blockingOptions']:checked").val()||$("#rdOther").is(":checked")&&$("#otherReason").val()==""?n=recon_localisation.BlockMemberValidationMessage:(ui.showBusy(),r=$("input[name='blockingOptions']:checked").val(),u={blockedProfileId:profileid,blockedReason:r,blockedReasonOther:r==3?$("#otherReason").val():""},$.ajax({type:"POST",data:JSON.stringify(u),url:t+"/BlockedMember",contentType:"application/json; charset=utf-8",dataType:"json",headers:{"X-Language":t101.helpers.getLanguageFromCookie(),Authorization:"Bearer "+i},success:function(){ui.hideBusy();displayConfirmation(recon_localisation.blockProfileBlockedDialogHeader,recon_localisation.BlockedMemberConfirmation.format(profilename),function(){window.opener==undefined?window.location.href="/":window.close()})},error:function(n,t){if(ui.hideBusy(),t===401){redirectLogin();return}if(n.responseJSON&&n.responseJSON[0].Key=="LimitExceeded"){displayLimitExceededDialog(recon_localisation.ErrorBlockLimitExceededDialogTitle,n.responseJSON[0].Value);return}if(n.responseJSON&&n.responseJSON[0].Key=="Forbidden"){displayConfirmation(recon_localisation.EmailVerificationRequiredTitle,n.responseJSON[0].Value);return}n.responseJSON&&n.responseJSON[0].Key=="InternalServerError"&&displayConfirmation(recon_localisation.ErrorBlockLimitExceededDialogTitle,n.responseJSON[0].Value)}}));n!=""&&$("#validationMessage").text(n).show()});$("#btnCancel").show().click(function(){ui.cancelDialog();ui.unblock()});ui.showDialog();return}function playCruiseSound(){var n="<audio autoplay>";n+='<source src="'+cruiseAudioPath+'/cruise_alert_sound.webm" type="audio/webm">';n+='<source src="'+cruiseAudioPath+'/cruise_alert_sound.mp3" type="audio/mpeg">';n+="<\/audio>";$("#sound").html(n)}function displayConfirmation(n,t,i){ui.resetDialog();ui.block();$("#dialog_header").text(n);$("#dialog_text").html(t).show();$("#btnOk").show().click(function(){i!=undefined&&i();ui.cancelDialog();ui.unblock()});ui.showDialog()}function displayLimitExceededDialog(n,t){ui.resetDialog();ui.block();$("#dialog_header").text(n);$("#dialog_text").html(t).show();$("#btnBlockList").show().click(function(){window.opener!=undefined?window.opener.location.href=t101.settings.paths.BlockedList:window.location.href=t101.settings.paths.BlockedList;window.close();ui.cancelDialog();ui.unblock()});ui.showDialog()}function whichPage(n){return Math.floor(n/20)+1}function gotoPage(n){var t=0;switch(n){case"Previous":$("#user-gallery-left").hasClass("button_greyed_out")||(t=imagepagenum==1?getImageId(totalpages,"First"):getImageId(imagepagenum-1,"First"));break;case"Next":$("#user-gallery-right").hasClass("button_greyed_out")||(t=imagepagenum==totalpages?getImageId(1,"First"):getImageId(imagepagenum+1,"First"))}$("#user-gallery-left, #user-gallery-right").hasClass("button_greyed_out")||displayImage(t,!0)}function getImageId(n,t){var i=20;return t=="Last"?n*i-1:n*i-i}function hideImageBlock(){$("#ImgBlock").hide()}function showImageBlock(){$("#main_image img").width()>10&&$("#ImgBlock").show()}function resetImageBlock(){var t=0,n;loggedIn==null||loggedIn||(t=61);$("#main_image img").width()>10?(n=($(window).width()-945)/2+(540-$("#main_image img").width())/2,n<28&&(n=28),$("#ImgBlock").css({width:$("#main_image img").width(),height:$("#main_image img").height(),left:n,top:(695-$("#main_image img").height())/2+t}),showImageBlock()):$("#ImgBlock").css({width:500,height:500,left:($(window).width()-940)/2+17.5,top:195/2+t})}function displayImage(n,t){resetImageBlock();t&&profileSlideShow("Stop");profileimages==null||profileimages.length===0?disableSlideShow():enableSlideShow();imagepagenum!=whichPage(n)&&(imagepagenum=whichPage(n),drawProfileImages(profileimages,imagepagenum),setTimeout(function(){redrawProfileImages(profileimages,imagepagenum)},10));var i=profileimages[n],r=new Image;$(r).load(function(){$("#main_image img").replaceWith(r);$("#main_image").data("image",i);slideshow&&(slideShowTimeout=setTimeout(function(){imagesNav("NextSlide")},slideinterval));$("#image"+currentimage).removeClass("highlight");$("#image"+n).addClass("highlight");currentimage=n;resetImageBlock();showImageBlock()}).attr("src",recon_images.getImageUrl(i.Id,recon_images.imageSize.profile));$("#gallery_upsell").hide();$('div [class="profile_no_images"]').hide();t101.analytics.trackEvent(t101.analytics.Kpis,t101.constants.gaKpis.MemberPhotoLargeLoaded,"Large member photo loaded.")}function drawProfileImages(n,t){var u,f,o;if(n){var i=n.length,r=20,e=r,s=t*r-r;for(totalpages=Math.floor(i/r),i%r>0&&totalpages++,i<e&&(e=i),u=s+e,u>i&&(u=i),$("#profile_images").empty(),totalpages>1?($("#currentpage").text(t),$("#controls").fadeIn("fast"),$("#image_paging a").removeClass("button_greyed_out").button("option","disabled",!1)):$("#image_paging a").addClass("button_greyed_out").button("option","disabled",!0),$("#totalpages").text(totalpages),f=s;f<u;f++)o=new Image,$(o).attr("id","image"+f).attr("src",t101.settings.paths.siteImages+"Profile/thumb_placeholder.gif").click(function(){displayImage(parseInt(this.id.toString().replace("image",""),10),!0)}),$("#profile_images").append(o)}}function redrawProfileImages(n,t){var f,u;if(n){var i=n.length,r=20,e=r,o=t*r-r;for(totalpages=Math.floor(i/r),i%r>0&&totalpages++,i<e&&(e=i),f=o+e,f>i&&(f=i),u=o;u<f;u++)$("#image"+u).attr("src",recon_images.getImageUrl(n[u].Id,recon_images.imageSize.thumbnail))}}function profileSlideShow(n){switch(n){case"Start":$("#slideshow").unbind("click").click(function(){imagesNav("Stop")});$("#slideshow img").attr("src",$("#slideshow img").attr("src").replace("play","stop"));slideshow=!0;break;case"Stop":$("#slideshow").unbind("click").click(function(){imagesNav("Play")});$("#slideshow img").attr("src",$("#slideshow img").attr("src").replace("stop","play"));slideshow=!1}}function imagesNav(n){var t;switch(n){case"Back":showSlideShow=!0;t=currentimage==0?profileimages.length-1:currentimage-1;displayImage(t,!0);break;case"Next":showSlideShow=!0;t=currentimage==profileimages.length-1?0:currentimage+1;displayImage(t,!0);break;case"NextSlide":showSlideShow=!0;t=currentimage==profileimages.length-1?0:currentimage+1;slideshow&&displayImage(t,!1);break;case"Play":$("#slideshow").data("isSlideShowPlaying",!0);profileSlideShow("Start");showSlideShow=!0;t=currentimage==profileimages.length-1?0:currentimage+1;slideShowTimeout=setTimeout("displayImage("+t+",false);",slideinterval);break;case"Stop":$("#slideshow").data("isSlideShowPlaying",!1);showSlideShow=!1;clearTimeout(slideShowTimeout);profileSlideShow("Stop")}}function setImageId(n){return gblImageId=n,""}function showGallery(n,t){var i={profileId:profileid,galleryid:n};$.ajax({type:"POST",url:"Services/Images.asmx/GetGallery",data:JSON.stringify(i),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n.d!=null&&(n.d.LoggedIn?n.d.OwnProfile?showGalleryImages(n):n.d.ProfileLevel==0?($("#gallery_upsell").show(),$("#main_image img").hide(),$('#main_image div[class="profile_no_images"]').hide(),$(".corners_container .title").corner(settingsTop),$(".corner_footer").corner(settingsBottom),$(".corners_button_container").corner(settings),$("#standard-limitations-bottom").corner(settingsBottomRight),$("#standardLimitationsUpgradeButton").attr("data-upgradesource","gallery"),hideImageBlock()):showGalleryImages(n,t):redirectLogin())}})}function showGalleryImages(n,t){var r,i,u;if(n.d.Images!=null&&n.d.Images.length>0){if($("#ctl00_ContentPlaceHolder1_gallery1").removeClass("gallery_button_off").addClass("gallery_button_on"),$("#profile_images").empty(),$("#profile_images").addClass("expanded"),$("#image_paging").show(),$("#member_stats").hide(),profileimages=n.d.Images,currentimage=0,imagepagenum=-1,$("#currentpage").text(1),r=0,t)for(i=0,u=n.d.Images.length;i<u;i++)if(n.d.Images[i].Id==t){r=i;break}displayImage(r,!0);t101.analytics.trackEvent(t101.analytics.Kpis,t101.constants.gaKpis.ProfileGalleryViewed,"Profile gallery viewed.")}}function getFriendImageUrl(n){return n.length===0?t101.settings.paths.siteImages+"noimage.gif":recon_images.getImageUrl(n,recon_images.imageSize.thumbnail)}function getLocation(n){var t=n.toString().split(", "),i=t[t.length-1],r=t[0];return r!=i?i+", "+r:i}function getFriendsListClass(){return friendsListClassArray[friendsListClassIndex++]}function premiumVisibilityClass(n){return n===1?"visible":"hidden"}function showFriends(n){t101.ads.refreshAdverts();$.ajax({type:"POST",url:"Services/FriendsAndFavourites.asmx/GetFriends",data:'{"profileId":'+profileid+',"startAt":'+(n*friendsPerPage-friendsPerPage+1)+',"rowsToReturn":'+friendsPerPage+"}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(t){t.d!=null&&(friendsListClassIndex=0,$("#friendslist").empty(),$("#friendListTemplate").tmpl(t.d.Results).appendTo("#friendslist"),$("#friends").show(),$("#profilecontent, #events").hide(),$("#tabProfile, #tabFriends, #tabEvents").removeClass("tab_open tab_closed"),$("#tabProfile, #tabEvents").addClass("tab_closed").addClass("white_text"),$("#tabFriends").addClass("tab_open").addClass("white_text"),n==1?$("#friends_previous, #friends_previous_top").addClass("button_greyed_out").button("option","disabled",!0):$("#friends_previous, #friends_previous_top").unbind("click").bind("click",function(){showFriends(n-1)}).removeClass("button_greyed_out").button("option","disabled",!1),n==friendPages?$("#friends_next, #friends_next_top").unbind("click").addClass("button_greyed_out").button("option","disabled",!0):$("#friends_next, #friends_next_top").unbind("click").bind("click",function(){showFriends(n+1)}).removeClass("button_greyed_out").button("option","disabled",!1),$("#friendpagecount, #friendpagecount_top").text(friendPages),$("#friendcurrentpage, #friendcurrentpage_top").text(n),$("html, body").animate({scrollTop:0},"fast"),$("#gallery_upsell").hide(),$(".profile_container_title").corner(settingsTop),$(".profile_container_footer").corner(settingsBottom),$(".profile_container").corner(settings),hideImageBlock())}})}function friendStatus(){$.ajax({type:"POST",url:"Services/FriendsAndFavourites.asmx/FriendStatus",data:'{"profileId":'+profileid+"}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){if(n.d.Code==18)redirectLogin();else{ui.resetDialog();ui.block();$("#dialog_header").append(recon_localisation.FriendFavouriteStatus_NotFriendOrFavouriteBlockedByFriend_DialogTitle);$("#dialog_text").append(n.d.Message).append($("#dialog_friendoptions").clone().show()).show();switch(n.d.Code){case t101.constants.friendAndFavouriteStatus.Error:$("#dialog_header").text(recon_localisation.EmailVerificationRequiredTitle);$("#btnOk").click(function(){ui.cancelDialog();ui.unblock()}).show();break;case t101.constants.friendAndFavouriteStatus.Friend:case t101.constants.friendAndFavouriteStatus.FriendAndBlockedByFriend:case t101.constants.friendAndFavouriteStatus.FriendAndBlocked:case t101.constants.friendAndFavouriteStatus.FavouriteFriendRequestPending:case t101.constants.friendAndFavouriteStatus.FavouriteAndBlockedByFriend:case t101.constants.friendAndFavouriteStatus.FavouriteAndBlocked:case t101.constants.friendAndFavouriteStatus.FavouriteAndOptedOutByFriend:case t101.constants.friendAndFavouriteStatus.FavouriteAndOptedOutByYou:case t101.constants.friendAndFavouriteStatus.FavouriteYouStandard:$("#btnYes").click(function(){updateFriend("removeFriendAndFavourite")}).show();$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show();break;case t101.constants.friendAndFavouriteStatus.Favourite:$("#dialog_text > #dialog_friendoptions, #dialog_text > #dialog_friendoptions > #changeToFriendOption, #dialog_text > #dialog_friendoptions > #removeFavouriteOption").show();$("#btnCancel").click(function(){ui.cancelDialog();ui.unblock()}).show();$("#btnSave").click(function(){updateFriend()}).show();break;case t101.constants.friendAndFavouriteStatus.NotFriendOrFavourite:$("#dialog_text > #dialog_friendoptions, #dialog_text > #dialog_friendoptions > #addFriendOption, #dialog_text > #dialog_friendoptions > #addFavouriteOption").show();$("#btnCancel").bind("click",function(){ui.cancelDialog();ui.unblock()}).show();$("#btnSave").click(function(){updateFriend()}).show();break;case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteAllowanceReached:$("#btnOk").click(function(){ui.cancelDialog();ui.unblock()}).show();break;case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteBlockedByFriend:case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteBlocked:case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteAndOptedOutByFriend:case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteAndOptedOutByYou:case t101.constants.friendAndFavouriteStatus.NotFriendOrFavouriteYouStandard:$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show();$("#btnYes").click(function(){updateFriend("addFavourite")}).show()}n.d.Counts!=null&&$("#dialog_text").append(n.d.Counts);ui.dialogCss.width="286px";ui.showDialog()}}})}function updateFriend(n,t){n==null&&(n=$("#dialog_friendoptions input:checked").val());t=!!t;n=="addFavourite"&&t101.analytics.trackEvent(t101.analytics.Kpis,t101.constants.gaKpis.MemberFavourited,"Member favourited.");var i={profileId:profileid,action:n,updateVisibility:t};$.ajax({type:"POST",url:"Services/FriendsAndFavourites.asmx/UpdateFriend",data:JSON.stringify(i),contentType:"application/json; charset=utf-8",dataType:"json",success:function(t){t.d.Code!=undefined&&t.d.Code==0?(ui.resetDialog(),ui.block(),$("#dialog_header").text(recon_localisation.FriendFavouriteStatus_NotFriendOrFavouriteBlockedByFriend_DialogTitle),$("#dialog_text").html(t.d.Message).show(),$("#btnYes").click(function(){updateFriend(n,!0)}).show(),$("#btnNo").click(function(){ui.cancelDialog();ui.unblock()}).show(),ui.dialogCss.width="286px",ui.showDialog()):n==="addFriend"||n==="changetoFriend"?(ui.resetDialog(),ui.block(),$("#dialog_header").text(recon_localisation.AddAsAFriend).show(),$("#dialog_text").append("<br>"+recon_localisation.FriendRequestSent+"<br><br>").show(),$("#btnOk").click(function(){ui.cancelDialog();ui.unblock()}).show()):(ui.cancelDialog(),ui.unblock())}})}function reportProfile(){loggedIn?(ui.resetDialog(),ui.block(),$("#dialog_header").append(recon_localisation.reportProfileDialogHeader),$("#dialog_text").append(recon_localisation.reportProfileDialogText+"<br><br>").append($("#report_profile").children().clone().show()).show(),$("#btnCancel").click(function(){ui.cancelDialog();ui.unblock()}).show(),$("#btnSend").click(function(){reportProfileSend()}).show(),ui.dialogCss.width="286px",ui.showDialog()):redirectLogin()}function reportProfileSend(){var n=$("#dialog_text #txtReportProfile").val(),t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,i=window.t101.SessionIdStorage.getSessionId(),r={MemberId:profileid,Comment:n};$.ajax({type:"POST",async:!0,url:t+"/Helpers/ProfileActions/ReportMember",headers:{Authorization:"Bearer "+i},data:JSON.stringify(r),contentType:"application/json; charset=utf-8",dataType:"json",success:function(){ui.cancelDialog();ui.resetDialog();$("#dialog_header").append(pageContentResource.ProfilePage_ReportProfileConfirmTitle);$("#dialog_text").append(pageContentResource.ProfilePage_ReportProfileConfirmText);$("#btnOk").bind("click",function(){ui.cancelDialog();ui.unblock()}).show();ui.showDialog()}})}function showEvents(n){function t(n){for(var i=n.length,r=["Col1 Row1","Col1 Row2","Col1 Row3","Col1 Row4","Col1 Row5","Col2 Row1","Col2 Row2","Col2 Row3","Col2 Row4","Col2 Row5"].slice(0,i),t=0;t<i;t++)n[t].CssClass=r[t];return n}t101.ads.refreshAdverts();var i=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,r=window.t101.SessionIdStorage.getSessionId();$.ajax({type:"GET",headers:{Authorization:"Bearer "+r},url:i+"/calendar?profileId="+profileid+"&skip="+(n*eventsPerPage-eventsPerPage)+"&take="+eventsPerPage,contentType:"application/json; charset=utf-8",dataType:"json",success:function(i){i!=null&&($("#eventslist").empty(),$("#eventListTemplate").tmpl(t(i)).appendTo("#eventslist"),$("#friends, #profilecontent").hide(),$("#events").show(),$("#tabProfile, #tabFriends, #tabEvents").removeClass("tab_open tab_closed"),$("#tabFriends, #tabProfile").addClass("tab_closed").addClass("white_text"),$("#tabEvents").addClass("tab_open").addClass("white_text"),n==1?$("#events_previous, #events_previous_top").addClass("button_greyed_out").button("option","disabled",!0):$("#events_previous, #events_previous_top").unbind("click").bind("click",function(){showEvents(n-1)}).removeClass("button_greyed_out").button("option","disabled",!1),n==eventPages?$("#events_next, #events_next_top").addClass("button_greyed_out").button("option","disabled",!0):$("#events_next, #events_next_top").unbind("click").bind("click",function(){showEvents(n+1)}).removeClass("button_greyed_out").button("option","disabled",!1),$("#eventpagecount,#eventpagecount_top").text(eventPages),$("#eventcurrentpage, #eventcurrentpage_top").text(n),$("html, body").animate({scrollTop:0},"fast"),$("#gallery_upsell").hide(),$(".profile_container_title").corner(settingsTop),$(".profile_container_footer").corner(settingsBottom),$(".profile_container").corner(settings),hideImageBlock())},error:function(){}})}function loadMembershipPrices(){ui.resetDialog();ui.block();$("#dialog_header").append(recon_localisation.GiftMembershipPricingTitle);$("#dialog_text").append(recon_localisation.GiftMembershipPricingText+"<br><br>").append($("#gift_membership_pricing").children().clone().show()).show();$("#btnCancel").click(function(){ui.cancelDialog();ui.unblock()}).show();$("#btnBuy").click(function(){var n=$("#dialog_text input[type=radio]:checked"),t=n.val();t101.orders.secureUrl=PaymentPath+"/"+t101.helpers.getLanguageFromCookie();t101.orders.CreateGiftOrderAndRedirectToSecure(t,profileid,n.data("type"),n.data("provider"));ui.cancelDialog();ui.unblock()}).show();ui.dialogCss.width="480px";ui.showDialog()}function displayGiftBlockedMessage(n){displayConfirmation(recon_localisation.SendGift,n?recon_localisation.SendGiftBlocked:recon_localisation.SendGiftBlockedYou)}var LocalisationInformation,CookieSettings,culture,Settings,recon_images,xHeight,xWidth,messages,slideShowTimeout,showSlideShow,cruiseAudioPath,gblImageId,friendsListClassIndex,friendsListClassArray,profile_not_found,slideShow,travelPlan,ui;(function(n){function h(t,i){return parseInt(n.css(t,i),10)||0}function e(n){return n=parseInt(n,10).toString(16),n.length<2?"0"+n:n}function l(t){while(t){var i=n.css(t,"backgroundColor"),r;if(i&&i!="transparent"&&i!="rgba(0, 0, 0, 0)")return i.indexOf("rgb")>=0?(r=i.match(/\d+/g),"#"+e(r[0])+e(r[1])+e(r[2])):i;if(t.nodeName.toLowerCase()=="html")break;t=t.parentNode}return"#ffffff"}function a(n,t,i){switch(n){case"round":return Math.round(i*(1-Math.cos(Math.asin(t/i))));case"cool":return Math.round(i*(1+Math.cos(Math.asin(t/i))));case"sharp":return i-t;case"bite":return Math.round(i*Math.cos(Math.asin((i-t-1)/i)));case"slide":return Math.round(i*Math.atan2(t,i/t));case"jut":return Math.round(i*Math.atan2(i,i-t-1));case"curl":return Math.round(i*Math.atan(t));case"tear":return Math.round(i*Math.cos(t));case"wicked":return Math.round(i*Math.tan(t));case"long":return Math.round(i*Math.sqrt(t));case"sculpt":return Math.round(i*Math.log(i-t-1,i));case"dogfold":case"dog":return t&1?t+1:i;case"dog2":return t&2?t+1:i;case"dog3":return t&3?t+1:i;case"fray":return t%2*i;case"notch":return i;case"bevelfold":case"bevel":return t+1;case"steep":return t/2+1;case"invsteep":return(i-t)/2+1}}var u=/MSIE/.test(navigator.userAgent),r=document.createElement("div").style,t=r.MozBorderRadius!==undefined,f=r.WebkitBorderRadius!==undefined,i=r.borderRadius!==undefined||r.BorderRadius!==undefined,o=document.documentMode||0,c=u&&(!o||o<8),s=u&&function(){var n=document.createElement("div");try{n.style.setExpression("width","0+0");n.style.removeExpression("width")}catch(t){return!1}return!0}();n.support=n.support||{};n.support.borderRadius=t||f||i;n.fn.corner=function(r){if(this.length===0){if(!n.isReady&&this.selector){var e=this.selector,o=this.context;n(function(){n(e,o).corner(r)})}return this}return this.each(function(){var it=n(this),p=[it.attr(n.fn.corner.defaults.metaAttr)||"",r||""].join(" ").toLowerCase(),vt=/keep/.test(p),ot=(p.match(/cc:(#[0-9a-f]+)/)||[])[1],st=(p.match(/sc:(#[0-9a-f]+)/)||[])[1],v=parseInt((p.match(/(\d+)px/)||[])[1],10)||10,ht=(p.match(/round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/)||["round"])[0],yt=/dogfold|bevelfold/.test(p),ct={T:0,B:1},e={TL:/top|tl|left/.test(p),TR:/top|tr|right/.test(p),BL:/bottom|bl|left/.test(p),BR:/bottom|br|right/.test(p)},d,b,lt,g,y,w,o,at,rt,ft,ut,k,et,nt,tt;if(e.TL||e.TR||e.BL||e.BR||(e={TL:1,TR:1,BL:1,BR:1}),n.fn.corner.defaults.useNative&&ht=="round"&&(i||t||f)&&!ot&&!st){e.TL&&it.css(i?"border-top-left-radius":t?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",v+"px");e.TR&&it.css(i?"border-top-right-radius":t?"-moz-border-radius-topright":"-webkit-border-top-right-radius",v+"px");e.BL&&it.css(i?"border-bottom-left-radius":t?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",v+"px");e.BR&&it.css(i?"border-bottom-right-radius":t?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",v+"px");return}d=document.createElement("div");n(d).css({overflow:"hidden",height:"1px",minHeight:"1px",fontSize:"1px",backgroundColor:st||"transparent",borderStyle:"solid"});b={T:parseInt(n.css(this,"paddingTop"),10)||0,R:parseInt(n.css(this,"paddingRight"),10)||0,B:parseInt(n.css(this,"paddingBottom"),10)||0,L:parseInt(n.css(this,"paddingLeft"),10)||0};typeof this.style.zoom!==undefined&&(this.style.zoom=1);vt||(this.style.border="none");d.style.borderColor=ot||l(this.parentNode);lt=n(this).outerHeight();for(g in ct)if(y=ct[g],y&&(e.BL||e.BR)||!y&&(e.TL||e.TR)){for(d.style.borderStyle="none "+(e[g+"R"]?"solid":"none")+" none "+(e[g+"L"]?"solid":"none"),w=document.createElement("div"),n(w).addClass("jquery-corner"),o=w.style,y?this.appendChild(w):this.insertBefore(w,this.firstChild),y&&lt!="auto"?(n.css(this,"position")=="static"&&(this.style.position="relative"),o.position="absolute",o.bottom=o.left=o.padding=o.margin="0",s?o.setExpression("width","this.parentNode.offsetWidth"):o.width="100%"):!y&&u?(n.css(this,"position")=="static"&&(this.style.position="relative"),o.position="absolute",o.top=o.left=o.right=o.padding=o.margin="0",s?(at=h(this,"borderLeftWidth")+h(this,"borderRightWidth"),o.setExpression("width","this.parentNode.offsetWidth - "+at+'+ "px"')):o.width="100%"):(o.position="relative",o.margin=y?b.B-v+"px -"+b.R+"px -"+b.B+"px -"+b.L+"px":"-"+b.T+"px -"+b.R+"px "+(b.T-v)+"px -"+b.L+"px"),rt=0;rt<v;rt++)ft=Math.max(0,a(ht,rt,v)),ut=d.cloneNode(!1),ut.style.borderWidth="0 "+(e[g+"R"]?ft:0)+"px 0 "+(e[g+"L"]?ft:0)+"px",y?w.appendChild(ut):w.insertBefore(ut,w.firstChild);if(yt&&n.support.boxModel){if(y&&c)continue;for(k in e)if(e[k]&&(!y||k!="TL"&&k!="TR")&&(y||k!="BL"&&k!="BR")){et={position:"absolute",border:"none",margin:0,padding:0,overflow:"hidden",backgroundColor:d.style.borderColor};nt=n("<div/>").css(et).css({width:v+"px",height:"1px"});switch(k){case"TL":nt.css({bottom:0,left:0});break;case"TR":nt.css({bottom:0,right:0});break;case"BL":nt.css({top:0,left:0});break;case"BR":nt.css({top:0,right:0})}w.appendChild(nt[0]);tt=n("<div/>").css(et).css({top:0,bottom:0,width:"1px",height:v+"px"});switch(k){case"TL":tt.css({left:v});break;case"TR":tt.css({right:v});break;case"BL":tt.css({left:v});break;case"BR":tt.css({right:v})}w.appendChild(tt[0])}}}})};n.fn.uncorner=function(){return(i||t||f)&&this.css(i?"border-radius":t?"-moz-border-radius":"-webkit-border-radius",0),n("div.jquery-corner",this).remove(),this};n.fn.corner.defaults={useNative:!0,metaAttr:"data-corner"}})(jQuery);jQuery.extend({Enumerable:function(){var n=function(n){this.GetEnumerator=n},s,u;n.Choice=function(){var t=arguments[0]instanceof Array?arguments[0]:arguments;return new n(function(){return new i(r.Blank,function(){return this.Yield(t[Math.floor(Math.random()*t.length)])},r.Blank)})};n.Cycle=function(){var t=arguments[0]instanceof Array?arguments[0]:arguments;return new n(function(){var n=0;return new i(r.Blank,function(){return n>=t.length&&(n=0),this.Yield(t[n++])},r.Blank)})};n.Empty=function(){return new n(function(){return new i(r.Blank,function(){return!1},r.Blank)})};n.From=function(e){if(e==null)return n.Empty();if(e instanceof n)return e;if(typeof e==f.Number||typeof e==f.Boolean)return n.Repeat(e,1);if(typeof e==f.String)return new n(function(){var n=0;return new i(r.Blank,function(){return n<e.length?this.Yield(e.charAt(n++)):!1},r.Blank)});if(typeof e!=f.Function){if(typeof e.length==f.Number)return new u(e);if(!(e instanceof Object)&&t.IsIEnumerable(e))return new n(function(){var t=!0,n;return new i(function(){n=new Enumerator(e)},function(){return t?t=!1:n.moveNext(),n.atEnd()?!1:this.Yield(n.item())},r.Blank)})}return new n(function(){var n=[],t=0;return new i(function(){for(var t in e)e[t]instanceof Function||n.push({Key:t,Value:e[t]})},function(){return t<n.length?this.Yield(n[t++]):!1},r.Blank)})};n.Return=function(t){return n.Repeat(t,1)};n.Matches=function(t,u,f){return f==null&&(f=""),u instanceof RegExp&&(f+=u.ignoreCase?"i":"",f+=u.multiline?"m":"",u=u.source),f.indexOf("g")===-1&&(f+="g"),new n(function(){var n;return new i(function(){n=new RegExp(u,f)},function(){var i=n.exec(t);return i?this.Yield(i):!1},r.Blank)})};n.Range=function(t,i,r){return r==null&&(r=1),n.ToInfinity(t,r).Take(i)};n.RangeDown=function(t,i,r){return r==null&&(r=1),n.ToNegativeInfinity(t,r).Take(i)};n.RangeTo=function(t,i,r){return r==null&&(r=1),t<i?n.ToInfinity(t,r).TakeWhile(function(n){return n<=i}):n.ToNegativeInfinity(t,r).TakeWhile(function(n){return n>=i})};n.Repeat=function(t,u){return u!=null?n.Repeat(t).Take(u):new n(function(){return new i(r.Blank,function(){return this.Yield(t)},r.Blank)})};n.RepeatWithFinalize=function(r,u){return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var n;return new i(function(){n=r()},function(){return this.Yield(n)},function(){n!=null&&(u(n),n=null)})})};n.Generate=function(u,f){return f!=null?n.Generate(u).Take(f):(u=t.CreateLambda(u),new n(function(){return new i(r.Blank,function(){return this.Yield(u())},r.Blank)}))};n.ToInfinity=function(t,u){return t==null&&(t=0),u==null&&(u=1),new n(function(){var n;return new i(function(){n=t-u},function(){return this.Yield(n+=u)},r.Blank)})};n.ToNegativeInfinity=function(t,u){return t==null&&(t=0),u==null&&(u=1),new n(function(){var n;return new i(function(){n=t+u},function(){return this.Yield(n-=u)},r.Blank)})};n.Unfold=function(u,f){return f=t.CreateLambda(f),new n(function(){var t=!0,n;return new i(r.Blank,function(){return t?(t=!1,n=u,this.Yield(n)):(n=f(n),this.Yield(n))},r.Blank)})};n.prototype={CascadeBreadthFirst:function(r,u){var f=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var e,s=0,o=[];return new i(function(){e=f.GetEnumerator()},function(){for(;;){if(e.MoveNext())return o.push(e.Current()),this.Yield(u(e.Current(),s));var i=n.From(o).SelectMany(function(n){return r(n)});if(i.Any())s++,o=[],t.Dispose(e),e=i.GetEnumerator();else return!1}},function(){t.Dispose(e)})})},CascadeDepthFirst:function(r,u){var f=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var o=[],e;return new i(function(){e=f.GetEnumerator()},function(){for(;;){if(e.MoveNext()){var i=u(e.Current(),o.length);return o.push(e),e=n.From(r(e.Current())).GetEnumerator(),this.Yield(i)}if(o.length<=0)return!1;t.Dispose(e);e=o.pop()}},function(){try{t.Dispose(e)}finally{n.From(o).ForEach(function(n){n.Dispose()})}})})},Flatten:function(){var u=this;return new n(function(){var e,f=null;return new i(function(){e=u.GetEnumerator()},function(){for(;;){if(f!=null){if(f.MoveNext())return this.Yield(f.Current());f=null}if(e.MoveNext())if(e.Current()instanceof Array){t.Dispose(f);f=n.From(e.Current()).SelectMany(r.Identity).Flatten().GetEnumerator();continue}else return this.Yield(e.Current());return!1}},function(){try{t.Dispose(e)}finally{t.Dispose(f)}})})},Pairwise:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n;return new i(function(){n=u.GetEnumerator();n.MoveNext()},function(){var t=n.Current();return n.MoveNext()?this.Yield(r(t,n.Current())):!1},function(){t.Dispose(n)})})},Scan:function(r,u,f){var e,o;return f!=null?this.Scan(r,u).Select(f):(u==null?(u=t.CreateLambda(r),e=!1):(u=t.CreateLambda(u),e=!0),o=this,new n(function(){var n,f,s=!0;return new i(function(){n=o.GetEnumerator()},function(){if(s){if(s=!1,e)return this.Yield(f=r);if(n.MoveNext())return this.Yield(f=n.Current())}return n.MoveNext()?this.Yield(f=u(f,n.Current())):!1},function(){t.Dispose(n)})}))},Select:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?this.Yield(r(n.Current(),f++)):!1},function(){t.Dispose(n)})})},SelectMany:function(r,u){var f=this;return r=t.CreateLambda(r),u==null&&(u=function(n,t){return t}),u=t.CreateLambda(u),new n(function(){var o,e=undefined,s=0;return new i(function(){o=f.GetEnumerator()},function(){if(e===undefined&&!o.MoveNext())return!1;do{if(e==null){var i=r(o.Current(),s++);e=n.From(i).GetEnumerator()}if(e.MoveNext())return this.Yield(u(o.Current(),e.Current()));t.Dispose(e);e=null}while(o.MoveNext());return!1},function(){try{t.Dispose(o)}finally{t.Dispose(e)}})})},Where:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){while(n.MoveNext())if(r(n.Current(),f++))return this.Yield(n.Current());return!1},function(){t.Dispose(n)})})},OfType:function(n){var t;switch(n){case Number:t=f.Number;break;case String:t=f.String;break;case Boolean:t=f.Boolean;break;case Function:t=f.Function;break;default:t=null}return t===null?this.Where(function(t){return t instanceof n}):this.Where(function(n){return typeof n===t})},Zip:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o,s=0;return new i(function(){e=f.GetEnumerator();o=n.From(r).GetEnumerator()},function(){return e.MoveNext()&&o.MoveNext()?this.Yield(u(e.Current(),o.Current(),s++)):!1},function(){try{t.Dispose(e)}finally{t.Dispose(o)}})})},Join:function(u,f,e,o,s){f=t.CreateLambda(f);e=t.CreateLambda(e);o=t.CreateLambda(o);s=t.CreateLambda(s);var h=this;return new n(function(){var c,a,l=null,v=0;return new i(function(){c=h.GetEnumerator();a=n.From(u).ToLookup(e,r.Identity,s)},function(){for(var n,t;;){if(l!=null){if(n=l[v++],n!==undefined)return this.Yield(o(c.Current(),n));n=null;v=0}if(c.MoveNext())t=f(c.Current()),l=a.Get(t).ToArray();else return!1}},function(){t.Dispose(c)})})},GroupJoin:function(u,f,e,o,s){f=t.CreateLambda(f);e=t.CreateLambda(e);o=t.CreateLambda(o);s=t.CreateLambda(s);var h=this;return new n(function(){var c=h.GetEnumerator(),l=null;return new i(function(){c=h.GetEnumerator();l=n.From(u).ToLookup(e,r.Identity,s)},function(){if(c.MoveNext()){var n=l.Get(f(c.Current()));return this.Yield(o(c.Current(),n))}return!1},function(){t.Dispose(c)})})},All:function(n){n=t.CreateLambda(n);var i=!0;return this.ForEach(function(t){if(!n(t))return i=!1,!1}),i},Any:function(n){n=t.CreateLambda(n);var i=this.GetEnumerator();try{if(arguments.length==0)return i.MoveNext();while(i.MoveNext())if(n(i.Current()))return!0;return!1}finally{t.Dispose(i)}},Concat:function(r){var u=this;return new n(function(){var e,f;return new i(function(){e=u.GetEnumerator()},function(){if(f==null){if(e.MoveNext())return this.Yield(e.Current());f=n.From(r).GetEnumerator()}return f.MoveNext()?this.Yield(f.Current()):!1},function(){try{t.Dispose(e)}finally{t.Dispose(f)}})})},Insert:function(r,u){var f=this;return new n(function(){var o,e,s=0,h=!1;return new i(function(){o=f.GetEnumerator();e=n.From(u).GetEnumerator()},function(){return s==r&&e.MoveNext()?(h=!0,this.Yield(e.Current())):o.MoveNext()?(s++,this.Yield(o.Current())):!h&&e.MoveNext()?this.Yield(e.Current()):!1},function(){try{t.Dispose(o)}finally{t.Dispose(e)}})})},Alternate:function(t){return t=n.Return(t),this.SelectMany(function(i){return n.Return(i).Concat(t)}).TakeExceptLast()},Contains:function(n,i){i=t.CreateLambda(i);var r=this.GetEnumerator();try{while(r.MoveNext())if(i(r.Current())===n)return!0;return!1}finally{t.Dispose(r)}},DefaultIfEmpty:function(r){var u=this;return new n(function(){var n,f=!0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?(f=!1,this.Yield(n.Current())):f?(f=!1,this.Yield(r)):!1},function(){t.Dispose(n)})})},Distinct:function(t){return this.Except(n.Empty(),t)},Except:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o;return new i(function(){e=f.GetEnumerator();o=new h(u);n.From(r).ForEach(function(n){o.Add(n)})},function(){while(e.MoveNext()){var n=e.Current();if(!o.Contains(n))return o.Add(n),this.Yield(n)}return!1},function(){t.Dispose(e)})})},Intersect:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o,s;return new i(function(){e=f.GetEnumerator();o=new h(u);n.From(r).ForEach(function(n){o.Add(n)});s=new h(u)},function(){while(e.MoveNext()){var n=e.Current();if(!s.Contains(n)&&o.Contains(n))return s.Add(n),this.Yield(n)}return!1},function(){t.Dispose(e)})})},SequenceEqual:function(i,r){var f,u;r=t.CreateLambda(r);f=this.GetEnumerator();try{u=n.From(i).GetEnumerator();try{while(f.MoveNext())if(!u.MoveNext()||r(f.Current())!==r(u.Current()))return!1;return u.MoveNext()?!1:!0}finally{t.Dispose(u)}}finally{t.Dispose(f)}},Union:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var s,e,o;return new i(function(){s=f.GetEnumerator();o=new h(u)},function(){var t;if(e===undefined){while(s.MoveNext())if(t=s.Current(),!o.Contains(t))return o.Add(t),this.Yield(t);e=n.From(r).GetEnumerator()}while(e.MoveNext())if(t=e.Current(),!o.Contains(t))return o.Add(t),this.Yield(t);return!1},function(){try{t.Dispose(s)}finally{t.Dispose(e)}})})},OrderBy:function(n){return new e(this,n,!1)},OrderByDescending:function(n){return new e(this,n,!0)},Reverse:function(){var t=this;return new n(function(){var n,u;return new i(function(){n=t.ToArray();u=n.length},function(){return u>0?this.Yield(n[--u]):!1},r.Blank)})},Shuffle:function(){var t=this;return new n(function(){var n;return new i(function(){n=t.ToArray()},function(){if(n.length>0){var t=Math.floor(Math.random()*n.length);return this.Yield(n.splice(t,1)[0])}return!1},r.Blank)})},GroupBy:function(r,u,f,e){var o=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),f!=null&&(f=t.CreateLambda(f)),e=t.CreateLambda(e),new n(function(){var n;return new i(function(){n=o.ToLookup(r,u,e).ToEnumerable().GetEnumerator()},function(){while(n.MoveNext())return f==null?this.Yield(n.Current()):this.Yield(f(n.Current().Key(),n.Current()));return!1},function(){t.Dispose(n)})})},PartitionBy:function(r,u,f,e){var s=this,o;return r=t.CreateLambda(r),u=t.CreateLambda(u),e=t.CreateLambda(e),f==null?(o=!1,f=function(n,t){return new c(n,t)}):(o=!0,f=t.CreateLambda(f)),new n(function(){var h,l,a,c=[];return new i(function(){h=s.GetEnumerator();h.MoveNext()&&(l=r(h.Current()),a=e(l),c.push(u(h.Current())))},function(){for(var t,i;(t=h.MoveNext())==!0;)if(a===e(r(h.Current())))c.push(u(h.Current()));else break;return c.length>0?(i=o?f(l,n.From(c)):f(l,c),t?(l=r(h.Current()),a=e(l),c=[u(h.Current())]):c=[],this.Yield(i)):!1},function(){t.Dispose(h)})})},BufferWithCount:function(r){var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){for(var t=[],i=0;n.MoveNext();)if(t.push(n.Current()),++i>=r)return this.Yield(t);return t.length>0?this.Yield(t):!1},function(){t.Dispose(n)})})},Aggregate:function(n,t,i){return this.Scan(n,t,i).Last()},Average:function(n){n=t.CreateLambda(n);var i=0,r=0;return this.ForEach(function(t){i+=n(t);++r}),i/r},Count:function(n){n=n==null?r.True:t.CreateLambda(n);var i=0;return this.ForEach(function(t,r){n(t,r)&&++i}),i},Max:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(function(n,t){return n>t?n:t})},Min:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(function(n,t){return n<t?n:t})},MaxBy:function(n){return n=t.CreateLambda(n),this.Aggregate(function(t,i){return n(t)>n(i)?t:i})},MinBy:function(n){return n=t.CreateLambda(n),this.Aggregate(function(t,i){return n(t)<n(i)?t:i})},Sum:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(0,function(n,t){return n+t})},ElementAt:function(n){var t,i=!1;if(this.ForEach(function(r,u){if(u==n)return t=r,i=!0,!1}),!i)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return t},ElementAtOrDefault:function(n,t){var i,r=!1;return this.ForEach(function(t,u){if(u==n)return i=t,r=!0,!1}),r?i:t},First:function(n){if(n!=null)return this.Where(n).First();var t,i=!1;if(this.ForEach(function(n){return t=n,i=!0,!1}),!i)throw new Error("First:No element satisfies the condition.");return t},FirstOrDefault:function(n,t){if(t!=null)return this.Where(t).FirstOrDefault(n);var i,r=!1;return this.ForEach(function(n){return i=n,r=!0,!1}),r?i:n},Last:function(n){if(n!=null)return this.Where(n).Last();var t,i=!1;if(this.ForEach(function(n){i=!0;t=n}),!i)throw new Error("Last:No element satisfies the condition.");return t},LastOrDefault:function(n,t){if(t!=null)return this.Where(t).LastOrDefault(n);var i,r=!1;return this.ForEach(function(n){r=!0;i=n}),r?i:n},Single:function(n){if(n!=null)return this.Where(n).Single();var i,t=!1;if(this.ForEach(function(n){if(t)throw new Error("Single:sequence contains more than one element.");else t=!0,i=n}),!t)throw new Error("Single:No element satisfies the condition.");return i},SingleOrDefault:function(n,t){if(t!=null)return this.Where(t).SingleOrDefault(n);var r,i=!1;return this.ForEach(function(n){if(i)throw new Error("Single:sequence contains more than one element.");else i=!0,r=n}),i?r:n},Skip:function(r){var u=this;return new n(function(){var n,f=0;return new i(function(){for(n=u.GetEnumerator();f++<r&&n.MoveNext(););},function(){return n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},SkipWhile:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,e=0,f=!1;return new i(function(){n=u.GetEnumerator()},function(){while(!f)if(n.MoveNext()){if(!r(n.Current(),e++))return f=!0,this.Yield(n.Current());continue}else return!1;return n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},Take:function(r){var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return f++<r&&n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},TakeWhile:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()&&r(n.Current(),f++)?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},TakeExceptLast:function(r){r==null&&(r=1);var u=this;return new n(function(){if(r<=0)return u.GetEnumerator();var n,f=[];return new i(function(){n=u.GetEnumerator()},function(){while(n.MoveNext()){if(f.length==r)return f.push(n.Current()),this.Yield(f.shift());f.push(n.Current())}return!1},function(){t.Dispose(n)})})},TakeFromLast:function(r){if(r<=0||r==null)return n.Empty();var u=this;return new n(function(){var o,f,e=[];return new i(function(){o=u.GetEnumerator()},function(){while(o.MoveNext())e.length==r&&e.shift(),e.push(o.Current());return f==null&&(f=n.From(e).GetEnumerator()),f.MoveNext()?this.Yield(f.Current()):!1},function(){t.Dispose(f)})})},IndexOf:function(n){var t=null;return this.ForEach(function(i,r){if(i===n)return t=r,!0}),t!==null?t:-1},LastIndexOf:function(n){var t=-1;return this.ForEach(function(i,r){i===n&&(t=r)}),t},ToArray:function(){var n=[];return this.ForEach(function(t){n.push(t)}),n},ToLookup:function(n,i,r){n=t.CreateLambda(n);i=t.CreateLambda(i);r=t.CreateLambda(r);var u=new h(r);return this.ForEach(function(t){var r=n(t),f=i(t),e=u.Get(r);e!==undefined?e.push(f):u.Add(r,[f])}),new a(u)},ToObject:function(n,i){n=t.CreateLambda(n);i=t.CreateLambda(i);var r={};return this.ForEach(function(t){r[n(t)]=i(t)}),r},ToDictionary:function(n,i,r){n=t.CreateLambda(n);i=t.CreateLambda(i);r=t.CreateLambda(r);var u=new h(r);return this.ForEach(function(t){u.Add(n(t),i(t))}),u},ToJSON:function(n,t){return JSON.stringify(this.ToArray(),n,t)},ToString:function(n,t){return n==null&&(n=""),t==null&&(t=r.Identity),this.Select(t).ToArray().join(n)},Do:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?(r(n.Current(),f++),this.Yield(n.Current())):!1},function(){t.Dispose(n)})})},ForEach:function(n){n=t.CreateLambda(n);var r=0,i=this.GetEnumerator();try{while(i.MoveNext())if(n(i.Current(),r++)===!1)break}finally{t.Dispose(i)}},Write:function(n,i){n==null&&(n="");i=t.CreateLambda(i);var r=!0;this.ForEach(function(t){r?r=!1:document.write(n);document.write(i(t))})},WriteLine:function(n){n=t.CreateLambda(n);this.ForEach(function(t){document.write(n(t));document.write("<br />")})},Force:function(){var n=this.GetEnumerator();try{while(n.MoveNext());}finally{t.Dispose(n)}},Let:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var f;return new i(function(){f=n.From(r(u)).GetEnumerator()},function(){return f.MoveNext()?this.Yield(f.Current()):!1},function(){t.Dispose(f)})})},Share:function(){var u=this,t;return new n(function(){return new i(function(){t==null&&(t=u.GetEnumerator())},function(){return t.MoveNext()?this.Yield(t.Current()):!1},r.Blank)})},MemoizeAll:function(){var f=this,t,u;return new n(function(){var n=-1;return new i(function(){u==null&&(u=f.GetEnumerator(),t=[])},function(){return(n++,t.length<=n)?u.MoveNext()?this.Yield(t[n]=u.Current()):!1:this.Yield(t[n])},r.Blank)})},Catch:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){try{return n.MoveNext()?this.Yield(n.Current()):!1}catch(t){return r(t),!1}},function(){t.Dispose(n)})})},Finally:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?this.Yield(n.Current()):!1},function(){try{t.Dispose(n)}finally{r()}})})},Trace:function(n,i){return n==null&&(n="Trace"),i=t.CreateLambda(i),this.Do(function(t){console.log(n,":",i(t))})}};var r={Identity:function(n){return n},True:function(){return!0},Blank:function(){}},f={Boolean:"boolean",Number:"number",String:"string",Object:"object",Undefined:typeof undefined,Function:typeof function(){}},t={CreateLambda:function(n){if(n==null)return r.Identity;if(typeof n==f.String){if(n=="")return r.Identity;if(n.indexOf("=>")==-1)return new Function("$,$$,$$$,$$$$","return "+n);var t=n.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);return new Function(t[1],"return "+t[2])}return n},IsIEnumerable:function(n){if(typeof Enumerator!=f.Undefined)try{return new Enumerator(n),!0}catch(t){}return!1},Compare:function(n,t){return n===t?0:n>t?1:-1},Dispose:function(n){n!=null&&n.Dispose()}},o={Before:0,Running:1,After:2},i=function(n,t,i){var u=new l,r=o.Before;this.Current=u.Current;this.MoveNext=function(){try{switch(r){case o.Before:r=o.Running;n();case o.Running:return t.apply(u)?!0:(this.Dispose(),!1);case o.After:return!1}}catch(i){this.Dispose();throw i;}};this.Dispose=function(){if(r==o.Running)try{i()}finally{r=o.After}}},l=function(){var n=null;this.Current=function(){return n};this.Yield=function(t){return n=t,!0}},e=function(n,i,r,u){this.source=n;this.keySelector=t.CreateLambda(i);this.descending=r;this.parent=u};e.prototype=new n;e.prototype.CreateOrderedEnumerable=function(n,t){return new e(this.source,n,t,this)};e.prototype.ThenBy=function(n){return this.CreateOrderedEnumerable(n,!1)};e.prototype.ThenByDescending=function(n){return this.CreateOrderedEnumerable(n,!0)};e.prototype.GetEnumerator=function(){var u=this,t,n,f=0;return new i(function(){t=[];n=[];u.source.ForEach(function(i,r){t.push(i);n.push(r)});var i=s.Create(u,null);i.GenerateKeys(t);n.sort(function(n,t){return i.Compare(n,t)})},function(){return f<n.length?this.Yield(t[n[f++]]):!1},r.Blank)};s=function(n,t,i){this.keySelector=n;this.descending=t;this.child=i;this.keys=null};s.Create=function(n,t){var i=new s(n.keySelector,n.descending,t);return n.parent!=null?s.Create(n.parent,i):i};s.prototype.GenerateKeys=function(n){for(var i=n.length,u=this.keySelector,r=new Array(i),t=0;t<i;t++)r[t]=u(n[t]);this.keys=r;this.child!=null&&this.child.GenerateKeys(n)};s.prototype.Compare=function(n,i){var r=t.Compare(this.keys[n],this.keys[i]);if(r==0){if(this.child!=null)return this.child.Compare(n,i);r=t.Compare(n,i)}return this.descending?-r:r};u=function(n){this.source=n};u.prototype=new n;u.prototype.Any=function(t){return t==null?this.source.length>0:n.prototype.Any.apply(this,arguments)};u.prototype.Count=function(t){return t==null?this.source.length:n.prototype.Count.apply(this,arguments)};u.prototype.ElementAt=function(t){return 0<=t&&t<this.source.length?this.source[t]:n.prototype.ElementAt.apply(this,arguments)};u.prototype.ElementAtOrDefault=function(n,t){return 0<=n&&n<this.source.length?this.source[n]:t};u.prototype.First=function(t){return t==null&&this.source.length>0?this.source[0]:n.prototype.First.apply(this,arguments)};u.prototype.FirstOrDefault=function(t,i){return i!=null?n.prototype.FirstOrDefault.apply(this,arguments):this.source.length>0?this.source[0]:t};u.prototype.Last=function(t){return t==null&&this.source.length>0?this.source[this.source.length-1]:n.prototype.Last.apply(this,arguments)};u.prototype.LastOrDefault=function(t,i){return i!=null?n.prototype.LastOrDefault.apply(this,arguments):this.source.length>0?this.source[this.source.length-1]:t};u.prototype.Skip=function(t){var u=this.source;return new n(function(){var n;return new i(function(){n=t<0?0:t},function(){return n<u.length?this.Yield(u[n++]):!1},r.Blank)})};u.prototype.TakeExceptLast=function(n){return n==null&&(n=1),this.Take(this.source.length-n)};u.prototype.TakeFromLast=function(n){return this.Skip(this.source.length-n)};u.prototype.Reverse=function(){var t=this.source;return new n(function(){var n;return new i(function(){n=t.length},function(){return n>0?this.Yield(t[--n]):!1},r.Blank)})};u.prototype.SequenceEqual=function(t,i){return(t instanceof u||t instanceof Array)&&i==null&&n.From(t).Count()!=this.Count()?!1:n.prototype.SequenceEqual.apply(this,arguments)};u.prototype.ToString=function(t,i){return i!=null||!(this.source instanceof Array)?n.prototype.ToString.apply(this,arguments):(t==null&&(t=""),this.source.join(t))};u.prototype.GetEnumerator=function(){var n=this.source,t=0;return new i(r.Blank,function(){return t<n.length?this.Yield(n[t++]):!1},r.Blank)};var h=function(){var t=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},u=function(n){return n===null?"null":n===undefined?"undefined":typeof n.toString===f.Function?n.toString():Object.prototype.toString.call(n)},s=function(n,t){this.Key=n;this.Value=t;this.Prev=null;this.Next=null},e=function(){this.First=null;this.Last=null},o;return e.prototype={AddLast:function(n){this.Last!=null?(this.Last.Next=n,n.Prev=this.Last,this.Last=n):this.First=this.Last=n},Replace:function(n,t){n.Prev!=null?(n.Prev.Next=t,t.Prev=n.Prev):this.First=t;n.Next!=null?(n.Next.Prev=t,t.Next=n.Next):this.Last=t},Remove:function(n){n.Prev!=null?n.Prev.Next=n.Next:this.First=n.Next;n.Next!=null?n.Next.Prev=n.Prev:this.Last=n.Prev}},o=function(n){this.count=0;this.entryList=new e;this.buckets={};this.compareSelector=n==null?r.Identity:n},o.prototype={Add:function(n,i){var h=this.compareSelector(n),o=u(h),e=new s(n,i),r,f;if(t(this.buckets,o)){for(r=this.buckets[o],f=0;f<r.length;f++)if(this.compareSelector(r[f].Key)===h){this.entryList.Replace(r[f],e);r[f]=e;return}r.push(e)}else this.buckets[o]=[e];this.count++;this.entryList.AddLast(e)},Get:function(n){var e=this.compareSelector(n),o=u(e),r,i,f;if(!t(this.buckets,o))return undefined;for(r=this.buckets[o],i=0;i<r.length;i++)if(f=r[i],this.compareSelector(f.Key)===e)return f.Value;return undefined},Set:function(n,i){var o=this.compareSelector(n),h=u(o),f,r,e;if(t(this.buckets,h))for(f=this.buckets[h],r=0;r<f.length;r++)if(this.compareSelector(f[r].Key)===o)return e=new s(n,i),this.entryList.Replace(f[r],e),f[r]=e,!0;return!1},Contains:function(n){var f=this.compareSelector(n),e=u(f),r,i;if(!t(this.buckets,e))return!1;for(r=this.buckets[e],i=0;i<r.length;i++)if(this.compareSelector(r[i].Key)===f)return!0;return!1},Clear:function(){this.count=0;this.buckets={};this.entryList=new e},Remove:function(n){var e=this.compareSelector(n),f=u(e),i,r;if(t(this.buckets,f))for(i=this.buckets[f],r=0;r<i.length;r++)if(this.compareSelector(i[r].Key)===e){this.entryList.Remove(i[r]);i.splice(r,1);i.length==0&&delete this.buckets[f];this.count--;return}},Count:function(){return this.count},ToEnumerable:function(){var t=this;return new n(function(){var n;return new i(function(){n=t.entryList.First},function(){if(n!=null){var t={Key:n.Key,Value:n.Value};return n=n.Next,this.Yield(t)}return!1},r.Blank)})}},o}(),a=function(t){this.Count=function(){return t.Count()};this.Get=function(i){return n.From(t.Get(i))};this.Contains=function(n){return t.Contains(n)};this.ToEnumerable=function(){return t.ToEnumerable().Select(function(n){return new c(n.Key,n.Value)})}},c=function(n,t){this.Key=function(){return n};u.call(this,t)};return c.prototype=new u,n}()}),function(n,t){n.fn.toEnumerable=function(){return t.From(this).Select(function(t){return n(t)})};t.prototype.TojQuery=function(){return n(this.ToArray())}}(jQuery,this.Enumerable||this.jQuery.Enumerable),function(n){function o(i,r,f,o){var s={data:o||(r?r.data:{}),_wrap:r?r._wrap:null,tmpl:null,parent:r||null,nodes:[],calls:d,nest:g,wrap:nt,html:tt,update:it};return i&&n.extend(s,i,{nodes:[],parent:r}),f&&(s.tmpl=f,s._ctnt=s._ctnt||s.tmpl(n,s),s.key=++e,(h.length?u:t)[e]=s),s}function s(t,i,u){var f,e=u?n.map(u,function(n){return typeof n=="string"?t.key?n.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+r+'="'+t.key+'" $2'):n:s(n,t,n._ctnt)}):t;return i?e:(e=e.join(""),e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,i,r,u){f=n(r).get();b(f);i&&(f=c(i).concat(f));u&&(f=f.concat(c(u)))}),f?f:c(e))}function c(t){var i=document.createElement("div");return i.innerHTML=t,n.makeArray(i.childNodes)}function p(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+n.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,i,r,u,f,e,o){var h=n.tmpl.tag[r],c,s,a;if(!h)throw"Template command not found: "+r;return c=h._default||[],e&&!/\w$/.test(f)&&(f+=e,e=""),f?(f=l(f),o=o?","+l(o)+")":e?")":"",s=e?f.indexOf(".")>-1?f+e:"("+f+").call($item"+o:f,a=e?s:"(typeof("+f+")==='function'?("+f+").call($item):("+f+"))"):a=s=c.$1||"null",u=l(u),"');"+h[i?"close":"open"].split("$notnull_1").join(f?"typeof("+f+")!=='undefined' && ("+f+")!=null":"true").split("$1a").join(a).split("$1").join(s).split("$2").join(u?u.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(n,t,i,r){return r=r?","+r+")":i?")":"",r?"("+t+").call($item"+r:n}):c.$2||"")+"_.push('"})+"');}return _;")}function w(t,i){t._wrap=s(t,!0,n.isArray(i)?i:[v.test(i)?i:n(i).html()]).join("")}function l(n){return n?n.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function k(n){var t=document.createElement("div");return t.appendChild(n.cloneNode(!0)),t.innerHTML}function b(f){function p(f){function p(n){n=n+a;s=v[n]=v[n]||o(s,t[s.parent.key+a]||s.parent,null,!0)}var y,h=f,c,s,l;if(l=f.getAttribute(r)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(y=h.getAttribute(r)));y!==l&&(h=h.parentNode?h.nodeType===11?0:h.getAttribute(r)||0:0,(s=t[l])||(s=u[l],s=o(s,t[h]||u[h],null,!0),s.key=++e,t[e]=s),i&&p(l));f.removeAttribute(r)}else i&&(s=n.data(f,"tmplItem"))&&(p(s.key),t[s.key]=s,h=n.data(f.parentNode,"tmplItem"),h=h?h.key:0);if(s){for(c=s;c&&c.key!=h;)c.nodes.push(f),c=c.parent;delete s._ctnt;delete s._wrap;n.data(f,"tmplItem",s)}}for(var a="_"+i,c,l,v={},h,s=0,y=f.length;s<y;s++)if((c=f[s]).nodeType===1){for(l=c.getElementsByTagName("*"),h=l.length-1;h>=0;h--)p(l[h]);p(c)}}function d(n,t,i,r){if(!n)return h.pop();h.push({_:n,tmpl:t,item:this,data:i,options:r})}function g(t,i,r){return n.tmpl(n.template(t),i,r,this)}function nt(t,i){var r=t.options||{};return r.wrapped=i,n.tmpl(n.template(t.tmpl),t.data,r,t.item)}function tt(t,i){var r=this._wrap;return n.map(n(n.isArray(r)?r.join(""):r).filter(t||"*"),function(n){return i?n.innerText||n.textContent:n.outerHTML||k(n)})}function it(){var t=this.nodes;n.tmpl(null,null,null,this).insertBefore(t[0]);n(t).remove()}var a=n.fn.domManip,r="_tmplitem",v=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,t={},u={},f,y={key:0,data:{}},e=0,i=0,h=[];n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(r,u){n.fn[r]=function(e){var o=[],h=n(e),c,s,a,v,l=this.length===1&&this[0].parentNode;if(f=t||{},l&&l.nodeType===11&&l.childNodes.length===1&&h.length===1)h[u](this[0]),o=this;else{for(s=0,a=h.length;s<a;s++)i=s,c=(s>0?this.clone(!0):this).get(),n.fn[u].apply(n(h[s]),c),o=o.concat(c);i=0;o=this.pushStack(o,r,h.selector)}return v=f,f=null,n.tmpl.complete(v),o}});n.fn.extend({tmpl:function(t,i,r){return n.tmpl(this[0],t,i,r)},tmplItem:function(){return n.tmplItem(this[0])},template:function(t){return n.template(t,this[0])},domManip:function(r,u,e){if(r[0]&&r[0].nodeType){for(var o=n.makeArray(arguments),s=r.length,h=0,c;h<s&&!(c=n.data(r[h++],"tmplItem")););s>1&&(o[0]=[n.makeArray(r)]);c&&i&&(o[2]=function(t){n.tmpl.afterManip(this,t,e)});a.apply(this,o)}else a.apply(this,arguments);return i=0,f||n.tmpl.complete(t),this}});n.extend({tmpl:function(i,r,f,e){var h,c=!e;if(c)e=y,i=n.template[i]||n.template(null,i),u={};else if(!i)return i=e.tmpl,t[e.key]=e,e.nodes=[],e.wrapped&&w(e,e.wrapped),n(s(e,null,e.tmpl(n,e)));return i?(typeof r=="function"&&(r=r.call(e||{})),f&&f.wrapped&&w(f,f.wrapped),h=n.isArray(r)?n.map(r,function(n){return n?o(f,e,i,n):null}):[o(f,e,i,r)],c?n(s(e,null,h)):h):[]},tmplItem:function(t){var i;for(t instanceof n&&(t=t[0]);t&&t.nodeType===1&&!(i=n.data(t,"tmplItem"))&&(t=t.parentNode););return i||y},template:function(t,i){return i?(typeof i=="string"?i=p(i):i instanceof n&&(i=i[0]||{}),i.nodeType&&(i=n.data(i,"tmpl")||n.data(i,"tmpl",p(i.innerHTML))),typeof t=="string"?n.template[t]=i:i):t?typeof t!="string"?n.template(null,t):n.template[t]||n.template(null,v.test(t)?t:n(t)):null},encode:function(n){return(""+n).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});n.extend(n.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){t={}},afterManip:function(t,r,u){var f=r.nodeType===11?n.makeArray(r.childNodes):r.nodeType===1?[r]:[];u.call(t,r);b(f);i++}})}(jQuery),function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof exports?module.exports=n(require("jquery")):n(jQuery)}(function(n){var o=!1,c=!1,w=0,b=2e3,u=0,a=["webkit","ms","moz","o"],t=window.requestAnimationFrame||!1,i=window.cancelAnimationFrame||!1,v,s,f,e;if(!t)for(v in a)s=a[v],t||(t=window[s+"RequestAnimationFrame"]),i||(i=window[s+"CancelAnimationFrame"]||window[s+"CancelRequestAnimationFrame"]);var r=window.MutationObserver||window.WebKitMutationObserver||!1,y={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var n=document.getElementsByTagName("script"),n=n.length?n[n.length-1].src.split("?")[0]:"";return 0<n.split("/").length?n.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0},l=!1,k=function(){if(l)return l;var e=document.createElement("DIV"),i=e.style,t=navigator.userAgent,u=navigator.platform,n={haspointerlock:"pointerLockElement"in document||"webkitPointerLockElement"in document||"mozPointerLockElement"in document};for(n.isopera=("opera"in window),n.isopera12=n.isopera&&("getUserMedia"in navigator),n.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),n.isie=("all"in document)&&("attachEvent"in e)&&!n.isopera,n.isieold=n.isie&&!("msInterpolationMode"in i),n.isie7=n.isie&&!n.isieold&&(!("documentMode"in document)||7==document.documentMode),n.isie8=n.isie&&("documentMode"in document)&&8==document.documentMode,n.isie9=n.isie&&("performance"in window)&&9<=document.documentMode,n.isie10=n.isie&&("performance"in window)&&10==document.documentMode,n.isie11=("msRequestFullscreen"in e)&&11<=document.documentMode,n.isieedge=navigator.userAgent.match(/Edge\/12\./),n.isie9mobile=/iemobile.9/i.test(t),n.isie9mobile&&(n.isie9=!1),n.isie7mobile=!n.isie9mobile&&n.isie7&&/iemobile/i.test(t),n.ismozilla=("MozAppearance"in i),n.iswebkit=("WebkitAppearance"in i),n.ischrome=("chrome"in window),n.ischrome22=n.ischrome&&n.haspointerlock,n.ischrome26=n.ischrome&&("transition"in i),n.cantouch=("ontouchstart"in document.documentElement)||("ontouchstart"in window),n.hasmstouch=window.MSPointerEvent||!1,n.hasw3ctouch=(window.PointerEvent||!1)&&(0<navigator.MaxTouchPoints||0<navigator.msMaxTouchPoints),n.ismac=/^mac$/i.test(u),n.isios=n.cantouch&&/iphone|ipad|ipod/i.test(u),n.isios4=n.isios&&!("seal"in Object),n.isios7=n.isios&&("webkitHidden"in document),n.isandroid=/android/i.test(t),n.haseventlistener=("addEventListener"in e),n.trstyle=!1,n.hastransform=!1,n.hastranslate3d=!1,n.transitionstyle=!1,n.hastransition=!1,n.transitionend=!1,u=["transform","msTransform","webkitTransform","MozTransform","OTransform"],t=0;t<u.length;t++)if("undefined"!=typeof i[u[t]]){n.trstyle=u[t];break}n.hastransform=!!n.trstyle;n.hastransform&&(i[n.trstyle]="translate3d(1px,2px,3px)",n.hastranslate3d=/translate3d/.test(i[n.trstyle]));n.transitionstyle=!1;n.prefixstyle="";n.transitionend=!1;for(var u="transition webkitTransition msTransition MozTransition OTransition OTransition KhtmlTransition".split(" "),f=" -webkit- -ms- -moz- -o- -o -khtml-".split(" "),o="transitionend webkitTransitionEnd msTransitionEnd transitionend otransitionend oTransitionEnd KhtmlTransitionEnd".split(" "),t=0;t<u.length;t++)if(u[t]in i){n.transitionstyle=u[t];n.prefixstyle=f[t];n.transitionend=o[t];break}n.ischrome26&&(n.prefixstyle=f[1]);n.hastransition=n.transitionstyle;n:{for(t=["-webkit-grab","-moz-grab","grab"],(n.ischrome&&!n.ischrome22||n.isie)&&(t=[]),u=0;u<t.length;u++)if(f=t[u],i.cursor=f,i.cursor==f){i=f;break n}i="url(//mail.google.com/mail/images/2/openhand.cur),n-resize"}return n.cursorgrabvalue=i,n.hasmousecapture="setCapture"in e,n.hasMutationObserver=!1!==r,l=n},d=function(f,e){function nt(){var n=s.doc.css(h.trstyle);return n&&"matrix"==n.substr(0,6)?n.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/):!1}function ut(){var n=s.win,t;if("zIndex"in n)return n.zIndex();for(;0<n.length&&9!=n[0].nodeType;){if(t=n.css("zIndex"),!isNaN(t)&&0!=t)return parseInt(t);n=n.parent()}return!1}function l(n,t,i){return t=n.css(t),n=parseFloat(t),isNaN(n)?(n=rt[t]||0,i=3==n?i?s.win.outerHeight()-s.win.innerHeight():s.win.outerWidth()-s.win.innerWidth():1,s.isie8&&n&&(n+=1),i?n:0):n}function tt(n,t,i,r){s._bind(n,t,function(r){r=r?r:window.event;var u={original:r,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==t?(u.deltaY=-.025*r.wheelDelta,r.wheelDeltaX&&(u.deltaX=-.025*r.wheelDeltaX)):u.deltaY=r.detail,i.call(n,u)},r)}function it(n,t,i){var r,u;if(0==n.deltaMode?(r=-Math.floor(s.opt.mousescrollstep/54*n.deltaX),u=-Math.floor(s.opt.mousescrollstep/54*n.deltaY)):1==n.deltaMode&&(r=-Math.floor(n.deltaX*s.opt.mousescrollstep),u=-Math.floor(n.deltaY*s.opt.mousescrollstep)),t&&s.opt.oneaxismousemode&&0==r&&u&&(r=u,u=0,i&&(0>r?s.getScrollLeft()>=s.page.maxw:0>=s.getScrollLeft())&&(u=r,r=0)),r&&(s.scrollmom&&s.scrollmom.stop(),s.lastdeltax+=r,s.debounced("mousewheelx",function(){var n=s.lastdeltax;s.lastdeltax=0;s.rail.drag||s.doScrollLeftBy(n)},15)),u){if(s.opt.nativeparentscrolling&&i&&!s.ispage&&!s.zoomactive)if(0>u){if(s.getScrollTop()>=s.page.maxh)return!0}else if(0>=s.getScrollTop())return!0;s.scrollmom&&s.scrollmom.stop();s.lastdeltay+=u;s.debounced("mousewheely",function(){var n=s.lastdeltay;s.lastdeltay=0;s.rail.drag||s.doScrollBy(n)},15)}return n.stopImmediatePropagation(),n.preventDefault()}var s=this,v,h,d,a,g,rt;if(this.version="3.6.6",this.name="nicescroll",this.me=e,this.opt={doc:n("body"),win:!1},n.extend(this.opt,y),this.opt.snapbackspeed=80,f)for(v in s.opt)"undefined"!=typeof f[v]&&(s.opt[v]=f[v]);this.iddoc=(this.doc=s.opt.doc)&&this.doc[0]?this.doc[0].id||"":"";this.ispage=/^BODY|HTML/.test(s.opt.win?s.opt.win[0].nodeName:this.doc[0].nodeName);this.haswrapper=!1!==s.opt.win;this.win=s.opt.win||(this.ispage?n(window):this.doc);this.docscroll=this.ispage&&!this.haswrapper?n(window):this.win;this.body=n("body");this.iframe=this.isfixed=this.viewport=!1;this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName;this.istextarea="TEXTAREA"==this.win[0].nodeName;this.forcescreen=!1;this.canshowonmouseevent="scroll"!=s.opt.autohidemode;this.page=this.view=this.onzoomout=this.onzoomin=this.onscrollcancel=this.onscrollend=this.onscrollstart=this.onclick=this.ongesturezoom=this.onkeypress=this.onmousewheel=this.onmousemove=this.onmouseup=this.onmousedown=!1;this.scroll={x:0,y:0};this.scrollratio={x:0,y:0};this.cursorheight=20;this.scrollvaluemax=0;this.isrtlmode="auto"==this.opt.rtlmode?"rtl"==(this.win[0]==window?this.body:this.win).css("direction"):!0===this.opt.rtlmode;this.observerbody=this.observerremover=this.observer=this.scrollmom=this.scrollrunning=!1;do this.id="ascrail"+b++;while(document.getElementById(this.id));this.hasmousefocus=this.hasfocus=this.zoomactive=this.zoom=this.selectiondrag=this.cursorfreezed=this.cursor=this.rail=!1;this.visibility=!0;this.hidden=this.locked=this.railslocked=!1;this.cursoractive=!0;this.wheelprevented=!1;this.overflowx=s.opt.overflowx;this.overflowy=s.opt.overflowy;this.nativescrollingarea=!1;this.checkarea=0;this.events=[];this.saved={};this.delaylist={};this.synclist={};this.lastdeltay=this.lastdeltax=0;this.detected=k();h=n.extend({},this.detected);this.ishwscroll=(this.canhwscroll=h.hastransform&&s.opt.hwacceleration)&&s.haswrapper;this.hasreversehr=this.isrtlmode&&!h.iswebkit;this.istouchcapable=!1;h.cantouch&&!h.isios&&!h.isandroid&&(h.iswebkit||h.ismozilla)&&(this.istouchcapable=!0,h.cantouch=!1);s.opt.enablemouselockapi||(h.hasmousecapture=!1,h.haspointerlock=!1);this.debounced=function(n,t,i){var r=s.delaylist[n];s.delaylist[n]=t;r||(s.debouncedelayed=setTimeout(function(){if(s){var t=s.delaylist[n];s.delaylist[n]=!1;t.call(s)}},i))};d=!1;this.synched=function(n,i){return s.synclist[n]=i,function(){d||(t(function(){var n,t;d=!1;for(n in s.synclist)t=s.synclist[n],t&&t.call(s),s.synclist[n]=!1}),d=!0)}(),n};this.unsynched=function(n){s.synclist[n]&&(s.synclist[n]=!1)};this.css=function(n,t){for(var i in t)s.saved.css.push([n,i,n.css(i)]),n.css(i,t[i])};this.scrollTop=function(n){return"undefined"==typeof n?s.getScrollTop():s.setScrollTop(n)};this.scrollLeft=function(n){return"undefined"==typeof n?s.getScrollLeft():s.setScrollLeft(n)};a=function(n,t,i,r,u,f,e){this.st=n;this.ed=t;this.spd=i;this.p1=r||0;this.p2=u||1;this.p3=f||0;this.p4=e||1;this.ts=(new Date).getTime();this.df=this.ed-this.st};a.prototype={B2:function(n){return 3*n*n*(1-n)},B3:function(n){return 3*n*(1-n)*(1-n)},B4:function(n){return(1-n)*(1-n)*(1-n)},getNow:function(){var n=1-((new Date).getTime()-this.ts)/this.spd,t=this.B2(n)+this.B3(n)+this.B4(n);return 0>n?this.ed:this.st+Math.round(this.df*t)},update:function(n,t){return this.st=this.getNow(),this.ed=n,this.spd=t,this.ts=(new Date).getTime(),this.df=this.ed-this.st,this}};this.ishwscroll?(this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},h.hastranslate3d&&h.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(n){if(!n){if(n=nt())return 16==n.length?-n[13]:-n[5];if(s.timerscroll&&s.timerscroll.bz)return s.timerscroll.bz.getNow()}return s.doc.translate.y},this.getScrollLeft=function(n){if(!n){if(n=nt())return 16==n.length?-n[12]:-n[4];if(s.timerscroll&&s.timerscroll.bh)return s.timerscroll.bh.getNow()}return s.doc.translate.x},this.notifyScrollEvent=function(n){var t=document.createEvent("UIEvents");t.initUIEvent("scroll",!1,!0,window,1);t.niceevent=!0;n.dispatchEvent(t)},g=this.isrtlmode?1:-1,h.hastranslate3d&&s.opt.enabletranslate3d?(this.setScrollTop=function(n,t){s.doc.translate.y=n;s.doc.translate.ty=-1*n+"px";s.doc.css(h.trstyle,"translate3d("+s.doc.translate.tx+","+s.doc.translate.ty+",0px)");t||s.notifyScrollEvent(s.win[0])},this.setScrollLeft=function(n,t){s.doc.translate.x=n;s.doc.translate.tx=n*g+"px";s.doc.css(h.trstyle,"translate3d("+s.doc.translate.tx+","+s.doc.translate.ty+",0px)");t||s.notifyScrollEvent(s.win[0])}):(this.setScrollTop=function(n,t){s.doc.translate.y=n;s.doc.translate.ty=-1*n+"px";s.doc.css(h.trstyle,"translate("+s.doc.translate.tx+","+s.doc.translate.ty+")");t||s.notifyScrollEvent(s.win[0])},this.setScrollLeft=function(n,t){s.doc.translate.x=n;s.doc.translate.tx=n*g+"px";s.doc.css(h.trstyle,"translate("+s.doc.translate.tx+","+s.doc.translate.ty+")");t||s.notifyScrollEvent(s.win[0])})):(this.getScrollTop=function(){return s.docscroll.scrollTop()},this.setScrollTop=function(n){return setTimeout(function(){s.docscroll.scrollTop(n)},1)},this.getScrollLeft=function(){return s.detected.ismozilla&&s.isrtlmode?Math.abs(s.docscroll.scrollLeft()):s.docscroll.scrollLeft()},this.setScrollLeft=function(n){return setTimeout(function(){s.docscroll.scrollLeft(s.detected.ismozilla&&s.isrtlmode?-n:n)},1)});this.getTarget=function(n){return n?n.target?n.target:n.srcElement?n.srcElement:!1:!1};this.hasParent=function(n,t){if(!n)return!1;for(var i=n.target||n.srcElement||n||!1;i&&i.id!=t;)i=i.parentNode||!1;return!1!==i};rt={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||document.documentElement.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft}};this.getOffset=function(){if(s.isfixed){var n=s.win.offset(),t=s.getDocumentScrollOffset();return n.top-=t.top,n.left-=t.left,n}return(n=s.win.offset(),!s.viewport)?n:(t=s.viewport.offset(),{top:n.top-t.top,left:n.left-t.left})};this.updateScrollBar=function(n){if(s.ishwscroll)s.rail.css({height:s.win.innerHeight()-(s.opt.railpadding.top+s.opt.railpadding.bottom)}),s.railh&&s.railh.css({width:s.win.innerWidth()-(s.opt.railpadding.left+s.opt.railpadding.right)});else{var u=s.getOffset(),r=u.top,i=u.left-(s.opt.railpadding.left+s.opt.railpadding.right),r=r+l(s.win,"border-top-width",!0),i=i+(s.rail.align?s.win.outerWidth()-l(s.win,"border-right-width")-s.rail.width:l(s.win,"border-left-width")),t=s.opt.railoffset;t&&(t.top&&(r+=t.top),t.left&&(i+=t.left));s.railslocked||s.rail.css({top:r,left:i,height:(n?n.h:s.win.innerHeight())-(s.opt.railpadding.top+s.opt.railpadding.bottom)});s.zoom&&s.zoom.css({top:r+1,left:1==s.rail.align?i-20:i+s.rail.width+4});s.railh&&!s.railslocked&&(r=u.top,i=u.left,(t=s.opt.railhoffset)&&(t.top&&(r+=t.top),t.left&&(i+=t.left)),n=s.railh.align?r+l(s.win,"border-top-width",!0)+s.win.innerHeight()-s.railh.height:r+l(s.win,"border-top-width",!0),i+=l(s.win,"border-left-width"),s.railh.css({top:n-(s.opt.railpadding.top+s.opt.railpadding.bottom),left:i,width:s.railh.width}))}};this.doRailClick=function(n,t,i){var r;s.railslocked||(s.cancelEvent(n),t?(t=i?s.doScrollLeft:s.doScrollTop,r=i?(n.pageX-s.railh.offset().left-s.cursorwidth/2)*s.scrollratio.x:(n.pageY-s.rail.offset().top-s.cursorheight/2)*s.scrollratio.y,t(r)):(t=i?s.doScrollLeftBy:s.doScrollBy,r=i?s.scroll.x:s.scroll.y,n=i?n.pageX-s.railh.offset().left:n.pageY-s.rail.offset().top,i=i?s.view.w:s.view.h,t(r>=n?i:-i)))};s.hasanimationframe=t;s.hascancelanimationframe=i;s.hasanimationframe?s.hascancelanimationframe||(i=function(){s.cancelAnimationFrame=!0}):(t=function(n){return setTimeout(n,15-Math.floor(+new Date/1e3)%16)},i=clearInterval);this.init=function(){var e,f,b,l,a,k,i,d,v,g,t,y;if(s.saved.css=[],h.isie7mobile||h.isoperamini)return!0;if(h.hasmstouch&&s.css(s.ispage?n("html"):s.win,{"-ms-touch-action":"none"}),s.zindex="auto",s.zindex=s.ispage||"auto"!=s.opt.zindex?s.opt.zindex:ut()||"auto",!s.ispage&&"auto"!=s.zindex&&s.zindex>u&&(u=s.zindex),s.isie&&0==s.zindex&&"auto"==s.opt.zindex&&(s.zindex="auto"),!s.ispage||!h.cantouch&&!h.isieold&&!h.isie9mobile){e=s.docscroll;s.ispage&&(e=s.haswrapper?s.win:s.doc);h.isie9mobile||s.css(e,{"overflow-y":"hidden"});s.ispage&&h.isie7&&("BODY"==s.doc[0].nodeName?s.css(n("html"),{"overflow-y":"hidden"}):"HTML"==s.doc[0].nodeName&&s.css(n("body"),{"overflow-y":"hidden"}));!h.isios||s.ispage||s.haswrapper||s.css(n("body"),{"-webkit-overflow-scrolling":"touch"});f=n(document.createElement("div"));f.css({position:"relative",top:0,float:"right",width:s.opt.cursorwidth,height:"0px","background-color":s.opt.cursorcolor,border:s.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":s.opt.cursorborderradius,"-moz-border-radius":s.opt.cursorborderradius,"border-radius":s.opt.cursorborderradius});f.hborder=parseFloat(f.outerHeight()-f.innerHeight());f.addClass("nicescroll-cursors");s.cursor=f;t=n(document.createElement("div"));t.attr("id",s.id);t.addClass("nicescroll-rails nicescroll-rails-vr");a=["left","right","top","bottom"];for(k in a)l=a[k],(b=s.opt.railpadding[l])?t.css("padding-"+l,b+"px"):s.opt.railpadding[l]=0;t.append(f);t.width=Math.max(parseFloat(s.opt.cursorwidth),f.outerWidth());t.css({width:t.width+"px",zIndex:s.zindex,background:s.opt.background,cursor:"default"});t.visibility=!0;t.scrollable=!0;t.align="left"==s.opt.railalign?0:1;s.rail=t;f=s.rail.drag=!1;!s.opt.boxzoom||s.ispage||h.isieold||(f=document.createElement("div"),s.bind(f,"click",s.doZoom),s.bind(f,"mouseenter",function(){s.zoom.css("opacity",s.opt.cursoropacitymax)}),s.bind(f,"mouseleave",function(){s.zoom.css("opacity",s.opt.cursoropacitymin)}),s.zoom=n(f),s.zoom.css({cursor:"pointer","z-index":s.zindex,backgroundImage:"url("+s.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),s.opt.dblclickzoom&&s.bind(s.win,"dblclick",s.doZoom),h.cantouch&&s.opt.gesturezoom&&(s.ongesturezoom=function(n){return 1.5<n.scale&&s.doZoomIn(n),.8>n.scale&&s.doZoomOut(n),s.cancelEvent(n)},s.bind(s.win,"gestureend",s.ongesturezoom)));s.railh=!1;s.opt.horizrailenabled&&(s.css(e,{"overflow-x":"hidden"}),f=n(document.createElement("div")),f.css({position:"absolute",top:0,height:s.opt.cursorwidth,width:"0px","background-color":s.opt.cursorcolor,border:s.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":s.opt.cursorborderradius,"-moz-border-radius":s.opt.cursorborderradius,"border-radius":s.opt.cursorborderradius}),h.isieold&&f.css({overflow:"hidden"}),f.wborder=parseFloat(f.outerWidth()-f.innerWidth()),f.addClass("nicescroll-cursors"),s.cursorh=f,i=n(document.createElement("div")),i.attr("id",s.id+"-hr"),i.addClass("nicescroll-rails nicescroll-rails-hr"),i.height=Math.max(parseFloat(s.opt.cursorwidth),f.outerHeight()),i.css({height:i.height+"px",zIndex:s.zindex,background:s.opt.background}),i.append(f),i.visibility=!0,i.scrollable=!0,i.align="top"==s.opt.railvalign?0:1,s.railh=i,s.railh.drag=!1);s.ispage?(t.css({position:"fixed",top:"0px",height:"100%"}),t.align?t.css({right:"0px"}):t.css({left:"0px"}),s.body.append(t),s.railh&&(i.css({position:"fixed",left:"0px",width:"100%"}),i.align?i.css({bottom:"0px"}):i.css({top:"0px"}),s.body.append(i))):(s.ishwscroll?("static"==s.win.css("position")&&s.css(s.win,{position:"relative"}),e="HTML"==s.win[0].nodeName?s.body:s.win,n(e).scrollTop(0).scrollLeft(0),s.zoom&&(s.zoom.css({position:"absolute",top:1,right:0,"margin-right":t.width+4}),e.append(s.zoom)),t.css({position:"absolute",top:0}),t.align?t.css({right:0}):t.css({left:0}),e.append(t),i&&(i.css({position:"absolute",left:0,bottom:0}),i.align?i.css({bottom:0}):i.css({top:0}),e.append(i))):(s.isfixed="fixed"==s.win.css("position"),e=s.isfixed?"fixed":"absolute",s.isfixed||(s.viewport=s.getViewport(s.win[0])),s.viewport&&(s.body=s.viewport,0==/fixed|absolute/.test(s.viewport.css("position"))&&s.css(s.viewport,{position:"relative"})),t.css({position:e}),s.zoom&&s.zoom.css({position:e}),s.updateScrollBar(),s.body.append(t),s.zoom&&s.body.append(s.zoom),s.railh&&(i.css({position:e}),s.body.append(i))),h.isios&&s.css(s.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),h.isie&&s.opt.disableoutline&&s.win.attr("hideFocus","true"),h.iswebkit&&s.opt.disableoutline&&s.win.css({outline:"none"}));!1===s.opt.autohidemode?(s.autohidedom=!1,s.rail.css({opacity:s.opt.cursoropacitymax}),s.railh&&s.railh.css({opacity:s.opt.cursoropacitymax})):!0===s.opt.autohidemode||"leave"===s.opt.autohidemode?(s.autohidedom=n().add(s.rail),h.isie8&&(s.autohidedom=s.autohidedom.add(s.cursor)),s.railh&&(s.autohidedom=s.autohidedom.add(s.railh)),s.railh&&h.isie8&&(s.autohidedom=s.autohidedom.add(s.cursorh))):"scroll"==s.opt.autohidemode?(s.autohidedom=n().add(s.rail),s.railh&&(s.autohidedom=s.autohidedom.add(s.railh))):"cursor"==s.opt.autohidemode?(s.autohidedom=n().add(s.cursor),s.railh&&(s.autohidedom=s.autohidedom.add(s.cursorh))):"hidden"==s.opt.autohidemode&&(s.autohidedom=!1,s.hide(),s.railslocked=!1);h.isie9mobile?(s.scrollmom=new p(s),s.onmangotouch=function(){var n=s.getScrollTop(),t=s.getScrollLeft(),i,r;if(n==s.scrollmom.lastscrolly&&t==s.scrollmom.lastscrollx)return!0;if(i=n-s.mangotouch.sy,r=t-s.mangotouch.sx,0!=Math.round(Math.sqrt(Math.pow(r,2)+Math.pow(i,2)))){var f=0>i?-1:1,e=0>r?-1:1,u=+new Date;s.mangotouch.lazy&&clearTimeout(s.mangotouch.lazy);80<u-s.mangotouch.tm||s.mangotouch.dry!=f||s.mangotouch.drx!=e?(s.scrollmom.stop(),s.scrollmom.reset(t,n),s.mangotouch.sy=n,s.mangotouch.ly=n,s.mangotouch.sx=t,s.mangotouch.lx=t,s.mangotouch.dry=f,s.mangotouch.drx=e,s.mangotouch.tm=u):(s.scrollmom.stop(),s.scrollmom.update(s.mangotouch.sx-r,s.mangotouch.sy-i),s.mangotouch.tm=u,i=Math.max(Math.abs(s.mangotouch.ly-n),Math.abs(s.mangotouch.lx-t)),s.mangotouch.ly=n,s.mangotouch.lx=t,2<i&&(s.mangotouch.lazy=setTimeout(function(){s.mangotouch.lazy=!1;s.mangotouch.dry=0;s.mangotouch.drx=0;s.mangotouch.tm=0;s.scrollmom.doMomentum(30)},100)))}},t=s.getScrollTop(),i=s.getScrollLeft(),s.mangotouch={sy:t,ly:t,dry:0,sx:i,lx:i,drx:0,lazy:!1,tm:0},s.bind(s.docscroll,"scroll",s.onmangotouch)):((h.cantouch||s.istouchcapable||s.opt.touchbehavior||h.hasmstouch)&&(s.scrollmom=new p(s),s.ontouchstart=function(t){var i,r;if(t.pointerType&&2!=t.pointerType&&"touch"!=t.pointerType)return!1;if(s.hasmoving=!1,!s.railslocked){if(h.hasmstouch)for(i=t.target?t.target:!1;i;){if(r=n(i).getNiceScroll(),0<r.length&&r[0].me==s.me)break;if(0<r.length)return!1;if("DIV"==i.nodeName&&i.id==s.id)break;i=i.parentNode?i.parentNode:!1}if(s.cancelScroll(),(i=s.getTarget(t))&&/INPUT/i.test(i.nodeName)&&/range/i.test(i.type))return s.stopPropagation(t);if(!("clientX"in t)&&"changedTouches"in t&&(t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY),s.forcescreen&&(r=t,t={original:t.original?t.original:t},t.clientX=r.screenX,t.clientY=r.screenY),s.rail.drag={x:t.clientX,y:t.clientY,sx:s.scroll.x,sy:s.scroll.y,st:s.getScrollTop(),sl:s.getScrollLeft(),pt:2,dl:!1},s.ispage||!s.opt.directionlockdeadzone)s.rail.drag.dl="f";else{var r=n(window).width(),u=n(window).height(),u=Math.max(0,Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-u),r=Math.max(0,Math.max(document.body.scrollWidth,document.documentElement.scrollWidth)-r);s.rail.drag.ck=!s.rail.scrollable&&s.railh.scrollable?0<u?"v":!1:s.rail.scrollable&&!s.railh.scrollable?0<r?"h":!1:!1;s.rail.drag.ck||(s.rail.drag.dl="f")}if(s.opt.touchbehavior&&s.isiframe&&h.isie&&(r=s.win.position(),s.rail.drag.x+=r.left,s.rail.drag.y+=r.top),s.hasmoving=!1,s.lastmouseup=!1,s.scrollmom.reset(t.clientX,t.clientY),!h.cantouch&&!this.istouchcapable&&!t.pointerType){if(!i||!/INPUT|SELECT|TEXTAREA/i.test(i.nodeName))return!s.ispage&&h.hasmousecapture&&i.setCapture(),s.opt.touchbehavior?(i.onclick&&!i._onclick&&(i._onclick=i.onclick,i.onclick=function(n){if(s.hasmoving)return!1;i._onclick.call(this,n)}),s.cancelEvent(t)):s.stopPropagation(t);/SUBMIT|CANCEL|BUTTON/i.test(n(i).attr("type"))&&(pc={tg:i,click:!1},s.preventclick=pc)}}},s.ontouchend=function(n){if(!s.rail.drag)return!0;if(2==s.rail.drag.pt){if(n.pointerType&&2!=n.pointerType&&"touch"!=n.pointerType)return!1;if(s.scrollmom.doMomentum(),s.rail.drag=!1,s.hasmoving&&(s.lastmouseup=!0,s.hideCursor(),h.hasmousecapture&&document.releaseCapture(),!h.cantouch))return s.cancelEvent(n)}else if(1==s.rail.drag.pt)return s.onmouseup(n)},d=s.opt.touchbehavior&&s.isiframe&&!h.hasmousecapture,s.ontouchmove=function(t,i){var r,e,c,f,o,l;if(!s.rail.drag||t.targetTouches&&s.opt.preventmultitouchscrolling&&1<t.targetTouches.length||t.pointerType&&2!=t.pointerType&&"touch"!=t.pointerType)return!1;if(2==s.rail.drag.pt){if(h.cantouch&&h.isios&&"undefined"==typeof t.original)return!0;s.hasmoving=!0;s.preventclick&&!s.preventclick.click&&(s.preventclick.click=s.preventclick.tg.onclick||!1,s.preventclick.tg.onclick=s.onpreventclick);t=n.extend({original:t},t);"changedTouches"in t&&(t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY);s.forcescreen&&(e=t,t={original:t.original?t.original:t},t.clientX=e.screenX,t.clientY=e.screenY);e=r=0;d&&!i&&(r=s.win.position(),e=-r.left,r=-r.top);c=t.clientY+r;r=c-s.rail.drag.y;var a=t.clientX+e,o=a-s.rail.drag.x,u=s.rail.drag.st-r;if(s.ishwscroll&&s.opt.bouncescroll?0>u?u=Math.round(u/2):u>s.page.maxh&&(u=s.page.maxh+Math.round((u-s.page.maxh)/2)):(0>u&&(c=u=0),u>s.page.maxh&&(u=s.page.maxh,c=0)),s.railh&&s.railh.scrollable&&(f=s.isrtlmode?o-s.rail.drag.sl:s.rail.drag.sl-o,s.ishwscroll&&s.opt.bouncescroll?0>f?f=Math.round(f/2):f>s.page.maxw&&(f=s.page.maxw+Math.round((f-s.page.maxw)/2)):(0>f&&(a=f=0),f>s.page.maxw&&(f=s.page.maxw,a=0))),e=!1,s.rail.drag.dl)e=!0,"v"==s.rail.drag.dl?f=s.rail.drag.sl:"h"==s.rail.drag.dl&&(u=s.rail.drag.st);else if(r=Math.abs(r),o=Math.abs(o),l=s.opt.directionlockdeadzone,"v"==s.rail.drag.ck){if(r>l&&o<=.3*r)return s.rail.drag=!1,!0;o>l&&(s.rail.drag.dl="f",n("body").scrollTop(n("body").scrollTop()))}else if("h"==s.rail.drag.ck){if(o>l&&r<=.3*o)return s.rail.drag=!1,!0;r>l&&(s.rail.drag.dl="f",n("body").scrollLeft(n("body").scrollLeft()))}if(s.synched("touchmove",function(){s.rail.drag&&2==s.rail.drag.pt&&(s.prepareTransition&&s.prepareTransition(0),s.rail.scrollable&&s.setScrollTop(u),s.scrollmom.update(a,c),s.railh&&s.railh.scrollable?(s.setScrollLeft(f),s.showCursor(u,f)):s.showCursor(u),h.isie10&&document.selection.clear())}),h.ischrome&&s.istouchcapable&&(e=!1),e)return s.cancelEvent(t)}else if(1==s.rail.drag.pt)return s.onmousemove(t)}),s.onmousedown=function(n,t){if(!s.rail.drag||1==s.rail.drag.pt){if(s.railslocked)return s.cancelEvent(n);s.cancelScroll();s.rail.drag={x:n.clientX,y:n.clientY,sx:s.scroll.x,sy:s.scroll.y,pt:1,hr:!!t};var i=s.getTarget(n);return!s.ispage&&h.hasmousecapture&&i.setCapture(),s.isiframe&&!h.hasmousecapture&&(s.saved.csspointerevents=s.doc.css("pointer-events"),s.css(s.doc,{"pointer-events":"none"})),s.hasmoving=!1,s.cancelEvent(n)}},s.onmouseup=function(n){if(s.rail.drag)return 1!=s.rail.drag.pt?!0:(h.hasmousecapture&&document.releaseCapture(),s.isiframe&&!h.hasmousecapture&&s.doc.css("pointer-events",s.saved.csspointerevents),s.rail.drag=!1,s.hasmoving&&s.triggerScrollEnd(),s.cancelEvent(n))},s.onmousemove=function(n){if(s.rail.drag){if(1==s.rail.drag.pt){if(h.ischrome&&0==n.which)return s.onmouseup(n);if(s.cursorfreezed=!0,s.hasmoving=!0,s.rail.drag.hr){s.scroll.x=s.rail.drag.sx+(n.clientX-s.rail.drag.x);0>s.scroll.x&&(s.scroll.x=0);var t=s.scrollvaluemaxw;s.scroll.x>t&&(s.scroll.x=t)}else s.scroll.y=s.rail.drag.sy+(n.clientY-s.rail.drag.y),0>s.scroll.y&&(s.scroll.y=0),t=s.scrollvaluemax,s.scroll.y>t&&(s.scroll.y=t);return s.synched("mousemove",function(){s.rail.drag&&1==s.rail.drag.pt&&(s.showCursor(),s.rail.drag.hr?s.hasreversehr?s.doScrollLeft(s.scrollvaluemaxw-Math.round(s.scroll.x*s.scrollratio.x),s.opt.cursordragspeed):s.doScrollLeft(Math.round(s.scroll.x*s.scrollratio.x),s.opt.cursordragspeed):s.doScrollTop(Math.round(s.scroll.y*s.scrollratio.y),s.opt.cursordragspeed))}),s.cancelEvent(n)}}else s.checkarea=0},h.cantouch||s.opt.touchbehavior?(s.onpreventclick=function(n){if(s.preventclick)return s.preventclick.tg.onclick=s.preventclick.click,s.preventclick=!1,s.cancelEvent(n)},s.bind(s.win,"mousedown",s.ontouchstart),s.onclick=h.isios?!1:function(n){return s.lastmouseup?(s.lastmouseup=!1,s.cancelEvent(n)):!0},s.opt.grabcursorenabled&&h.cursorgrabvalue&&(s.css(s.ispage?s.doc:s.win,{cursor:h.cursorgrabvalue}),s.css(s.rail,{cursor:h.cursorgrabvalue}))):(v=function(n){if(s.selectiondrag){if(n){var t=s.win.outerHeight();n=n.pageY-s.selectiondrag.top;0<n&&n<t&&(n=0);n>=t&&(n-=t);s.selectiondrag.df=n}0!=s.selectiondrag.df&&(s.doScrollBy(2*-Math.floor(s.selectiondrag.df/6)),s.debounced("doselectionscroll",function(){v()},50))}},s.hasTextSelected="getSelection"in document?function(){return 0<document.getSelection().rangeCount}:"selection"in document?function(){return"None"!=document.selection.type}:function(){return!1},s.onselectionstart=function(){s.ispage||(s.selectiondrag=s.win.offset())},s.onselectionend=function(){s.selectiondrag=!1},s.onselectiondrag=function(n){s.selectiondrag&&s.hasTextSelected()&&s.debounced("selectionscroll",function(){v(n)},250)}),h.hasw3ctouch?(s.css(s.rail,{"touch-action":"none"}),s.css(s.cursor,{"touch-action":"none"}),s.bind(s.win,"pointerdown",s.ontouchstart),s.bind(document,"pointerup",s.ontouchend),s.bind(document,"pointermove",s.ontouchmove)):h.hasmstouch?(s.css(s.rail,{"-ms-touch-action":"none"}),s.css(s.cursor,{"-ms-touch-action":"none"}),s.bind(s.win,"MSPointerDown",s.ontouchstart),s.bind(document,"MSPointerUp",s.ontouchend),s.bind(document,"MSPointerMove",s.ontouchmove),s.bind(s.cursor,"MSGestureHold",function(n){n.preventDefault()}),s.bind(s.cursor,"contextmenu",function(n){n.preventDefault()})):this.istouchcapable&&(s.bind(s.win,"touchstart",s.ontouchstart),s.bind(document,"touchend",s.ontouchend),s.bind(document,"touchcancel",s.ontouchend),s.bind(document,"touchmove",s.ontouchmove)),!s.opt.cursordragontouch&&(h.cantouch||s.opt.touchbehavior)||(s.rail.css({cursor:"default"}),s.railh&&s.railh.css({cursor:"default"}),s.jqbind(s.rail,"mouseenter",function(){if(!s.ispage&&!s.win.is(":visible"))return!1;s.canshowonmouseevent&&s.showCursor();s.rail.active=!0}),s.jqbind(s.rail,"mouseleave",function(){s.rail.active=!1;s.rail.drag||s.hideCursor()}),s.opt.sensitiverail&&(s.bind(s.rail,"click",function(n){s.doRailClick(n,!1,!1)}),s.bind(s.rail,"dblclick",function(n){s.doRailClick(n,!0,!1)}),s.bind(s.cursor,"click",function(n){s.cancelEvent(n)}),s.bind(s.cursor,"dblclick",function(n){s.cancelEvent(n)})),s.railh&&(s.jqbind(s.railh,"mouseenter",function(){if(!s.ispage&&!s.win.is(":visible"))return!1;s.canshowonmouseevent&&s.showCursor();s.rail.active=!0}),s.jqbind(s.railh,"mouseleave",function(){s.rail.active=!1;s.rail.drag||s.hideCursor()}),s.opt.sensitiverail&&(s.bind(s.railh,"click",function(n){s.doRailClick(n,!1,!0)}),s.bind(s.railh,"dblclick",function(n){s.doRailClick(n,!0,!0)}),s.bind(s.cursorh,"click",function(n){s.cancelEvent(n)}),s.bind(s.cursorh,"dblclick",function(n){s.cancelEvent(n)})))),h.cantouch||s.opt.touchbehavior?(s.bind(h.hasmousecapture?s.win:document,"mouseup",s.ontouchend),s.bind(document,"mousemove",s.ontouchmove),s.onclick&&s.bind(document,"click",s.onclick),s.opt.cursordragontouch&&(s.bind(s.cursor,"mousedown",s.onmousedown),s.bind(s.cursor,"mouseup",s.onmouseup),s.cursorh&&s.bind(s.cursorh,"mousedown",function(n){s.onmousedown(n,!0)}),s.cursorh&&s.bind(s.cursorh,"mouseup",s.onmouseup))):(s.bind(h.hasmousecapture?s.win:document,"mouseup",s.onmouseup),s.bind(document,"mousemove",s.onmousemove),s.onclick&&s.bind(document,"click",s.onclick),s.bind(s.cursor,"mousedown",s.onmousedown),s.bind(s.cursor,"mouseup",s.onmouseup),s.railh&&(s.bind(s.cursorh,"mousedown",function(n){s.onmousedown(n,!0)}),s.bind(s.cursorh,"mouseup",s.onmouseup)),!s.ispage&&s.opt.enablescrollonselection&&(s.bind(s.win[0],"mousedown",s.onselectionstart),s.bind(document,"mouseup",s.onselectionend),s.bind(s.cursor,"mouseup",s.onselectionend),s.cursorh&&s.bind(s.cursorh,"mouseup",s.onselectionend),s.bind(document,"mousemove",s.onselectiondrag)),s.zoom&&(s.jqbind(s.zoom,"mouseenter",function(){s.canshowonmouseevent&&s.showCursor();s.rail.active=!0}),s.jqbind(s.zoom,"mouseleave",function(){s.rail.active=!1;s.rail.drag||s.hideCursor()}))),s.opt.enablemousewheel&&(s.isiframe||s.bind(h.isie&&s.ispage?document:s.win,"mousewheel",s.onmousewheel),s.bind(s.rail,"mousewheel",s.onmousewheel),s.railh&&s.bind(s.railh,"mousewheel",s.onmousewheelhr)),s.ispage||h.cantouch||/HTML|^BODY/.test(s.win[0].nodeName)||(s.win.attr("tabindex")||s.win.attr({tabindex:w++}),s.jqbind(s.win,"focus",function(n){o=s.getTarget(n).id||!0;s.hasfocus=!0;s.canshowonmouseevent&&s.noticeCursor()}),s.jqbind(s.win,"blur",function(){o=!1;s.hasfocus=!1}),s.jqbind(s.win,"mouseenter",function(n){c=s.getTarget(n).id||!0;s.hasmousefocus=!0;s.canshowonmouseevent&&s.noticeCursor()}),s.jqbind(s.win,"mouseleave",function(){c=!1;s.hasmousefocus=!1;s.rail.drag||s.hideCursor()})));s.onkeypress=function(t){var r;if(s.railslocked&&0==s.page.maxh||(t=t?t:window.e,r=s.getTarget(t),r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!r.getAttribute("type")&&!r.type||!/submit|button|cancel/i.tp)||n(r).attr("contenteditable")))return!0;if(s.hasfocus||s.hasmousefocus&&!o||s.ispage&&!o&&!c){if(r=t.keyCode,s.railslocked&&27!=r)return s.cancelEvent(t);var u=t.ctrlKey||!1,f=t.shiftKey||!1,i=!1;switch(r){case 38:case 63233:s.doScrollBy(72);i=!0;break;case 40:case 63235:s.doScrollBy(-72);i=!0;break;case 37:case 63232:s.railh&&(u?s.doScrollLeft(0):s.doScrollLeftBy(72),i=!0);break;case 39:case 63234:s.railh&&(u?s.doScrollLeft(s.page.maxw):s.doScrollLeftBy(-72),i=!0);break;case 33:case 63276:s.doScrollBy(s.view.h);i=!0;break;case 34:case 63277:s.doScrollBy(-s.view.h);i=!0;break;case 36:case 63273:s.railh&&u?s.doScrollPos(0,0):s.doScrollTo(0);i=!0;break;case 35:case 63275:s.railh&&u?s.doScrollPos(s.page.maxw,s.page.maxh):s.doScrollTo(s.page.maxh);i=!0;break;case 32:s.opt.spacebarenabled&&(f?s.doScrollBy(s.view.h):s.doScrollBy(-s.view.h),i=!0);break;case 27:s.zoomactive&&(s.doZoom(),i=!0)}if(i)return s.cancelEvent(t)}};s.opt.enablekeyboard&&s.bind(document,h.isopera&&!h.isopera12?"keypress":"keydown",s.onkeypress);s.bind(document,"keydown",function(n){n.ctrlKey&&(s.wheelprevented=!0)});s.bind(document,"keyup",function(n){n.ctrlKey||(s.wheelprevented=!1)});s.bind(window,"blur",function(){s.wheelprevented=!1});s.bind(window,"resize",s.lazyResize);s.bind(window,"orientationchange",s.lazyResize);s.bind(window,"load",s.lazyResize);!h.ischrome||s.ispage||s.haswrapper||(g=s.win.attr("style"),t=parseFloat(s.win.css("width"))+1,s.win.css("width",t),s.synched("chromefix",function(){s.win.attr("style",g)}));s.onAttributeChange=function(){s.lazyResize(s.isieold?250:30)};!1!==r&&(s.observerbody=new r(function(t){return t.forEach(function(t){if("attributes"==t.type)return n("body").hasClass("modal-open")&&!n.contains(n(".modal-dialog")[0],s.doc[0])?s.hide():s.show()}),document.body.scrollHeight!=s.page.maxh?s.lazyResize(30):void 0}),s.observerbody.observe(document.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]}));s.ispage||s.haswrapper||(!1!==r?(s.observer=new r(function(n){n.forEach(s.onAttributeChange)}),s.observer.observe(s.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),s.observerremover=new r(function(n){n.forEach(function(n){if(0<n.removedNodes.length)for(var t in n.removedNodes)if(s&&n.removedNodes[t]==s.win[0])return s.remove()})}),s.observerremover.observe(s.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(s.bind(s.win,h.isie&&!h.isie9?"propertychange":"DOMAttrModified",s.onAttributeChange),h.isie9&&s.win[0].attachEvent("onpropertychange",s.onAttributeChange),s.bind(s.win,"DOMNodeRemoved",function(n){n.target==s.win[0]&&s.remove()})));!s.ispage&&s.opt.boxzoom&&s.bind(window,"resize",s.resizeZoom);s.istextarea&&(s.bind(s.win,"keydown",s.lazyResize),s.bind(s.win,"mouseup",s.lazyResize));s.lazyResize(30)}"IFRAME"==this.doc[0].nodeName&&(y=function(){var t,i;s.iframexd=!1;try{t="contentDocument"in this?this.contentDocument:this.contentWindow.document}catch(r){s.iframexd=!0;t=!1}if(s.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;s.forcescreen=!0;s.isiframe&&(s.iframe={doc:n(t),html:s.doc.contents().find("html")[0],body:s.doc.contents().find("body")[0]},s.getContentSize=function(){return{w:Math.max(s.iframe.html.scrollWidth,s.iframe.body.scrollWidth),h:Math.max(s.iframe.html.scrollHeight,s.iframe.body.scrollHeight)}},s.docscroll=n(s.iframe.body));h.isios||!s.opt.iframeautoresize||s.isiframe||(s.win.scrollTop(0),s.doc.height(""),i=Math.max(t.getElementsByTagName("html")[0].scrollHeight,t.body.scrollHeight),s.doc.height(i));s.lazyResize(30);h.isie7&&s.css(n(s.iframe.html),{"overflow-y":"hidden"});s.css(n(s.iframe.body),{"overflow-y":"hidden"});h.isios&&s.haswrapper&&s.css(n(t.body),{"-webkit-transform":"translate3d(0,0,0)"});"contentWindow"in this?s.bind(this.contentWindow,"scroll",s.onscroll):s.bind(t,"scroll",s.onscroll);s.opt.enablemousewheel&&s.bind(t,"mousewheel",s.onmousewheel);s.opt.enablekeyboard&&s.bind(t,h.isopera?"keypress":"keydown",s.onkeypress);(h.cantouch||s.opt.touchbehavior)&&(s.bind(t,"mousedown",s.ontouchstart),s.bind(t,"mousemove",function(n){return s.ontouchmove(n,!0)}),s.opt.grabcursorenabled&&h.cursorgrabvalue&&s.css(n(t.body),{cursor:h.cursorgrabvalue}));s.bind(t,"mouseup",s.ontouchend);s.zoom&&(s.opt.dblclickzoom&&s.bind(t,"dblclick",s.doZoom),s.ongesturezoom&&s.bind(t,"gestureend",s.ongesturezoom))},this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){y.call(s.doc[0],!1)},500),s.bind(this.doc,"load",y))};this.showCursor=function(n,t){if(s.cursortimeout&&(clearTimeout(s.cursortimeout),s.cursortimeout=0),s.rail){if(s.autohidedom&&(s.autohidedom.stop().css({opacity:s.opt.cursoropacitymax}),s.cursoractive=!0),s.rail.drag&&1==s.rail.drag.pt||("undefined"!=typeof n&&!1!==n&&(s.scroll.y=Math.round(1*n/s.scrollratio.y)),"undefined"!=typeof t&&(s.scroll.x=Math.round(1*t/s.scrollratio.x))),s.cursor.css({height:s.cursorheight,top:s.scroll.y}),s.cursorh){var i=s.hasreversehr?s.scrollvaluemaxw-s.scroll.x:s.scroll.x;!s.rail.align&&s.rail.visibility?s.cursorh.css({width:s.cursorwidth,left:i+s.rail.width}):s.cursorh.css({width:s.cursorwidth,left:i});s.cursoractive=!0}s.zoom&&s.zoom.stop().css({opacity:s.opt.cursoropacitymax})}};this.hideCursor=function(n){s.cursortimeout||!s.rail||!s.autohidedom||s.hasmousefocus&&"leave"==s.opt.autohidemode||(s.cursortimeout=setTimeout(function(){s.rail.active&&s.showonmouseevent||(s.autohidedom.stop().animate({opacity:s.opt.cursoropacitymin}),s.zoom&&s.zoom.stop().animate({opacity:s.opt.cursoropacitymin}),s.cursoractive=!1);s.cursortimeout=0},n||s.opt.hidecursordelay))};this.noticeCursor=function(n,t,i){s.showCursor(t,i);s.rail.active||s.hideCursor(n)};this.getContentSize=s.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:s.haswrapper?function(){return{w:s.doc.outerWidth()+parseInt(s.win.css("paddingLeft"))+parseInt(s.win.css("paddingRight")),h:s.doc.outerHeight()+parseInt(s.win.css("paddingTop"))+parseInt(s.win.css("paddingBottom"))}}:function(){return{w:s.docscroll[0].scrollWidth,h:s.docscroll[0].scrollHeight}};this.onResize=function(n,t){if(!s||!s.win)return!1;if(!s.haswrapper&&!s.ispage){if("none"==s.win.css("display"))return s.visibility&&s.hideRail().hideRailHr(),!1;s.hidden||s.visibility||s.showRail().showRailHr()}var i=s.page.maxh,r=s.page.maxw,u=s.view.h,f=s.view.w;if(s.view={w:s.ispage?s.win.width():parseInt(s.win[0].clientWidth),h:s.ispage?s.win.height():parseInt(s.win[0].clientHeight)},s.page=t?t:s.getContentSize(),s.page.maxh=Math.max(0,s.page.h-s.view.h),s.page.maxw=Math.max(0,s.page.w-s.view.w),s.page.maxh==i&&s.page.maxw==r&&s.view.w==f&&s.view.h==u){if(s.ispage||(i=s.win.offset(),s.lastposition&&(r=s.lastposition,r.top==i.top&&r.left==i.left)))return s;s.lastposition=i}return(0==s.page.maxh?(s.hideRail(),s.scrollvaluemax=0,s.scroll.y=0,s.scrollratio.y=0,s.cursorheight=0,s.setScrollTop(0),s.rail&&(s.rail.scrollable=!1)):(s.page.maxh-=s.opt.railpadding.top+s.opt.railpadding.bottom,s.rail.scrollable=!0),0==s.page.maxw?(s.hideRailHr(),s.scrollvaluemaxw=0,s.scroll.x=0,s.scrollratio.x=0,s.cursorwidth=0,s.setScrollLeft(0),s.railh&&(s.railh.scrollable=!1)):(s.page.maxw-=s.opt.railpadding.left+s.opt.railpadding.right,s.railh&&(s.railh.scrollable=s.opt.horizrailenabled)),s.railslocked=s.locked||0==s.page.maxh&&0==s.page.maxw,s.railslocked)?(s.ispage||s.updateScrollBar(s.view),!1):(s.hidden||s.visibility?!s.railh||s.hidden||s.railh.visibility||s.showRailHr():s.showRail().showRailHr(),s.istextarea&&s.win.css("resize")&&"none"!=s.win.css("resize")&&(s.view.h-=20),s.cursorheight=Math.min(s.view.h,Math.round(s.view.h/s.page.h*s.view.h)),s.cursorheight=s.opt.cursorfixedheight?s.opt.cursorfixedheight:Math.max(s.opt.cursorminheight,s.cursorheight),s.cursorwidth=Math.min(s.view.w,Math.round(s.view.w/s.page.w*s.view.w)),s.cursorwidth=s.opt.cursorfixedheight?s.opt.cursorfixedheight:Math.max(s.opt.cursorminheight,s.cursorwidth),s.scrollvaluemax=s.view.h-s.cursorheight-s.cursor.hborder-(s.opt.railpadding.top+s.opt.railpadding.bottom),s.railh&&(s.railh.width=0<s.page.maxh?s.view.w-s.rail.width:s.view.w,s.scrollvaluemaxw=s.railh.width-s.cursorwidth-s.cursorh.wborder-(s.opt.railpadding.left+s.opt.railpadding.right)),s.ispage||s.updateScrollBar(s.view),s.scrollratio={x:s.page.maxw/s.scrollvaluemaxw,y:s.page.maxh/s.scrollvaluemax},s.getScrollTop()>s.page.maxh?s.doScrollTop(s.page.maxh):(s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y)),s.scroll.x=Math.round(s.getScrollLeft()*(1/s.scrollratio.x)),s.cursoractive&&s.noticeCursor()),s.scroll.y&&0==s.getScrollTop()&&s.doScrollTo(Math.floor(s.scroll.y*s.scrollratio.y)),s)};this.resize=s.onResize;this.lazyResize=function(n){return n=isNaN(n)?30:n,s.debounced("resize",s.resize,n),s};this.jqbind=function(t,i,r){s.events.push({e:t,n:i,f:r,q:!0});n(t).bind(i,r)};this.bind=function(n,t,i,r){var u="jquery"in n?n[0]:n;"mousewheel"==t?"onwheel"in s.win?s._bind(u,"wheel",i,r||!1):(n="undefined"!=typeof document.onmousewheel?"mousewheel":"DOMMouseScroll",tt(u,n,i,r||!1),"DOMMouseScroll"==n&&tt(u,"MozMousePixelScroll",i,r||!1)):u.addEventListener?(h.cantouch&&/mouseup|mousedown|mousemove/.test(t)&&s._bind(u,"mousedown"==t?"touchstart":"mouseup"==t?"touchend":"touchmove",function(n){if(n.touches){if(2>n.touches.length){var t=n.touches.length?n.touches[0]:n;t.original=n;i.call(this,t)}}else n.changedTouches&&(t=n.changedTouches[0],t.original=n,i.call(this,t))},r||!1),s._bind(u,t,i,r||!1),h.cantouch&&"mouseup"==t&&s._bind(u,"touchcancel",i,r||!1)):s._bind(u,t,function(n){return(n=n||window.event||!1)&&n.srcElement&&(n.target=n.srcElement),"pageY"in n||(n.pageX=n.clientX+document.documentElement.scrollLeft,n.pageY=n.clientY+document.documentElement.scrollTop),!1===i.call(u,n)||!1===r?s.cancelEvent(n):!0})};h.haseventlistener?(this._bind=function(n,t,i,r){s.events.push({e:n,n:t,f:i,b:r,q:!1});n.addEventListener(t,i,r||!1)},this.cancelEvent=function(n){return n?(n=n.original?n.original:n,n.preventDefault(),n.stopPropagation(),n.preventManipulation&&n.preventManipulation(),!1):!1},this.stopPropagation=function(n){return n?(n=n.original?n.original:n,n.stopPropagation(),!1):!1},this._unbind=function(n,t,i,r){n.removeEventListener(t,i,r)}):(this._bind=function(n,t,i,r){s.events.push({e:n,n:t,f:i,b:r,q:!1});n.attachEvent?n.attachEvent("on"+t,i):n["on"+t]=i},this.cancelEvent=function(n){return(n=window.event||!1,!n)?!1:(n.cancelBubble=!0,n.cancel=!0,n.returnValue=!1)},this.stopPropagation=function(n){return(n=window.event||!1,!n)?!1:(n.cancelBubble=!0,!1)},this._unbind=function(n,t,i){n.detachEvent?n.detachEvent("on"+t,i):n["on"+t]=!1});this.unbindAll=function(){for(var n,t=0;t<s.events.length;t++)n=s.events[t],n.q?n.e.unbind(n.n,n.f):s._unbind(n.e,n.n,n.f,n.b)};this.showRail=function(){return 0!=s.page.maxh&&(s.ispage||"none"!=s.win.css("display"))&&(s.visibility=!0,s.rail.visibility=!0,s.rail.css("display","block")),s};this.showRailHr=function(){return s.railh?(0!=s.page.maxw&&(s.ispage||"none"!=s.win.css("display"))&&(s.railh.visibility=!0,s.railh.css("display","block")),s):s};this.hideRail=function(){return s.visibility=!1,s.rail.visibility=!1,s.rail.css("display","none"),s};this.hideRailHr=function(){return s.railh?(s.railh.visibility=!1,s.railh.css("display","none"),s):s};this.show=function(){return s.hidden=!1,s.railslocked=!1,s.showRail().showRailHr()};this.hide=function(){return s.hidden=!0,s.railslocked=!0,s.hideRail().hideRailHr()};this.toggle=function(){return s.hidden?s.show():s.hide()};this.remove=function(){var r,i,t,u;for(s.stop(),s.cursortimeout&&clearTimeout(s.cursortimeout),s.debouncedelayed&&clearTimeout(s.debouncedelayed),s.doZoomOut(),s.unbindAll(),h.isie9&&s.win[0].detachEvent("onpropertychange",s.onAttributeChange),!1!==s.observer&&s.observer.disconnect(),!1!==s.observerremover&&s.observerremover.disconnect(),!1!==s.observerbody&&s.observerbody.disconnect(),s.events=null,s.cursor&&s.cursor.remove(),s.cursorh&&s.cursorh.remove(),s.rail&&s.rail.remove(),s.railh&&s.railh.remove(),s.zoom&&s.zoom.remove(),r=0;r<s.saved.css.length;r++)i=s.saved.css[r],i[0].css(i[1],"undefined"==typeof i[2]?"":i[2]);s.saved=!1;s.me.data("__nicescroll","");t=n.nicescroll;t.each(function(n){if(this&&this.id===s.id){delete t[n];for(var i=++n;i<t.length;i++,n++)t[n]=t[i];t.length--;t.length&&delete t[t.length]}});for(u in s)s[u]=null,delete s[u];s=null};this.scrollstart=function(n){return this.onscrollstart=n,s};this.scrollend=function(n){return this.onscrollend=n,s};this.scrollcancel=function(n){return this.onscrollcancel=n,s};this.zoomin=function(n){return this.onzoomin=n,s};this.zoomout=function(n){return this.onzoomout=n,s};this.isScrollable=function(t){if(t=t.target?t.target:t,"OPTION"==t.nodeName)return!0;for(;t&&1==t.nodeType&&!/^BODY|HTML/.test(t.nodeName);){var i=n(t),i=i.css("overflowY")||i.css("overflowX")||i.css("overflow")||"";if(/scroll|auto/.test(i))return t.clientHeight!=t.scrollHeight;t=t.parentNode?t.parentNode:!1}return!1};this.getViewport=function(t){var i,r;for(t=t&&t.parentNode?t.parentNode:!1;t&&1==t.nodeType&&!/^BODY|HTML/.test(t.nodeName);){if((i=n(t),/fixed|absolute/.test(i.css("position")))||(r=i.css("overflowY")||i.css("overflowX")||i.css("overflow")||"",/scroll|auto/.test(r)&&t.clientHeight!=t.scrollHeight||0<i.getNiceScroll().length))return i;t=t.parentNode?t.parentNode:!1}return!1};this.triggerScrollEnd=function(){if(s.onscrollend){var n=s.getScrollLeft(),t=s.getScrollTop();s.onscrollend.call(s,{type:"scrollend",current:{x:n,y:t},end:{x:n,y:t}})}};this.onmousewheel=function(n){if(!s.wheelprevented){if(s.railslocked)return s.debounced("checkunlock",s.resize,250),!0;if(s.rail.drag)return s.cancelEvent(n);if("auto"==s.opt.oneaxismousemode&&0!=n.deltaX&&(s.opt.oneaxismousemode=!1),s.opt.oneaxismousemode&&0==n.deltaX&&!s.rail.scrollable)return s.railh&&s.railh.scrollable?s.onmousewheelhr(n):!0;var t=+new Date,i=!1;return(s.opt.preservenativescrolling&&s.checkarea+600<t&&(s.nativescrollingarea=s.isScrollable(n),i=!0),s.checkarea=t,s.nativescrollingarea)?!0:((n=it(n,!1,i))&&(s.checkarea=0),n)}};this.onmousewheelhr=function(n){if(!s.wheelprevented){if(s.railslocked||!s.railh.scrollable)return!0;if(s.rail.drag)return s.cancelEvent(n);var t=+new Date,i=!1;return s.opt.preservenativescrolling&&s.checkarea+600<t&&(s.nativescrollingarea=s.isScrollable(n),i=!0),s.checkarea=t,s.nativescrollingarea?!0:s.railslocked?s.cancelEvent(n):it(n,!0,i)}};this.stop=function(){return s.cancelScroll(),s.scrollmon&&s.scrollmon.stop(),s.cursorfreezed=!1,s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y)),s.noticeCursor(),s};this.getTransitionSpeed=function(n){return n=Math.min(Math.round(10*s.opt.scrollspeed),Math.round(n/20*s.opt.scrollspeed)),20<n?n:0};s.opt.smoothscroll?s.ishwscroll&&h.hastransition&&s.opt.usetransition&&s.opt.smoothscroll?(this.prepareTransition=function(n,t){var i=t?20<n?n:0:s.getTransitionSpeed(n),r=i?h.prefixstyle+"transform "+i+"ms ease-out":"";return s.lasttransitionstyle&&s.lasttransitionstyle==r||(s.lasttransitionstyle=r,s.doc.css(h.transitionstyle,r)),i},this.doScrollLeft=function(n,t){var i=s.scrollrunning?s.newscrolly:s.getScrollTop();s.doScrollPos(n,i,t)},this.doScrollTop=function(n,t){var i=s.scrollrunning?s.newscrollx:s.getScrollLeft();s.doScrollPos(i,n,t)},this.doScrollPos=function(n,t,i){var r=s.getScrollTop(),u=s.getScrollLeft();if(((0>(s.newscrolly-r)*(t-r)||0>(s.newscrollx-u)*(n-u))&&s.cancelScroll(),0==s.opt.bouncescroll&&(0>t?t=0:t>s.page.maxh&&(t=s.page.maxh),0>n?n=0:n>s.page.maxw&&(n=s.page.maxw)),s.scrollrunning&&n==s.newscrollx&&t==s.newscrolly)||(s.newscrolly=t,s.newscrollx=n,s.newscrollspeed=i||!1,s.timer))return!1;s.timer=setTimeout(function(){var r=s.getScrollTop(),u=s.getScrollLeft(),i=Math.round(Math.sqrt(Math.pow(n-u,2)+Math.pow(t-r,2))),i=s.newscrollspeed&&1<s.newscrollspeed?s.newscrollspeed:s.getTransitionSpeed(i);s.newscrollspeed&&1>=s.newscrollspeed&&(i*=s.newscrollspeed);s.prepareTransition(i,!0);s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm);0<i&&(!s.scrollrunning&&s.onscrollstart&&s.onscrollstart.call(s,{type:"scrollstart",current:{x:u,y:r},request:{x:n,y:t},end:{x:s.newscrollx,y:s.newscrolly},speed:i}),h.transitionend?s.scrollendtrapped||(s.scrollendtrapped=!0,s.bind(s.doc,h.transitionend,s.onScrollTransitionEnd,!1)):(s.scrollendtrapped&&clearTimeout(s.scrollendtrapped),s.scrollendtrapped=setTimeout(s.onScrollTransitionEnd,i)),s.timerscroll={bz:new a(r,s.newscrolly,i,0,0,.58,1),bh:new a(u,s.newscrollx,i,0,0,.58,1)},s.cursorfreezed||(s.timerscroll.tm=setInterval(function(){s.showCursor(s.getScrollTop(),s.getScrollLeft())},60)));s.synched("doScroll-set",function(){s.timer=0;s.scrollendtrapped&&(s.scrollrunning=!0);s.setScrollTop(s.newscrolly);s.setScrollLeft(s.newscrollx);s.scrollendtrapped||s.onScrollTransitionEnd()})},50)},this.cancelScroll=function(){if(!s.scrollendtrapped)return!0;var n=s.getScrollTop(),t=s.getScrollLeft();return s.scrollrunning=!1,h.transitionend||clearTimeout(h.transitionend),s.scrollendtrapped=!1,s._unbind(s.doc[0],h.transitionend,s.onScrollTransitionEnd),s.prepareTransition(0),s.setScrollTop(n),s.railh&&s.setScrollLeft(t),s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm),s.timerscroll=!1,s.cursorfreezed=!1,s.showCursor(n,t),s},this.onScrollTransitionEnd=function(){s.scrollendtrapped&&s._unbind(s.doc[0],h.transitionend,s.onScrollTransitionEnd);s.scrollendtrapped=!1;s.prepareTransition(0);s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm);s.timerscroll=!1;var n=s.getScrollTop(),t=s.getScrollLeft();if(s.setScrollTop(n),s.railh&&s.setScrollLeft(t),s.noticeCursor(!1,n,t),s.cursorfreezed=!1,0>n?n=0:n>s.page.maxh&&(n=s.page.maxh),0>t?t=0:t>s.page.maxw&&(t=s.page.maxw),n!=s.newscrolly||t!=s.newscrollx)return s.doScrollPos(t,n,s.opt.snapbackspeed);s.onscrollend&&s.scrollrunning&&s.triggerScrollEnd();s.scrollrunning=!1}):(this.doScrollLeft=function(n,t){var i=s.scrollrunning?s.newscrolly:s.getScrollTop();s.doScrollPos(n,i,t)},this.doScrollTop=function(n,t){var i=s.scrollrunning?s.newscrollx:s.getScrollLeft();s.doScrollPos(i,n,t)},this.doScrollPos=function(n,r,u){function l(){if(s.cancelAnimationFrame)return!0;if(s.scrollrunning=!0,v=1-v)return s.timer=t(l)||1;var u=0,r,n,i=n=s.getScrollTop();s.dst.ay?(i=s.bzscroll?s.dst.py+s.bzscroll.getNow()*s.dst.ay:s.newscrolly,r=i-n,(0>r&&i<s.newscrolly||0<r&&i>s.newscrolly)&&(i=s.newscrolly),s.setScrollTop(i),i==s.newscrolly&&(u=1)):u=1;n=r=s.getScrollLeft();s.dst.ax?(n=s.bzscroll?s.dst.px+s.bzscroll.getNow()*s.dst.ax:s.newscrollx,r=n-r,(0>r&&n<s.newscrollx||0<r&&n>s.newscrollx)&&(n=s.newscrollx),s.setScrollLeft(n),n==s.newscrollx&&(u+=1)):u+=1;2==u?(s.timer=0,s.cursorfreezed=!1,s.bzscroll=!1,s.scrollrunning=!1,0>i?i=0:i>s.page.maxh&&(i=s.page.maxh),0>n?n=0:n>s.page.maxw&&(n=s.page.maxw),n!=s.newscrollx||i!=s.newscrolly?s.doScrollPos(n,i):s.onscrollend&&s.triggerScrollEnd()):s.timer=t(l)||1}var e,o,f,c,h,v;if(r="undefined"==typeof r||!1===r?s.getScrollTop(!0):r,s.timer&&s.newscrolly==r&&s.newscrollx==n)return!0;s.timer&&i(s.timer);s.timer=0;e=s.getScrollTop();o=s.getScrollLeft();(0>(s.newscrolly-e)*(r-e)||0>(s.newscrollx-o)*(n-o))&&s.cancelScroll();s.newscrolly=r;s.newscrollx=n;s.bouncescroll&&s.rail.visibility||(0>s.newscrolly?s.newscrolly=0:s.newscrolly>s.page.maxh&&(s.newscrolly=s.page.maxh));s.bouncescroll&&s.railh.visibility||(0>s.newscrollx?s.newscrollx=0:s.newscrollx>s.page.maxw&&(s.newscrollx=s.page.maxw));s.dst={};s.dst.x=n-o;s.dst.y=r-e;s.dst.px=o;s.dst.py=e;f=Math.round(Math.sqrt(Math.pow(s.dst.x,2)+Math.pow(s.dst.y,2)));s.dst.ax=s.dst.x/f;s.dst.ay=s.dst.y/f;c=0;h=f;0==s.dst.x?(c=e,h=r,s.dst.ay=1,s.dst.py=0):0==s.dst.y&&(c=o,h=n,s.dst.ax=1,s.dst.px=0);f=s.getTransitionSpeed(f);u&&1>=u&&(f*=u);s.bzscroll=0<f?s.bzscroll?s.bzscroll.update(h,f):new a(c,h,f,0,1,0,1):!1;s.timer||((e==s.page.maxh&&r>=s.page.maxh||o==s.page.maxw&&n>=s.page.maxw)&&s.checkContentSize(),v=1,s.cancelAnimationFrame=!1,s.timer=1,s.onscrollstart&&!s.scrollrunning&&s.onscrollstart.call(s,{type:"scrollstart",current:{x:o,y:e},request:{x:n,y:r},end:{x:s.newscrollx,y:s.newscrolly},speed:f}),l(),(e==s.page.maxh&&r>=e||o==s.page.maxw&&n>=o)&&s.checkContentSize(),s.noticeCursor())},this.cancelScroll=function(){return s.timer&&i(s.timer),s.timer=0,s.bzscroll=!1,s.scrollrunning=!1,s}):(this.doScrollLeft=function(n,t){var i=s.getScrollTop();s.doScrollPos(n,i,t)},this.doScrollTop=function(n,t){var i=s.getScrollLeft();s.doScrollPos(i,n,t)},this.doScrollPos=function(n,t){var r=n>s.page.maxw?s.page.maxw:n,i;0>r&&(r=0);i=t>s.page.maxh?s.page.maxh:t;0>i&&(i=0);s.synched("scroll",function(){s.setScrollTop(i);s.setScrollLeft(r)})},this.cancelScroll=function(){});this.doScrollBy=function(n,t){var r=0,r=t?Math.floor((s.scroll.y-n)*s.scrollratio.y):(s.timer?s.newscrolly:s.getScrollTop(!0))-n,i;if(s.bouncescroll&&(i=Math.round(s.view.h/2),r<-i?r=-i:r>s.page.maxh+i&&(r=s.page.maxh+i)),s.cursorfreezed=!1,i=s.getScrollTop(!0),0>r&&0>=i)return s.noticeCursor();if(r>s.page.maxh&&i>=s.page.maxh)return s.checkContentSize(),s.noticeCursor();s.doScrollTop(r)};this.doScrollLeftBy=function(n,t){var r=0,r=t?Math.floor((s.scroll.x-n)*s.scrollratio.x):(s.timer?s.newscrollx:s.getScrollLeft(!0))-n,i;if(s.bouncescroll&&(i=Math.round(s.view.w/2),r<-i?r=-i:r>s.page.maxw+i&&(r=s.page.maxw+i)),s.cursorfreezed=!1,i=s.getScrollLeft(!0),0>r&&0>=i||r>s.page.maxw&&i>=s.page.maxw)return s.noticeCursor();s.doScrollLeft(r)};this.doScrollTo=function(n){s.cursorfreezed=!1;s.doScrollTop(n)};this.checkContentSize=function(){var n=s.getContentSize();n.h==s.page.h&&n.w==s.page.w||s.resize(!1,n)};s.onscroll=function(){s.rail.drag||s.cursorfreezed||s.synched("scroll",function(){s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y));s.railh&&(s.scroll.x=Math.round(s.getScrollLeft()*(1/s.scrollratio.x)));s.noticeCursor()})};s.bind(s.docscroll,"scroll",s.onscroll);this.doZoomIn=function(t){var i,f,e,r;if(!s.zoomactive){s.zoomactive=!0;s.zoomrestore={style:{}};i="position top left zIndex backgroundColor marginTop marginBottom marginLeft marginRight".split(" ");f=s.win[0].style;for(e in i)r=i[e],s.zoomrestore.style[r]="undefined"!=typeof f[r]?f[r]:"";return s.zoomrestore.style.width=s.win.css("width"),s.zoomrestore.style.height=s.win.css("height"),s.zoomrestore.padding={w:s.win.outerWidth()-s.win.width(),h:s.win.outerHeight()-s.win.height()},h.isios4&&(s.zoomrestore.scrollTop=n(window).scrollTop(),n(window).scrollTop(0)),s.win.css({position:h.isios4?"absolute":"fixed",top:0,left:0,"z-index":u+100,margin:"0px"}),i=s.win.css("backgroundColor"),(""==i||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(i))&&s.win.css("backgroundColor","#fff"),s.rail.css({"z-index":u+101}),s.zoom.css({"z-index":u+102}),s.zoom.css("backgroundPosition","0px -18px"),s.resizeZoom(),s.onzoomin&&s.onzoomin.call(s),s.cancelEvent(t)}};this.doZoomOut=function(t){if(s.zoomactive)return s.zoomactive=!1,s.win.css("margin",""),s.win.css(s.zoomrestore.style),h.isios4&&n(window).scrollTop(s.zoomrestore.scrollTop),s.rail.css({"z-index":s.zindex}),s.zoom.css({"z-index":s.zindex}),s.zoomrestore=!1,s.zoom.css("backgroundPosition","0px 0px"),s.onResize(),s.onzoomout&&s.onzoomout.call(s),s.cancelEvent(t)};this.doZoom=function(n){return s.zoomactive?s.doZoomOut(n):s.doZoomIn(n)};this.resizeZoom=function(){if(s.zoomactive){var t=s.getScrollTop();s.win.css({width:n(window).width()-s.zoomrestore.padding.w+"px",height:n(window).height()-s.zoomrestore.padding.h+"px"});s.onResize();s.setScrollTop(Math.min(s.page.maxh,t))}};this.init();n.nicescroll.push(this)},p=function(n){var t=this;this.nc=n;this.steptime=this.lasttime=this.speedy=this.speedx=this.lasty=this.lastx=0;this.snapy=this.snapx=!1;this.demuly=this.demulx=0;this.lastscrolly=this.lastscrollx=-1;this.timer=this.chky=this.chkx=0;this.time=function(){return+new Date};this.reset=function(n,i){t.stop();var r=t.time();t.steptime=0;t.lasttime=r;t.speedx=0;t.speedy=0;t.lastx=n;t.lasty=i;t.lastscrollx=-1;t.lastscrolly=-1};this.update=function(n,i){var r=t.time();t.steptime=r-t.lasttime;t.lasttime=r;var r=i-t.lasty,e=n-t.lastx,u=t.nc.getScrollTop(),f=t.nc.getScrollLeft(),u=u+r,f=f+e;t.snapx=0>f||f>t.nc.page.maxw;t.snapy=0>u||u>t.nc.page.maxh;t.speedx=e;t.speedy=r;t.lastx=n;t.lasty=i};this.stop=function(){t.nc.unsynched("domomentum2d");t.timer&&clearTimeout(t.timer);t.timer=0;t.lastscrollx=-1;t.lastscrolly=-1};this.doSnapy=function(n,i){var r=!1;0>i?(i=0,r=!0):i>t.nc.page.maxh&&(i=t.nc.page.maxh,r=!0);0>n?(n=0,r=!0):n>t.nc.page.maxw&&(n=t.nc.page.maxw,r=!0);r?t.nc.doScrollPos(n,i,t.nc.opt.snapbackspeed):t.nc.triggerScrollEnd()};this.doMomentum=function(n){var e=t.time(),u=n?e+n:t.lasttime,f;n=t.nc.getScrollLeft();var h=t.nc.getScrollTop(),o=t.nc.page.maxh,s=t.nc.page.maxw;if(t.speedx=0<s?Math.min(60,t.speedx):0,t.speedy=0<o?Math.min(60,t.speedy):0,u=u&&60>=e-u,(0>h||h>o||0>n||n>s)&&(u=!1),n=t.speedx&&u?t.speedx:!1,t.speedy&&u&&t.speedy||n){f=Math.max(16,t.steptime);50<f&&(n=f/50,t.speedx*=n,t.speedy*=n,f=50);t.demulxy=0;t.lastscrollx=t.nc.getScrollLeft();t.chkx=t.lastscrollx;t.lastscrolly=t.nc.getScrollTop();t.chky=t.lastscrolly;var i=t.lastscrollx,r=t.lastscrolly,c=function(){var n=600<t.time()-e?.04:.02;t.speedx&&(i=Math.floor(t.lastscrollx-t.speedx*(1-t.demulxy)),t.lastscrollx=i,0>i||i>s)&&(n=.1);t.speedy&&(r=Math.floor(t.lastscrolly-t.speedy*(1-t.demulxy)),t.lastscrolly=r,0>r||r>o)&&(n=.1);t.demulxy=Math.min(1,t.demulxy+n);t.nc.synched("domomentum2d",function(){t.speedx&&(t.nc.getScrollLeft()!=t.chkx&&t.stop(),t.chkx=i,t.nc.setScrollLeft(i));t.speedy&&(t.nc.getScrollTop()!=t.chky&&t.stop(),t.chky=r,t.nc.setScrollTop(r));t.timer||(t.nc.hideCursor(),t.doSnapy(i,r))});1>t.demulxy?t.timer=setTimeout(c,f):(t.stop(),t.nc.hideCursor(),t.doSnapy(i,r))};c()}else t.doSnapy(t.nc.getScrollLeft(),t.nc.getScrollTop())}},h=n.fn.scrollTop;n.cssHooks.pageYOffset={get:function(t,i){return(i=n.data(t,"__nicescroll")||!1)&&i.ishwscroll?i.getScrollTop():h.call(t)},set:function(t,i){var r=n.data(t,"__nicescroll")||!1;return r&&r.ishwscroll?r.setScrollTop(parseInt(i)):h.call(t,i),this}};n.fn.scrollTop=function(t){if("undefined"==typeof t){var i=this[0]?n.data(this[0],"__nicescroll")||!1:!1;return i&&i.ishwscroll?i.getScrollTop():h.call(this)}return this.each(function(){var i=n.data(this,"__nicescroll")||!1;i&&i.ishwscroll?i.setScrollTop(parseInt(t)):h.call(n(this),t)})};f=n.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(t,i){return(i=n.data(t,"__nicescroll")||!1)&&i.ishwscroll?i.getScrollLeft():f.call(t)},set:function(t,i){var r=n.data(t,"__nicescroll")||!1;return r&&r.ishwscroll?r.setScrollLeft(parseInt(i)):f.call(t,i),this}};n.fn.scrollLeft=function(t){if("undefined"==typeof t){var i=this[0]?n.data(this[0],"__nicescroll")||!1:!1;return i&&i.ishwscroll?i.getScrollLeft():f.call(this)}return this.each(function(){var i=n.data(this,"__nicescroll")||!1;i&&i.ishwscroll?i.setScrollLeft(parseInt(t)):f.call(n(this),t)})};e=function(t){var i=this,r,u;if(this.length=0,this.name="nicescrollarray",this.each=function(n){for(var t=0,r=0;t<i.length;t++)n.call(i[t],r++);return i},this.push=function(n){i[i.length]=n;i.length++},this.eq=function(n){return i[n]},t)for(r=0;r<t.length;r++)u=n.data(t[r],"__nicescroll")||!1,u&&(this[this.length]=u,this.length++);return this},function(n,t,i){for(var r=0;r<t.length;r++)i(n,t[r])}(e.prototype,"show hide toggle onResize resize remove stop doScrollPos".split(" "),function(n,t){n[t]=function(){var n=arguments;return this.each(function(){this[t].apply(this,n)})}});n.fn.getNiceScroll=function(t){return"undefined"==typeof t?new e(this):this[t]&&n.data(this[t],"__nicescroll")||!1};n.extend(n.expr[":"],{nicescroll:function(t){return n.data(t,"__nicescroll")?!0:!1}});n.fn.niceScroll=function(t,i){var r,u;return"undefined"!=typeof i||"object"!=typeof t||"jquery"in t||(i=t,t=!1),i=n.extend({},i),r=new e,"undefined"==typeof i&&(i={}),t&&(i.doc=n(t),i.win=n(this)),u=!("doc"in i),u||"win"in i||(i.win=n(this)),this.each(function(){var t=n(this).data("__nicescroll")||!1;t||(i.doc=u?n(this):i.doc,t=new d(i,n(this)),n(this).data("__nicescroll",t));r.push(t)}),1==r.length?r[0]:r};window.NiceScroll={getjQuery:function(){return n}};n.nicescroll||(n.nicescroll=new e,n.nicescroll.options=y)});var profilepage="view_profile.aspx",v3ProfilePage="{urlBase}{lang}/profile/",membershippage="Account",xHeight,xWidth,newWindowOpen,popupWidth=524,popupHeight=685,maxnotes=1e3,startat=1,totalrows=0,currentpage=1,totalpages=0,p,site,settingsTop="top 5px",settingsBottom="bottom 5px",settingsBottomRight="br 5px",settings="5px";LocalisationInformation={getCountryCode:function(){var t=CookieSettings.readCookie("Culture"),n;if(t==null||t.length<2)n="en";else{t=t.substr(10,2).toLowerCase();switch(t){case"fr":n="fr";break;case"es":n="es";break;case"de":n="de";break;case"pt":n="pt";break;default:n="en"}}return n},getImagePath:function(){return t101.settings.paths.siteImages+this.getCountryCode()+"/"},getTimeSince:function(n,t){var f=t,r=0,i=0,e=0,h=Math.floor(n/1e3),o,s,u;for(h>0&&(r=Math.floor(h/60)),r>0&&(i=Math.floor(r/60),r=r%60),i>0&&(e=Math.floor(i/24),i=i%24),f=e===0&&i===0&&r===0?f.format(e,i,1):f.format(e,i,r),o=f.split(" "),s="",u=0;u<o.length;u++)o[u].substring(0,1)!=="0"&&(s=s+o[u]+" ");return s}};CookieSettings={createCookie:function(n,t,i){var u=new Date;u.setDate(u.getDate()+i);var r=n+"="+escape(t)+(i==null?"":";expires="+u.toGMTString()),f=document.location.hostname.split("."),e=f.length;r+=";domain="+f[e-2]+"."+f[e-1];r+=";path=/";document.location.protocol==="https:"&&(r+=";secure");document.cookie=r},readCookie:function(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)===" ";)t=t.substring(1,t.length);if(t.indexOf(r)===0)return t.substring(r.length,t.length)}return null},eraseCookie:function(n){CookieSettings.createCookie(n,"",-1)}};String.prototype.format=String.prototype.format||function(){var n=Array.prototype.slice.call(arguments);return this.replace(/\{(\d+)\}/gi,function(t,i){return typeof n[i]!="undefined"?n[i]:t})};culture={cookieDomain:"",update:function(n,t){function r(n){var u=window.location.pathname.substr(1,window.location.pathname.length),i=u.split("/"),r,t;if(i<1)return window.location;for(r=window.location.protocol+"//"+window.location.host,t=0;t<i.length;t++){if(t===0&&i[t].length===2&&n!==undefined&&n!==null&&n.length>1){r+="/"+n.substring(0,2);continue}i[t].length<3&&isNaN(parseInt(i[t],10))||(r+="/"+i[t])}return r+window.location.search}var i=window.t101.SessionIdStorage.getSessionId();jQuery.ajax({type:"PUT",headers:{Authorization:"Bearer "+i},url:t101.settings.paths.apiUrl+"/AccountActions/SetCulture",data:JSON.stringify({Culture:n}),contentType:"application/json; charset=utf-8",success:function(){window.location=r(n);t.length>0&&openMessages(t)}})}};Settings={MemberImages:"",ThumbnailLocation:0,NoImageThumbnail:"",CommonSiteImages:""};var dateFormatting={jsonDateParse:function(inputDate){return eval(inputDate.replace(/\/Date\((\d+)\)\//gi,"new Date($1)"))},convertToUtcDate:function(n){return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())},displayDate:function(n){return n==null?"":this.formatDate(this.jsonDateParse(n))},formatDate:function(n){var t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),f=Math.round((t.getTime()-n.getTime())/36e5),r,u;return f<24?LocalisationInformation.getTimeSince(t-n,recon_localisation.Ago):n>i?recon_localisation.Today+", "+this.getTime(n):(r=i,r.setDate(i.getDate()-1),n>r)?recon_localisation.Yesterday+", "+this.getTime(n):(u=i,u.setDate(i.getDate()-5),n>u)?recon_localisation["DateTimeDay"+n.getDay()]+", "+this.getTime(n):n.getFullYear()<t.getFullYear()?recon_localisation["DateTimeAbbreviatedDay"+n.getDay()]+" "+n.getDate()+" "+recon_localisation["DateTimeAbbreviatedMonth"+n.getMonth()]+" "+n.getFullYear():recon_localisation["DateTimeAbbreviatedDay"+n.getDay()]+" "+n.getDate()+" "+recon_localisation["DateTimeAbbreviatedMonth"+n.getMonth()]},getTime:function(n){var t=n.getHours(),i=n.getMinutes();return this.ZeroPadInteger(t)+":"+this.ZeroPadInteger(i)},basicDate:function(n){if(n==null)return"";var t;return t=n.Updated!==undefined?this.jsonDateParse(n.Updated):typeof n=="object"?n:this.jsonDateParse(n),this.ZeroPadInteger(t.getDate())+" "+recon_localisation["DateTimeAbbreviatedMonth"+t.getMonth()]+" "+t.getFullYear()},ZeroPadInteger:function(n){return n<10?"0"+n:n}},favouritePhotos={activeObject:"#ImgBlock",favouritePhotoType:1,favouritePhotoTop:0,galleries:[],images:[],totalImages:0,currentGalleryId:0,imagesPerPage:0,galleriesPerPage:0,currentImagesPage:0,currentGalleriesPage:0,profileEventId:0,serviceUrl:"Services/FavouritePhotos.asmx",enableFavouritePhotoOptions:function(){loggedIn&&($(favouritePhotos.activeObject).unbind("mouseover").unbind("mouseout"),$("#FavouritePhotoButton").unbind("mouseover").unbind("click"),$("#FavouritePhotoButton").bind("mouseover",function(){favouritePhotos.showButtonFavourite()}).bind("mouseout",function(){favouritePhotos.hideButtonFavourite()}),$(favouritePhotos.activeObject).bind("mouseover",function(){favouritePhotos.showButtonFavourite()}),$(favouritePhotos.activeObject).bind("mouseout",function(){favouritePhotos.hideButtonFavourite()}))},FavouritePhotosAddGallery:function(n){var t=JSON.stringify({galleryName:n});$.ajax({type:"POST",async:!0,cache:!1,data:t,url:this.serviceUrl+"/AddGallery",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){!n.d<=0?favouritePhotos.galleries=favouritePhotos.getGalleries(favouritePhotos.addPhotoToGalleryAction):ui.showErrorDialog(recon_localisation.dialogErrorGeneralText)},error:function(){ui.showErrorDialog(recon_localisation.dialogErrorGeneralText)}})},disableFavouritePhotoOptions:function(){$(favouritePhotos.activeObject).unbind("mouseover").unbind("mouseout");$("#FavouritePhotoButton").unbind("mouseover")},showButtonFavourite:function(){if(!$(".profile_no_images").is(":visible")&&($("#slideshow").data("isSlideShowPlaying")&&imagesNav("Stop"),!$("#main_image img").data("OwnImage"))){$("#main_image img").data("CanAddToFavourites")||$("#main_image img").data("CanAddToFavourites")==undefined||this.favouritePhotoType==2?$("#main_image img").data("GalleryId")==0?$("#FavouritePhotoButton").text(recon_localisation.FavouritePhotoIphoneMessage):$("#FavouritePhotoButton").text(recon_localisation.dialogFavouritePhotoAdd):$("#FavouritePhotoButton").text(recon_localisation.dialogFavouritePhotoInHiddenGallery);var t=$("#main_image").offset(),n=t.top+$("#main_image").height()/2-$("#FavouritePhotoButton").height()/2;if($("#FavouritePhotoButton").css("left",t.left+($("#main_image").width()-216)/2),this.favouritePhotoTop>0&&(n=this.favouritePhotoTop),this.favouritePhotoType==2?n=300:$("#FavouritePhotoButton").css("position","absolute"),$("#main_image img").data("GalleryId")==0){$("#FavouritePhotoButton").unbind("click").css("top",n).corner("5px").show();return}$("#main_image img").data("CanAddToFavourites")==!0||$("#main_image img").data("CanAddToFavourites")==undefined||this.favouritePhotoType==2?$("#FavouritePhotoButton").unbind("click").bind("click",function(){favouritePhotos.addPhotoToGalleryOptions()}).css("top",n).css("cursor","pointer").corner("5px").show():$("#FavouritePhotoButton").unbind("click").css("top",n).css("cursor","not-allowed").corner("5px").show()}},hideButtonFavourite:function(){$("#FavouritePhotoButton").hide()},addPhotoToGalleryOptions:function(){if(favouritePhotos.hideButtonFavourite(),favouritePhotos.totalGalleries()==0){ui.block();ui.showBusy();favouritePhotos.getGalleries(favouritePhotos.addPhotoToGalleryAction);return}favouritePhotos.addPhotoToGalleryAction()},addPhotoToGalleryAction:function(){var t,n,i;if(window.slideShow&&slideShow._isPlaying&&slideShow.stop(),ui.block(),favouritePhotos.totalGalleries()==0){ui.showBusy();favouritePhotos.FavouritePhotosAddGallery(recon_localisation.dialogFavouritePhotosDefaultGallery);return}for(ui.hideBusy(),$("#favouritePhotoGalleryListOptions").empty(),t=$.Enumerable.From(favouritePhotos.galleries).Where(function(n){if(n.hasOwnProperty("Name")&&n.Name)return n}).OrderBy(function(n){if(n.hasOwnProperty("Name")&&n.Name)return n.Name.toLowerCase()}).ToArray(),n=0;n<t.length;n++)i=$("<option><\/option>").attr("value",favouritePhotos.galleries[n].Id).text(favouritePhotos.galleries[n].Name),$("#favouritePhotoGalleryListOptions").append(i);$(".dialogOverlay").show();favouritePhotos.showDialogFavourite()},showBusySaving:function(){var t=$("#main_image").offset(),n=t.top+$("#main_image").height()/2-$("#progressindicator").height()/2;$("#progressindicator").removeClass("favouritePhotoIndicator").addClass("favouritePhotoIndicator").css("left",t.left+150);this.favouritePhotoTop>0&&(n=this.favouritePhotoTop);this.favouritePhotoType==2&&(n=300);$("#progressindicator").css("top",n).show()},hideBusySaving:function(){$("#progressindicator").hide()},showDialogFavourite:function(){ui.resetDialog();ui.block();var t=$("#main_image"),i=$("#FavouritePhotoForm"),r=$(window).width()/2-100,u=t.offset(),n=u.top+t.height()/2-i.height()/2;this.favouritePhotoTop>0&&(n=this.favouritePhotoTop-70);this.favouritePhotoType==2&&(r=u.left+150,n=300);$("#btnFPCancel").unbind("click").bind("click",function(){favouritePhotos.cancelDialogFavourite()});$("#btnFPSave").unbind("click").bind("click",function(){favouritePhotos.saveFavouritePhoto()});i.css({top:n,left:r}).show();favouritePhotos.disableFavouritePhotoOptions();favouritePhotos.hideButtonFavourite()},cancelDialogFavourite:function(){ui.unblock();this.favouritePhotoType==2&&ui.block();ui.resetDialog();$("#btnFPCancel").unbind("click");$("#btnFPSave").unbind("click");$("#FavouritePhotoForm").hide();$(".dialogOverlay").hide();favouritePhotos.enableFavouritePhotoOptions()},saveFavouritePhoto:function(){$("#btnFPCancel").unbind("click");$("#btnFPSave").unbind("click");$("#FavouritePhotoForm").hide();favouritePhotos.FavouritePhotosAddPhoto($("#favouritePhotoGalleryListOptions").val())},FavouritePhotosAddPhoto:function(n){var t,i;ui.showBusy();t=$("#main_image").data("image")==undefined?$("#main_image img").attr("src").toString().match(/.*\/(.+?)\./)[1]:$("#main_image").data("image").Id;i=JSON.stringify({galleryId:n,imageReference:t,referenceType:this.favouritePhotoType,profileEventId:favouritePhotos.profileEventId});$.ajax({type:"POST",async:!0,cache:!1,data:i,url:this.serviceUrl+"/AddPhoto",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){ui.hideBusy();favouritePhotos.enableFavouritePhotoOptions();switch(n.d){case-1:ui.hideBusy();favouritePhotos.favouritePhotoType==1?ui.showErrorDialog(recon_localisation.dialogFavouritePhotosMaxLimitMessage):ui.showErrorDialog(recon_localisation.dialogFavouritePhotosMaxLimitMessage,ui.cancelErrorDialogLeaveBlock);break;case 0:ui.unblock();break;default:favouritePhotos.favouritePhotoType==1&&ui.unblock()}},error:function(){ui.showErrorDialog(recon_localisation.dialogErrorGeneralText)}})},totalGalleries:function(){return this.galleries?$.Enumerable.From(this.galleries).Count(function(n){return n.Id>0}):0},totalImagePages:function(){return Math.floor(this.totalImages/this.imagesPerPage)},totalGalleryPages:function(){return Math.floor(this.totalGalleries()/this.galleriesPerPage)},getGalleries:function(n){ui.block();$.ajax({type:"POST",url:this.serviceUrl+"/GetGalleries",contentType:"application/json; charset=utf-8",dataType:"json",data:{},success:function(t){favouritePhotos.galleries=[];t&&(t.hasOwnProperty("d")&&(t=t.d),favouritePhotos.galleries=t,typeof n=="function"&&n())}})}},global_gallery_images,global_thumbnail_images,current_gallery_id=0,global_galleries_list;recon_images={imageSize:{thumbnail:0,profile:1,gallery:2,eventListImage:19,eventGalleryThumb:21,eventGalleryFullSize:22},getImageUrl:function(n,t){return userimagepath+t+"/"+n+".jpg"}};messages={};messages={fetchingPage:!1,itemCount:0,pageSize:100,messageSize:1e3,HasMore:!0,Container:null,Template:null,Direction:"Down",CurrentPage:0,ConversationId:null,webDomain:"",profileId:0,RecipientProfileId:null,ImagePath:"",AttachmentList:[],RedirectToInbox:!1,unreadConversations:0,siteImagePath:"",countTotalMessages:0,countNewMessages:0,emptyListText:"",emptyVisitorListText:"",emptyFavouriteListText:"",isOfficialMessage:!1,visibleMessageIds:[],openProfileInV3:"",updateMessageCount:function(){if($(".UnreadCountTab").html(messages.countNewMessages>0?"("+messages.countNewMessages+")":""),messages.poll.pollType===0||messages.poll.pollType===1){var n=messages.countNewMessages>0&&messages.poll.pollType===0?" ("+messages.countNewMessages+" "+recon_localisation.Unread+")":"";$("#MessageTitleBar span").text(messages.countTotalMessages+" "+recon_localisation.Messages+n)}},fetchNextPage:function(){messages.Direction==="Up"?messages.Container.prop("scrollTop")==0&&messages.HasMore&&messages.postData("/Conversation/MessagePage",JSON.stringify({page:messages.CurrentPage,conversationId:messages.ConversationId}),messages.messageCallback):Math.ceil(messages.Container.prop("scrollTop")+Math.ceil(messages.Container.height()))>=messages.Container.prop("scrollHeight")&&messages.HasMore&&!messages.fetchingPage&&(messages.fetchingPage=!0,messages.postData("/Messages/ConversationNextPage",JSON.stringify({page:messages.CurrentPage}),messages.conversationCallback))},fetchNextSentPage:function(){Math.ceil(messages.Container.prop("scrollTop")+Math.ceil(messages.Container.height()))>=messages.Container.prop("scrollHeight")&&messages.HasMore&&!messages.fetchingPage&&(messages.fetchingPage=!0,messages.postData("/Sent/ConversationNextPage",JSON.stringify({page:messages.CurrentPage}),messages.conversationCallback))},postData:function(n,t,i){$.ajax({type:"POST",async:!0,cache:!1,data:t,url:n,contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){i(n)}})},conversationCallback:function(n){var t,i,r;if(n.Conversations.length>0){for(messages.CurrentPage++,messages.Template.tmpl(n.Conversations).insertBefore("#LoadingMore"),t=0,i=n.Conversations.length;t<i;t++)r=n.Conversations[t].ConversationId,$("#"+r).children(".ConversationCol2").children("A:first-child").children(".ConversationDate").data("Timestamp",n.Conversations[t].Timestamp);n.Conversations.length>0&&dateFormatting.jsonDateParse(n.Conversations[0].Timestamp)>messages.poll.conversationTimestamp&&(messages.poll.conversationTimestamp=dateFormatting.jsonDateParse(n.Conversations[0].Timestamp));n.Conversations.length<messages.pageSize&&($("#LoadingMore").hide(),$("#ConversationList .Conversation").eq($("#ConversationList .Conversation").length-2).height("35px"),messages.HasMore=!1)}messages.fetchingPage=!1},messageCallback:function(n){var t,i;n.MessageList.length>0&&(messages.CurrentPage++,t=messages.Container.prop("scrollHeight"),$("#MessageListEmpty").length>0&&$("#MessageListEmpty").remove(),messages.Template.tmpl(n.MessageList).insertAfter("#LoadingMore"),i=messages.Container.prop("scrollHeight"),n.MessageList.length<messages.pageSize?($("#LoadingMore").hide(),messages.HasMore=!1):$("#MessageList div:first").prepend($("#LoadingMore")),messages.roundCorners(),messages.conversationFiller(),messages.isOfficialMessage||messages.Container.prop({scrollTop:i-t}))},messageSend:function(){messages.enableSendMessage(!1);var n=JSON.stringify({conversationId:messages.ConversationId,recipientProfileId:messages.RecipientProfileId,messageBody:$("#messageBody").val(),attachments:$("#attachments").val()});messages.postData("/Messages/SendMessage",n,messages.messageSendCallback);t101.analytics.trackEvent(t101.analytics.Kpis,t101.constants.gaKpis.SendMessageClicked,"Send Message clicked.")},messageSendCallback:function(n){switch(n.Result){case 0:if($("#messageBody").val(""),$("#attachments").val(""),$("#AttachmentCount").empty(),messages.checkMessageLength("#messageBody"),messages.RedirectToInbox){window.location="/Conversation/"+$("#conversationId").val();return}messages.poll.stop();messages.poll.inboxPoll();messages.conversationFiller();$("#messageBody").focus();break;case 1:ui.resetDialog();$("#dialog_header").text(n.ShortDescription);$("#dialog_text").text(n.LongDescription);$("#btnNo").click(function(){ui.cancelDialog()}).show();$("#btnYes").click(function(){ui.cancelDialog();messages.makeProfileVisible()}).show();ui.showDialog();break;case 2:case 3:case 4:ui.resetDialog();$("#dialog_header").text(n.ShortDescription);$("#dialog_text").text(n.LongDescription);$("#btnOk").show().bind("click",function(){ui.cancelDialog();messages.enableSendMessage(!0)});ui.showDialog()}},makeProfileVisible:function(){var n=JSON.stringify({conversationId:messages.ConversationId,recipientProfileId:messages.RecipientProfileId,messageBody:$("#messageBody").val()});messages.postData("/Messages/MakeProfileVisibleAndSendMessage",n,messages.messageSendCallback);messages.enableSendMessage(!0)},getImagesForGallery:function(n){var t=JSON.stringify({galleryId:n});messages.postData("/Messages/GetImagesForGallery",t,messages.imagesForGalleryCallback)},imagesForGalleryCallback:function(n){$("#GalleryImageList").empty();messages.Template=$("#GalleryImageItemTemplate");messages.Template.tmpl(n).appendTo("#GalleryImageList")},preloadAttachmentList:function(){for(var i,n,t=0,r=messages.AttachmentList.length;t<r;t++)i=messages.AttachmentList[t],n=$("<img><\/img>").addClass("floatLeft").attr("alt",""),n.attr("src",messages.ImagePath+i+".jpg"),n.attr("id",i),n.click(messages.removeAttachmentFromList),n.appendTo("#AttachmentImageList");messages.AttachmentList.length>0&&($("#Done").removeAttr("disabled").removeClass("button_greyed_out").button("option","disabled",!1),$("#Done").button(),$("#Done").data("isBound",!0),$("#Done").unbind().click(function(){$("#attachments").val(messages.AttachmentList);$("form").submit()}))},addAttachmentToList:function(n){for(var t,i=0,r=messages.AttachmentList.length;i<r;i++)if(messages.AttachmentList[i]==n)return;if(t=$("<img><\/img>").addClass("floatLeft").attr("alt",""),t.attr("src",messages.ImagePath+n+".jpg"),t.attr("id",n),t.click(messages.removeAttachmentFromList),messages.AttachmentList.length<10){if(messages.AttachmentList.push(n),t.appendTo("#AttachmentImageList"),$("#AttachmentImageList img").css("margin-right","2px"),$("#AttachmentImageList img:nth-child(10)").css("margin-right","0px"),$("#Done").data("isBound"))return;$("#Done").removeAttr("disabled").removeClass("button_greyed_out").button("option","disabled",!1).button().data("isBound",!0).unbind().click(function(){$("#attachments").val(messages.AttachmentList);$("form").submit()})}},removeAttachmentFromList:function(){var t=$(this).attr("id"),n,i;for($("#"+t).remove(),n=0,i=messages.AttachmentList.length;n<i;n++)messages.AttachmentList[n]==t&&messages.AttachmentList.splice(n,1);messages.AttachmentList.length===0&&$("#Done").data("isBound",!1).unbind().attr("disabled","disabled").button("option","disabled",!0).addClass("button_greyed_out")},confirmDeleteConversation:function(n,t){ui.block();ui.resetDialog();$("#dialog_header").text(recon_localisation.dialogRemoveMessagesTitle);$("#dialog_text").text(recon_localisation.dialogRemoveMessagesText);$("#btnYes").show().bind("click",function(){ui.unblock();ui.cancelDialog();messages.deleteConversation(n,t)});$("#btnNo").show().bind("click",function(){ui.unblock();ui.cancelDialog()});ui.showDialog()},deleteConversation:function(n,t){var i="/Messages/DeleteConversation",r=JSON.stringify({conversationId:n});t?messages.postData(i,r,messages.returnToInbox):messages.postData(i,r,messages.deleteConversationCallback)},deleteConversationCallback:function(n){if($("#"+n+" div").hasClass("UnreadHighlight")&&messages.countNewMessages--,messages.countTotalMessages--,messages.updateMessageCount(),$("#"+n).remove(),messages.poll.pollType===1||messages.HasMore&&!messages.fetchingPage){messages.fetchNextSentPage();return}if(messages.poll.pollType===0||messages.HasMore&&!messages.fetchingPage){messages.fetchNextPage();return}messages.emptyConversationList()},returnToInbox:function(){window.location="/"},confirmDeleteOfficialMessage:function(n,t){ui.block();ui.resetDialog();$("#dialog_header").text(recon_localisation.dialogRemoveMessagesTitle);$("#dialog_text").text(recon_localisation.dialogRemoveOfficialMessagesText);$("#btnYes").show().bind("click",function(){ui.unblock();ui.cancelDialog();messages.deleteOfficialMessage(n,t)});$("#btnNo").show().bind("click",function(){ui.unblock();ui.cancelDialog()});ui.showDialog()},deleteOfficialMessage:function(n,t){var i="/Messages/DeleteOfficialMessage",r=JSON.stringify({conversationId:n});t?messages.postData(i,r,messages.returnToInbox):messages.postData(i,r,messages.deleteConversationCallback)},roundCorners:function(){$(".TitleBar").corner("top 5px");$("#MessageListEmpty").corner();$("#MessageInboxWrapper, #MyVisitorListWrapper, #FavouriteListWrapper, #SendMessageFormItems, .MessageBodyContainer, .ContentWrapper").corner("bottom 5px");$(".MessageTab A").corner("top 5px");$(".MessageTab").corner("top 5px")},previousMessageTime:null,messageTime:function(n){var t='<div class="MessageTimerContainer">'+dateFormatting.formatDate(dateFormatting.jsonDateParse(n))+'<div class="HiddenMessageTimerContainer">'+n+"<\/div><\/div>",i;return messages.previousMessageTime!=null&&(i=Math.abs(dateFormatting.jsonDateParse(n)-messages.previousMessageTime),i/6e4<10&&(t="")),messages.previousMessageTime=dateFormatting.jsonDateParse(n),t},checkMessageLength:function(n){var t=$(n).val().length;t===0||t>messages.messageSize?(messages.enableSendMessage(!1),t>messages.messageSize&&$("#SendMessageFooter").addClass("overlimit")):($("#SendMessageFooter").removeClass("overlimit"),messages.enableSendMessage(!0));$("#SendMessageRemainChars").text(messages.messageSize-t)},enableSendMessage:function(n){if(n){if($("#SendMessage").data("isBound"))return;$("#SendMessage").removeAttr("disabled").removeClass("button_greyed_out").button("option","disabled",!1);$("#SendMessage").button();$("#SendMessage").unbind().bind("click",messages.messageSend);$("#SendMessage").data("isBound",!0)}else $("#SendMessage").data("isBound",!1),$("#SendMessage").unbind(),$("#SendMessage").attr("disabled","disabled").button("option","disabled",!0).addClass("button_greyed_out")},updateTimes:function(){$(".MessageTimerContainer").each(function(){var n=$(this).find(".HiddenMessageTimerContainer").text();n!=""&&$(this).html(dateFormatting.formatDate(dateFormatting.jsonDateParse(n))+'<div class="HiddenMessageTimerContainer">'+n+"<\/div>")})},updateConversationTimeStamps:function(){$(".ConversationDate").each(function(){$(this).html(dateFormatting.formatDate(dateFormatting.jsonDateParse($(this).data("Timestamp"))))})},viewProfile:function(n,t,i,r){var f=messages.v3PilotUrl,e="{urlBase}{lang}/profile/".replace("{urlBase}",f),o=t101.helpers.getLanguageFromCookie(),s=e.replace("{lang}",o),u;if(getProfileWindowDimensions(),messages.openProfileInV3=="True"){let n;n=i?t+"?version="+i:t;newWindowOpen=window.open(s+n,t,"resizable=yes,scrollbars=yes,status=0,width=1150,height="+xHeight)}else u=messages.webDomain+"/view_profile.aspx?id="+n,r!=undefined&&r!=null&&r.length>0&&(u+="&"+r),newWindowOpen=window.open(u,n,"resizable=yes,scrollbars=yes,status=0,width=995,height="+xHeight);giveWindowFocus(0)},removeHighLight:function(n){$("."+n).removeClass("UnreadHighlight")},viewAttachments:function(n,t){var i,r;if($("#CloseAttachments").unbind().bind("click",messages.closeAttachmentsView),t.length>0){i=[];for(r in t)t[r].Id!="00000000-0000-0000-0000-000000000000"&&(i[i.length]=t[r]);slideShow.init();slideShow.dataList=i;slideShow._imageIndex=n;slideShow.displayCallback=messages.showAttachmentImage;t.length>1?slideShow.enable():slideShow.disable();messages.showAttachmentImage(t[n])}},noAttachment:function(){ui.resetDialog();$("#dialog_header").text(recon_localisation.dialogPhotoRemovedHeader);$("#dialog_text").text(recon_localisation.dialogPhotoRemoved);$("#btnOk").click(function(){ui.cancelDialog()}).show();ui.showDialog()},showAttachmentImage:function(n){$("#attachmentContainer .attachment").attr("src",messages.ImagePath+"/"+n.Id+".jpg");$("#attachmentContainer .attachment").data("GalleryId",n.GalleryId);messages.profileId===n.ProfileId?$("#attachmentContainer .attachment").data("OwnImage",!0):$("#attachmentContainer .attachment").data("OwnImage",!1);$("#attachmentContainer .attachment").data("CanAddToFavourites",n.CanAddToFavourites);$("#attachmentContainer").show();setTimeout(function(){messages.resetBlock()},500)},resetBlock:function(){var n=$("#attachmentContainer .attachment").height()+"px",t=$("#attachmentContainer .attachment").width()+"px";$("#ImgBlock").css("width",t).css("height",n)},closeAttachmentsView:function(){slideShow.stop();$("#attachmentContainer").hide();$("#attachmentContainer .attachment").attr("src",messages.siteImagePath+"/noimage.gif")},navigate:function(n){window.open(n,"wgm_main");self.blur()},conversationFiller:function(){var i=$("#MessageList").height(),n=0,t;$(".MessageSentWrapper, .MessageTimerContainer, .MessageReceivedWrapper, .MessageSpacer").each(function(){n+=$(this).height();$(this).hasClass("MessageTimerContainer")&&(n+=10)});t=i-n-6;t<=0?$("#NewConversationFiller").remove():$("#NewConversationFiller").height(t+"px")},showLogin:function(n,t){ui.block();ui.resetDialog();$("#dialog_header").text(n);$("#dialog_text").text(t);$("#dialog_text").after($("#loginform"));$("#btnLogin").show().bind("click",function(){document.forms[0].submit()});ui.showDialog()},forgottenDetails:function(n){newWindowOpen=window.open(messages.webDomain+"/"+n,"wgm_main");giveWindowFocus(0)},emptySentList:function(){if($("#NotesListEmpty").remove(),$("#LoadingMore").hide(),$("#NotesList").children().length===0){var n=$("<div><\/div>").text(messages.emptyListText);n.attr("id","NotesListEmpty");$("#NotesList").prepend(n)}},emptyConversationList:function(){if($("#ConversationListEmpty").remove(),$("#LoadingMore").hide(),$("#ConversationList").children().length===0){var n=$("<div><\/div>").text(messages.emptyListText);n.attr("id","ConversationListEmpty");$("#ConversationList").prepend(n)}}};messages.inbox={makeProfileVisible:function(){messages.postData("/Messages/MakeProfileVisible",{},window.location.reload)}};messages.poll={timeout:2e4,conversationTimestamp:new Date,conversationSentTimestamp:new Date,visitorTimestamp:new Date,favouriteTimestamp:new Date,messageTimestamp:new Date,timestamp:new Date,playNewMessageAudio:!1,playCruisedAudio:!1,playFavouriteOnlineAudio:!1,timer:null,pollType:0,start:function(){messages.poll.timer=setTimeout(function(){messages.poll.inboxPoll()},messages.poll.timeout)},stop:function(){clearTimeout(messages.poll.timer)},inboxPoll:function(){messages.ConversationId==null&&(messages.ConversationId="00000000-0000-0000-0000-000000000000");var n=JSON.stringify({convDate:messages.poll.conversationTimestamp,convSentDate:messages.poll.conversationSentTimestamp,visitDate:messages.poll.visitorTimestamp,favDate:messages.poll.favouriteTimestamp,msgDate:messages.poll.messageTimestamp,timestamp:messages.poll.timestamp,pollType:messages.poll.pollType,convId:messages.ConversationId,recipientProfileId:messages.RecipientProfileId});$.ajax({type:"POST",async:!0,cache:!1,data:n,url:"/Poll/Inbox",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){messages.poll.inboxPollCallback(n)},error:function(){messages.poll.start()}})},inboxPollCallback:function(n){n!=null&&(messages.countTotalMessages=n.Msgs,messages.countNewMessages=n.NewMsgs,messages.updateMessageCount(),$("#FavouritesOnlineCount").html(n.Favs),$("#MyVisitorCount").html(n.Visitors),(messages.poll.pollType===0||messages.poll.pollType===1)&&(messages.poll.updateConversationList(n.ConvList),messages.poll.removeDeleteConversations(n.ConvDeleteList)),(messages.poll.pollType===0||messages.poll.pollType===1||messages.poll.pollType===3)&&messages.poll.updateVisitorList(n.VisitList),(messages.poll.pollType===0||messages.poll.pollType===1||messages.poll.pollType===3)&&messages.poll.updateFavouriteList(n.FavList),messages.poll.pollType===2&&messages.poll.updateMessageList(n.MsgList,n.Read),n.MsgAudio&&messages.poll.conversationTimestamp!=dateFormatting.jsonDateParse(n.ConvDate)&&messages.poll.playSound(1),n.CruiseAudio&&messages.poll.playSound(3),n.FavAudio&&messages.poll.playSound(2),messages.poll.conversationTimestamp=dateFormatting.jsonDateParse(n.ConvDate),messages.poll.conversationSentTimestamp=dateFormatting.jsonDateParse(n.ConvSentDate),messages.poll.visitorTimestamp=dateFormatting.jsonDateParse(n.VisitDate),messages.poll.favouriteTimestamp=dateFormatting.jsonDateParse(n.FavDate),messages.poll.messageTimestamp=dateFormatting.jsonDateParse(n.MsgDate),messages.poll.timestamp=dateFormatting.jsonDateParse(n.Timestamp),messages.poll.start())},updateConversationList:function(n){var i,r,u,t,f,e;if(n!=null&&n.length>0){if(messages.poll.checkForLoadingMore("#ConversationList"),$("#ConversationList").length>0){for(i=0,r=n.length;i<r;i++)$("#"+n[i].ConversationId).slideUp("fast",function(){$(this).remove()});for(u=$("#ConversationList div:first-child").attr("id"),$("#ConversationItemTemplate").tmpl(n).insertBefore("#"+u).hide(),$("#ConversationList div:hidden").slideDown("slow",function(){$("#LoadingMore").hide()}),t=0,f=n.length;t<f;t++)e=n[t].ConversationId,$("#"+e).children(".ConversationCol2").children("A:first-child").children(".ConversationDate").data("Timestamp",n[t].Timestamp);window.opener!=null&&window.opener.messageCentreNotification()}$("#ConversationListEmpty").length>0&&$("#ConversationListEmpty").remove()}},removeDeleteConversations:function(n){if(n!=null&&n.length>0)for(var t=0,i=n.length;t<i;t++)$("#"+n[t]).slideUp("fast",function(){$(this).remove()})},updateVisitorList:function(n){var t,i,r,u;if(n!=null&&n.length>0)for($("#MyVisitorListEmpty").length>0&&($("#ProfileVisitTemplate").tmpl(n).insertBefore($("#MyVisitorListEmpty")),$("#MyVisitorListEmpty").fadeOut("fast")),t=0,$("#MyVisitorList a").each(function(){t<n.length?$(this).replaceWith($("#ProfileVisitTemplate").tmpl(n[t])):$(this).remove();t++}),i=t,r=n.length;i<r;i++)$("#ProfileVisitTemplate").tmpl(n[i]).insertAfter($("#MyVisitorList a:last-child"));else $("#MyVisitorList a").each(function(){$(this).remove()}),$("#MyVisitorListEmpty").length>0?$("#MyVisitorListEmpty").fadeIn("fast"):(u=$("<div><\/div").attr("id","MyVisitorListEmpty").html(messages.emptyVisitorListText),$("#MyVisitorList").html(u))},updateFavouriteList:function(n){var t,i,r,u;if(n!=null&&n.length>0)for($("#FavouriteListEmpty").length>0&&($("#ProfileFavouriteTemplate").tmpl(n).insertBefore($("#FavouriteListEmpty")),$("#FavouriteListEmpty").fadeOut("fast")),t=0,$("#FavouriteList a").each(function(){t<n.length?$(this).hasClass(n[t].Name)||$(this).replaceWith($("#ProfileFavouriteTemplate").tmpl(n[t])):$(this).remove();t++}),i=t,r=n.length;i<r;i++)$("#ProfileFavouriteTemplate").tmpl(n[i]).insertAfter($("#FavouriteList a:last-child"));else $("#FavouriteList a").each(function(){$(this).remove()}),$("#FavouriteListEmpty").length>0?$("#FavouriteListEmpty").fadeIn("fast"):(u=$("<div><\/div").attr("id","FavouriteListEmpty").html(messages.emptyFavouriteListText),$("#FavouriteListEmpty").html(u))},updateMessageList:function(n,t){var r,i;for($("div.MessageReceivedWrapper div.UnreadGrey").removeClass("UnreadGrey").addClass("ReceivedGrey"),$("div.MessageReceivedWrapper img.UnreadIcon").each(function(){$(this).removeClass("UnreadIcon").addClass("ReadIcon");$(this).attr("title","Read").attr("alt","Read");$(this).attr("src",messages.siteImagePath+"/icon_Read.png")}),t&&($("div.MessageSentWrapper div.UnreadGrey").removeClass("UnreadGrey").addClass("ReceivedGrey"),$("div.MessageSentWrapper img.UnreadIcon").each(function(){$(this).removeClass("UnreadIcon").addClass("ReadIcon");$(this).attr("title","Read").attr("alt","Read");$(this).attr("src",messages.siteImagePath+"/icon_Read.png")})),r=[],i=0;i<n.length;i++)messages.poll.isMessageAlreadyVisible(n[i])==!1&&(r.push(n[i]),messages.visibleMessageIds==null&&(messages.visibleMessageIds=[]),messages.visibleMessageIds.push(n[i].Id));n.length>0&&($("#MessageListEmpty").length>0&&$("#MessageListEmpty").remove(),messages.Template.tmpl(r).insertBefore(".NewProfile"),messages.roundCorners(),$("#MessageList").animate({scrollTop:$("#MessageList").prop("scrollHeight")},1500),window.opener!=null&&window.opener.messageCentreNotification())},isMessageAlreadyVisible:function(n){if(messages.visibleMessageIds==null||messages.visibleMessageIds.length===0)return!1;for(var t=0;t<messages.visibleMessageIds.length;t++)if(messages.visibleMessageIds[t]==n.Id)return!0;return!1},checkForLoadingMore:function(n){if(!($("#LoadingMore").length>0)){var t=$("<img><\/img>").attr("alt","loading").attr("src",messages.siteImagePath+"/ajax-loader.gif"),i=$("<div><\/div>").attr("id","LoadingMore").addClass("Conversation").addClass("floatLeftCleared").html(t).hide();$(n).prepend(i)}},playSound:function(n){var t="message_alert_sound",i;switch(n){case 1:t="message_alert_sound";break;case 2:t="favourite_alert_sound";break;case 3:t="cruise_alert_sound";break;case 4:t="thread_alert_sound"}i="<audio autoplay>";i+='<source src="'+messages.siteImagePath+"/"+t+'.webm" type="audio/webm">';i+='<source src="'+messages.siteImagePath+"/"+t+'.mp3" type="audio/mpeg">';i+="<\/audio>";$("#NotificationSound").html(i)}},function(n){var i="placeholderEnhanced",r="placeholder"in document.createElement("input")&&"placeholder"in document.createElement("textarea"),u={focus:"focus.placeholder",blur:"blur.placeholder",submit:"submit.placeholder"},t="placeholder",f;r||(f=n.fn.val,n.fn.val=function(){var n=this[0];if(this.length)return arguments.length||n.nodeName!=="INPUT"&&n.nodeName!=="TEXTAREA"?(this.hasClass(t)&&this.removeClass(t),f.apply(this,arguments)):n.value===this.attr("placeholder")?"":n.value});n.fn[i]=function(){function o(t){var i={},r=["placeholder","name","id"];return n.each(t.attributes,function(t,u){u.specified&&n.inArray(u.name,r)<0&&(i[u.name]=u.value)}),i}function f(n){n.css({position:"absolute",left:"-9999em"})}function e(n){n.css({position:"",left:""})}if(this.length)return r||n("form").filter(function(){return!n.data(this,i)}).each(function(){n(this).bind(u.submit,function(){n(this).find("input[placeholder], textarea[placeholder]").each(function(){n(this).val()||this.disabled||(this.value="")})});n.data(this,i,!0)}),this.each(function(){if(!n.data(this,i)){var h=this,s=n(h),a=s.attr("placeholder"),v=h.type==="password",c,y,l;y=function(){s.val()||(r?s.addClass(t):v?(e(c),f(s)):s.val(a).addClass(t))};!v||r?l=function(){s.hasClass(t)&&(r||(h.value=""),s.removeClass(t))}:r||(l=function(){e(s);f(c)},c=n("<input>",n.extend(o(h),{type:"text",value:a,tabindex:-1})).addClass(t).bind(u.focus,function(){s.trigger(u.focus)}).insertBefore(s));s.bind(u.blur,y).bind(u.focus,l).trigger(u.blur);n.data(h,i,!0)}})};n(function(){n("input[placeholder], textarea[placeholder]")[i]()})}(jQuery);showSlideShow=!0;gblImageId=0;friendsListClassIndex=0;friendsListClassArray=["col1","col1","col1","col1","col1","col1","col1","col2 coltop","col2","col2","col2","col2","col2","col2","col3 coltop","col3","col3","col3","col3","col3","col3"];profile_not_found={removeFavourite:function(n){var t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,i=window.t101.SessionIdStorage.getSessionId();jQuery.ajax({type:"POST",headers:{Authorization:"Bearer "+i},url:t+"/Helpers/ProfileActions/RemoveFromFavourites?profileId="+n,contentType:"application/json; charset=utf-8",dataType:"json",success:function(){$(".profilenotfound_ff_btn").parent().hide()}})},cancelFriendRequest:function(n){var t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,i=window.t101.SessionIdStorage.getSessionId();jQuery.ajax({type:"POST",headers:{Authorization:"Bearer "+i},url:t+"/Helpers/ProfileActions/CancelFriendRequest?profileId="+n,contentType:"application/json; charset=utf-8",dataType:"json",success:function(){$(".profilenotfound_ff_btn").parent().hide()}})},removeFriend:function(n){var t=angular.injector(["ng","t101SharedModule"]).get("sharedConstants").apiBasePath,i=window.t101.SessionIdStorage.getSessionId();jQuery.ajax({type:"POST",headers:{Authorization:"Bearer "+i},url:t+"/Helpers/ProfileActions/RemoveFriend?profileId="+n,contentType:"application/json; charset=utf-8",dataType:"json",success:function(){$(".profilenotfound_ff_btn").parent().hide()}})}};slideShow={playButton:"#playButton",prevButton:"#prevButton",nextButton:"#nextButton",duration:3e3,imageContainer:"#imageContainer",dataList:null,displayCallback:null,pageResetCallback:null,_timer:null,_imageIndex:0,_isPlaying:!1,controlNextPrev:!1,init:function(){this.playButton="#playButton";this.prevButton="#prevButton";this.nextButton="#nextButton";this.duration=3e3;this.imageContainer="#imageContainer";this.dataList=null;this.displayCallback=null;this.pageResetCallback=null;this._timer=null;this._imageIndex=0;this._isPlaying=!1;this.controlNextPrev=!1;jQuery(this.playButton).unbind("click");jQuery(this.nextButton).unbind("click");jQuery(this.prevButton).unbind("click")},enable:function(){jQuery(this.playButton).on("click",function(){slideShow.start()}).removeAttr("disabled").removeClass("button_greyed_out");jQuery(this.nextButton).on("click",function(){slideShow.next()}).removeAttr("disabled").removeClass("button_greyed_out");jQuery(this.prevButton).on("click",function(){slideShow.previous()}).removeAttr("disabled").removeClass("button_greyed_out")},disable:function(){jQuery(this.playButton).off("click").attr("disabled","disabled").addClass("button_greyed_out");jQuery(this.nextButton).off("click").attr("disabled","disabled").addClass("button_greyed_out");jQuery(this.prevButton).off("click").attr("disabled","disabled").addClass("button_greyed_out")},start:function(){$(this.playButton).unbind("click").click(function(){slideShow.stop()});$(this.playButton+" img").attr("src",$(this.playButton+" img").attr("src").replace("play","stop"));this._isPlaying=!0;slideShow.changeImage(this._imageIndex)},stop:function(){$(this.playButton).unbind("click").click(function(){slideShow.start()});$(this.playButton+" img").attr("src",$(this.playButton+" img").attr("src").replace("stop","play"));this._isPlaying=!1;clearTimeout(this._timer)},next:function(){slideShow.stop();slideShow.changeImage(this._imageIndex+1)},previous:function(){slideShow.stop();this._imageIndex==0&&(this._imageIndex=this.dataList.length);slideShow.changeImage(this._imageIndex-1)},enablePreviousButton:function(){$(this.prevButton).removeClass("button_greyed_out").button({disabled:!1}).unbind("click").click(function(){slideShow.previous()})},disablePreviousButton:function(){$(this.prevButton).addClass("button_greyed_out").button({disabled:!0}).unbind("click")},enableNextButton:function(){$(this.nextButton).removeClass("button_greyed_out").button({disabled:!1}).unbind("click").click(function(){slideShow.next()})},disableNextButton:function(){$(this.nextButton).addClass("button_greyed_out").button({disabled:!0}).unbind("click")},changeImage:function(n){if((this.dataList[n]==null||this.dataList[n].Id==0)&&(n=0,this.pageResetCallback!=null&&this.pageResetCallback()),this.displayCallback!=null){if(this.dataList[n].IsHidden){slideShow.changeImage(n+1);return}if(this.dataList[n].IsAdult&&this.dataList[n].IsStandard){slideShow.changeImage(n+1);return}this.displayCallback(this.dataList[n])}this._isPlaying&&(this._timer=setTimeout("slideShow.changeImage("+(n+1)+")",this.duration),$(this.playButton+" img").attr("src",$(this.playButton+" img").attr("src").replace("play","stop")));this._imageIndex=n;slideShow.controlNextPrev&&(n==0?slideShow.disablePreviousButton():slideShow.enablePreviousButton())},setIndex:function(n){for(var t=0,i=this.dataList.length;t<i;t++)if(this.dataList[t].Id==n){this._imageIndex=t;return}}};slideShow.favouritesPhotos={reset:function(){this._imageIndex=0;favouritePhotos.currentImagesPage=0;favouritePhotos.displayFavouritePhotoList(favouritePhotos.calculatePagedImagesArray());ui.block()},displayPhoto:function(n){n&&n.Id>0&&(slideShow._imageIndex+5>=favouritePhotos.images.length&&favouritePhotos.totalImages!=favouritePhotos.images.length&&slideShow.favouritesPhotos.nextPage(),n.IsHidden&&favouritePhotos.displayRemoveFavouritePhotoDialog(n),n.ProfileImage&&favouritePhotos.displayFavouriteProfilePhoto(n,!1),n.EventImage&&favouritePhotos.displayFavouriteEventPhoto(n,!1),slideShow._imageIndex+1==(favouritePhotos.currentImagesPage+1)*favouritePhotos.imagesPerPage&&(favouritePhotos.currentImagesPage++,favouritePhotos.displayFavouritePhotoList(favouritePhotos.calculatePagedImagesArray())))},nextPage:function(){favouritePhotos.currentImagesPage<favouritePhotos.totalImagePages()&&favouritePhotos.totalImages!=favouritePhotos.images.length&&favouritePhotos.currentGalleryId>0&&(ui.block(),$.ajax({type:"POST",url:"Services/FavouritePhotos.asmx/GetPhotos",data:JSON.stringify({galleryId:favouritePhotos.currentGalleryId,page:favouritePhotos.currentImagesPage+1}),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n&&n.hasOwnProperty("d")&&(favouritePhotos.images=favouritePhotos.images.concat(n.d.FavouritePhotos),slideShow.dataList=favouritePhotos.sortedImagesArray(),favouritePhotos.totalImages=n.d.TotalImagesInGallery)}}))}};slideShow.eventsPhotos={displayPhoto:function(n){if(n&&n.Id>0){var t=new Image;$(t).load(function(){$("#main_image img").replaceWith(t);$("#main_image").data("image",n);resetImageBlock()}).attr("src",recon_images.getImageUrl(n.ImageGuid,recon_images.imageSize.eventGalleryFullSize))}}};travelPlan={ErrorMessage:"",TravelPeriodDdl:{day:0,month:0,year:0,Reset:function(){travelPlan.TravelPeriodDdl.day=0;travelPlan.TravelPeriodDdl.month=0;travelPlan.TravelPeriodDdl.year=0}},DefaultTravelPlan:{ProfileId:-1,LocationId:-1,FromDate:new Date,ToDate:new Date,SpecificLocation:"",Branch1:-1,Branch2:-1,Branch3:-1,Branch4:-1,Branch5:-1},CurrentUser:{myLocations:null,selectedTravelPlan:null,selectedTravelPlanId:0,travelPlans:null,userId:0},Initialise:function(n,t,i){function u(){travelPlan.CurrentUser.selectedTravelPlanId=0;travelPlan.Dialog.DisplayTravelPlanDialog(travelPlan.Dialog.Mode.Add)}function f(){travelPlan.CurrentUser.travelPlans!==null&&travelPlan.CurrentUser.travelPlans.length<=0?$(".default-message-holder").show():($(".default-message-holder").hide(),travelPlan.CurrentUser.travelPlans.length>0&&travelPlan.Ui.SortTravelPlansByDate())}travelPlan.CurrentUser.userId=n;travelPlan.CurrentUser.travelPlans=t;for(var r=0;r<travelPlan.CurrentUser.travelPlans.length;r++)travelPlan.CurrentUser.travelPlans[r].FromDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(travelPlan.CurrentUser.travelPlans[r].FromDate)),travelPlan.CurrentUser.travelPlans[r].ToDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(travelPlan.CurrentUser.travelPlans[r].ToDate));travelPlan.CurrentUser.myLocations=i;travelPlan.CurrentUser.selectedTravelPlan=travelPlan.DefaultTravelPlan;f();$("#ErrorSummary").hide();$("#ErrorDialog").hide();$("#previewprofile").click(function(){viewprofile(travelPlan.CurrentUser.userId)}).css("cursor","pointer");$("#dialog_controls").append($("#dialog_travel_plans"));$("#dialog_text").addClass("dialog_delete_plans");travelPlan.Ui.BindTravelPlanContainers();travelPlan.Ui.BindDateContainers();$(".add_travel_plan").click(function(){u()});$("a.t101-button").button();travelPlan.Ui.DisableButton($("#btn_deleteTravel, #btn_editTravel"));$("#dialog").keypress(function(n){var t=n.keyCode?n.keyCode:n.which;t===13&&(n.preventDefault(),$("#btnSave").trigger("click"))})},Dialog:{Mode:{Add:1,Edit:2,Delete:3},DisplayTravelPlanDialog:function(n){function f(n){var t=$(".results_container");t!==undefined&&t!==null&&t.length>0?e(n):(travelPlan.CurrentUser.travelPlans[0]=n,$.ajax({type:"POST",async:!0,cache:!1,data:"{ travelPlanId: "+n.Id+"}",url:"/Services/TravelPlanWebService.asmx/GetTravelPlanPanel",contentType:"application/json; charset=utf-8",dataType:"html",success:function(n){n&&n!=""?b(n):(travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText),ui.unblock())},error:function(){travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText);ui.unblock()}}))}function e(n){travelPlan.CurrentUser.travelPlans[travelPlan.CurrentUser.travelPlans.length]=n;var i=$(".travel_plan_container").first(),t=$(i).clone();travelPlan.Ui.UpdateTravelPlanContainer(t,n);$(t).appendTo($(".travel_plans_container"));travelPlan.Ui.SortTravelPlansByDate();travelPlan.Ui.BindTravelPlanContainers();ui.unblock();ui.hideBusy()}function o(){$.ajax({type:"POST",async:!0,data:travelPlan.Utilities.ToJson(travelPlan.CurrentUser.selectedTravelPlan),url:"/Services/TravelPlanWebService.asmx/Add",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n.data!==undefined||n.d!==null?(n.d.FromDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(n.d.FromDate)),n.d.ToDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(n.d.ToDate)),f(n.d)):(travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText),ui.unblock())},error:function(){travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText);ui.unblock()}})}function s(){$.ajax({type:"POST",async:!0,data:travelPlan.Utilities.ToJson(travelPlan.CurrentUser.selectedTravelPlan),url:"/Services/TravelPlanWebService.asmx/Update",contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n.data!==undefined||n.d!==null?(n.d.FromDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(n.d.FromDate)),n.d.ToDate=dateFormatting.convertToUtcDate(dateFormatting.jsonDateParse(n.d.ToDate)),st(n.d)):(travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText),ui.unblock())},error:function(){travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText);ui.unblock()}})}function i(n,t,i){return n<0||t<0||i<0?!1:!0}function h(){for(var n=1;n<6;n++)$("#branch"+n).removeClass("attribute_error");travelPlan.Ui.HideErrorContainer()}function c(){ui.cancelDialog();var n=travelPlan.CurrentUser.selectedTravelPlanId;$.ajax({type:"POST",async:!0,data:"{ travelPlanId: "+n+"}",url:"/Services/TravelPlanWebService.asmx/Delete",contentType:"application/json; charset=utf-8",dataType:"json",success:function(t){t.d!==undefined&&t.d?tt(n):(travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText),ui.unblock())},error:function(){travelPlan.Validation.ShowErrorDialog(recon_localisation.dialogErrorGeneralText);ui.unblock()}})}function l(){$("#btnCancel").show().bind("click",function(){ui.unblock();ui.cancelDialog();travelPlan.Ui.Reset()});$("#btnSave").show().bind("click",function(){ut();travelPlan.Ui.Reset()});travelPlan.Ui.ResetErrorAttributes();u(376)}function a(){var n=$(".travelFrom.day").val(),t=$(".travelFrom.month").val(),i=$(".travelFrom.year").val();return travelPlan.Utilities.BuildDateFromDropDownVals(n,t,i)}function v(){var n=$(".travelTo.day").val(),t=$(".travelTo.month").val(),i=$(".travelTo.year").val();return travelPlan.Utilities.BuildDateFromDropDownVals(n,t,i)}function y(){for(var t=travelPlan.CurrentUser.travelPlans.length,n=0;n<t;n++)if(travelPlan.CurrentUser.travelPlans[n].Id==travelPlan.CurrentUser.selectedTravelPlanId)return travelPlan.CurrentUser.selectedTravelPlan=travelPlan.CurrentUser.travelPlans[n],travelPlan.CurrentUser.travelPlans[n];return null}function p(){var n={},u=travelPlan.CurrentUser.selectedTravelPlanId,t,i,r;return u>0&&(n.Id=u),t=$("input.specific-location").val(),t.length>50&&(t=t.substring(0,49)),n.ProfileId=travelPlan.CurrentUser.userId,n.LocationId=travelPlan.Ui.GetLastBranch().val(),i=new Date(a()),r=new Date(v()),n.FromDate=i.getFullYear()+"/"+(i.getMonth()+1)+"/"+i.getDate(),n.ToDate=r.getFullYear()+"/"+(r.getMonth()+1)+"/"+r.getDate(),n.SpecificLocation=t,n.Branches=w(),travelPlan.CurrentUser.selectedTravelPlan=n,n}function w(){for(var i,n="",t=1;t<6;t++)i=$("#branch"+t).val(),parseInt(i,10)>=0&&(n+=i+",");return n.substring(0,n.length-1)}function b(n){$(".repeater-container").hide();$(".default-message-holder").hide();var t=$.parseJSON(n);$(".repeater-container").html(t.d);$(".repeater-container").show();travelPlan.Ui.BindTravelPlanContainers();ui.unblock();ui.hideBusy()}function k(){var u=$(".travelFrom.day").val(),f=$(".travelFrom.month").val(),e=$(".travelFrom.year").val(),t,n,r;if(!i(u,f,e))return $(".travelFrom").addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanFromDateRequired),!1;var o=$(".travelTo.day").val(),s=$(".travelTo.month").val(),h=$(".travelTo.year").val();return i(o,s,h)?(t=travelPlan.Utilities.BuildDateFromDropDownVals(u,f,e),t===null)?($(".travelFrom.day").addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanInvalidDate),!1):(n=travelPlan.Utilities.BuildDateFromDropDownVals(o,s,h),n===null)?($(".travelTo.day").addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanInvalidDate),!1):(r=new Date,n<new Date(r.getFullYear(),r.getMonth(),r.getDate()))?(travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanToDateInPastError),!1):t>n?(travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanFromDateBeforeToDateError),!1):ct(t,n)?!0:!1:($(".travelTo").addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanToDateRequired),!1)}function d(){if(!at())return!1;var t=travelPlan.CurrentUser.myLocations.split(","),n=travelPlan.Ui.GetLastBranch();return vt(n,t)?pt()?($(n).removeClass("attribute_error"),travelPlan.Ui.HideErrorContainer(),!0):!1:!1}function g(){var n=y();n!==undefined&&n!==null&&(ft(),travelPlan.Validation.RemoveErrorAttributeFromLocation(),r(".travelFrom",travelPlan.Utilities.TryGetDate(n.FromDate)),r(".travelTo",travelPlan.Utilities.TryGetDate(n.ToDate)))}function r(n,t){$(n+".day").val(t.getDate());$(n+".month").val(t.getMonth()+1);$(n+".year").val(t.getFullYear())}function nt(n){for(var i=travelPlan.CurrentUser.travelPlans.length,t=0;t<i;t++)travelPlan.CurrentUser.travelPlans[t]!==undefined&&travelPlan.CurrentUser.travelPlans[t].Id==n&&travelPlan.CurrentUser.travelPlans.splice(t,1)}function tt(n){nt(n);var t=$("div.travel_plan_container[data-travelplanid]").filter(function(){return $(this).data("travelplanid")==n});if(t!==undefined&&($(t).remove(),travelPlan.Ui.DisableButton($("#btn_deleteTravel, #btn_editTravel"))),ui.unblock(),$("div.travel_plan_container[data-travelplanid]").length>0){travelPlan.Ui.SortTravelPlansByDate();return}$(".default-message-holder").show();$(".results_container").remove();$(".repeater-container").hide()}function it(){for(var n=1;n<6;n++)$("#branch"+n).val(-1).trigger("change").removeClass("attribute_error");$(".specific-location").val("").removeClass("attribute_error");travelPlan.Ui.HideErrorContainer()}function rt(){$(".travelTo.day, .travelTo.month, .travelTo.year").val(-1);$(".travelFrom.day, .travelFrom.month, .travelFrom.year").val(-1)}function ut(){ht()&&(ui.cancelDialog(),ui.block(),ui.showBusy(),p(),travelPlan.CurrentUser.selectedTravelPlanId>0?s():o())}function ft(){getUserLocations(travelPlan.CurrentUser.selectedTravelPlan.LocationTree);$(".specific-location").val(travelPlan.CurrentUser.selectedTravelPlan.SpecificLocation)}function u(n){ui.block();ui.dialogCss.width=n;$("#dialog").width(n);ui.showDialog()}function et(){$("#btnNo").show().bind("click",function(){ui.unblock();ui.cancelDialog()});$("#btnYes").show().bind("click",function(){c()});u(300)}function ot(n){for(var i=travelPlan.CurrentUser.travelPlans.length,t=0;t<i;t++)if(travelPlan.CurrentUser.travelPlans[t].Id==n.Id){travelPlan.CurrentUser.travelPlans[t]=n;return}}function st(n){ot(n);var t=travelPlan.Ui.GetTravelPlanContainer($(".travel_plan_container[data-travelplanid]"),n.Id);travelPlan.Ui.UpdateTravelPlanContainer($(t),n);travelPlan.Ui.SortTravelPlansByDate();travelPlan.Ui.BindTravelPlanContainers();ui.unblock();ui.hideBusy()}function ht(){return d()?k()?!0:!1:!1}function ct(n,t){for(var r=travelPlan.CurrentUser.travelPlans.length,i=0;i<r;i++)if(travelPlan.CurrentUser.travelPlans[i].Id!=travelPlan.CurrentUser.selectedTravelPlanId&&lt(travelPlan.CurrentUser.travelPlans[i],n,t))return travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanPeriodClash),!1;return!0}function lt(n,i,r){return i<n.FromDate&&r>n.FromDate||t(i,n.FromDate)&&t(r,n.ToDate)||t(i,n.FromDate)&&r>i&&n.ToDate>n.FromDate||i>n.FromDate&&i<n.ToDate}function t(n,t){return n-t==0}function at(){for(var n=1;n<6;n++){var t="#branch"+n,i="#branch"+(n+1),r=$(t).val(),u=$("#branch"+(n-1)).val();if(u<0)return!0;if(r<1&&$(t).children().length>1)return $(t).addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanGeneralDestinationError),!1;if(r>0&&$(i).val()<1&&$(i).children().length>1)return $(i).addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanGeneralDestinationError),!1}return!0}function vt(n,t){var r,i;if($(n)!==undefined)for(r=t.length,i=0;i<r;i++)if(!yt($(n),t[i]))return!1;return!0}function yt(n,t){return $(n).val()===t?($(n).addClass("attribute_error"),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanDestinationProfileClash),!1):!0}function pt(){var n=$.trim($("input.specific-location").val());return n===undefined||n===null||n.length<1?($("input.specific-location").addClass("attribute_error"),$("input.specific-location").unbind("keydown").bind("keydown",function(){$(this).removeClass("attribute_error");$(this).unbind("keydown");travelPlan.Ui.HideErrorContainer()}),travelPlan.Validation.ShowErrorSpan(recon_localisation.TravelPlanSpecificLocationError),!1):!0}(ui.resetDialog(),travelPlan.TravelPeriodDdl.Reset(),n!==undefined)&&(n!==travelPlan.Dialog.Mode.Delete?($("#dialog_text").hide(),$("#dialog_travel_plans").show(),n===travelPlan.Dialog.Mode.Add?(travelPlan.Ui.UnselectTravelPlanContainers(),$("#dialog_header").text(recon_localisation.TravelPlanDialogAddTravelTitle),getUserLocations(travelPlan.CurrentUser.myLocations),travelPlan.Ui.BindDateContainers(),it(),rt()):n===travelPlan.Dialog.Mode.Edit&&($("#dialog_header").text(recon_localisation.TravelPlanDialogEditTravelTitle),travelPlan.Ui.UnbindDateContainers(),g(),h()),l()):($("#dialog_text").html(recon_localisation.TravelPlanDeleteMessageWarning).show(),$("#dialog_travel_plans").hide(),$("#dialog_header").text(recon_localisation.TravelPlanDialogDeleteTravelTitle),et()))}},Validation:{RemoveErrorAttributeFromLocation:function(){for(var r,t,i,n=1;n<6;n++)r="#branch"+(n-1),t="#branch"+n,$(t).removeClass("attribute_error"),($(r).val()==-1||$(t).children().length<2)&&$(t).attr("disabled","disabled");i=$(".specific-location");i!==undefined&&$(i).val()!==""&&$(i).removeClass("attribute_error");travelPlan.Ui.HideErrorContainer()},ShowErrorSpan:function(n){$("#ErrorSummary").html(n).show()},ShowErrorDialog:function(n){$("#dialog_buttons").hide();ui.dialogCss.width="250px";$("#ErrorDialog").width("250px");$("#ErrorDialog").css(ui.dialogCss).show();var t=($(window).width()-$("#ErrorDialog").width())/2;$("#ErrorDialog").css("left",t);$("#error_dialog_header").empty().text(recon_localisation.dialogErrorTitle);$("#error_dialog_text").empty().show().html(n);$("#btnErrorOK").show().bind("click",function(){$("#dialog_buttons").show();$("#ErrorDialog").hide()});$("#ErrorDialog").show();ui.block();ui.setTop($("#ErrorDialog"));ui.hideBusy()}},Utilities:{TryGetDate:function(n){return $.type(n)===$.type(new Date)?new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0):dateFormatting.jsonDateParse(n)},ToJson:function(n){var t={travelPlan:n};return JSON.stringify(t)},BuildDateFromDropDownVals:function(n,t,i){function r(){var r=new Date;return(r.setFullYear(i,t-1,n),r.getDate()!=n||r.getMonth()!=t-1&&r.getFullYear()!=i)?!1:!0}return r()?n>0&&t>0&&i>0?new Date(i,t-1,n):null:null}},Ui:{Reset:function(){travelPlan.Ui.DisableButton($("#btn_deleteTravel, #btn_editTravel"));travelPlan.Ui.UnselectTravelPlanContainers()},ResetErrorAttributes:function(){$(".travelFrom").removeClass("attribute_error");$(".travelTo").removeClass("attribute_error");travelPlan.Ui.HideErrorContainer()},HideErrorContainer:function(){$("#ErrorSummary").hide()},BindTravelPlanContainers:function(){function n(){if(travelPlan.CurrentUser.selectedTravelPlanId>0){var n=$(".travel_plan_container[data-travelplanid]").filter(function(){return $(this).data("travelplanid")==travelPlan.CurrentUser.selectedTravelPlanId});n.find("div.item_container.highlight_bgcolour").removeClass("highlight_bgcolour").addClass("item_container_bgcolour")}}function t(n){n.find("div.item_container").hasClass("highlight_bgcolour")?n.find("div.item_container").removeClass("highlight_bgcolour").addClass("item_container_bgcolour"):n.find("div.item_container").removeClass("item_container_bgcolour").addClass("highlight_bgcolour")}function i(i){t(i);n();var u=$(i).data("travelplanid");r(u)}function r(n){n===travelPlan.CurrentUser.selectedTravelPlanId?(travelPlan.CurrentUser.selectedTravelPlanId=0,travelPlan.Ui.DisableButton($("#btn_deleteTravel, #btn_editTravel"))):(travelPlan.CurrentUser.selectedTravelPlanId=n,travelPlan.Ui.EnableButton($("#btn_editTravel"),function(){u()}),travelPlan.Ui.EnableButton($("#btn_deleteTravel"),function(){f()}))}function u(){travelPlan.Dialog.DisplayTravelPlanDialog(travelPlan.Dialog.Mode.Edit)}function f(){travelPlan.Dialog.DisplayTravelPlanDialog(travelPlan.Dialog.Mode.Delete)}$(".travel_plan_container").css("cursor","pointer").unbind("click").click(function(){i($(this))})},UnselectTravelPlanContainers:function(){$(".travel_plan_container").find("div.item_container.highlight_bgcolour").removeClass("highlight_bgcolour").addClass("item_container_bgcolour")},BindDateContainers:function(){function n(n){if(n!==undefined&&n!==null){var i=null,r="day";if(n.hasClass(".travelFrom")){n.hasClass("day")?travelPlan.TravelPeriodDdl.day=1:n.hasClass("month")?travelPlan.TravelPeriodDdl.month=1:n.hasClass("year")&&(travelPlan.TravelPeriodDdl.year=1);return}n.hasClass("day")?i=$(".travelTo.day"):n.hasClass("month")?(i=$(".travelTo.month"),r="month"):n.hasClass("year")&&(i=$(".travelTo.year"),r="year");travelPlan.TravelPeriodDdl[r]=t(n,i,travelPlan.TravelPeriodDdl[r])}}function t(n,t,i){return i===0&&$(t).val($(n).val()),1}travelPlan.TravelPeriodDdl.Reset();$(".travelTo").unbind().bind("change",function(){n($(this));travelPlan.Ui.ResetErrorAttributes()});$(".travelFrom").unbind().bind("change",function(){travelPlan.Ui.ResetErrorAttributes();n($(this))})},DisableButton:function(n){$(n).unbind("click").addClass("button_greyed_out").button("option","disabled",!0)},EnableButton:function(n,t){$(n).unbind("click").click(t).removeClass("button_greyed_out").css("cursor","pointer").button("option","disabled",!1)},GetLastBranch:function(){for(var i,t,r=$("#branch5"),n=1;n<6;n++)if(i=n+1,t=$("#branch"+i).val(),t===undefined||t==="-1")return $("#branch"+n);return r},GetTravelPlanContainer:function(n,t){return $(n).filter(function(){return $(this).data("travelplanid")==t})},SortTravelPlansByDate:function(){function f(){if(travelPlan.CurrentUser.travelPlans!==undefined)for(var n=0;n<travelPlan.CurrentUser.travelPlans.length;n++)travelPlan.CurrentUser.travelPlans[n].FromDate=travelPlan.Utilities.TryGetDate(travelPlan.CurrentUser.travelPlans[n].FromDate),travelPlan.CurrentUser.travelPlans[n].ToDate=travelPlan.Utilities.TryGetDate(travelPlan.CurrentUser.travelPlans[n].ToDate)}var n,t;f();var i=$.Enumerable.From(travelPlan.CurrentUser.travelPlans).OrderBy(function(n){return n.FromDate.getTime()}).ThenBy(function(n){return n.ToDate.getTime()}).ToArray(),u=$(".travel_plan_container[data-travelplanid]").clone(!0,!0),r=$(".travel_plans_container");for($(r).children().remove(),n=0;n<i.length;n++)t=travelPlan.Ui.GetTravelPlanContainer($(u),i[n].Id),t!==undefined&&$(r).append(t)},UnbindDateContainers:function(){$(".travelTo").unbind();$(".travelFrom").unbind()},UpdateTravelPlanContainer:function(n,t){function i(n){var t;return t=n.SpecificLocation===undefined||n.SpecificLocation==""?n.FullLocation:n.FullLocation+", "+n.SpecificLocation,r(t)}function r(n){var t=47,i=n;return n.length>t&&(i=n.substring(0,t-2)+"..."),i}$(n).data("travelplanid",t.Id);$(n).data("locationid",t.LocationId);$($(n).find("span.location")).text(i(t));$($(n).find("span.period")).text(dateFormatting.basicDate(t.FromDate)+" - "+dateFormatting.basicDate(t.ToDate))}}};ui={overlayCss:{padding:0,margin:0,top:0,left:0,backgroundColor:"#000000",position:"absolute",width:"100%",zIndex:2e3},dialogCss:{padding:0,margin:0,position:"absolute",width:"300px",top:"200px",zIndex:2100},busyCss:{padding:"34px 0px 34px 0px",margin:0,position:"fixed",width:"100px",top:"45%",zIndex:2300,textAlign:"center"},favouritePhotoCss:{padding:0,margin:0,position:"absolute",width:"540px",top:"125px",zIndex:2100},block:function(){if(jQuery("#uiOverlay").length===0){var n=Math.max(jQuery(window).height(),jQuery(document).height()),t=jQuery("<div><\/div>").attr("id","uiOverlay").css(ui.overlayCss).fadeTo(0,.6).height(n);jQuery("body").prepend(t)}},unblock:function(){jQuery("#uiOverlay").length>0&&jQuery("#uiOverlay").remove();ui.hideBusy();ui.cancelDialog()},resetDialog:function(){jQuery("#dialog_header").empty();jQuery("#dialog_text").empty();jQuery("#dialog_text").unbind("click").attr("style","");ui.dialogCss.width="300px";ui.dialogCss.height=null;jQuery("#btnCancel").hide().unbind("click");jQuery("#btnDelete").hide().unbind("click");jQuery("#btnSave").hide().unbind("click");jQuery("#btnNo").hide().unbind("click");jQuery("#btnYes").hide().unbind("click");jQuery("#btnOk").hide().unbind("click");jQuery("#btnSend").hide().unbind("click");jQuery("#btnClose").hide().unbind("click");jQuery("#btnUpgrade").hide().unbind("click");jQuery("#btnLogin").hide().unbind("click");jQuery("#btnCustom").hide().unbind("click");jQuery("#btnBuy").hide().unbind("click");jQuery("#btnBlockList").hide().unbind("click")},showDialog:function(){var n=jQuery("#dialog"),t,i;n.length===0?(t=jQuery("<div><\/div>").attr("id","dialog").css(ui.dialogCss),jQuery("body").prepend(t)):n.css(ui.dialogCss).show();i=(jQuery(window).width()-n.width())/2;n.css("left",i);ui.setTop(n);jQuery(window).unbind("resize").resize(function(){ui.reposition(n)});jQuery(".dialogOverlay").show()},cancelDialog:function(n){ui.resetDialog();jQuery("#dialog").length>0&&(jQuery("#dialog").hide(),ui.resetDialog(),n&&n());jQuery(".dialogOverlay").hide()},showErrorDialog:function(n,t){var i=jQuery("#dialog"),r,u;ui.hideBusy();ui.resetDialog();jslog("Show error dialog");jQuery("#dialog_header").empty().text(recon_localisation.dialogErrorTitle);jQuery("#dialog_text").empty().show().html(n);jQuery("#btnOk").show().click(function(){t?t():ui.cancelErrorDialog()});i.length===0?(r=jQuery("<div><\/div>").attr("id","dialog").css(ui.dialogCss),r.append(jQuery("#dialog_header")).append(jQuery("#dialog_text")),jQuery("body").prepend(r)):i.css(ui.dialogCss).show();u=(jQuery(window).width()-i.width())/2;i.css("left",u);ui.setTop(i);jQuery(window).unbind("resize").resize(function(){ui.reposition(i)});jslog("Show error dialog done")},cancelErrorDialog:function(){jQuery("#dialog").length>0&&(jQuery("#dialog").hide(),ui.resetDialog(),ui.unblock())},cancelErrorDialogLeaveBlock:function(){jQuery("#dialog").length>0&&(jQuery("#dialog").hide(),ui.resetDialog())},showBusy:function(){var n,t,i;jQuery("#busyDialog").length===0?(n=jQuery("<img />").attr("src",t101.settings.paths.staticSitePath+"content/images/spinner.gif").attr("width",32).attr("height",32),t=jQuery("<div><\/div>").attr("id","busyDialog").css(ui.busyCss).append(n),jQuery("body").prepend(t)):jQuery("#busyDialog").css(ui.busyCss).show();i=(jQuery(window).width()-jQuery("#busyDialog").width())/2;jQuery("#busyDialog").css("left",i);jQuery(window).unbind("resize").resize(function(){ui.reposition(jQuery("#busyDialog"))})},hideBusy:function(n){jQuery("#busyDialog").length>0&&(jQuery("#busyDialog").remove(),n&&n())},reposition:function(n){if(n.length>0){var t=(jQuery(window).width()-n.width())/2;n.css("left",t)}},setTop:function(n){if(n.length>0){var i=jQuery(document).height(),r=jQuery(window).height(),u=jQuery(n).height(),f=jQuery(window).scrollTop(),t;t=r<=i?r/2-u/2+f:i/2-u/2+f;t<0&&(t=0);n.css("top",t)}}}