function roleCheckDependencies(){var n=$(this).attr("data-dependencies").split(","),t=$(this).attr("data-dependency-unlock"),i=$(this).is(":checked");i?$.each(n,function(n,t){$("#"+t).prop("checked",!0);$("#"+t).prop("disabled",!0)}):$("#"+t).removeProp("disabled")}function ajaxSearch(n){var t=getCurrentLang(),i=getUrlRefreshHash(),r="/"+t+"/Ajax/Search/#"+i,u=getSearchParameters(n),f=JSON.stringify(u,null,2);$.ajax({url:r,type:"POST",data:f,datatype:"html",contentType:"application/json; charset=utf-8",success:function(n){$("#ajaxSearchResultHolder").replaceWith(n);$("#ajaxListItemCountHolder").html($("#ajaxSearchResultsCount").html())},error:function(n,t,i){alert(t);alert(i)}})}function getUrlRefreshHash(){return $.now()}function getCurrentLang(){var i=$(location).attr("href"),n=i.match("(cs)|(en)"),t=defaultLang;return n!=null&&(t=n[0]),t}function getSearchParameters(n){(n==null||n==0)&&(n=1);var s=$("#Text").val(),t=$("#SelectedType .active").attr("data-value"),i=$("#SelectedOrderType .active").attr("data-value"),r=$("#SelectedAuthorization .active").attr("data-value"),u=$("#SelectedCategory .active").attr("data-value"),h=$("#SelectedSubjects").val(),f=$("#ajaxSearchShowModeSwitch .active").attr("data-value"),e=$("#SelectedPageSize").val(),o=$("#SelectedDocumentFolder").val();return t==undefined&&(t=0),i==undefined&&(i=1),r==undefined&&(r=0),u==undefined&&(u=0),f==undefined&&(f=1),e==undefined&&(e=12),o==undefined&&(o=0),{Text:s,SelectedType:t,SelectedAuthorization:r,SelectedCategory:u,SelectedOrderType:i,SelectedSubjects:h,CurrentPage:n,SelectedPageSize:e,SelectedShowMode:f,SelectedDocumentFolder:o}}function ajaxifyForm(n){$(":submit",n).click(function(t){t.preventDefault();$.post(n.attr("action"),n.serialize(),function(t,i){if(i=="success"){var r=$(t);ajaxifyForm(r);n.after(r).remove()}})})}function deleteTag(n){n.preventDefault();var t=$(this).attr("data-url");return $.get(t,function(n){$("#ajaxTags").html(n);$(".ajaxVideoTagDelete").on("click",deleteTag)}),!1}function deleteTagEn(n){n.preventDefault();var t=$(this).attr("data-url");return $.get(t,function(n){$("#ajaxTagsEn").html(n);$(".ajaxVideoTagDeleteEn").on("click",deleteTagEn)}),!1}function isInIframe(){try{return window.self!==window.top}catch(n){return!0}}function toHHMMSS(n){var r=parseInt(n,10),u=Math.floor(r/3600),t=Math.floor((r-u*3600)/60),i=r-u*3600-t*60;return t<10&&(t="0"+t),i<10&&(i="0"+i),u+":"+t+":"+i}function mvcBootstrapconvertor(){$(".input-validation-error").parents(".form-group").addClass("has-error");$(".field-validation-error").addClass("text-danger")}var defaultLang="cs";$(function(){var n,t,i,r,u;mvcBootstrapconvertor();$("#ajaxListItemCountHolder").html($("#ajaxSearchResultsCount").html());$(document).ajaxStart(function(){$("#ajaxSearchResultsLoading").removeClass("hidden");$("#ajaxSearchResultHolder").hide()}).ajaxStop(function(){$("#ajaxSearchResultsLoading").addClass("hidden");$("#ajaxSearchResultHolder").fadeIn("slow")});$(document.body).on("click",".ajaxClick",function(n){var t=$(this),o=t.is(":checkbox"),s,h;o||n.preventDefault();var r=t.attr("data-return-selector"),u=t.attr("data-replace-this"),f=t.attr("data-on-success"),e=t.attr("data-replace-selector"),i=t.attr("href");if(typeof i=="undefined"&&(i=t.attr("data-href")),typeof i=="undefined")return alert("Chybí url. Vyplňte Href.");if(s=t.attr("data-confirm"),typeof s=="undefined"){if($.ajax({method:"GET",dataType:"html",url:i}).success(function(n){typeof f!="undefined"&&window[f](n);typeof u!="undefined"&&u&&t.replaceWith(n);typeof r!="undefined"&&$(r).html(n);typeof e!="undefined"&&$(e).replaceWith(n)}).error(function(n,t,r){alert("Url:\n"+i+"\nStatus: "+n.status+"\nError: "+r)}),!o)return!1}else if(h=confirm(s),h===!0&&($.ajax({method:"GET",dataType:"html",url:i}).success(function(n){typeof f!="undefined"&&window[f](n);typeof u!="undefined"&&u&&t.replaceWith(n);typeof r!="undefined"&&$(r).html(n);typeof e!="undefined"&&$(e).replaceWith(n)}).error(function(n,t,r){alert("Url:\n"+i+"\nStatus: "+n.status+"\nError: "+r)}),!o))return!1;return!1});$(document.body).on("click",".ajaxModalOpen",function(n){n.preventDefault();var u=$(this).attr("href"),i=$(this).attr("data-modal-width"),r=$(this).attr("data-modal-height"),t=$(this).attr("data-modal-label");return typeof i!="undefined"&&$("#ajaxModal .modal-dialog").css("width",i),typeof r!="undefined"&&$("#ajaxModalFrame").attr("height",r),typeof t!="undefined"&&($("#ajaxModalLabel").text(t),$("#ajaxModal").attr("aria-labelledby",t)),$("#ajaxModalFrame").attr("src",u),$("#ajaxModal").modal({show:!0}),!1});n=$("#AuthorizationId.ajaxDdlDepartments option:selected").attr("value");n==="2"&&$("#ajaxAllowedIpBlocks").slideDown("slow");n==="4"&&$("#ajaxAllowedDepartments").slideDown("slow");$("#AuthorizationId.ajaxDdlDepartments").change(function(){$("#ajaxAllowedDepartments").hide();$("#ajaxAllowedIpBlocks").hide();var n=$("#AuthorizationId.ajaxDdlDepartments option:selected").attr("value");n==="2"&&$("#ajaxAllowedIpBlocks").slideDown("slow");n==="4"&&$("#ajaxAllowedDepartments").slideDown("slow")});t=$("#ajaxSetLeftMenuActive").val();t!=="undefined"&&$(t).addClass("active");$(".ajaxVideoTagAdd").click(function(n){n.preventDefault();var t=$(this).attr("data-url"),i=$("#Tags").val();return $("#Tags").val()?($("#Tags").parents(".form-group").removeClass("has-error"),t=t+"&text="+i,$.ajax({url:t,type:"GET",success:function(n){$("#ajaxTags").html(n);$("#Tags").val("");$(".ajaxVideoTagDelete").on("click",deleteTag)},error:function(n,t,i){alert(t);alert(i)}})):$("#Tags").parents(".form-group").addClass("has-error"),!1});$(".ajaxVideoTagAddEn").click(function(n){n.preventDefault();var t=$(this).attr("data-url"),i=$("#TagsEn").val();return $("#TagsEn").val()?($("#TagsEn").parents(".form-group").removeClass("has-error"),t=t+"&text="+i,$.ajax({url:t,type:"GET",success:function(n){$("#ajaxTagsEn").html(n);$("#TagsEn").val("");$(".ajaxVideoTagDeleteEn").on("click",deleteTag)},error:function(n,t,i){alert(t);alert(i)}})):$("#TagsEn").parents(".form-group").addClass("has-error"),!1});$(".ajaxVideoTagDelete").on("click",deleteTag);$(".ajaxVideoTagDeleteEn").on("click",deleteTagEn);i=$(".ajaxifyFormPortalPublicationPositions");ajaxifyForm(i);r=$(".ajaxifyFormFields");ajaxifyForm(r);u=$(".ajaxifyFormCategories");ajaxifyForm(u);$("#languageTabs a").click(function(n){n.preventDefault();$(this).tab("show")});$("#ajaxModalAddVideoOpen").click(function(n){n.preventDefault();var t=$("#ajaxModalAddVideoOpen").attr("href");return $("#ajaxDialogAddVideoToPlaylistFrame").attr("src",t+"?"+(new Date).getTime()),$("#ajaxModalAddVideo").modal({show:!0}),!1});$(".ajaxVideoChangePortalOpen").click(function(n){n.preventDefault();var t=$(this).attr("href");return $("#ajaxModalVideoChangePortalFrame").attr("src",t+"?"+(new Date).getTime()),$("#ajaxModalVideoChangePortal").modal({show:!0}),!1});$(".ajaxModalFlowPlayerListOpen").click(function(n){n.preventDefault();var t=$(this).attr("href");return $("#ajaxModalVideoListFlowPlayerFrame").attr("src",t+"?"+(new Date).getTime()),$("#ajaxModalVideoListFlowPlayer").modal({show:!0}),!1});$("#ajaxModalVideoListFlowPlayer").on("hide.bs.modal",function(){$("#ajaxModalVideoListFlowPlayerFrame").attr("src","about:blank")});$(".ajaxModalFlowPlayerOpen").click(function(n){n.preventDefault();var t=$(this).attr("href");return $("#ajaxModalFlowPlayerFrame").attr("src",t+"?"+(new Date).getTime()),$("#ajaxModalFlowPlayer").modal({show:!0}),!1});$("#ajaxModalFlowPlayer").on("hide.bs.modal",function(){$("#ajaxModalFlowPlayerFrame").attr("src","about:blank")});$(".ajaxModalCuePointsOpen").click(function(n){n.preventDefault();var t=$(this).attr("href");return $("#ajaxModalCuePointsFrame").attr("src",t+"?"+(new Date).getTime()),$("#ajaxModalCuePointsFrame").css("height",$(window).height()*.9),$("#ajaxModalCuePoints").modal({show:!0}),!1});$("#ajaxModalEncoderProfilesOpen").click(function(n){return n.preventDefault(),$("#ajaxModalEncoderProfiles").modal({show:!0}),!1});$("#ajaxVideoChangePortalFormButton").on("click",function(n){return n.preventDefault(),window.scrollTo(0,0),$("#SelectedPortalId").val()==="0"?$("#SelectedPortalId").parents(".form-group").addClass("has-error"):($("#SelectedPortalId").parents(".form-group").removeClass("has-error"),$("#SelectedEditorId").val()==="0"?$("#SelectedEditorId").parents(".form-group").addClass("has-error"):($("#SelectedEditorId").parents(".form-group").removeClass("has-error"),$("#preventDoubleSubmitDark").show(),$("#preventDoubleSubmitWaiting").show(),$.ajax({url:"/Administrace/Video/ChangePortal",type:"POST",data:$("#ajaxVideoChangePortalForm").serialize(),success:function(){parent.location.reload()},error:function(n,t,i){alert(t);alert(i)}}))),!1});$("#ajaxGrabScreenshot").on("hidden.bs.modal",function(){window.location.href=window.location.href});$("#ajaxModalCuePoints").on("hidden.bs.modal",function(){window.location.href=window.location.href});$("#ajaxUploadScreenshot").on("hidden.bs.modal",function(){window.location.href=window.location.href});$("#ajaxModalVideoChangePortal").on("hidden.bs.modal",function(){window.location.href=window.location.href});$("#ajaxModalAddVideo").on("hidden.bs.modal",function(){var n=$("#ajaxModalAddVideo").attr("data-document-id");$.ajax({url:"/Administrace/Playlists/GetVideosInPlaylist/"+n,type:"GET",success:function(n){$("#ajaxVideoInPlaylist").replaceWith(n)}})});$("#ajaxModalCategories").on("hidden.bs.modal",function(){var n=$("#ajaxModalCategories").attr("data-document-id");$.ajax({url:"/Administrace/Video/GetBadgesCategories/"+n,type:"GET",success:function(n){$("#ajaxBadgesCategories").replaceWith(n)}})});$("#ajaxModalFields").on("hidden.bs.modal",function(){var n=$("#ajaxModalFields").attr("data-document-id");$.ajax({url:"/Administrace/Video/GetBadgesFields/"+n,type:"GET",success:function(n){$("#ajaxBadgesFields").replaceWith(n)}})});$("#ajaxModalPortalPublicationPositions").on("hidden.bs.modal",function(){var n=$("#ajaxModalPortalPublicationPositions").attr("data-document-id");$.ajax({url:"/Administrace/Video/GetBadgesPortalPublicationPositions/"+n,type:"GET",success:function(n){$("#ajaxBadgesPortalPublicationPositions").replaceWith(n)}})});$(".ajaxItemSaveOrder").click(function(){var n=$(this).attr("data-playlistId"),t=$("#ajaxVideoSortable").sortable("toArray").toString();$.get("/Administrace/Playlists/UpdateItemsOrder",{itemsOrder:t,playlistId:n})});$(".ajaxMarkAsPublished").click(function(){var n=$("#IsPublished"),t=n.val();n.val(t==="True"?"False":"True")});$("#ajaxInstitutionListSearchSubmit").click(function(n){return n.preventDefault(),$.ajax({url:"/Administrace/Enums/InstitutionList",type:"POST",data:$("#ajaxInstitutionListSearchForm").serialize(),success:function(){location.reload()},error:function(n,t,i){alert(t);alert(i)}}),!1});$(".ajaxRenameInstitutionOpen").click(function(n){n.preventDefault();var t=$(this).attr("href");return $("#ajaxRenameInstitutionFrame").attr("src",t),$("#ajaxRenameInstitutionModal").modal({show:!0}),!1});$("#ajaxRenameInstitutionModal").on("hidden.bs.modal",function(){location.reload()});$("#ajaxRenameInstitutionFormButton").on("click",function(n){return n.preventDefault(),window.scrollTo(0,0),$("#preventDoubleSubmitDark").show(),$("#preventDoubleSubmitWaiting").show(),$.ajax({url:"/Administrace/Enums/InstitutionEdit",type:"POST",data:$("#ajaxRenameInstitutionForm").serialize(),success:function(){parent.location.reload()},error:function(n,t,i){alert(t);alert(i)}}),!1});$("#ajaxVideoDetailCopyToSession").on("click",function(n){return n.preventDefault(),$.ajax({url:"/Administrace/Video/CopyEditToClipboard",type:"POST",data:$("#ajaxVideoEditForm").serialize(),success:function(){},error:function(n,t,i){alert(t);alert(i)}}),!1});$("#ajaxVideoDetailCopyFromSession").on("click",function(n){return n.preventDefault(),$.ajax({url:"/Administrace/Video/CopyEditFromClipboard",type:"POST",data:$("#ajaxVideoEditForm").serialize(),success:function(n){$("#Name").val(n.Name);$("#Description").val(n.Description);$("#NameEn").val(n.NameEn);$("#DescriptionEn").val(n.DescriptionEn);$("#Author").val(n.Author);$("#AuthorEmail").val(n.AuthorEmail);$("#Credits").val(n.Credits);$("#Department").val(n.Department);$("#Notes").val(n.Notes);$("#ReleaseDate").val(n.ReleaseDate)},error:function(n,t,i){alert(t);alert(i)}}),!1});$("#ajaxExtendetEditButton").on("click",function(n){return n.preventDefault(),$("#ajaxExtendetEdit").slideToggle("slow"),$(this).find("span.glyphicon").hasClass("glyphicon-arrow-down")?($(this).find("span.glyphicon").removeClass("glyphicon-arrow-down"),$(this).find("span.glyphicon").addClass("glyphicon-arrow-up")):($(this).find("span.glyphicon").removeClass("glyphicon-arrow-up"),$(this).find("span.glyphicon").addClass("glyphicon-arrow-down")),!1});$(".ajaxChbRoleCheckDependencies").each(roleCheckDependencies);$(document.body).on("click",".ajaxChbRoleCheckDependencies",roleCheckDependencies)});window.closeModal=function(){$(".modal").modal("hide")};$.fn.preventDoubleSubmit=function(){$(this).submit(function(){if(this.beenSubmitted)return!1;window.scrollTo(0,0);$("#preventDoubleSubmitDark").show();$("#preventDoubleSubmitWaiting").show();this.beenSubmitted=!0})}