function addInputTemplate(b,c){var a=parseInt($("#index_"+c).val());$.ajax({url:b,data:{index:a},success:function(d){$("#div_"+c).append(d);$("#"+c+"_"+a).slideDown("normal");$("#remove_link_"+c+"_"+a).click(function e(){removeInputTemplate(c,a);return false});$("#index_"+c).val(a+1)}});return false}function removeInputTemplate(c,b){var a="#"+c+"s\\["+b+"\\]\\.deleted";$(a).val(true);$("#"+c+"_"+b).slideUp("normal")}function markInputForDeletion(f,b){var e="#delete_link_"+f+"_"+b;var c="#undodelete_link_"+f+"_"+b;var d="#message_"+f+"_"+b;var a="#"+f+"s\\["+b+"\\]\\.deleted";$(a).val(true);$(d).addClass("exclamation");$(d).html("This "+f+" will be deleted upon form submission");$(d).show();$(e).hide();$(c).show();return false}function undoMarkInputForDeletion(f,b){var e="#delete_link_"+f+"_"+b;var c="#undodelete_link_"+f+"_"+b;var d="#message_"+f+"_"+b;var a="#"+f+"s\\["+b+"\\]\\.deleted";$(a).val(false);$(d).html("");$(d).removeClass("exclamation");$(d).hide();$(c).hide();$(e).show()}function loadStatesForCountry(){$.ajax({url:"/school/getStatesForCountry.html",data:"country="+this.value,cache:true,success:function(a){$("#stateSelect").html(a);$("#state").change(function(){GRAILSUI.school.dataSource.scriptQueryAppend="country="+$("#country").val()+"&state="+this.value})},error:function(){$("#stateSelect").html("")}});GRAILSUI.school.dataSource.scriptQueryAppend="country="+this.value}function startLuceneIndexing(){$.ajax({url:"/admin/startLuceneIndexing.html"})}function resumeLuceneIndexing(){$.ajax({url:"/admin/resumeLuceneIndexing.html"})}function startDocumentLoading(b,a){$.ajax({url:"/admin/startDocumentLoading.html?loadBatchSize="+b+"&loadBatches="+a})}function startFullTextLoading(){$.ajax({url:"/admin/startFullTextLoading.html"})}function startDocumentBulkDeletion(a){$.ajax({url:"/admin/startDocumentBulkDeletion.html?docsToDelete="+a})}function startDuplicateDetection(a){$.ajax({url:"/admin/startDuplicateDetection.html?"+a})}function startDocumentProcessing(a){$.ajax({url:"/admin/startDocumentProcessing.html?processorList="+a})}function startDocumentCollection(){$.ajax({url:"/admin/startDocumentCollection.html"})}function embargoRadioButtonHandler(){if(this.value=="NONE"){hideEmbargoEndDate()}else{$("#embargoDate").show()}}function hideEmbargoEndDate(){$("#embargoEndDate").val("");$("#embargoDate").hide()}function documentTypeRadioButtonHandler(){setRequiredMarker(this)}function setRequiredMarker(a){if(a!=null){if(a.value=="OTHER"){$(".other").html("&nbsp;")}else{$(".other").html("*")}}}$.fn.clearForm=function(){return this.each(function(){var b=this.type,a=this.tagName.toLowerCase();if(a=="form"){return $(":input",this).clearForm()}if(b=="text"||b=="password"||a=="textarea"){this.value=""}else{if(b=="checkbox"||b=="radio"){this.checked=false}else{if(a=="select"){this.selectedIndex=0}}}})};function restoreExampleText(){$(".inputValue").example(function(){return $(this).attr("title")})}function popUpWindow(b,a,d,f,e){if(b.indexOf("print_view")==-1){var g=0}else{var g=1}var c=window.open(b,"FPU","copyhistory=0, scrollbars=0, menubar="+g+", height="+a+", width="+d+", left="+f+", top="+e+", toolbar=0, location=0, status=0,resizable=0");return false}function applyExampleText(){$(".inputValue").example(function(){return $(this).attr("title")});$(".example_gray").example(function(){return $(this).attr("title")},{className:"gray"})}function addFileUploadInput(){var b=parseInt($("#file_index").val());var a=parseInt($("#file_max").val());var c=parseInt($("#file_count").val());if(c>=a){alert("You may not upload more than "+a+" files");return false}$.ajax({url:"/document/suppFileInput.html",data:{index:b},success:function(d){$("#supplementary").append(d);$("#newupload_"+b).slideDown("normal");$("#removeUploadLink_"+b).click(function e(){removeNewUploadLink(b);return false});$("#file_index").val(b+1);$("#file_count").val(c+1)}});return false}function removeNewUploadLink(d){var a="#newupload_"+d;var b=parseInt($("#file_count").val());$(a).slideUp("normal",function c(){$(a).remove();$("#file_count").val(b-1)})}function markFileForDeletion(e){var d="#file_deletelink_"+e;var b="#file_undodeletelink_"+e;var c="#message_"+e;var a="#documentContents\\["+e+"\\]\\.deleted";$(a).val(true);$(c).addClass("exclamation");$(c).html("This file will be deleted upon form submission");$(c).show();$(d).hide();$(b).show();return false}function undoMarkFileForDeletion(e){var d="#file_deletelink_"+e;var b="#file_undodeletelink_"+e;var c="#message_"+e;var a="#documentContents\\["+e+"\\]\\.deleted";$(a).val(false);$(c).html("");$(c).removeClass("exclamation");$(c).hide();$(b).hide();$(d).show()}function isNumberKey(b){var a=(b.which)?b.which:event.keyCode;if(a>31&&(a<48||a>57)){return false}return true};
