var QuickOutput={pageSelected:false,selectPageTriggersRangeSelection:true,isFullRecord:function(){return $("#records_chunks").length===0},isMarkedList:function(){var b=$("#output_form");if(!b.length){return false}var c=b.find('input[name="search_mode"]');if(!c.length){return false}var a=c.val();if(typeof a==="undefined"){return false}return a==="MarkedList"},isSafari:Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,removeAddToENWButton:function(){if(QuickOutput.isFullRecord()&&$('[id^="enw_link"]').children().length){$(".quickOutputENW").filter("a").parent("li").remove();var e=$(".saveToMenu").find("a").first();var a=e.text();var b=e.attr("class").split(/\s+/);var c="";$.each(b,function(f,g){if(g.indexOf("quickOutput")===0){c=g}});if(c.length){var d=$(".saveAgainTo").filter(".quickOutputENW").removeClass("quickOutputENW").unbind("click").addClass(c).click(function(f){f.preventDefault();$(".saveToMenu").find("a."+c).click()}).find("span").text(a)}}},selectionsAvailable:function(){if(typeof jQuery!=="undefined"){return $('input[name="isickref"]').length>0}}};var captcha={token:null,recaptchaVerified:false,userSIDVerify:null,executeRecaptcha:function(){captcha.token=grecaptcha.getResponse();if(captcha.token==null||captcha.token==""){grecaptcha.reset();grecaptcha.execute()}return captcha.token},validateRecaptcha:function(a){captcha.executeRecaptcha();if(captcha.token){var b=$("#recaptchaUrl").first().text();captcha.userSIDVerify=$("#captcha_token").val();$.ajax({type:"POST",async:false,url:b,data:{response:captcha.token},success:captcha.checkToken,error:function(){captcha.recaptchaVerified=true}})}},checkToken:function(a){var b=a.success;if(b===true){captcha.userSIDVerify=captcha.token;captcha.recaptchaVerified=true}else{captcha.recaptchaVerified=false}},};(function(g){_.templateSettings={interpolate:/\<\@\=(.+?)\@\>/gim,evaluate:/\<\@(.+?)\@\>/gim,escape:/\<\@\-(.+?)\@\>/gim};var o=Backbone.View.extend({el:g(".saveTo"),initialize:function(){_.bindAll(this,"render","showActions");this.render();return this},render:function(){if(this.$el.size()===0){this.$el=g(".saveTo")}this.$el.button({text:false,icons:{primary:"ui-icon-triangle-1-s"}}).click(this.showActions);return this},showActions:function(H){disable_auto_submit();$this=g(H.currentTarget);$button=$this.parent();var F=g(document).height()/2;var G=$button.position().top;var E=G<=F;var I=$button.next().show();I.css({visibility:"visible"}).position({my:E?"left top":"left bottom",at:E?"left bottom":"left top",of:$button.parent().find(".saveAgainTo")});g(document).one("click",function(){I.hide()});return false}});var D=Backbone.View.extend({el:g(".saveAgainTo"),initialize:function(){_.bindAll(this,"render","doPreviousAction");this.render();return this},render:function(){if(this.$el.size()===0){this.$el=g(".saveAgainTo")}this.$el.button().click(this.doPreviousAction);return this},doPreviousAction:function(){return false}});var h=Backbone.Model.extend({});var p=Backbone.View.extend({el:g(".formatForPrintButton"),extraParams:"",format:"formatForPrint",idPrefix:"qoPrint",paramHelper:function(E){return""},shouldRemoveRurl:true,overlayButtonsetClass:"quickoutput-overlay-buttonset",overlayActionClass:"quickoutput-action",overlayCancelActionClass:"quickoutput-cancel-action",notEntitleCloseActionTemplate:_.template(g("#qoNotEntitleCloseActionTemplate").html()),recordSelectedTemplate:_.template(g("#qoRecordSelectedTemplate").html()),recordsSelectedTemplate:_.template(g("#qoRecordsSelectedTemplate").html()),numberOfRecordsTemplate:_.template(g("#qoNumberOfRecordsTemplate").html()),sendingTemplate:_.template(g("#qoSendingTemplate").html()),hiddenValuesTemplate:_.template(g("#qoHiddenValuesTemplate").html()),optionalEmailValidationError:g("#qoOptionalEmailValidationError").html(),requiredEmailValidationError:g("#qoRequiredEmailValidationError").html(),actionButtonsTemplate:function(){var E=this;if(E.idPrefix=="qoRefExport"){return _.template('
')}else{return _.template(' ')}},getTemplateContents:function(F,G){var H=this.idPrefix;if(G!==undefined){H=G}var E=g("#"+H+F+"Template");return E.length?E.html():null},templateFactory:function(F,E){var G=this.getTemplateContents(F);if(G!==null){return _.template(G)}if(E){G=this.getTemplateContents(F,"qo");if(G!==null){return _.template(G)}}return _.template("")},buttonTemplate:function(){return this.templateFactory("Button")},titleTemplate:function(){return this.templateFactory("Title")},contentTemplate:function(){return this.templateFactory("Content",true)},detailsTemplate:function(){return this.templateFactory("Details")},actionTemplate:function(){return this.templateFactory("Action",true)},sendingTitleTemplate:function(){return this.templateFactory("SendingTitle")},sendingMessageTemplate:function(){return this.templateFactory("SendingMessage",true)},sendingOneMessageTemplate:function(){return this.templateFactory("SendingOneMessage",true)},sentTitleTemplate:function(){return this.templateFactory("SentTitle")},sentMessageTemplate:function(){return this.templateFactory("SentMessage",true)},sentOneMessageTemplate:function(){return this.templateFactory("SentOneMessage",true)},instructionActionTemplate:function(){return this.templateFactory("InstructionAction",true)},hasIncitesEntitleTemplate:function(){return this.templateFactory("HasIncitesEntitle",true)},noIncitesEntitleTemplate:function(){return this.templateFactory("NoIncitesEntitle",true)},datasetMaxTemplate:function(){return this.templateFactory("DatasetMax",true)},cancelActionTemplate:function(){return this.templateFactory("CancelAction",true)},saveActionTemplate:function(){return this.templateFactory("SaveAction",true)},closeActionTemplate:function(){return this.templateFactory("CloseAction",true)},sentCloseActionTemplate:function(){return this.templateFactory("SentCloseAction",true)},errorTemplate:function(){return this.templateFactory("Error",true)},sentTemplate:function(){return this.templateFactory("Sent",true)},initialize:function(E){_.bindAll(this,"isRangeSelected","numberOfRecordsSelected","formInvalid","numberOfRecordsForRange","prepValidator","render","selectionParams","formatNumberWithcommas","baseUrl","downloadFile","handleError","postData","requestUrl","classText","selectCheckBox","allRecordsOnPage","doAction","doCancelAction","doDoneAction","doRefreshAction","fixMode","saveDoAgain","showOptions","showProcessing","showConfirmation","actionButtonsTemplate","invalidMarkedListOptions","numberOfProcessedRecords","postToNewWindow","rangeFieldsInMaxRecordLimit","removeRurl","saveEmailAddress","selectionsInMarkedListRecordLimit","setFilters","setModel","setRangeParameters","showError","showFormattedError","showJsonError","submitForm","uncheckSelections");if(typeof E!=="undefined"&&typeof E.model!=="undefined"){this.model=E.model}this.render();return this},render:function(){var E=this;E.$el.html(E.buttonTemplate()());E.$el.find('[type="image"]').click(E.showOptions);E.$el.show();E.$el.css({visibility:"visible"});return E},fixMode:function(L,G){var F=this;var K=g(G).find('input[name="search_mode"]').val();var J=g(G).find('input[name="colName"]').val();var I=g(L).find('input[name="mode"]').val();if(I==="quickOutputForCited"&&J==="DIIDW"){if(F.idPrefix!=="qoEmail"){g(G).find('input[name="mode"]').val("OpenQuickOutputForCited")}return}var H=g(G).find('input[name="use_two_ets"]').val();if(F.idPrefix=="qoIncites"&&H=="true"){g(G).find('input[name="mode"]').val("outputServiceForInCites");g(L).find('input[name="mode"]').val("outputServiceForInCites");return}var M=g(G).find('input[name="research_id"]').val();var E=g(G).find('input[name="admin_rid"]').val();if(F.shouldSignIn&&typeof M!=="undefined"&&typeof E!=="undefined"&&(F.idPrefix==="qoRID"||F.idPrefix==="qodistinctAuthorSet")){g(G).find('input[name="mode"]').val("outputServiceForClaimPublications");g(L).find('input[name="mode"]').val("outputServiceForClaimPublications");return}if(F.fileDownload){g(G).find('input[name="mode"]').val(K==="CitedRefList"?"CitedRefList-OpenOutputService":I==="quickOutputForUATODII"?"OpenQuickOutputForUATODII":J==="DIIDW"?"OpenQuickOutputForDII":"OpenOutputService");g(L).find('input[name="mode"]').val(K==="CitedRefList"?"CitedRefList-OpenOutputService":I==="quickOutputForUATODII"?"OpenQuickOutputForUATODII":J==="DIIDW"?"OpenQuickOutputForDII":"OpenOutputService")}else{if(F.mode){if(F.formName){g(G).find('input[name="mode"]').val((K==="CitedRefList"?"CitedRefList-":"")+F.mode)}else{g(L).find('input[name="mode"]').val((K==="CitedRefList"?"CitedRefList-":"")+F.mode)}}}if(QuickOutput.isMarkedList()&&(F.idPrefix==="qoEmail"||F.idPrefix=="qoENW"||F.idPrefix=="qoRID"||F.idPrefix=="qoRefWorks"||F.idPrefix=="qoIncites")){if(J==="DIIDW"){g(G).find('input[name="mode"]').val("quickOutputForDII");g(L).find('input[name="mode"]').val("quickOutputForDII");return}else{g(G).find('input[name="mode"]').val("outputService");g(L).find('input[name="mode"]').val("outputService");return}}},invalidMarkedListOptions:function(){var I="#output_form";var G=g(I);if(typeof G==="undefined"||G.length<1){return false}var F=G.find('input[name="value(record_select_type)"]:checked');if(typeof F==="undefined"||F.length<1){return false}var E=this;var H=F.val();switch(H){case"range":if(E.idPrefix=="qoIncites"){return false}if(!E.bothRangeFieldsHaveValue(I)){alert(getMessageById("quickOutputNullInARange"));return true}if(!E.bothRangeFieldsAreNumbers(I)){alert(getMessageById("range_specialchar_error"));return true}if(!E.bothRangeFieldsInOrder(I)){alert(getMessageById("range_notsequential_error"));return true}if(!E.bothRangeFieldsInSet(I)){alert(getMessageById("range_notinset_error"));return true}if(!E.rangeFieldsInMaxRecordLimit(I)){if(E.idPrefix=="qoFastSave"){alert(getMessageById("qo_range_morethan_fastsave_error"))}if(E.idPrefix=="qoRefExport"){alert(getMessageById("qo_range_morethan_refsave_error"))}else{alert(getMessageById("qo_range_morethan_maxrec_error"))}return true}break;case"allrecords":if(E.idPrefix=="qoIncites"||E.idPrefix=="qoFastSave"||E.idPrefix=="qoRefExport"){break}if(CURRENT_NUM_MARKED_LIST_RECORDS>QUICK_OUTPUT_MAX_RECORDS){alert(getMessageById("ml_allrecs_morethan_maxrec_output_notice"));return false}break;case"pagerecordsByValue":case"selrecord":case"selrecords":default:}},removeRurl:function(F,G){var E=this;if(E.shouldRemoveRurl){var H=g(G).find('input[name="rurl"]');E.savedRurl=H.val();H.remove()}},saveEmailAddress:function(F,G){var E=this;g.each([F,G],function(I,H){var J=g(H).find('input[name="emailAddress"]');if(J.length&&J.val().length){g(F).find('input[name="emailAddress"]').val(J.val());g(G).find('input[name="emailAddress"]').val(J.val());E.savedEmailAddress=J.val();return}})},fullRecordParams:function(E){var F=g('form[name="mark_records_form"]').find('[name="selectedIds"]').val();if(typeof F==="undefined"){F="1"}g(E).find('[name="value(record_select_type)"]').val("pagerecords");g(E).find("#mark_from").val(F);g(E).find("#mark_to").val(F);g(E).find("#filters").val(g(E).find('[name="fields_selection"]').val());return"&isickref="+F+"&excludeEventConfig=ExcludeIfFromFullRecPage"},setRangeParameters:function(M,G){var F=this;var O=g(M).find('[name="markFrom"]').val();var I=g(M).find('[name="markTo"]').val();if(typeof O==="undefined"||!O.length||typeof I==="undefined"||!I.length){O=g(G).find('[name="markFrom"]').val();I=g(G).find('[name="markTo"]').val();if(typeof O==="undefined"||!O.length||typeof I==="undefined"||!I.length){return}}var J=/^\s*(\d+)\s*$/;var E=O.match(J);var K=I.match(J);if(!E||!K||E.length<2||K.length<2){return}var H=parseInt(E[1]);var N=parseInt(K[1]);if(H>N){var L=N;N=H;H=L}g(M).find("#mark_from").val(H);g(M).find("#mark_to").val(N);g(M).find("#selectedIds").val("");g(M).find('[name="selectedIds"]').val("");if(F.model){F.model.attributes.selectedIds=""}if(G&&F.idPrefix!="qodistinctAuthorSet"){g(G).find('[name="mark_from"]').val(H);g(G).find('[name="mark_to"]').val(N);g(G).find("#selectedIds").val("");g(G).find('[name="selectedIds"]').val("")}},isRangeSelected:function(F,H){var E=g(H?H:F).find('[name="value(record_select_type)"]');if(!E.length){if(H){E=g(F).find('[name="value(record_select_type)"]')}if(!E.length){if(this.savedIsRangeSelected){return this.savedIsRangeSelected}return false}}var G=E.filter(":checked");this.savedIsRangeSelected=!(G.length<1||G.val()!=="range");return this.savedIsRangeSelected},selectCheckBox:function(I,H){var F=this;var E=F.markedListCandidates.length;var G=0;if(I){G=I-1}if(!H){H=E}while(G