function baseViewModel(){var n=this;ko.utils.extend(n,new entityActions);ko.utils.extend(n,new friendPrototype);this.CurrentMember=ko.observable();this.Member=ko.observable();this.SessionGuid=ko.observable();this.Dream=ko.observable();this.AllLists=ko.observableArray([]);this.CurrentList=ko.observable();this.Categories=ko.observableArray([]);this.Slides=ko.observableArray([]);this.CurrentListDreams=ko.observableArray([]);this.FeaturedExperiences=ko.observableArray([]);this.PendingExperience=ko.observable();this.HoverDream=ko.observable();this.HoverDreamHeight=180;this.PendingExperiences=ko.observableArray([]);this.ObjType=ko.observable(1);this.ListId=ko.observable(0);this.CategoryFilters=function(){$("#Categories").toggle()};this.sortDreamInList=function(t){var u;var f=t.targetParent,e=t.item,i=t.targetIndex,r=i+1;f.Id!="allDreamsWrapper"&&(r=vm.NewDreams().length+vm.allMemberDreams().length-i);u="/api/MemberListSortAPI/?memberListId="+n.ListId()+"&displayPosition="+r+"&dreamid="+e.Id();$.ajax({type:"POST",contentType:!1,processData:!1,cache:!1,url:u,success:function(){fadeinmessage("Sort Complete","success")},error:function(n){fadeinmessage(n,"success")}})};this.allowEdit=function(){return!0};this.hasRecent=ko.computed(function(){return this.Dream()?this.Dream().Id()>0?!0:!1:!1},n);this.EditProfile=function(){window.location="/member/profile/"+memberID};this.searchHome=function(){modalSearchDreams()};this.searchOnEnter=function(){return n.searchExperiences(),!1};this.startMyDream=function(){return createDreamNow(),!1};this.searchExperiences=function(){var t=0,n,i;return vm!=undefined&&(t=vm.ListId()),n=$.trim($("#searchterms").val()),n=this.htmlEscape(n),n!=""?(i="/"+encodeURIComponent(n)+"/experiences.html?listId="+t,window.location=i):window.location="/mynewdreams/index/",!1};this.searchTerms=function(n){var i=0,t,r;return vm!=undefined&&(i=vm.ListId()),t=$.trim(n),t=this.htmlEscape(t),t!=""?(r="/"+encodeURIComponent(t)+"/experiences.html?listId="+i,window.location=r):window.location="/mynewdreams/index/",!1};this.htmlEscape=function(n){return String(n).replace(/&/g,"").replace(/"/g,"").replace(/'/g,"").replace(//g,"").replace("?","").replace("(","").replace(")","").replace("[","").replace("]","").replace("\\","").replace("/","").replace("%","").replace("*","").replace("+","")};this.PendingOpen=!1;this.showPending=function(){if(!this.PendingOpen&&this.PendingExperiences().length>0){var n=this.PendingExperiences().length,t=n*26+82;$("#PendingExperiencestopbox").animate({height:t},300,function(){});this.PendingOpen=!0}};this.hidePending=function(){this.PendingExperiences().length>0&&($("#PendingExperiencestopbox").animate({height:52},200,function(){}),this.PendingOpen=!1)};this.submitPending=function(){this.PendingExperiences().length>0&&(window.location="/DreamMaker/CreatePendingDreams/")};this.hasPending=ko.computed(function(){return this.PendingExperiences()?this.PendingExperiences().length>0?!0:!1:!1},this);this.clearPending=function(){if(this.PendingExperiences().length>0){for(i=0;i0?!0:!1:!1},this);this.aLink=n.Memberink;this.viewMember=function(){window.location=this.aLink};this.notUploadingImage=function(){return this.uploadingImage()?!1:!0};this.startImageUpload=function(){this.uploadingYoutubeVideo(!1);this.uploadingImage(!0);this.uploadingUserImage(!0)};this.saveDisplayName=function(){};this.makeMostRecentDream=function(n,t){var i={},r;i.memberId=this.Id();i.dreamId=n.Id();r=JSON.stringify(i);$.ajax({url:"/api/MemberAPI/MakeMostRecentDream",cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:r,success:function(){t!=undefined&&t!=null&&t(n,!0)},error:function(){t!=undefined&&t!=null&&t(n,!1)}})};this.addFriend=function(n){t.Friends.push(n)};this.loadFriends=function(n){var i,u,r;this.Friends().length0&&(r={},r.memberId=this.Id(),u=JSON.stringify(r),i="/api/MemberAPI/Search/"+n,i=i.replace("@","$").replace(".","^"),$.ajax({url:i,cache:!1,type:"GET",contentType:"application/json; charset=utf-8",success:function(n){t!=undefined&&t!=null&&t(n,!0)},error:function(n){t!=undefined&&t!=null&&t(n,!1)}}))};this.searchByName=function(n,t){var i,r,u;n.length>0&&(i={},i.searchTerm=n,r=JSON.stringify(i),u="/api/MemberAPI/SearchByName",$.ajax({url:u,cache:!1,type:"Post",data:r,contentType:"application/json; charset=utf-8",success:function(n){t!=undefined&&t!=null&&t(n,!0)},error:function(n){t!=undefined&&t!=null&&t(n,!1)}}))};this.inviteFriends=function(n,t){var i,r,u;n.length>0&&(i={},i.friends=n,showWaitModal(),r=JSON.stringify(i),u="/api/MemberAPI/InviteFriends/"+name,$.ajax({url:u,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:r,success:function(n){t!=undefined&&t!=null&&t(n,!0);fadeinmessage("invitaiton sent","success");hideWaitModal()},error:function(n){t!=undefined&&t!=null&&t(n,!1)}}))};this.inviteEmailFriends=function(n,t){var i,r,u;n.length>0&&(i={},i.friends=n,r=JSON.stringify(i),u="/api/MemberAPI/InviteFriendsByEmailAddress",$.ajax({url:u,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:r,success:function(n){t!=undefined&&t!=null&&t(n,!0)},error:function(n){t!=undefined&&t!=null&&t(n,!1)}}))}}function setupMember(n,t){var i=new member(t);n.Member(i)}function memberlist(n,t){var i=this,r,u;if(this.enumPrivacy={Private:1,Public:2,PublicButAnonymous:3,InvitationOnly:4,InvitationWithForward:5},this.Id=ko.observable(n.Id),this.Name=ko.observable(n.Name),this.Description=ko.observable(n.Description),this.Verb=ko.observable(n.Verb),this.ImageUrl=ko.observable(n.ImageUrl),this.PrivacySetting=ko.observable(n.PrivacySetting),this.ListLink=ko.observable(n.ListLink),this.PublicListLink=ko.observable(n.PublicListLink),this.Owner=n.Owner,t==undefined||t!=undefined&&t==!1?(this.Limit=4294967295,this.IsDefault=!1):(this.Limit=10,this.IsDefault=!0),this.DreamCount=ko.observable(n.DreamCount),this.Dreams=ko.observableArray([]),this.MoreCount=0,n.DreamCount>n.Dreams.length&&(this.MoreCount=n.DreamCount-n.Dreams.length),this.DreamsLoaded=ko.observable(!1),n.Dreams!=null){for(r=0;r0&&n(!0,t)},error:function(n){fadeinmessage("User Update Failed: "+n.ErrorList,"warning")}})};this.updateList=function(n){var u=this,t=ko.toJS(this),i=JSON.stringify(t),r=this.Id();$.ajax({url:NEWMEMBERLIST_API_URL+"/UpdateList/"+r,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:i,success:function(t){n!=undefined&&n!=null?n(!0,t):fadeinmessage("Update Successful","success")},error:function(){n!=undefined&&n!=null?n(!1):fadeinmessage("Update Failed","error")}})}}function NewDreamList(n,t,i){var e=this,r={},u,f;r.listname=t;r.listdescription=i;u=JSON.stringify(r);f="/api/MemberListAPI/CreateList/";$.ajax({url:f,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:u,success:function(t){n.AllLists.push(new memberlist(t,!1));fadeinmessage("List Created Successful","success")},error:function(){fadeinmessage("List Create Failed","error")}})}function LoadCurrentList(n,t){n.CurrentList(new memberlist(t,!1))}function LoadInitialMemberListdata(n,t,i){var u,r;for(n.AllLists([]),u=!0,r=0;r0&&vm.PlayingMedia(vm.Medium()[0]);vm.PlayingMedia().IsHover(!0);hideWaitModal()},error:function(){this.cancelEditPlayingMedia(n);fadeinmessage("Update Failed","error");hideWaitModal()}}),!1};this.removeDreamMedia=function(){var t=this,n={},i,r,u;return n.EntityId=vm.EntityId(),n.EntityType=vm.EntityType(),i=ko.toJS(t),n.tMedia=i,r=JSON.stringify(n),u=vm.Dream().Id(),$.ajax({url:DREAMMEDIA_API_URL+"/DeleteMedia/"+u,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:r,success:function(n){n&&fadeinmessage("Update Successful","success");vm.Medium.remove(t);vm.Medium().length>0&&vm.PlayingMedia(vm.Medium()[0])},error:function(){this.cancelEditPlayingMedia(media);fadeinmessage("Update Failed","error")}}),!1};this.removePartnerMedia=function(n){var r,u,f;var e=this,i=vm.EntityId(),o=vm.EntityType(),t={};return t.EntityId=parseInt(i),t.EntityType=parseInt(o),r=ko.toJS(e),t.tMedia=r,u=JSON.stringify(t),f=i,$.ajax({url:DREAMMEDIA_API_URL+"/DeleteMedia/"+f,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:u,success:function(t){n!=undefined&&n!=null&&n(!0,t)},error:function(t){n!=undefined&&n!=null&&n(!1,t)}}),!1};this.setViewingMedia=function(n){vm.PlayingMedia(n);try{}catch(t){}};this.stopPlaying=function(){vm.PlayingMedia(null)}}function LoadDreamMediaFromServer(n){var t=n,i;t.Medium([]);i=DREAMMEDIA_API_URL+"?startindex="+currentMediaItemIndex+"&take="+currentMediaTake+"&languageId=1&dreamId="+t.Dream().Id();currentMediaItemcount=0;$.get(i,function(n){for(var r,i=0;i0&&startDreamSwiper()},"json")}function LoadExperienceMediaFromServer(n){currentItemcount=0;var t=n;t.Medium([]);$.get(MEDIAAPI_URL+"?startindex="+currentMediaItemIndex+"&take="+currentMediaTake+"&languageId=1&experienceId="+n.Experience().Id(),function(i){for(var u,r=0;r0){var t=$("#mixed-slider").html();t!=null&&t!=undefined&&(sliderwidth=$(window).width(),sliderheight=316,slider=$("#mixed-slider").advancedSlider({width:sliderwidth,height:sliderheight,responsive:!0,skin:"light-round",shadow:!1,effectType:"swipe",slideshow:!0,pauseSlideshowOnHover:!0,swipeThreshold:30,slideButtons:!0,thumbnailType:"tooltip",thumbnailWidth:140,thumbnailHeight:80,thumbnailButtons:!0,thumbnailSwipe:!0,thumbnailScrollerResponsive:!0,minimumVisibleThumbnails:2,maximumVisibleThumbnails:4,keyboardNavigation:!0}))}else $("#mediaExists").show()}function startDreamSwiper(){slider!=null&&$("#mixed-slider").reInit();viewModel.Medium().length>0&&(slider=$(".swiper-container").swiper({mode:"horizontal",loop:!0}))}function showtab(n){try{n=="tabMedia"?$("#mixed-slider").css("display","block"):$("#mixed-slider").css("display","none")}catch(t){}}function setExperiencedata(n,t){var i;i=vm!=null?new experience(t,vm.ListId()):new experience(t,0);n.Experience(i)}function LoadInitialExperiences(n,t){for(i=0;i0?null:null;this.City=ko.observable(n.City);this.Country=ko.observable(n.Country);this.Region=ko.observable(n.Region);this.DisplayLanguageId=ko.observable(n.DisplayLanguageId);this.isEditing=ko.observable(!1);this.ObjectType=ko.observable("experience");this.Alink=ko.computed(function(){var t=i.Id(),n=0;return vm!=undefined&&(n=vm.ListId()),"/"+i.Name()+"/Details.html?id="+t+"&listId="+n},this);this.startEdit=function(){this.isEditing(!0)};this.showActions=function(n,t){var i=$(t.target);i.children(".actionbtn").css("display","block");i.children(".actionbtnadd").css("display","block")};this.hideActions=function(n,t){var i=$(t.target);i.children(".actionbtn").hide();i.children(".actionbtnadd").hide()};this.viewDetails=function(){var r=i.Id(),n=0,t;vm!=undefined&&(n=vm.ListId());t="/"+this.Name()+"/Details.html?id="+r+"&listId="+n;window.location=t};this.AddMedia=function(){alert("TO BE IMPLEMENTED");window.location="/AddMediaToExperience/"+self.Id()};this.getActivityById=function(n){for(var r=null,i,t=0;t-1&&(val=val.replace("exp:"+this.Id()+", ",""),n.IsPending(!1)),$.cookie("PendingAdd",val,{path:"/",expires:30}));fadeinmessage(n.Name()+" successfully removed from you new dreams","error")};this.mouseEnterPreview=function(){var n=$("#"+this.previewId()).find(".featuredbottomText");n.stop().animate({height:230,opacity:1.8},1e3)};this.mouseLeavePreview=function(){var n=$("#"+this.previewId()).find(".featuredbottomText");n.stop().animate({height:45,opacity:.8},1e3)};this.addToDream=function(n){var t={},i,r;t.dreamId=vm.Dream().Id();t.experienceId=n.Id();i=JSON.stringify(t);r="/api/MemberAPI/AddExperienceToDream";$.ajax({url:r,cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:i,success:function(){fadeinmessage(n.Name()+" successfully added to your dream","success")},error:function(){fadeinmessage(n.Name()+" failed to add","error")}})}}function CreateDreamFromExperience(){if(vm.Experience()){var t=vm.Experience().Id(),n=0;vm!=undefined&&(n=vm.ListId());window.location="/"+vm.Experience().Name()+"/experiences.html?listId="+n+"&expid="+t}else window.location="/"+vm.Experience().Name()+"/experiences.html"}function LoadExperiencesFromServer(n){var t;currentItemcount=0;t=n.SearchTerms();setCurrentItemIndex(n);var f=encodeURIComponent(t),r=$("#SelectedCategoryId").val(),u=0;r!=undefined&&(u=r);$("#waitloadbox").css("display","block");getInProgress||(getInProgress=!0,$.get(SEARCHAPI_URL+"Get?startindex="+currentItemIndex+"&take="+Take+"&languageId=1&categoryId="+u+"&terms="+f,function(t){for(i=0;i0)for(i=0;i0&&(t.IsPending()||t.IsPending(!0),n.PendingExperiences.push(t)))}function setCurrentItemIndex(){currentItemIndex=vm.Experiences().length}function setCurrentSearchItemIndex(){currentItemIndex=vm.searchExperiences().length}function partner(n){this.Id=ko.observable(n.Id);this.ImageUrl=ko.observable(n.ImageUrl);this.DisplayName=ko.observable(n.DisplayName);this.ShortDescription=ko.observable(n.ShortDescription);this.CurrentLanguageId=ko.observable(n.CurrentLanguageId);this.HeaderHTML=ko.observable(n.HeaderHTML);this.AboutHTML=ko.observable(n.AboutHTML);this.Status=ko.observable(n.Status);this.PartnerLink=ko.observable(n.PartnerLink);this.MoreInfoUrl=ko.observable(n.MoreInfoUrl);this.PartnerGuid=ko.observable(n.PartnerGuid);this.SummaryData=ko.observable(n.SummaryData);this.CountLoves=ko.observable(n.CountLoves);this.HasCrop=ko.observable(!1);this.hasImage=ko.computed(function(){return this.ImageUrl().length>0?!0:!1},this);this.uploadingImage=ko.observable(!1);this.uploadingWait=ko.observable(!1);this.uploadingUserImage=ko.observable(!0);this.uploadedPreviewImage=ko.observable(!0);this.noUploadedPreviewImage=ko.computed(function(){return this.uploadedPreviewImage()?!1:!0},this);this.startImageUpload=function(){this.uploadingImage(!0);this.uploadingUserImage(!0)};this.notUploadingImage=function(){return this.uploadingImage()?!1:!0};this.savePartner=function(n){var t=this,i=ko.toJS(t),r=JSON.stringify(i);showWaitModal();$.ajax({url:"/api/PartnerAPI/UpdatePartner",cache:!1,type:"POST",contentType:"application/json; charset=utf-8",data:r,success:function(){n!=undefined&&n!=null&&n(!0)},error:function(){n!=undefined&&n!=null&&n(!1)}})}}function LoadPartner(n,t){n.Partner(new partner(t))}function partnerlist(n){this.Id=ko.observable(n.Id);this.PartnerId=ko.observable(n.PartnerId);this.ImageUrl=ko.observable(n.ImageUrl);this.DisplayName=ko.observable(n.DisplayName);this.ShortDescription=ko.observable(n.ShortDescription);this.Description=ko.observable(n.Description);this.viewPartnerList=function(){window.location="/partnerlist/index/"+this.Id()}}function LoadPartnerList(n,t){n.PartnerList(new partner(t))}function LoadPartnerLists(n,t){for(i=0;i0&&$.get(APINav_URL+"?categoryId="+r+"&languageId=1",function(t){for(i=0;i0;)t.Comments.pop();for(i=0;i=0&&(s&&(s.remove(y),n.processAllDeferredBindingUpdates&&n.processAllDeferredBindingUpdates()),p.splice(l,0,y));n.utils.domData.set(c,u,null);o.item.remove();n.processAllDeferredBindingUpdates&&n.processAllDeferredBindingUpdates();v.afterMove&&v.afterMove.call(this,h,i,o)}k&&k.apply(this,arguments)},connectWith:v.connectClass?"."+v.connectClass:!1}));v.isEnabled!==i&&n.computed({read:function(){p.sortable(n.utils.unwrapObservable(v.isEnabled)?"enable":"disable")},disposeWhenNodeIsRemoved:s})},0),n.utils.domNodeDisposal.addDisposeCallback(s,function(){p.sortable("destroy")}),{controlsDescendantBindings:!0}},update:function(t,i,u,e,o){var s=r(i,"foreach");n.utils.domData.set(t,f,s.foreach);n.bindingHandlers.template.update(t,function(){return s},u,e,o)},connectClass:"ko_container",allowDrop:!0,afterMove:null,beforeMove:null,options:{}};n.bindingHandlers.draggable={init:function(u,f,e,s,h){var c=n.utils.unwrapObservable(f())||{},y=c.options||{},l=n.utils.extend({},n.bindingHandlers.draggable.options),p=r(f,"data"),a=c.connectClass||n.bindingHandlers.draggable.connectClass,v=c.isEnabled!==i?c.isEnabled:n.bindingHandlers.draggable.isEnabled;return c=c.data||c,n.utils.domData.set(u,o,c),n.utils.extend(l,y),l.connectToSortable=a?"."+a:!1,t(u).draggable(l),v!==i&&n.computed({read:function(){t(u).draggable(n.utils.unwrapObservable(v)?"enable":"disable")},disposeWhenNodeIsRemoved:u}),n.bindingHandlers.template.init(u,function(){return p},e,s,h)},update:function(t,i,u,f,e){var o=r(i,"data");return n.bindingHandlers.template.update(t,function(){return o},u,f,e)},connectClass:n.bindingHandlers.sortable.connectClass,options:{helper:"clone"}}});var originalMember,originalDream,initialListItems,drmID=0,memberID=0,expID=0,viewModel=function(){var n=this;ko.utils.extend(n,new entityActions);this.CurrentMember=ko.observable();this.Member=ko.observable();this.Experience=ko.observable();this.Experiences=ko.observableArray([]);this.PendingExperience=ko.observable();this.PendingExperiences=ko.observableArray([]);this.FeaturedExperiences=ko.observableArray([]);this.Slides=ko.observableArray([]);this.TopLineItems=ko.observableArray([]);this.PlayingActivity=ko.observable();this.Activity=ko.observable();this.Activities=ko.observableArray([]);this.Dream=ko.observable();this.Dreams=ko.observableArray([]);this.PlayingMedia=ko.observable();this.Medium=ko.observableArray([]);this.AllLists=ko.observableArray([]);this.AssignedLists=ko.observableArray([]);this.AvailableLists=ko.observableArray([]);this.CurrentList=ko.observable();this.CurrentListDreams=ko.observableArray([]);this.Categories=ko.observableArray();this.SubCategories=ko.observableArray();this.CurrentCategory=ko.observable();this.hasSubCategories=ko.observable(!1);this.SearchTerms=ko.observable();this.ObjType=ko.observable(1);this.ListId=ko.observable(0);this.SearchEntityNames=ko.observableArray([]);this.isEditingList=ko.observable(!1);this.isEditingName=ko.observable(!0);this.isEditingMedia=ko.observable(!1);this.newActivity=ko.observable(!1);this.newActivityWait=ko.observable(!1);this.newActivityImage=ko.observable(!1);this.newActivityImageWait=ko.observable(!1);this.uploadingImage=ko.observable(!1);this.uploadingWait=ko.observable(!1);this.uploadingUserImage=ko.observable(!0);this.uploadingYoutubeVideo=ko.observable(!1);this.isEditingMediaOrder=ko.observable(!1);this.allowEdit=function(){return!0};this.selectedItem=ko.observable();this.showManageMedia=function(){window.location="/experienceimagemanager/managemedia/"+this.Experience().Id()};this.notUploading=ko.computed(function(){return this.uploadingWait()?this.uploadingWait()==!1?!0:!1:!1},n);this.CategoryFilters=function(){$("#Categories").toggle()};this.hasRecent=ko.computed(function(){return this.Dream()?this.Dream().Id()>0?!0:!1:!1},n);this.hasFeatured=ko.computed(function(){return this.FeaturedExperiences().length>0?!0:!1},n);this.showWelcomeRecent=ko.computed(function(){return this.Dream()?this.Dream().Id()==0?!0:!1:!1},n);this.findExperience=function(){window.location="/Search/Index"};this.EditProfile=function(){window.location="/member/profile/"+memberID};this.EditPassword=function(){window.location="/account/manage/"};this.ViewExperience=function(){window.location=this.ExperienceLink};this.EditExperience=function(){window.location="/experience/edit/"+this.Experience().Id()};this.CreateExperience=function(){window.location="/experience/create/"};this.viewDream=function(){window.location="/Dream/Details/"+drmID};this.startEditMedia=function(){this.isEditingName(!1);this.isEditingList(!1);this.isEditingMedia(!0);this.isEditingMediaOrder(!1)};this.cancelEditMedia=function(){this.isEditingMedia(!1)};this.startMediaOrder=function(){this.isEditingName(!1);this.isEditingList(!1);this.isEditingMedia(!1);this.isEditingMediaOrder(!0)};this.cancelMediaOrder=function(){this.uploadingImage=!1};this.startYoutubeUpload=function(){this.uploadingImage()?(this.uploadingYoutubeVideo(!0),this.uploadingImage(!0),this.uploadingUserImage(!1)):(this.uploadingYoutubeVideo(!0),this.uploadingImage(!0),this.uploadingUserImage(!1))};this.startImageUpload=function(){this.uploadingYoutubeVideo(!1);this.uploadingImage(!0);this.uploadingUserImage(!0)};this.cancelImageUpload=function(){this.uploadingImage=!1;this.uploadingWait(!1)};this.startActivityUpload=function(){this.newActivity(!0);this.newActivityWait(!1)};this.cancelActivityUpload=function(){this.newActivity(!1);this.newActivityWait(!1)};this.startActivityImageUpload=function(){this.newActivityImage(!0);this.newActivityImageWait(!1)};this.cancelActivityImageUpload=function(){this.newActivityImage(!1);this.newActivityImageWait(!1)};this.startEditName=function(){this.isEditingName(!0);this.isEditingList(!1);this.isEditingMedia(!1);this.isEditingMediaOrder(!1)};this.cancelEditName=function(){this.isEditingName(!1)};this.startEditList=function(){this.isEditingName(!1);this.isEditingList(!0);this.isEditingMedia(!1);this.isEditingMediaOrder(!1)};this.cancelEditList=function(){this.isEditingList(!1)};this.sortExperienceMedia=function(n){var f=n.targetParent,i=n.item,u=n.targetIndex,r=u+1,t;i.ObjectType()=="activity"?(t=EXPERIENCEACTIVITYSORTAPI_URL+"?experienceId="+vm.Experience().Id()+"&displayPosition="+r+"&activityId="+i.Id(),$.ajax({type:"POST",contentType:!1,processData:!1,cache:!1,url:t,success:function(){},error:function(){}})):i.ObjectType()=="activitymedia"?(t=ACTIVITYMEDIASORTAPI_URL+"?activityId="+vm.PlayingActivity().Id()+"&displayPosition="+r+"&mediaId="+i.Id(),$.ajax({type:"POST",contentType:!1,processData:!1,cache:!1,url:t,success:function(){},error:function(){}})):(t=EXPERIENCEMEDIASORTAPI_URL+"?experienceId="+vm.Experience().Id()+"&displayPosition="+r+"&mediaId="+i.Id(),$.ajax({type:"POST",contentType:!1,processData:!1,cache:!1,url:t,success:function(){$("img#photo").imgAreaSelect({hide:!0});vm.PlayingMedia().IsHover(!1);i.IsHover(!0);vm.PlayingMedia(i);$("img#photo").imgAreaSelect({aspectRatio:"4:3",handles:!0,onSelectChange:preview})},error:function(){}}))};this.sortDreamMedia=function(n){var f=n.targetParent,t=n.item,u=n.targetIndex,r=u,i=DREAMMEDIASORTAPI_URL+"?dreamId="+vm.EntityId()+"&displayPosition="+r+"&mediaId="+t.Id();vm.EntityType()==4&&(i=DREAMMEDIASORTAPI_URL+"/SortDreamActivityMedia?dreamActivityId="+vm.EntityId()+"&displayPosition="+r+"&mediaId="+t.Id());vm.EntityType()==3&&(i="/api/ExperienceActivityAPI/SortActivityMedia?activityId="+vm.EntityId()+"&displayPosition="+r+"&mediaId="+t.Id());$.ajax({type:"POST",contentType:!1,processData:!1,cache:!1,url:i,success:function(){$("img#photo").imgAreaSelect({hide:!0});vm.PlayingMedia().IsHover(!1);t.IsHover(!0);vm.PlayingMedia(t);$("img#photo").imgAreaSelect({aspectRatio:"4:3",handles:!0,onSelectChange:preview})},error:function(){}})};this.searchOnEnter=function(){return n.searchExperiences(),!1};this.searchISearch=function(){return modalSearchDreams(),!1};this.startMyDream=function(){return createDreamNow(),!1};this.notifyOfScrollEvent=function(){this.getMoreExperiences()};this.getNextExperiences=function(){this.Experiences([]);LoadExperiencesFromServer(n)};this.searchExperiences=function(){var n=0;return vm!=undefined&&(n=vm.ListId()),$("#searchterms").val()!=""&&(window.location="/"+$("#searchterms").val()+"/experiences.html?listId="+n),!1};this.searchInsideCategory=function(t){currentItemcount=0;currentItemIndex=0;var i=t.Name();this.Experiences([]);this.SubCategories([]);this.hasSubCategories(!1);LoadSubCategoriesFromServer(n);LoadExperiencesFromServer(n);hideCategories();$("#CategoryNameHeader").html(i);$("#CategoryNameHeader").css("display","block");$("#ClearMessageAnchor").css("display","block")};this.resetCategory=function(){this.Experiences([]);this.SubCategories([]);this.hasSubCategories(!1);currentItemcount=0;currentItemIndex=0;$("#SelectedCategoryId").val("0");LoadExperiencesFromServer(n);hideCategories();$("#CategoryNameHeader").css("display","none");$("#ClearMessageAnchor").css("display","none")};this.getMoreExperiences=function(){LoadExperiencesFromServer(n)};this.getPreviousExperiences=function(){this.Experiences([]);currentItemIndex-=currentItemcount;currentItemIndex-=Take;currentItemIndex<0&&(currentItemIndex=0);LoadExperiencesFromServer(n)};this.replyingComment=!1;this.creatingComment=!1;this.commentEntry=ko.observable(!1);this.commentEntryContainerId=null;this.cancelCommentEntryEventHandler=null;this.entryTitle=ko.observable();this.entryComment=ko.observable();this.parentCommentId=0;this.showReplyToComment=function(n,t,i){if(_isUserAuthorized==!0){if(this.replyingComment==!1){this.replyingComment=!0;this.commentEntryContainerId=n;this.parentCommentId=i.Id;var r=$("#"+n),u=$("#newCommentBox");r.html(u.html());this.cancelCommentEntryEventHandler=t;ko.applyBindings(this,r[0])}}else window.location.href="/account/login?returnurl="+window.location.pathname};this.showNewThreadEntry=function(n){_isUserAuthorized==!0?this.creatingComment==!1&&(this.creatingComment=!0,this.commentEntry(!0),this.cancelCommentEntryEventHandler=n):window.location.href="/account/login?returnurl="+window.location.pathname};this.quitCommentEntry=function(){this.creatingComment?(this.commentEntry(!1),this.creatingComment=!1,this.cancelCommentEntryEventHandler!=undefined&&this.cancelCommentEntryEventHandler(null)):(this.replyingComment=!1,this.cancelCommentEntryEventHandler!=undefined&&(this.cancelCommentEntryEventHandler(this.commentEntryContainerId),this.commentEntryContainerId=0))};this.successCreateExperienceCommentEHofView=null;this.saveExperienceComment=function(n){this.successCreateExperienceCommentEHofView=n;createExperienceComment(this.Experience().Id(),this.parentCommentId,this.entryTitle(),this.entryComment(),this.commentEntryReset)};this.commentEntryReset=function(n){this.successCreateExperienceCommentEHofView!=null&&(this.commentEntry(!1),this.creatingComment=!1,this.replyingComment=!1,this.entryTitle=ko.observable(),this.entryComment=ko.observable(),this.successCreateExperienceCommentEHofView(n,this.commentEntryContainerId))};this.allCommentsDisplay=ko.computed(function(){var n=this.Experience();return n!=undefined&&n!=null?this.Experience().EntityComments!=null?this.Experience().EntityComments().HasMore():!1:!1},n);this.displayMoreButton=ko.observable(this.allCommentsDisplay);this.currentPage=1;this.showMoreComments=function(n){this.displayMoreButton(!1);getExperienceComments(this.Experience().Id(),this.currentPage,n)};this.selectedMemberList=ko.observable();this.selectedMemberList.subscribe(function(){});this.PendingOpen=!1;this.showPending=function(){if(!this.PendingOpen&&this.PendingExperiences().length>0){var n=this.PendingExperiences().length,t=n*20+132;$("#PendingExperiencestopbox").animate({height:t},300,function(){});this.PendingOpen=!0}};this.hidePending=function(){this.PendingExperiences().length>0&&($("#PendingExperiencestopbox").animate({height:52},200,function(){}),this.PendingOpen=!1)};this.submitPending=function(){this.PendingExperiences().length>0&&(window.location="/DreamMaker/CreatePendingDreams/")};this.clearPending=function(){if(this.PendingExperiences().length>0){for(i=0;i0?!0:!1:!1},n);this.setupMember=function(n){var t=new member(n);this.Member(t)};this.searchHome=function(){modalSearchDreams()};this.createDreamEnter=function(){createDreamNow()()};this.searchTerms=function(n){var i=0,t,r;return vm!=undefined&&(i=vm.ListId()),t=$.trim(n),t=this.htmlEscape(t),t!=""?(r="/"+encodeURIComponent(t)+"/experiences.html?listId="+i,window.location=r):window.location="/mynewdreams/index/",!1};this.htmlEscape=function(n){return String(n).replace(/&/g,"").replace(/"/g,"").replace(/'/g,"").replace(//g,"").replace("?","").replace("(","").replace(")","").replace("[","").replace("]","").replace("\\","").replace("/","").replace("%","").replace("*","").replace("+","")}};var DREAMLIST_API_URL="/api/DreamListAPI/",DREAMAVAILABLELIST_API_URL="/api/DreamAvailableListAPI/",DREAMNEWLIST_API_URL="/api/DreamNewListAPI",LISTDREAMS_API_URL="/api/DreamsForList/",NEWMEMBERLIST_API_URL="/api/MemberListAPI/",MEMBERLISTSORT_API_URL="/api/MemberListSortAPI/",showingcreate=!1;var EXPERIENCEMEDIA_API_URL="/api/ExperienceMediaAPI/",DREAMMEDIA_API_URL="/api/DreamMediaAPI/",MEDIAAPI_URL="/api/MediaAPI/GetExperienceMedia",EXPERIENCEMEDIASORTAPI_URL="/api/ExperienceMediaSortAPI",DREAMMEDIASORTAPI_URL="/api/DreamMediaSortAPI",ACTIVITYMEDIASORTAPI_URL="/api/ActivityMediaSortAPI",currentMediaTitle="",currentMediaDescription="",currentSlideID=0,currentMediaItemIndex=0,initialMediaLoad=!0,currentMediaItemcount=0,currentMediaItemIndex=0,currentMediaTake=12,currentMediaReceived=0;slider=null;var EXPERIENCEAPI_URL="/api/SearchAPI/",EXPERIENCEUPDATEAPI_URL="/api/ExperienceAPI/",EXPERIENCE_Location_UPDATEAPI_URL="/api/ExperienceAPI/",EXPERIENCEFEATUREAPI_URL="/api/ExperienceFeaturesAPI/";var currentItemcount=0,currentItemIndex=0,Take=20,Received=0,SEARCHAPI_URL="/api/SearchAPI/",getInProgress=!1;var APINav_URL="/api/SearchCategoryAPI/",currentCategoryItemcount=0,currentCategoyrItemIndex=0,CategoryTake=20,CategoryReceived=0;_open=!1