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},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("+","")}}