function injectPrettyPrint(){if(typeof disableStyleCode!="undefined"){return}var b=false;$("pre code").parent().each(function(){if(!$(this).hasClass("prettyprint")){$(this).addClass("prettyprint");b=true}});if(b){prettyPrint()}}function stopUpload(c,b){var a="";if(c==1){htmlText=document.getElementById("entryDescription").value;htmlText=htmlText+b+"\r\n\r\n";document.getElementById("entryDescription").value=htmlText;document.getElementById("upload_process").innerHTML="<span style='color: green;'><br/>Done.<br/>You can now upload another image/document, or choose 'done'.</span>"}else{document.getElementById("upload_process").innerHTML="<span style='color: red;'><br/>Error.<br/>"+b+"</span>"}document.getElementById("hidden_upload_id").src="";return true}function goToByScroll(a){$("html,body").animate({scrollTop:$("#"+a).offset().top},"slow")}function addTagString2(b,a){value=document.getElementById(a).value;index=value.indexOf(b+" ");document.getElementById(a).focus();if(value.length+b.length>140){alert("Maximum number of input characters reached.")}else{if(b==value){document.getElementById(a).value=""}else{if(index!=-1&&index+b.length<value.length){if(index>0){index=index-1}begin=value.substr(0,index);rest=value.substr(index+b.length+1,value.length-1);document.getElementById(a).value=begin+rest}else{if(index!=-1&&index+b.length==value.length){if(index>0){index=index-1}begin=value.substr(0,index);rest="";document.getElementById(a).value=begin+rest}else{if(index==-1){b=b+" ";document.getElementById(a).value+=b}}}}}textCounter(document.getElementById(a),document.getElementById(a+"-maxlength"),140)}function addTagStringNoDelete(b,a){value=document.getElementById(a).value;index=value.indexOf(b+" ");document.getElementById(a).focus();if(value.length+b.length>140){alert("Maximum number of input characters reached.")}b=b+" ";document.getElementById(a).value+=b;textCounter(document.getElementById(a),document.getElementById(a+"-maxlength"),140)}function clearTagString(){document.getElementById("tagString").value=""}function clearString(a){document.getElementById(a).value="";document.getElementById(a).focus()}function textCounter(c,a,b){if(c.value.length>b){c.value=c.value.substring(0,b)}else{a.value=b-c.value.length}}function checkDelete(b){var a=window.confirm("Really want to delete '"+b+"' ?");return(a)}function getUrlVars(){var d=[],c;var a=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var b=0;b<a.length;b++){c=a[b].split("=");d.push(c[0]);d[c[0]]=c[1]}return d}$(document).ready(function(){if(getUrlVars()["id"]==null){$("#showDetails").hide()}else{$("#showDetails").show();$("#therest").hide()}$("#showNewTopic").hide();$("#showHelp1").hide();$("#showHelp2").hide();$("#showHelp3").hide();$("#showHelp4").hide();$("#showHelp5").hide();$(".showfilter").hide();$(".hoverFadeIn_").hide();$("#MarkdownRendered").hide();$("#uploadBox").hide();$(".masscheckbox").hide();$(".preselect").select();$(".focus").focus();$("#entryDescription").markItUp(mySettings);setTimeout(function(){$(".hoverOut_").fadeOut(1500)},5000);$(".inputBoxLink").click(function(){$("#upload_process").html("");$("#uploadBox").dialog("open");return false});$("#uploadBox").dialog({autoOpen:false,resizable:true,height:350,width:550,zIndex:9999,modal:true,buttons:{upload:function(){$("#upload_process").html("<br/>Loading ...");$("#upload_process").show();document.forms.uploadForm.submit()},done:function(){$(this).dialog("close")}}});$("#oneShotPreviewDialogLink").click(function(){markdownString=escape($("#entryDescription").val());$("#oneShotPreviewDialogDiv").load("markdownToHtml?markdown="+markdownString);$("#oneShotPreviewDialog").dialog("open");return false});$("#oneShotPreviewDialog").dialog({autoOpen:false,resizable:true,height:500,width:661,zIndex:9999,modal:true,buttons:{done:function(){$(this).dialog("close")}}});$(".dialogHelpLink").click(function(){$("#dialogHelp").dialog("open");$("#helpId").attr("src","http://localhost:8080/detailsFullScreen/9/test3")});$("#dialogHelp").dialog({autoOpen:false,resizable:false,height:550,width:800,modal:true,zIndex:9999,buttons:{Cancel:function(){$(this).dialog("close")}}});function c(h){tips.text(h).addClass("ui-state-highlight")}function a(i,h,j){if(!(h.test(i.val()))){i.addClass("ui-state-error");c(j);return false}else{return true}}function g(j,k,i,h){if(j.val().length>h||j.val().length<i){j.addClass("ui-state-error");c("Length of "+k+" must be between "+i+" and "+h+".");return false}else{return true}}var f=$("#editTopicName"),e=$("#dialogEditTopicNameInput"),b=$("#message");allFields=$([]).add(f).add(e).add(b),tips=$(".validateTips");$("#dialogCreateNewTopic").dialog({autoOpen:false,resizable:false,height:250,width:350,modal:true,buttons:{"Create new topic":function(){var h=true;allFields.removeClass("ui-state-error");h=h&&g(f,"topic name",3,32);h=h&&a(f,/^[a-z&\u00C4-\u00FC]([\S+ ])+$/i,"Topic name may consist of a-z, 0-9, _ , blanks and must begin with a letter.");if(h){document.forms.createNewTopicForm.submit();$(this).dialog("close")}},Cancel:function(){$(this).dialog("close")}}});$(".dialogCreateNewTopicLink").click(function(){$("#dialogCreateNewTopic").dialog("open")});$("#dialogEditTopic").dialog({autoOpen:false,resizable:false,height:250,width:350,modal:true,buttons:{"Save changes":function(){var h=true;allFields.removeClass("ui-state-error");h=h&&g(e,"topic name",3,32);h=h&&a(e,/^[a-z&\u00C4-\u00FC]([\S+ ])+$/i,"Topic name may consist of a-z, 0-9, _ , blanks and must begin with a letter.");if(h){document.forms.submitDialogEditTopic.submit();$(this).dialog("close")}},Cancel:function(){$(this).dialog("close")}}});$(".dialogEditTopicLink").click(function(){var i=$(this).parent().attr("topic-id");var h=$(this).parent().attr("topic-name");$("#dialogEditTopicIdInput").val(i);$("#dialogEditTopicNameInput").val(h);$("#dialogEditTopic").dialog("open")});$("#dialogDeleteTopic").dialog({autoOpen:false,resizable:false,height:220,width:350,modal:true,buttons:{"Delete topic":function(){document.forms.submitDialogDeleteTopic.submit()},Cancel:function(){$(this).dialog("close")}}});$(".dialogDeleteTopicLink").click(function(){var i=$(this).parent().attr("topic-id");var h=$(this).parent().attr("topic-name");$("#dialogDeleteTopicIdInput").val(i);$("#dialogDeleteTopicIdDeleteParam").val(i);$("#dialogDeleteTopicNameInput").val(h);$("#dialogDeleteTopic").dialog("option","title","Delete topic "+$("#dialogDeleteTopicNameInput").val()+" ?");$("#dialogDeleteTopic").dialog("open")});$("#dialogExpireTopic").dialog({autoOpen:false,resizable:false,height:250,width:400,modal:true,buttons:{"Expire topic":function(){document.forms.submitDialogExpireTopic.submit()},Cancel:function(){$(this).dialog("close")}}});$(".dialogExpireTopicLink").click(function(){var i=$(this).parent().attr("topic-id");var h=$(this).parent().attr("topic-name");$("#dialogExpireTopicIdInput").val(i);$("#dialogExpireTopicIdDeleteParam").val(i);$("#dialogExpireTopicNameInput").val(h);$("#dialogExpireTopic").dialog("option","title","Expire topic "+$("#dialogDeleteTopicNameInput").val()+" ?");$("#dialogExpireTopic").dialog("open")});$("#dialogUnexpireTopic").dialog({autoOpen:false,resizable:false,height:220,width:350,modal:true,buttons:{"Unexpire topic":function(){document.forms.submitDialogUnexpireTopic.submit()},Cancel:function(){$(this).dialog("close")}}});$(".dialogUnexpireTopicLink").click(function(){var i=$(this).parent().attr("topic-id");var h=$(this).parent().attr("topic-name");$("#dialogUnexpireTopicIdInput").val(i);$("#dialogUnexpireTopicIdDeleteParam").val(i);$("#dialogUnexpireTopicNameInput").val(h);$("#dialogUnexpireTopic").dialog("option","title","Unexpire topic "+$("#dialogDeleteTopicNameInput").val()+" ?");$("#dialogUnexpireTopic").dialog("open")});$(".hover_").hover(function(){$(this).find(".hoverFadeIn_").fadeIn(200)},function(){$(this).find(".hoverFadeIn_").fadeOut(50)});$(".hover2").hover(function(){$(this).css("background-color","#eeeeee")},function(){$(this).css("background-color","#FFFFFF")});$("#messageLink").click(function(){$(".hoverOut_").hide()});$("#rendering").click(function(){if($("#HTMLRendered").is(":hidden")){$("#HTMLRendered").fadeIn(250);$("#MarkdownRendered").hide();$("#rendering").text("show as Markdown")}else{$("#HTMLRendered").fadeOut(250);$("#MarkdownRendered").show();$("#rendering").text("show as HTML")}});$("#masseditlink").click(function(){$(".masscheckbox").toggle()});$("#filterbutton").click(function(){$("#filterarea").toggle()});$(".showfilterlink").click(function(){$(".showfilter").toggle()});$("#selectall").click(function(){var h=$(this).closest("form").find(":checkbox");h.attr("checked","checked")});$("#selectnone").click(function(){var h=$(this).closest("form").find(":checkbox");h.removeAttr("checked")});$("#selectinfos").click(function(){var h=$(this).closest("form").find(".info");h.attr("checked","checked")});$("#selectlessons").click(function(){var h=$(this).closest("form").find(".lesson");h.attr("checked","checked")});$("#selectquestions").click(function(){var h=$(this).closest("form").find(".question");h.attr("checked","checked")});$("#selectimages").click(function(){var h=$(this).closest("form").find(".image");h.attr("checked","checked")});$("#selectdocuments").click(function(){var h=$(this).closest("form").find(".document");h.attr("checked","checked")});$(".checkTopicLink").click(function(h){$(".checkmarkTopic").removeClass("font-orange-small");$(".checkmarkTopic").addClass("greygrey");$(".checkTopicLink").removeClass("font-orange-small");$("#"+h.target.id).addClass("font-orange-small");$("#check_"+h.target.id).removeClass("greygrey");$("#check_"+h.target.id).addClass("font-orange-small");topicIdString=h.target.id;topicIdString=topicIdString.substring(0,topicIdString.indexOf("_",0));$("#topicIdSelector").val(topicIdString);$("#topicName").val("")});$("#showTopicsLink").click(function(){$(".showTopics").toggle()});$("#showTagsLink").click(function(){$(".showTags").toggle()});$("#filterLink0").click(function(){$(".filterType0").toggle()});$("#filterLink1").click(function(){$(".filterType1").toggle()});$("#filterLink2").click(function(){$(".filterType2").toggle()});$("#filterLink3").click(function(){$(".filterType3").toggle()});$("#filterLinkShowAll").click(function(){$(".filterType0").show();$(".filterType1").show();$(".filterType2").show();$(".filterType3").show()});$(".helpFocus1").blur(function(){$("#showHelp11").fadeOut(250)});$(".helpFocus1").focus(function(){$("#showHelp11").fadeIn(450)});$(".helpFocus2").blur(function(){$("#showHelp2").fadeOut(250)});$(".helpFocus2").focus(function(){$("#showHelp2").fadeIn(450)});$(".helpFocus3").blur(function(){$("#showHelp3").fadeOut(250)});$(".helpFocus3").focus(function(){$("#showHelp3").fadeIn(450)});$(".helpFocus4").blur(function(){$("#showHelp4").fadeOut(250)});$(".helpFocus4").focus(function(){$("#showHelp4").fadeIn(450)});$("#helpLink1").click(function(){if($("#showHelp1").is(":hidden")){$("#showHelp1").fadeIn(250);$("#helpLink1").text("hide help");$(".fadeOutHelp1").hide()}else{$("#showHelp1").hide();$("#helpLink1").text("show help");$(".fadeOutHelp1").show()}});$("#helpLink2").click(function(){if($("#showHelp2").is(":hidden")){$("#showHelp2").fadeIn(250);$(".fadeOutHelp2").hide()}else{$("#showHelp2").fadeOut(250);$(".fadeOutHelp2").show()}});$("#helpLink3").click(function(){if($("#showHelp3").is(":hidden")){$("#showHelp3").fadeIn(250);$(".fadeOutHelp3").hide()}else{$("#showHelp3").fadeOut(250);$(".fadeOutHelp3").show()}});$("#helpLink4").click(function(){if($("#showHelp4").is(":hidden")){$("#showHelp4").fadeIn(250);$(".fadeOutHelp4").hide()}else{$("#showHelp4").fadeOut(250);$(".fadeOutHelp4").show()}});$("#helpLink5").click(function(){if($("#showHelp5").is(":hidden")){$("#showHelp5").fadeIn(250);$(".fadeOutHelp5").hide()}else{$("#showHelp5").fadeOut(250);$(".fadeOutHelp5").show()}});$("#clickme2").click(function(){if($("#showDetails").is(":hidden")){$("#therest").fadeOut(0,function(){$("#showDetails").fadeIn(100)});$("#clickme2").text("hide details");$("#clickme2").attr("href","#showDetailsAnchor");$("#entryDescription").focus();return false}else{$("#showDetails").fadeOut(0,function(){$("#therest").fadeIn(100)});$("#clickme2").text("add details ...");$("#clickme2").attr("href","#top")}});$("#topicbar").click(function(){$("#topicName").attr("value","");$("#topicIdSelector").attr("value","")});$("#linkNewTopic").click(function(){if($("#showNewTopic").is(":hidden")){$("#showNewTopic").fadeIn(250)}else{$("#showNewTopic").fadeOut(250)}});$("#messageLink").click(function(){$("#messageBox").fadeOut(250)});var d=false;$(document).keyup(function(h){if(h.which==17){d=false}}).keydown(function(h){if(h.which==17){d=true}if(h.which==83&&d==true){$(".autosubmit").submit();return false}if(h.which==70&&d==true){window.location.href="/showSearch";h.preventDefault();return false}if(h.which==72&&d==true){window.location.href="/home";h.preventDefault();return false}if(h.which==87&&d==true){hideWindow();return false}if(h.which==27){hideWindow();return false}});$(function(){$("#datepicker").datepicker()});$("#mask").click(function(){$("#datepicker").datepicker()});$("#neverExpire").click(function(){$("#datepicker").attr("value","")})});
