function launchContent(n){var t,i,r,u,f,e,s=JSON.stringify(n),o=!1;$.ajax({type:"POST",url:"/Component/LaunchParameters/",data:{componentDetails:s},success:function(n){e=n.ContentType;fullScreenInd=n.FullScreenInd;t=n.Width;i=n.Height;r=n.Adjustable;f=n.HierarchyId;u=n.Error;o=n.StatusCompleteOnLaunch;webLinkUrl=n.WebLinkUrl;launch(e,fullScreenInd,t,i,r,f,o,u,!1,webLinkUrl)},async:!1})}function launchContentFromHierarchy(n){var t,i,r,u,f,e,o=!1;$.ajax({type:"POST",url:"/Component/LaunchParametersFromHierarchy",data:{componentHierarchyId:n},success:function(n){e=n.ContentType;fullScreenInd=n.FullScreenInd;t=n.Width;i=n.Height;r=n.Adjustable;f=n.HierarchyId;u=n.Error;o=n.StatusCompleteOnLaunch;webLinkUrl=n.WebLinkUrl;launch(e,fullScreenInd,t,i,r,f,o,u,!1,webLinkUrl)},async:!1});$("#componetDetailDialog").css("display")=="none"&&(callingPage=-1)}function launchContentFromHierarchyForGuestAccess(n){var t,i,r,u,f,e,o=!1;$("#guestAccessModal").modal("hide");$.ajax({type:"POST",url:"/Component/LaunchParametersFromHierarchyForGuestAccess",data:{componentHierarchyId:n},success:function(n){e=n.ContentType;fullScreenInd=n.FullScreenInd;t=n.Width;i=n.Height;r=n.Adjustable;f=n.HierarchyId;u=n.Error;o=n.StatusCompleteOnLaunch;webLinkUrl=n.WebLinkURL;launch(e,fullScreenInd,t,i,r,f,o,u,!0,webLinkUrl)},async:!1})}function launch(n,t,i,r,u,f,e,o,s,h){var c=null,l;n=="app"?c=s?window.open("/LearningContent/LaunchApplicationForGuestAccess/"+f):window.open("/LearningContent/LaunchApplication/"+f):n=="file"?s?(window.open("/LearningContent/LaunchFileForGuestAccess/"+f),e&&refreshComponentForLinks()):(window.open("/LearningContent/LaunchFile/"+f),e&&refreshComponentForLinks()):n=="webLink"?(h.match(/^https?:\/\//i)||(h="http://"+h),s?(t?window.open(h):(targetWin=window.open(h,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin),e&&refreshComponentForLinks()):(t?window.open(h):(targetWin=window.open(h,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin),e&&refreshComponentForLinks())):n=="htmlPackage"?s?(t?window.open("/LearningContent/LaunchForGuestAccess/"+f):(targetWin=window.open("/LearningContent/LaunchForGuestAccess/"+f,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin),e&&refreshComponentForLinks()):(t?window.open("/LearningContent/Launch/"+f):(targetWin=window.open("/LearningContent/Launch/"+f,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin),e&&refreshComponentForLinks()):s?(targetWin=window.open("/LearningContent/LaunchForGuestAccess/"+f,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin):o.indexOf("Error: This content is already active!")>=0?(targetWin=window.open("","eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),targetWin.location=="about:blank"&&(targetWin.location.href="/LearningContent/Launch/"+f),targetWin.focus()):o.indexOf("Error: You already have active content!")>=0?(targetWin=window.open("","eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),targetWin.location=="about:blank"?targetWin.location.href="/LearningContent/Launch/"+f:alert("Error: You already have active content!\r\nIf you cannot find the active content window, then please clear this message, log out of the Hub and log back in to Play this session."),targetWin.focus()):o!=null&&o!=""?alert(o.replace(/\\r/g,"\r").replace(/\\n/g,"\n")):(targetWin=window.open("/LearningContent/Launch/"+f,"eLfHContent","location=0,menubar=0,resizable="+u+",width="+i+",height="+r),c=targetWin);s||c!=null&&$("#myActivityPanel").length>0&&(l=setInterval(function(){c.closed&&($.ajax({type:"POST",url:"/Component/ActivityDetail",data:{componentHierarchyId:f},success:function(n){$(".componentstatus #ComponentStatusIcon").attr("src",n.ImagePath+"?time="+(new Date).toString());$(".componentstatus #ComponentStatusText").text(n.StatusText);$("#ActivityNumberOfAccesses #ActivityNumberOfAccessesTitle").html(n.NumberOfAccesses);var t='<tr><td><img src="'+n.ActivityImagePath+"?time="+(new Date).toString()+'" alt="Activity Status" style="padding-right:5px; width:20px;" /><\/td><td>'+n.LastAccessDateString+"<\/td><\/tr>";t+='<tr><td colspan="2" style="padding-left: 2px;">'+(n.Score!=null&&n.Score!=0?"Score: "+n.ScoreString:"")+"<p><\/p><\/td><\/tr>";$("#ActivityNumberOfAccesses #ActivityNumberOfAccessesList").prepend(t);$("#ActivityLastAccessed").text(n.LastAccessDateString);$("#SessionIcon").attr("src",n.SessionIcon+"?time="+(new Date).toString());$(".feedback-controls").show();$("#componentDetailPanel").removeClass("col-md-12");$("#componentDetailPanel").addClass("col-md-9");$("#leftHandColumn,#myActivityPanel").show()},async:!0}),clearInterval(l))},500))}function showDetails(n){var i,r,t;i=typeof n.callingFunction=="undefined"?"/Component/DetailsPartial/":"/Component/GetDetailsPartialForCatalogueComponent/";r=JSON.stringify(n);t='<button type="button" class="btn btn-elfh" data-dismiss="modal" data-target="#componetDetailDialog" aria-label="Close"style="float:right;margin-top: 4px;margin-left:4px;width:80px; border-width:2px;border-color:#fff;">Close<\/button>';$.ajax({type:"POST",url:i,data:{componentDetails:r},success:function(n){$("#componentDetailContent").html(n);$("#componentDetailContent .panel:first").css({"margin-top":"0px","margin-bottom":"0px"});var i=$("#componentDetailContent").find(".panel-heading:first a:first");i.length>0?i.before(t):$("#componentDetailContent").find(".panel-heading:first").append(t);$("#chileModals").html("");$.each($("#componentDetailContent .modal"),function(){$("#chileModals").append($(this))});$("#componentDetailContent .modal").remove();$("#componetDetailDialog").modal("show")},error:function(){alert("Error: Unable to view component details!")},async:!1})}function refreshDetails(n){if(RefreshWindowOpener){if(callingPage==-1)return;if(callingPage==0)if($("#componetDetailDialog").css("display")!="none")$("#componetDetailDialog").on("hide.bs.modal",function(){setTimeout("location.reload(true)",50)});else setTimeout("location.reload(true)",50);else callingPage==1?setTimeout("SubmitSearchForm()",50):callingPage==2?setTimeout(function(){app.myElearning.UpdateSessionAndParentNodeStatus(n)},50):setTimeout("alert('Refresh the page to see the result of your activity.')",50)}}function refreshComponentForLinks(){if(RefreshWindowOpener){if(callingPage==-1)return;callingPage==2&&app.myElearning.launchedComponentId>0&&setTimeout(function(){app.myElearning.UpdateSessionAndParentNodeStatus(app.myElearning.launchedComponentId)},50)}}var targetWin,callingPage=0