jQuery.namespace=function(str,noclobber){var i,a=str.split("."),o=window,callthrough=false;if(/[^a-zA-Z.]/.test(str)){return false}for(i=0;i<a.length;i++){if(!o[a[i]]){o[a[i]]={};callthrough=true}o=o[a[i]]}if(!!noclobber){return callthrough}return true};
AJS.$.extend(AJS,{LEFT:"left",RIGHT:"right",ACTIVE_CLASS:"active",BOX_SHADOW_CLASS:"box-shadow",LOADING_CLASS:"loading",INTELLIGENT_GUESS:"Intelligent Guess",DIRTY_FORM_VALUE:"AJS_DirtyForms_cleanValue"});
(function($){$.namespace("jira.keyboard");jira.keyboard;var _keyCodeToEnum={},_enumToKeyCode={},_keyCodeToIsAscii={};var SpecialKey=jira.keyboard.SpecialKey={BACKSPACE:specialKey("backspace",8,true),TAB:specialKey("tab",9,true),RETURN:specialKey("return",13,true),SHIFT:specialKey("shift",16),CTRL:specialKey("ctrl",17),ALT:specialKey("alt",18),PAUSE:specialKey("pause",19),CAPS_LOCK:specialKey("capslock",20),ESC:specialKey("esc",27,true),SPACE:specialKey("space",32,true),PAGE_UP:specialKey("pageup",33),PAGE_DOWN:specialKey("pagedown",34),END:specialKey("end",35),HOME:specialKey("home",36),LEFT:specialKey("left",37),UP:specialKey("up",38),RIGHT:specialKey("right",39),DOWN:specialKey("down",40),INSERT:specialKey("insert",45),DELETE:specialKey("del",46),F1:specialKey("f1",112),F2:specialKey("f2",113),F3:specialKey("f3",114),F4:specialKey("f4",115),F5:specialKey("f5",116),F6:specialKey("f6",117),F7:specialKey("f7",118),F8:specialKey("f8",119),F9:specialKey("f9",120),F10:specialKey("f10",121),F11:specialKey("f11",122),F12:specialKey("f12",123),NUMLOCK:specialKey("numlock",144),SCROLL:specialKey("scroll",145),META:specialKey("meta",224)};function specialKey(name,keyCode,isAscii){_keyCodeToEnum[keyCode]=name;_enumToKeyCode[name]=keyCode;if(isAscii){_keyCodeToIsAscii[keyCode]=true}return name}SpecialKey.eventType=function(){return $.browser.mozilla?"keypress":"keydown"};SpecialKey.fromKeyCode=function(keyCode){return _keyCodeToEnum[keyCode]};SpecialKey.toKeyCode=function(specialKey){return _enumToKeyCode[specialKey]};SpecialKey.isAscii=function(keyCode){return !!_keyCodeToIsAscii[keyCode]};SpecialKey.isSpecialKey=function(keyName){return !!SpecialKey.toKeyCode(keyName)};function originalEvent(e){return e.originalEvent||e}jira.keyboard.characterEntered=function(keypressEvent){var e=originalEvent(keypressEvent);if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode!==null&&(!SpecialKey.isAscii(characterCode)||SpecialKey.fromKeyCode(characterCode)===SpecialKey.SPACE)){return String.fromCharCode(characterCode)}}};function characterCodeForKeypress(keypressEvent){var e=originalEvent(keypressEvent);if(e.which==null){return e.keyCode}else{if(e.which!=0&&e.charCode!=0){return e.which}else{return null}}}jira.keyboard.specialKeyEntered=function(e){e=originalEvent(e);if($.browser.mozilla){if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode===null){return SpecialKey.fromKeyCode(e.keyCode)}else{if(SpecialKey.isAscii(characterCode)){return SpecialKey.fromKeyCode(characterCode)}}}}else{if(e.type!=="keypress"){return SpecialKey.fromKeyCode(e.keyCode)}}};function keyEntered(e){e=originalEvent(e);var special=jira.keyboard.specialKeyEntered(e);if(special){return special}else{if($.browser.mozilla){if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode!==null){return String.fromCharCode(characterCode).toLowerCase()}}}else{if(e.type!=="keypress"){return String.fromCharCode(e.keyCode).toLowerCase()}}}}jira.keyboard.shortcutEntered=function(e){e=originalEvent(e);if(e.type===jira.keyboard.SpecialKey.eventType()){var specialKey=jira.keyboard.specialKeyEntered(e),modifiers="";if(e.altKey&&specialKey!==SpecialKey.ALT){modifiers+=modifier(SpecialKey.ALT)}if(e.ctrlKey&&specialKey!==SpecialKey.CTRL){modifiers+=modifier(SpecialKey.CTRL)}if(e.metaKey&&!e.ctrlKey&&specialKey!==SpecialKey.META){modifiers+=modifier(SpecialKey.META)}if(e.shiftKey&&specialKey!==SpecialKey.SHIFT){modifiers+=modifier(SpecialKey.SHIFT)}if(specialKey){return modifiers+specialKey}else{if(modifiers.length>0&&modifiers!=="shift+"){var key=keyEntered(e);if(key){return modifiers+key}}}}};function modifier(modifier){return modifier+"+"}})(AJS.$);
(function($){$.namespace("jira.mouse");jira.mouse;var MotionDetector=jira.mouse.MotionDetector=function(){this.reset()};MotionDetector.prototype.reset=function(){this._handler=null;this._x=null;this._y=null;this.moved=false};MotionDetector.prototype.wait=function(eventHandler){var instance=this;if(!instance._handler){this.reset();$(window.top.document).bind("mousemove",instance._handler=function(e){if(!instance._x&&!instance._y){instance._x=e.pageX;instance._y=e.pageY}else{if(!(e.pageX===instance._x&&e.pageY===instance._y)){instance.unbind();instance.moved=true;if(eventHandler){eventHandler.call(this,e)}}}})}};MotionDetector.prototype.unbind=function(){if(this._handler){$(window.top.document).unbind("mousemove",this._handler);this.reset()}}})(AJS.$);
AJS.copyObject=function(object,deep){var copiedObject={};AJS.$.each(object,function(name,property){if(typeof property!=="object"||property===null||property instanceof AJS.$){copiedObject[name]=property}else{if(deep!==false){copiedObject[name]=AJS.copyObject(property,deep)}}});return copiedObject};
AJS.implementsInterface=function(object,implementation){var valid=true;AJS.$.each(implementation,function(i,method){if(!AJS.$.isFunction(object[method])){valid=false;throw new Error("AJS.implementsInteface: Expected method ["+method+"] on object")}});return valid};
AJS.$.namespace("jira.app.fragments.issueActionsFragment");jira.app.fragments.issueActionsFragment=function(){function addIssueIdToReturnUrl(issueId){var matchSelectedIssueId=/selectedIssueId=[0-9]*/g;if(self!=top){return encodeURIComponent(window.top.location.href)}var url=window.location.href,newUrl=url;if(/selectedIssueId=[0-9]*/.test(url)){newUrl=url.replace(matchSelectedIssueId,"selectedIssueId="+issueId)}else{if(url.lastIndexOf("?")>=0){newUrl=url+"&"}else{newUrl=url+"?"}newUrl=newUrl+"selectedIssueId="+issueId}return encodeURIComponent(newUrl)}return function(json){var returnURL=addIssueIdToReturnUrl(json.id);var htmlParts=['<div class="aui-list"><ul class="aui-list-section"><li class="aui-list-item"><a href="',contextPath,"/browse/",json.key,'" class="aui-list-item-link">',htmlEscape(json.viewIssue),"</a></li></ul>"];var hasActions=json.actions&&json.actions.length>0;var hasOperations=json.operations&&json.operations.length>0;if(hasActions){htmlParts.push(hasOperations?'<ul class="aui-list-section">':'<ul class="aui-list-section aui-last">');var URL_A=contextPath+"/secure/WorkflowUIDispatcher.jspa?id="+json.id+"&amp;action=";var URL_B="&amp;atl_token="+json.atlToken+"&amp;returnUrl="+returnURL;AJS.$.each(json.actions,function(){htmlParts.push('<li class="aui-list-item"><a href="',URL_A,this.action,URL_B,'" rel="',this.action,'" class="aui-list-item-link issueaction-workflow-transition">',htmlEscape(this.name),"</a></li>")});htmlParts.push("</ul>")}if(hasOperations){htmlParts.push('<ul class="aui-list-section aui-last">');URL_A="&amp;returnUrl="+returnURL;URL_B="&amp;atl_token="+json.atlToken;AJS.$.each(json.operations,function(){htmlParts.push('<li class="aui-list-item"><a href="',this.url,URL_A,URL_B,'" class="aui-list-item-link ',this.styleClass,'">',htmlEscape(this.name),"</a></li>")});htmlParts.push("</ul>")}htmlParts.push("</div>");return AJS.$(htmlParts.join(""))}}();
(function($){$.namespace("jira.ajax");jira.ajax.SmartAjaxResult=function(xhr,requestId,statusText,data,successful,errorThrown){var status=tryIt(function(){return xhr.status},0);var result={successful:successful,status:status,statusText:statusText,errorThrown:errorThrown,readyState:xhr.readyState,hasData:data!=null&&data.length>0,data:data,xhr:xhr,aborted:xhr.aborted,requestId:requestId};result.toString=function(){return"{\n"+"successful  : "+this.successful+",\n"+"status      : "+this.status+",\n"+"statusText  : "+this.statusText+",\n"+"hasData     : "+this.hasData+",\n"+"readyState  : "+this.readyState+",\n"+"requestId   : "+this.requestId+",\n"+"aborted     : "+this.aborted+",\n"+"}"};return result};jira.ajax.SmartAjaxResult.ERROR="error";jira.ajax.SmartAjaxResult.TIMEOUT="timeout";jira.ajax.SmartAjaxResult.NOTMODIFIED="notmodified";jira.ajax.SmartAjaxResult.PARSEERROR="parseerror";jira.ajax.makeRequest=function(ajaxOptions){var _smartAjaxResult={};var log=function(calltype,requestId,msg){if(AJS.log){var id=requestId?"["+requestId+"] ":" ";AJS.log("ajax"+id+calltype+" : "+msg)}};var generateRequestId=function(){var now=new Date();var midnight=new Date(now.getFullYear(),now.getMonth(),now.getDate(),0,0,0,0);var ms=(now.getTime()-midnight.getTime());return Math.max(Math.floor(ms),1)};var errorHandler=function(xhr,statusText,errorThrown,smartAjaxResult){if(!smartAjaxResult){var data=tryIt(function(){return xhr.responseText},"");smartAjaxResult=_smartAjaxResult=new jira.ajax.SmartAjaxResult(xhr,_requestId,statusText,data,false,errorThrown)}log("error",smartAjaxResult.requestId,smartAjaxResult);if($.isFunction(ajaxOptions.error)){ajaxOptions.error(xhr,statusText,errorThrown,smartAjaxResult)}};var successHandler=function(data,statusText,xhr){if(xhr.status<100){_smartAjaxResult=new jira.ajax.SmartAjaxResult(xhr,_requestId,jira.ajax.SmartAjaxResult.ERROR,"",false);errorHandler(xhr,jira.ajax.SmartAjaxResult.ERROR,undefined,_smartAjaxResult);return}_smartAjaxResult=new jira.ajax.SmartAjaxResult(xhr,_requestId,statusText,data,true);log("success",_smartAjaxResult.requestId,_smartAjaxResult);if($.isFunction(ajaxOptions.success)){ajaxOptions.success(data,statusText,xhr,_smartAjaxResult)}};var completeHandler=function(xhr,textStatus){if($.isFunction(ajaxOptions.complete)){ajaxOptions.complete(xhr,textStatus,_smartAjaxResult)}};var ourAjaxOptions={};for(var x in ajaxOptions){ourAjaxOptions[x]=ajaxOptions[x]}ourAjaxOptions.error=errorHandler;ourAjaxOptions.success=successHandler;ourAjaxOptions.complete=completeHandler;var xhr=$.ajax(ourAjaxOptions);var _requestId=generateRequestId();try{xhr.abort=function(oldabort){return function(){log("aborted",_requestId,"");xhr.aborted=true;if($.isFunction(oldabort)){try{oldabort.call(xhr)}catch(ex){}}}}(xhr.abort)}catch(ex){}log("started",_requestId,""+ourAjaxOptions.url);return xhr};jira.ajax.buildDialogErrorContent=function(smartAjaxResult,noHeader){var fourHundredClass=Math.floor(smartAjaxResult.status/100);if(smartAjaxResult.hasData&&fourHundredClass!=4){return wrapDialogErrorContent(AJS.extractBodyFromResponse(smartAjaxResult.data))}else{var errMsg=buildRawHttpErrorMessage(smartAjaxResult);return buildDialogAjaxErrorMessage(errMsg,noHeader)}};jira.ajax.buildSimpleErrorContent=function(smartAjaxResult){return buildRawHttpErrorMessage(smartAjaxResult)};function buildRawHttpErrorMessage(smartAjaxResult){var AJS=window.top.AJS;var errMsg;if(smartAjaxResult.statusText==jira.ajax.SmartAjaxResult.TIMEOUT){errMsg=AJS.params.ajaxTimeout}else{if(smartAjaxResult.status==401){errMsg=AJS.params.ajaxUnauthorised}else{if(smartAjaxResult.hasData){errMsg=AJS.params.ajaxServerError}else{errMsg=AJS.params.ajaxCommsError}}}return errMsg}function buildDialogAjaxErrorMessage(errorMessage,noHeader){var errorContent='<div class="warningBox">'+"<p>"+errorMessage+"</p>"+"<p>"+AJS.params.ajaxErrorCloseDialog+"</p>"+"</div>";if(!noHeader){errorContent="<h1>"+AJS.params.ajaxErrorDialogHeading+"</h1>"+errorContent}return wrapDialogErrorContent(errorContent)}function wrapDialogErrorContent(content){var $container=$('<div class="ajaxerror"/>');$container.append(content);return $container}})(AJS.$);AJS.$(function(){AJS.$.ajaxSetup({timeout:60000,async:true,cache:false,global:true})});
AJS.parseUri=function(uri,strict){var unesc=window.decodeURIComponent||unescape;var esc=window.encodeURIComponent||escape;function parseUri(str){var o=parseUri.options,m=o.parser[o.strictMode?"strict":"loose"].exec(str),uri={},i=14;while(i--){uri[o.key[i]]=m[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1){uri[o.q.name][unesc($1)]=unesc($2)}});return uri}parseUri.options={strictMode:!!strict,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};uri=parseUri(uri);uri.toString=function(){var params=[];AJS.$.each(uri.queryKey,function(name,value){params.push(esc(name)+"="+esc(value))});return uri.protocol+"://"+uri.authority+uri.path+"?"+params.join("&")+"#"+uri.anchor};return uri};
jQuery.effects||(function($){$.effects={};$.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(i,attr){$.fx.step[attr]=function(fx){if(!fx.colorInit){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);fx.colorInit=true}fx.elem.style[attr]="rgb("+Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0],10),255),0)+","+Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1],10),255),0)+","+Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2],10),255),0)+")"}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3){return color}if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)){return[parseInt(result[1],10),parseInt(result[2],10),parseInt(result[3],10)]}if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)){return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55]}if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)){return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)]}if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)){return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)]}if(result=/rgba\(0, 0, 0, 0\)/.exec(color)){return colors["transparent"]}return colors[$.trim(color).toLowerCase()]}function getColor(elem,attr){var color;do{color=$.curCSS(elem,attr);if(color!=""&&color!="transparent"||$.nodeName(elem,"body")){break}attr="backgroundColor"}while(elem=elem.parentNode);return getRGB(color)}var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function getElementStyles(){var style=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,newStyle={},key,camelCase;if(style&&style.length&&style[0]&&style[style[0]]){var len=style.length;while(len--){key=style[len];if(typeof style[key]=="string"){camelCase=key.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});newStyle[camelCase]=style[key]}}}else{for(key in style){if(typeof style[key]==="string"){newStyle[key]=style[key]}}}return newStyle}function filterStyles(styles){var name,value;for(name in styles){value=styles[name];if(value==null||$.isFunction(value)||name in shorthandStyles||(/scrollbar/).test(name)||(!(/color/i).test(name)&&isNaN(parseFloat(value)))){delete styles[name]}}return styles}function styleDifference(oldStyle,newStyle){var diff={_:0},name;for(name in newStyle){if(oldStyle[name]!=newStyle[name]){diff[name]=newStyle[name]}}return diff}$.effects.animateClass=function(value,duration,easing,callback){if($.isFunction(easing)){callback=easing;easing=null}return this.each(function(){var that=$(this),originalStyleAttr=that.attr("style")||" ",originalStyle=filterStyles(getElementStyles.call(this)),newStyle,className=that.attr("className");$.each(classAnimationActions,function(i,action){if(value[action]){that[action+"Class"](value[action])}});newStyle=filterStyles(getElementStyles.call(this));that.attr("className",className);that.animate(styleDifference(originalStyle,newStyle),duration,easing,function(){$.each(classAnimationActions,function(i,action){if(value[action]){that[action+"Class"](value[action])}});if(typeof that.attr("style")=="object"){that.attr("style").cssText="";that.attr("style").cssText=originalStyleAttr}else{that.attr("style",originalStyleAttr)}if(callback){callback.apply(this,arguments)}})})};$.fn.extend({_addClass:$.fn.addClass,addClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{add:classNames},speed,easing,callback]):this._addClass(classNames)},_removeClass:$.fn.removeClass,removeClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{remove:classNames},speed,easing,callback]):this._removeClass(classNames)},_toggleClass:$.fn.toggleClass,toggleClass:function(classNames,force,speed,easing,callback){if(typeof force=="boolean"||force===undefined){if(!speed){return this._toggleClass(classNames,force)}else{return $.effects.animateClass.apply(this,[(force?{add:classNames}:{remove:classNames}),speed,easing,callback])}}else{return $.effects.animateClass.apply(this,[{toggle:classNames},force,speed,easing])}},switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.apply(this,[{add:add,remove:remove},speed,easing,callback])}});$.extend($.effects,{version:"1.8rc3",save:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null){element.data("ec.storage."+set[i],element[0].style[set[i]])}}},restore:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null){element.css(set[i],element.data("ec.storage."+set[i]))}}},setMode:function(el,mode){if(mode=="toggle"){mode=el.is(":hidden")?"show":"hide"}return mode},getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=0.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height}switch(origin[1]){case"left":x=0;break;case"center":x=0.5;break;case"right":x=1;break;default:x=origin[1]/original.width}return{x:x,y:y}},createWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent()}var props={width:element.outerWidth(true),height:element.outerHeight(true),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});element.wrap(wrapper);wrapper=element.parent();if(element.css("position")=="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0})}return wrapper.css(props).show()},removeWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent().replaceWith(element)}return element},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1]}});return value}});function _normalizeArguments(effect,options,speed,callback){if(typeof effect=="object"){callback=options;speed=null;options=effect;effect=options.effect}if($.isFunction(options)){callback=options;speed=null;options={}}if(typeof options=="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}}options=options||{};speed=speed||options.duration;speed=$.fx.off?0:typeof speed=="number"?speed:$.fx.speeds[speed]||$.fx.speeds._default;callback=callback||options.complete;return[effect,options,speed,callback]}$.fn.extend({effect:function(effect,options,speed,callback){var args=_normalizeArguments.apply(this,arguments),args2={options:args[1],duration:args[2],callback:args[3]},effectMethod=$.effects[effect];return effectMethod&&!$.fx.off?effectMethod.call(this,args2):this},_show:$.fn.show,show:function(speed){if(!speed||typeof speed=="number"||$.fx.speeds[speed]){return this._show.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="show";return this.effect.apply(this,args)}},_hide:$.fn.hide,hide:function(speed){if(!speed||typeof speed=="number"||$.fx.speeds[speed]){return this._hide.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="hide";return this.effect.apply(this,args)}},__toggle:$.fn.toggle,toggle:function(speed){if(!speed||typeof speed=="number"||$.fx.speeds[speed]||typeof speed=="boolean"||$.isFunction(speed)){return this.__toggle.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="toggle";return this.effect.apply(this,args)}},cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit]}});return val}});$.easing.jswing=$.easing.swing;$.extend($.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return -c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b}return -c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t+b}return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b}return -c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t*t+b}return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return -c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return -c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0){return b}if(t==d){return b+c}if((t/=d/2)<1){return c/2*Math.pow(2,10*(t-1))+b}return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return -c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1){return -c/2*(Math.sqrt(1-t*t)-1)+b}return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d/2)==2){return b+c}if(!p){p=d*(0.3*1.5)}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}if(t<1){return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-$.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else{if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b}else{if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b}}}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2){return $.easing.easeInBounce(x,t*2,0,c,d)*0.5+b}return $.easing.easeOutBounce(x,t*2-d,0,c,d)*0.5+c*0.5+b}})})(jQuery);
(function(){begetObject=function(obj){var f=function(){};f.prototype=obj;return new f()};var initializing=false,fnTest=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(){var prop;var _super=this.prototype;if(arguments.length>1){var interfaces=AJS.$.makeArray(arguments);prop=interfaces.pop();var completeInterface;AJS.$.each(interfaces,function(i,inter){if(completeInterface){completeInterface=completeInterface.extend(inter)}else{completeInterface=inter}});return completeInterface.extend(this.prototype).extend(prop)}else{prop=arguments[0]}initializing=true;var prototype=new this();initializing=false;for(var name in prop){if(prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])){prototype[name]=(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret}})(name,prop[name])}else{if(typeof _super[name]==="object"){var newObj=begetObject(prop[name]);AJS.$.each(_super[name],function(name,obj){if(!newObj[name]){newObj[name]=obj}else{if(typeof newObj[name]==="object"){var newSubObj=begetObject(newObj[name]);AJS.$.each(obj,function(subName,subObj){if(!newSubObj[subName]){newSubObj[subName]=subObj}});newObj[name]=newSubObj}}});prototype[name]=newObj}else{prototype[name]=prop[name]}}}function Class(){if(!initializing&&this.init){this.init.apply(this,arguments)}}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class}})();var Interface=Class.extend({});
AJS.Event=Class.extend({init:function(options){this.$target=AJS.$(options.target);this.eventOwner=options.eventOwner},getEventInterface:function(){var instance=this;return{target:function(){return instance.$target},eventOwner:function(){return instance.eventOwner}}},fire:function(){var event=new AJS.$.Event(this.EVENT_NAME);AJS.$(this.$target).trigger(event,[this.getEventInterface()]);return event.result}});AJS.ContentChangeEvent=AJS.Event.extend({EVENT_NAME:"contentChange"});
jQuery.fn.hasFixedParent=function(){var hasFixedParent=false;this.parents().each(function(){if(AJS.$(this).css("position")==="fixed"){hasFixedParent=true;return false}});return hasFixedParent};
jQuery.fn.scrollIntoView=function(options){if(this.length>0&&!this.hasFixedParent()){options=options||{};options.marginTop=options.marginTop||options.margin||0;options.marginBottom=options.marginBottom||options.margin||0;if(!this.is(":visible")&&options.callback){options.callback();return this}var $window=window.top.jQuery(window.top);var $stalker=window.top.jQuery("#stalker");var scrollTop=$window.scrollTop();var scrollHeight=$window.height();var offsetTop=Math.max(0,getPageY(this[0])-options.marginTop);var offsetHeight=options.marginTop+this.outerHeight()+options.marginBottom;var newScrollTop=scrollTop;if(newScrollTop+scrollHeight<offsetTop+offsetHeight){newScrollTop=offsetTop+offsetHeight-scrollHeight}if($stalker.length>0){offsetTop-=$stalker.outerHeight()+35}if(newScrollTop>offsetTop){newScrollTop=offsetTop}if(newScrollTop!==scrollTop){var $target=this;var $document=window.top.jQuery(window.top.document);$document.trigger("moveToStarted",$target);$document.find("body, html").stop(true).animate({scrollTop:newScrollTop},options.duration||100,"swing",function(){if(options.callback){options.callback()}$document.trigger("moveToFinished",$target);$stalker.trigger("positionChanged")})}else{if(options.callback){options.callback()}}}return this;function getPageY(element){var offsetTop=0;do{offsetTop+=element.offsetTop}while(element=element.offsetParent);return offsetTop}};
jQuery.fn.handleAccessKeys=function(options){var accessKeyAttr="accesskey";if(jQuery.browser.msie&&jQuery.browser.version=="7.0"){accessKeyAttr="accessKey"}options=options||{};this.each(function(){var $form=AJS.$(this),blackList=[],$myAccessKeyElems,$accessKeyElems;$accessKeyElems=jQuery("form").not(this).find(":input["+accessKeyAttr+"], a["+accessKeyAttr+"]");$myAccessKeyElems=jQuery(":input["+accessKeyAttr+"], a["+accessKeyAttr+"]",this);if(!$form.is("form")){console.warn("jQuery.fn.enableAccessKeys: node type ["+$form.attr("nodeName")+"] is not valid. "+"Only <form> supported");return this}if($form.data("handleAccessKeys.applied")){return}$form.data("handleAccessKeys.applied",true);$form.find(":input["+accessKeyAttr+"], a["+accessKeyAttr+"]").each(function(){var accessKey=jQuery(this).attr(accessKeyAttr);if(accessKey){blackList.push(accessKey.toLowerCase())}});$form.delegate(":input, a","focus",function(){removeAccessKeys($accessKeyElems,blackList);attachAccessKeys($myAccessKeyElems)}).delegate(":input, a","blur",function(){attachAccessKeys($accessKeyElems)})});function isInvalid(key,blackList){if(key){if(options.selective===false){return true}if(/[a-z]/i.test(key)){key=key.toLowerCase()}return jQuery.inArray(key,blackList)!==-1}}function attachAccessKeys($accessKeyElems){$accessKeyElems.each(function(){var $this=AJS.$(this);if($this.data(accessKeyAttr)){$this.attr(accessKeyAttr,$this.data(accessKeyAttr))}})}function removeAccessKeys($accessKeyElems,blackList){$accessKeyElems.each(function(){var $this=AJS.$(this);if(isInvalid($this.attr(accessKeyAttr),blackList)){$this.data(accessKeyAttr,$this.attr(accessKeyAttr));$this.removeAttr(accessKeyAttr)}})}return this};
jQuery.getDocHeight=function(){return Math.max(jQuery(document).height(),jQuery(window).height(),document.documentElement.clientHeight)};
AJS.containDropdown=function(dropdown,containerSelector,dynamic){function getDropdownOffset(){return dropdown.$.offset().top-jQuery(containerSelector).offset().top}var container,ddOffset,availableArea,shadowOffset=25;if(dropdown.$.parents(containerSelector).length!==-1){container=jQuery(containerSelector),ddOffset=getDropdownOffset(),shadowOffset=30,availableArea=container.outerHeight()-ddOffset-shadowOffset;if(availableArea<=parseInt(dropdown.$.attr("scrollHeight"),10)){AJS.containDropdown.containHeight(dropdown,availableArea)}else{if(dynamic){AJS.containDropdown.releaseContainment(dropdown)}}dropdown.reset()}};AJS.containDropdown.containHeight=function(dropdown,availableArea){dropdown.$.css({height:availableArea});if(dropdown.$.css("overflowY")!=="scroll"){dropdown.$.css({width:15+dropdown.$.attr("scrollWidth"),overflowY:"scroll",overflowX:"hidden"})}};AJS.containDropdown.releaseContainment=function(dropdown){dropdown.$.css({height:"",width:"",overflowY:"",overflowX:""})};
(function(){var eventsToListenTo="input keyup propertychange";jQuery.fn.expandOnInput=function(maxHeight){var $textareas=this.filter("textarea");$textareas.unbind(eventsToListenTo,setHeight).bind(eventsToListenTo,setHeight);if(AJS.$.browser.mozilla||AJS.$.browser.msie){$textareas.unbind("paste",triggerKeyup).bind("paste",triggerKeyup)}$textareas.unbind("refreshInputHeight").bind("refreshInputHeight",function(){setHeight.call(AJS.$(this).css("height",""))});$textareas.data("expandOnInput_maxHeight",maxHeight);$textareas.each(function(){var $this=AJS.$(this);$this.each(function(){var $this=AJS.$(this);$this.data("hasFixedParent",$this.hasFixedParent())});if(AJS.$(this).val()!==""){setHeight.call(this)}});return this};function triggerKeyup(){var $textarea=AJS.$(this),textarea=this;setTimeout(function(){$textarea.keyup();textarea.scrollTop=textarea.scrollHeight},0)}function setHeight(){var $textarea=AJS.$(this),height=parseInt($textarea.css("height"),10)||$textarea.height(),padding=$textarea.attr("clientHeight")-height;this.scrollHeight;var maxHeight=parseInt($textarea.css("maxHeight"),10)||$textarea.data("expandOnInput_maxHeight")||AJS.$(window).height()-160,newHeight=Math.max(height,this.scrollHeight-padding);if(newHeight<maxHeight){$textarea.css({"overflow":"hidden","height":newHeight+"px"})}else{var cursorPosition=this.selectionStart;$textarea.css({"overflow-y":"auto","height":maxHeight+"px"});if(AJS.$.browser.msie&&AJS.$.browser.version<=7){setTimeout(function(){$textarea.css({"zoom":"1"})},0)}$textarea.unbind(eventsToListenTo,setHeight);$textarea.unbind("paste",triggerKeyup);if(this.selectionStart!==cursorPosition){this.selectionStart=cursorPosition;this.selectionEnd=cursorPosition}newHeight=maxHeight}if(!$textarea.data("hasFixedParent")){var $window=AJS.$(window),scrollTop=$window.scrollTop(),minScrollTop=$textarea.offset().top+newHeight-$window.height()+29;if(scrollTop<minScrollTop){$window.scrollTop(minScrollTop)}}$textarea.trigger("stalkerHeightUpdated")}})();
jQuery.os={};if(navigator.platform.toLowerCase().indexOf("win")!=-1){jQuery.os.windows=true}if(navigator.platform.toLowerCase().indexOf("mac")!=-1){jQuery.os.mac=true}if(navigator.platform.toLowerCase().indexOf("linux")!=-1){jQuery.os.linux=true};
AJS.$.deactivateLinkedMenu=function(){};AJS.$.linkedMenuInstances=[];AJS.$.fn.linkedMenu=function(opts){var idx,that=this,onDisable,enabled=false,focusElement=function(elem){elem=AJS.$(elem);that.blur();elem.trigger("click","focus","mousedown")},keyHandler=function(e){var targ;if(e.keyCode===37||e.keyCode===39||e.keyCode===27){if(e.keyCode===37){targ=idx-1;if(idx-1>=0){if(isNotActive(that[targ])){idx=targ;focusElement(that[idx])}}else{targ=that.length-1;if(isNotActive(that[targ])){idx=targ;focusElement(that[idx])}}}else{if(e.keyCode===39){targ=idx+1;if(targ<that.length){if(isNotActive(that[targ])){idx=targ;focusElement(that[idx])}}else{targ=0;if(isNotActive(that[targ])){idx=targ;focusElement(that[idx])}}}else{that.disableLinkedMenu(e)}}e.preventDefault()}},isNotActive=function(elem){if(elem!==that[idx]){return true}},focusBridge=function(){if(isNotActive(this)){idx=AJS.$.inArray(this,that);focusElement(this)}},reflectionBridge=function(){var targ=AJS.$.inArray(this,AJS.$(opts.reflectFocus));if(isNotActive(that[targ])){idx=targ;focusElement(that[idx])}},enable=function(){var elem,clss;if(!enabled){AJS.$.currentLinkedMenu=that;if(opts.onFocusRemoveClass){elem=AJS.$(opts.onFocusRemoveClass);clss=opts.onFocusRemoveClass.match(/\.([a-z]*)$/);if(clss&&clss[1]&&elem.length>0){AJS.$(opts.onFocusRemoveClass).removeClass(clss[1]);onDisable=function(){AJS.$(elem).addClass(clss[1])}}}enabled=true;idx=AJS.$.inArray(this,that);that.mouseover(focusBridge);if(AJS.$.browser.mozilla){AJS.$(document).keypress(keyHandler)}else{AJS.$(document).keydown(keyHandler)}AJS.$(document).mousedown(that.disableLinkedMenu);if(opts.reflectFocus){AJS.$(opts.reflectFocus).mouseover(reflectionBridge)}}};that.disableLinkedMenu=function(e){AJS.$(document).unbind("keypress",keyHandler);AJS.$(document).unbind("keydown",keyHandler);that.unbind("mouseover",focusBridge);AJS.$(document).unbind("mousedown",arguments.callee);if(opts.reflectFocus){AJS.$(opts.reflectFocus).unbind("mouseover",reflectionBridge)}if(onDisable){onDisable()}that.blur();delete AJS.$.currentLinkedMenu;window.setTimeout(function(){enabled=false},200)};opts=opts||{};that.click(enable);return that};
if(!this.JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c}return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(typeof value.length==="number"&&!value.propertyIsEnumerable("length")){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();
(function(){var $doc=jQuery(document);function getWindow(){if(window.top){return window.top}else{return window}}function getLayer(instance){return instance.$layer||instance.$popup||instance.$||instance.popup}function listenForLayerEvents($doc){$doc.bind("showLayer",function(e,type,item){if(item&&item.id&&item.id.indexOf("user-hover-dialog")>=0){return}var topWindow=getWindow().AJS;if(topWindow.currentLayerItem&&item!==topWindow.currentLayerItem&&topWindow.currentLayerItem.type!=="popup"){topWindow.currentLayerItem.hide()}if(item){topWindow.currentLayerItem=item;topWindow.currentLayerItem.type=type}}).bind("hideLayer",function(e,type,item){if(!item||item.id&&item.id.indexOf("user-hover-dialog")>=0){return}var topWindow=getWindow().AJS;if(topWindow.currentLayerItem){if(topWindow.currentLayerItem===item){topWindow.currentLayerItem=null}else{if(jQuery.contains(getLayer(item),getLayer(topWindow.currentLayerItem))){topWindow.currentLayerItem.hide()}}}}).bind("hideAllLayers",function(){var topWindow=getWindow().AJS;if(topWindow.currentLayerItem){topWindow.currentLayerItem.hide()}}).click(function(e){var topWindow=getWindow().AJS;if(topWindow.currentLayerItem&&topWindow.currentLayerItem.type!=="popup"){if(topWindow.currentLayerItem._validateClickToClose){if(topWindow.currentLayerItem._validateClickToClose(e)){topWindow.currentLayerItem.hide()}}else{topWindow.currentLayerItem.hide()}}})}$doc.bind("iframeAppended",function(e,iframe){iframe=jQuery(iframe);iframe.load(function(){listenForLayerEvents(iframe.contents())})});listenForLayerEvents($doc)})();
(function(){AJS.parseOptionsFromFieldset=function($fieldset){var parsedValues=parseFieldset($fieldset,$fieldset);$fieldset.remove();return parsedValues};function parseFieldset($fieldset,$parentFieldset){var ret={};$fieldset.children().each(function(){var itemValue,$item=jQuery(this);if($item.is("input[type=hidden]")){itemValue=parseValue($item);ret[itemValue.id]=itemValue.value}else{if($item.is("fieldset")){ret[$item.attr("title")||$item.attr("id")]=parseFieldset($item,$parentFieldset)}else{$item.insertBefore($parentFieldset)}}});return ret}function parseValue($item){var itemValue={},value=$item.val();itemValue.id=$item.attr("title")||$item.attr("id");itemValue.value=(value.match(/^(tru|fals)e$/i)?value.toLowerCase()=="true":value);return itemValue}})();
jQuery.fn.getOptionsFromAttributes=function(){var options={};if(this.length){jQuery.each(this[0].attributes,function(){var map,nodeValue=this.nodeValue,target=options;if(/^data-/.test(this.nodeName)){map=this.nodeName.replace(/^data-/,"").split("."),AJS.$.each(map,function(i,propertyName){propertyName=propertyName.replace(/([a-z])-([a-z])/gi,function(entireMatch,firstMatch,secondMatch){return firstMatch+secondMatch.toUpperCase()});propertyName=propertyName.replace(/_([a-z]+)/gi,function(entireMatch,firstMatch){return firstMatch.toUpperCase()});if(i===map.length-1){target[propertyName]=nodeValue.match(/^(tru|fals)e$/i)?nodeValue.toLowerCase()=="true":nodeValue}else{if(!target[propertyName]){target[propertyName]={}}}target=target[propertyName]})}})}return options};
AJS.Control=Class.extend({INVALID:"INVALID",_throwReadOnlyError:function(property){new Error(this.CLASS_SIGNATURE+": Sorry ["+property+"] is a read-only property")},_assignEvents:function(group,target){var key,handlers;var instance=this;this._activeEvents=this._activeEvents||{};if(typeof target==="string"){key=group+"/"+target;if(this._activeEvents[key]){return}handlers=this._activeEvents[key]={};AJS.$.each(this._events[group],function(eventType,handler){handlers[eventType]=function(event){handler.call(instance,event,AJS.$(this))};AJS.$(document).delegate(target,eventType,handlers[eventType])})}else{target=AJS.$(target);if(target.length===0){return}if(this._activeEvents[group+"/"+target[0][AJS.$.expando]]){return}handlers={};AJS.$.each(this._events[group],function(eventType,handler){handlers[eventType]=function(event){handler.call(instance,event,AJS.$(this))};target.bind(eventType,handlers[eventType])});key=group+"/"+(target[0]===window?"window":target[0][AJS.$.expando]);this._activeEvents[key]=handlers}},_unassignEvents:function(group,target){var key,handlers,eventType;this._activeEvents=this._activeEvents||{};if(typeof target==="string"){key=group+"/"+target;handlers=this._activeEvents[key];if(!handlers){return}for(eventType in handlers){AJS.$(document).undelegate(target,eventType,handlers[eventType])}}else{target=AJS.$(target);if(target.length===0){return}key=group+"/"+target[0][AJS.$.expando];handlers=this._activeEvents[key];if(!handlers){return}try{for(eventType in handlers){target.unbind(eventType,handlers[eventType])}}catch(error){var events=AJS.$.data(target[0],"events");if(events){for(eventType in handlers){var $handlers=events[eventType];if(!$handlers){continue}var i=$handlers.length;while(i--){if($handlers[i].handler===handlers[eventType]){$handlers.splice(i,1);if($handlers.length===0){delete events[eventType]}break}}}}}}delete this._activeEvents[key]},_isValidInput:function(){return true},_handleKeyEvent:function(e){var instance=this;if(instance._isValidInput(e)){var SpecialKey=jira.keyboard.SpecialKey,shortcut=jira.keyboard.shortcutEntered(e);if(shortcut){if(instance.keys[shortcut]){instance.keys[shortcut].call(instance,e);return}else{if((shortcut===SpecialKey.BACKSPACE||shortcut===SpecialKey.DELETE)&&instance.keys.onEdit){instance.keys.onEdit.call(instance,e);return}}}var character=jira.keyboard.characterEntered(e);if(character&&instance.keys.onEdit){instance.keys.onEdit.call(instance,e,character)}}},getCustomEventName:function(methodName){return(this.CLASS_SIGNATURE||"")+"_"+methodName},_getCustomEventArgs:function(){return[this]},trigger:function(event){event=new jQuery.Event(event);AJS.$(this).trigger(event);return !event.isDefaultPrevented()},_supportsBoxShadow:function(){var s=document.body.style;return s.WebkitBoxShadow!==undefined||s.MozBoxShadow!==undefined||s.boxShadow!==undefined},_setOptions:function(options){var element,optionsFromDOM;options=options||{};if(options instanceof AJS.$||typeof options==="string"){options={element:options}}element=AJS.$(options.element);optionsFromDOM=element.getOptionsFromAttributes();this.options=AJS.$.extend(true,this._getDefaultOptions(options),optionsFromDOM,options);if(element.length===0){return this.INVALID}},getCaret:function(node){var startIndex=node.selectionStart;if(startIndex>=0){return(node.selectionEnd>startIndex)?-1:startIndex}if(document.selection){var textRange1=document.selection.createRange();if(textRange1.text.length===0){var textRange2=textRange1.duplicate();textRange2.moveToElementText(node);textRange2.setEndPoint("EndToStart",textRange1);return textRange2.text.length}}return -1},_render:function(){var i,name=arguments[0],args=[];for(i=1;i<arguments.length;i++){args.push(arguments[i])}return this._renders[name].apply(this,args)}});
AJS.Descriptor=Class.extend({init:function(properties){if(this._validate(properties)){this.properties=AJS.$.extend(this._getDefaultOptions(),properties)}},allProperties:function(){return this.properties},_validate:function(properties){if(this.REQUIRED_PROPERTIES){AJS.$.each(this.REQUIRED_PROPERTIES,function(name){if(typeof properties[name]==="undefined"){throw new Error("AJS.Descriptor: expected property ["+name+"] but was undefined")}})}return true}});
AJS.GroupDescriptor=AJS.Descriptor.extend({_getDefaultOptions:function(){return{showLabel:true,label:"",items:[]}},styleClass:function(){return this.properties.styleClass},weight:function(){return this.properties.weight},label:function(){return this.properties.label},showLabel:function(){return this.properties.showLabel},items:function(){return this.properties.items},addItem:function(item){this.properties.items.push(item)},setModel:function($model){this.properties.model=$model},replace:function(){return this.properties.replace},description:function(){return this.properties.description},model:function($model){if($model){this.properties.model=$model}else{return this.properties.model}}});
AJS.ItemDescriptor=AJS.Descriptor.extend({REQUIRED_PROPERTIES:{label:true},_getDefaultOptions:function(){return{showLabel:true}},styleClass:function(){return this.properties.styleClass},value:function(){return this.properties.value},labelSuffix:function(){return this.properties.labelSuffix},title:function(){return this.properties.title},label:function(){return this.properties.label},allowDuplicate:function(){return this.properties.allowDuplicate},removeOnUnSelect:function(){return this.properties.removeOnUnSelect},icon:function(){return this.properties.icon},selected:function(value){if(typeof value!=="undefined"){this.properties.selected=value}else{return this.properties.selected}},model:function($model){if($model){this.properties.model=$model}else{return this.model}},href:function(){return this.properties.href},html:function(){return this.properties.html}});
AJS.SelectionScheme=AJS.Control.extend({init:function(eventDelegator){this.$eventDelegator=AJS.$(eventDelegator)},enable:function(){this.enabled=true;if(this.enabledCallback){this.enabledCallback(this)}},disable:function(){this.enabled=false;if(this.disabledCallback){this.disabledCallback(this)}},setEnabledCallback:function(callback){this.enabledCallback=callback},setDisabledCallback:function(callback){this.disabledCallback=callback},listen:function(){this._assignEvents("delegator",this.$eventDelegator)},stopListening:function(){this._unassignEvents("delegator",this.$eventDelegator)},_resolveKey:function(specialKey){var key;AJS.$.each(this.triggerKeys,function(_,triggerSpecialKey){if(specialKey===triggerSpecialKey){key=triggerSpecialKey;return false}});return key},_handleKeyCode:function(keyCode,e){var instance=this;if(this._resolveKey(jira.keyboard.specialKeyEntered(e))){this.enable();this.$eventDelegator.bind("keyup",function(keyupEvent){if(keyCode===keyupEvent.which&&!keyupEvent.ctrlKey){instance.disable();AJS.$(this).unbind("keyup",arguments.callee)}})}},_events:{delegator:{keydown:function(e){this._handleKeyCode(e.which,e)},keypress:function(e){this._handleKeyCode(e.which,e)}}}});AJS.SelectiveSelectionScheme=AJS.SelectionScheme.extend({triggerKeys:[jira.keyboard.SpecialKey.CTRL,jira.keyboard.SpecialKey.ALT,jira.keyboard.SpecialKey.META]});AJS.RangeSelectionScheme=AJS.SelectionScheme.extend({triggerKeys:[jira.keyboard.SpecialKey.SHIFT]});
AJS.SelectionManager=AJS.Control.extend({init:function(eventDelegator){var instance=this;this.schemes=[];AJS.$.each(this.schemesClasses,function(i,schemeClass){var scheme=new schemeClass(eventDelegator);scheme.setEnabledCallback(function(){instance.setActiveScheme.apply(instance,arguments)});scheme.setDisabledCallback(function(){instance.setNoScheme.apply(instance,arguments)});instance.schemes.push(scheme)})},getActiveScheme:function(){return this.activeScheme},setActiveScheme:function(scheme){this.trigger(this.getCustomEventName("setActiveScheme"));this.activeScheme=scheme},setNoScheme:function(){this.trigger(this.getCustomEventName("setNoScheme"));this.activeScheme=null},enable:function(){AJS.$.each(this.schemes,function(){this.listen()})},disable:function(){AJS.$.each(this.schemes,function(){this.stopListening()})},schemesClasses:[AJS.SelectiveSelectionScheme,AJS.RangeSelectionScheme]});
AJS.Group=AJS.Control.extend({init:function(){this.items=[];this.index=-1;this._assignEvents("instance",this)},addItem:function(item){this.items.push(item);this._assignEvents("item",item)},removeItem:function(item){var index=AJS.$.inArray(item,this.items);if(index<0){throw new Error("AJS.Group: item ["+item+"] is not a member of this group")}item.trigger("blur");if(index<this.index){this.index--}this.items.splice(index,1);this._unassignEvents("item",item)},removeAllItems:function(){for(var i=0;i<this.items.length;i++){this._unassignEvents("item",this.items[i]);this.items[i].trigger("blur")}this.index=-1;this.items.length=0;this._unassignEvents("keys",document)},shiftFocus:function(offset){if(this.items.length>0){var i=(Math.max(0,this.index)+this.items.length+offset)%this.items.length;this.items[i].trigger("focus")}},_events:{"instance":{"focus":function(){if(this.items.length===0){return}if(this.index<0){this.items[0].trigger("focus")}else{this._assignEvents("keys",document)}},"blur":function(){if(this.index>=0){this.items[this.index].trigger("blur")}else{this._unassignEvents("keys",document)}}},"keys":{"keydown keypress":function(event){this._handleKeyEvent(event)}},"item":{"focus":function(event){var index=this.index;this.index=AJS.$.inArray(event.target,this.items);if(index<0){this.trigger("focus")}else{if(index!==this.index){this.items[index].trigger("blur")}}},"blur":function(event){if(this.index===AJS.$.inArray(event.target,this.items)){this.index=-1;this.trigger("blur")}},"remove":function(event){this.removeItem(event.target)}}},keys:{}});
AJS.ListItemGroup=AJS.Group.extend({keys:{"up":function(event){this.shiftFocus(-1);event.preventDefault()},"down":function(event){this.shiftFocus(1);event.preventDefault()},"return":function(event){this.items[this.index].trigger("accept");event.preventDefault()}}});
AJS.LozengeGroup=AJS.Group.extend({keys:{"left":function(){if(this.index>0){this.shiftFocus(-1)}},"right":function(){if(this.index===this.items.length-1){this.items[this.index].trigger("blur")}else{this.shiftFocus(1)}},"backspace":function(){var index=this.index;if(index>0){this.shiftFocus(-1)}else{if(this.items.length>1){this.shiftFocus(1)}}this.items[index].trigger("remove")},"del":function(){var index=this.index;if(index+1<this.items.length){this.shiftFocus(1)}this.items[index].trigger("remove")}}});
AJS.Lozenge=AJS.Control.extend({init:function(options){this._setOptions(options);this.$lozenge=this._render("lozenge");this.$removeButton=this._render("removeButton");this._assignEvents("instance",this);this._assignEvents("lozenge",this.$lozenge);this._assignEvents("removeButton",this.$removeButton);this.$removeButton.appendTo(this.$lozenge);this.$lozenge.appendTo(this.options.container)},_getDefaultOptions:function(){return{label:null,title:null,container:null,focusClass:"focused"}},_renders:{"lozenge":function(){var label=AJS.escapeHTML(this.options.label);var title=AJS.escapeHTML(this.options.title)||"";return AJS.$('<li class="item-row" title="'+title+'"><button type="button" tabindex="-1" class="value-item"><span><span class="value-text">'+label+"</span></span></button></li>")},"removeButton":function(){return AJS.$('<em class="item-delete" title="'+AJS.escapeHTML(AJS.params.removeItem)+'"></em>')}},_events:{"instance":{"focus":function(){this.$lozenge.addClass(this.options.focusClass)},"blur":function(){this.$lozenge.removeClass(this.options.focusClass)},"remove":function(){this.$lozenge.remove()}},"lozenge":{"click":function(){this.trigger("focus")}},"removeButton":{"click":function(){this.trigger("remove")}}}});
AJS.ListItem=AJS.Control.extend({init:function(options){this._setOptions(options);this.$element=AJS.$(this.options.element);this.hasFocus=false;this._assignEvents("instance",this);this._assignEvents("element",this.$element)},_getDefaultOptions:function(){return{element:null,focusClass:AJS.ACTIVE_CLASS}},_events:{"instance":{"focus":function(event){this.hasFocus=true;this.$element.addClass(this.options.focusClass);if(!event.noscrolling){AJS.ListItem.MOTION_DETECTOR.unbind();this.$element.scrollIntoView(AJS.ListItem.SCROLL_INTO_VIEW_OPTIONS)}},"blur":function(){this.hasFocus=false;this.$element.removeClass(this.options.focusClass)},"accept":function(){var event=new jQuery.Event("click");var $target=this.$element.is("a[href]")?this.$element:this.$element.find("a[href]");$target.trigger(event);if(!event.isDefaultPrevented()){window.top.location=$target.attr("href")}}},"element":{"mousemove":function(){if(AJS.ListItem.MOTION_DETECTOR.moved&&!this.hasFocus){this.trigger({type:"focus",noscrolling:true})}}}}});AJS.ListItem.MOTION_DETECTOR=new jira.mouse.MotionDetector();AJS.ListItem.SCROLL_INTO_VIEW_OPTIONS={duration:100,callback:function(){AJS.ListItem.MOTION_DETECTOR.wait()}};
AJS.InlineLayer=AJS.Control.extend({CLASS_SIGNATURE:"AJS_InlineLayer",SCROLL_HIDE_EVENT:"scroll.hide-dropdown",init:function(options){var instance=this;if(!(options instanceof AJS.InlineLayer.Descriptor)){this.options=new AJS.InlineLayer.Descriptor(options)}else{this.options=options}this.offsetTarget(this.options.offsetTarget());this.contentRetriever=this.options.contentRetriever();this.positionController=this.options.positioningController();if(!(this.contentRetriever instanceof AJS.ContentRetrieverInterface)){throw new Error("AJS.InlineLayer: Failed construction, Content retriever does not implement interface "+"[AJS.ContentRetrieverInterface]")}this.contentRetriever.startingRequest(function(){instance._showLoading()});this.contentRetriever.finishedRequest(function(){instance._hideLoading()});this.$layer=this._render("layer",this.options.alignment())},content:function(arg){var instance=this;if(AJS.$.isFunction(arg)){if(this.contentRetriever.isLocked()){throw new Error(this.CLASS_SIGNATURE+".content() : Illegal operation, trying to access content while it is "+"locked. If you are seeing this error it is most likely because we are waiting for an request to "+"come back from the server that builds content")}this.contentRetriever.content(function(content){instance.$content=content;arg.call(instance)})}else{return this.$content}},offsetTarget:function(offsetTarget){if(offsetTarget){this.$offsetTarget=AJS.$(offsetTarget)}else{return this.$offsetTarget}},contentChange:function(callback){var event,instance=this;if(AJS.$.isFunction(callback)){if(!this.contentChangeCallback){this.contentChangeCallback=[]}this.contentChangeCallback.push(callback)}else{if(!callback&&this.contentChangeCallback){AJS.$.each(this.contentChangeCallback,function(i,callback){callback(instance)});event=new AJS.ContentChangeEvent({target:this.layer(),eventOwner:AJS.InlineLayer});event.fire()}}},onhide:function(callback){var instance=this;if(AJS.$.isFunction(callback)){if(!this.hideCallback){this.hideCallback=[]}this.hideCallback.push(callback)}else{if(!callback&&this.hideCallback){AJS.$.each(this.hideCallback,function(i,callback){callback(instance)})}}},layer:function(layer){if(layer){this.$layer=layer}else{return this.$layer}},placeholder:function(placeholder){if(placeholder){this._throwReadOnlyError("placeholder")}else{return this.$placeholder}},isVisible:function(visible){if(typeof visible!=="undefined"){this._throwReadOnlyError("visible")}else{return this.visible}},scrollableContainer:function(scrollableContainer){if(scrollableContainer){this._throwReadOnlyError("scrollableContainer")}else{return this.$scrollableContainer}},isInitialized:function(initialised){if(initialised){this._throwReadOnlyError("initialized")}else{return this.initialized}},hide:function(){if(!this.isVisible()){return false}this.visible=false;this.layer().removeClass(AJS.ACTIVE_CLASS).hide();var positionController=this.positionController;setTimeout(function(){positionController.appendToPlaceholder()},0);this._unbindEvents();this.onhide();AJS.$(document).trigger("hideLayer",[this.CLASS_SIGNATURE,this]);AJS.InlineLayer.current=null},refreshContent:function(callback){var instance=this;this.content(function(){this.layer().empty().append(this.content());if(AJS.$.isFunction(callback)){callback.call(instance)}this.contentChange()})},show:function(){var instance=this;if(this.isVisible()){return}if(!this.isInitialized()){this._lazyInit(function(){instance._show()})}else{if(this.contentRetriever.cache()===false){this.refreshContent(function(){instance._show()})}else{instance._show()}}},setPosition:function(){var offset,scrollTop,maxHeight,newOffsetTop;if(!this.isInitialized()||!this.offsetTarget()||this.offsetTarget().length===0){return}offset=this.positionController.offset();newOffsetTop=offset.top+this.offsetTarget().outerHeight();if(AJS.dim.dim){scrollTop=Math.max(document.body.scrollTop,document.documentElement.scrollTop);maxHeight=AJS.$(window).height()+scrollTop-newOffsetTop-this.options.cushion()}this.layer().css({top:newOffsetTop,maxHeight:maxHeight||""});if(this.options.alignment()===AJS.RIGHT){this._positionRight(offset)}else{if(this.options.alignment()===AJS.LEFT){this._positionLeft(offset)}else{if(this.options.alignment()===AJS.INTELLIGENT_GUESS){if((offset.left+this.layer().outerWidth()/2)>AJS.$(window).width()/2){this._positionRight(offset)}else{this._positionLeft(offset)}}}}},setWidth:function(width,showhorizontalScroll){var contentScrollWidth=this.content().attr("scrollWidth");if(!(this.content().hasClass("error")||this.content().hasClass("warn"))){this.content().css({whiteSpace:"nowrap",overflowX:"",width:"auto"})}if(contentScrollWidth<=width){this.layer().css({width:width,whiteSpace:""})}else{if(showhorizontalScroll){this.layer().css({width:width,overflowX:"auto",whiteSpace:""})}else{this.layer().css({width:width,overflowX:"hidden",whiteSpace:""})}}},_offset:function(){var iframeOffset,offsetInDocument=this.offsetTarget().offset();if(window.top){iframeOffset=AJS.$("iframe[name="+window.name+"]",window.top.document).offset();return{left:iframeOffset.left+10+offsetInDocument.left,top:iframeOffset.top+offsetInDocument.top}}else{return offsetInDocument}},_lazyInit:function(callback){this.initialized=true;this.refreshContent(function(){var instance=this;this.layer().insertAfter(this.offsetTarget());if(this._supportsBoxShadow()){this.layer().addClass(AJS.BOX_SHADOW_CLASS)}this.$placeholder=AJS.$("<div class='ajs-layer-placeholder' />").insertAfter(this.offsetTarget());this.$scrollableContainer=this.offsetTarget().closest(this.options.hideOnScroll());this.positionController.set(this.layer(),this.offsetTarget(),this.placeholder());this.positionController.rebuilt(function(layer){instance.layer(layer)});callback()})},_show:function(){if(AJS.InlineLayer.current){AJS.InlineLayer.current.hide()}this.visible=true;this.content().show();this.positionController.appendToBody();this.layer().addClass(AJS.ACTIVE_CLASS);this.layer().show();this.setWidth(this.options.width());this.setPosition();this._bindEvents();if(!AJS.dim.dim){this.positionController.scrollTo()}AJS.InlineLayer.current=this;AJS.$(document).trigger("showLayer",[this.CLASS_SIGNATURE,this])},_positionLeft:function(offset){var newLeft=offset.left;this.currentPositioning=AJS.LEFT;this.layer().css({left:newLeft})},_positionRight:function(offset){var newLeft=offset.left-this.layer().outerWidth()+this.offsetTarget().outerWidth();this.currentPositioning=AJS.RIGHT;this.layer().css({left:newLeft})},_hideLoading:function(){this.$layer.removeClass(AJS.LOADING_CLASS);this.$offsetTarget.removeClass(AJS.LOADING_CLASS)},_showLoading:function(){this.$layer.addClass(AJS.LOADING_CLASS);this.$offsetTarget.addClass(AJS.LOADING_CLASS)},_unbindEvents:function(){this.$scrollableContainer.unbind(this.SCROLL_HIDE_EVENT);this._unassignEvents("container",document);this._unassignEvents("win",window)},_bindEvents:function(){var instance=this;this.$scrollableContainer.one(this.SCROLL_HIDE_EVENT,function(){instance.hide()});this._assignEvents("container",document);this._assignEvents("win",window)},_validateClickToClose:function(e){if(e.target===this.offsetTarget()[0]){return false}else{if(e.target===this.layer()[0]){return false}else{if(this.offsetTarget().has(e.target).length>0){return false}else{if(this.layer().has(e.target).length>0){return false}}}}return true},_events:{container:{keydown:function(e){if(jira.keyboard.specialKeyEntered(e)===jira.keyboard.SpecialKey.ESC){this.hide()}},keypress:function(e){if(jira.keyboard.specialKeyEntered(e)===jira.keyboard.SpecialKey.ESC){this.hide()}},click:function(e){if(this._validateClickToClose(e)){this.hide()}}},win:{resize:function(){this.setPosition()},scroll:function(){this.setPosition()}}},_renders:{layer:function(){return AJS.$("<div />").addClass("ajs-layer")}}});
AJS.InlineLayer.Descriptor=AJS.Descriptor.extend({init:function(properties){this._super(properties);if(!this.contentRetriever()){if(this.ajaxOptions()){this.contentRetriever(new AJS.AjaxContentRetriever(this.ajaxOptions()))}else{if(this.content()){this.contentRetriever(new AJS.DOMContentRetriever(this.content()))}else{throw new Error("AJS.InlineLayer.Descriptor: Expected either [ajaxOptions] or [contentRetriever] or [content] to be defined")}}}if(this._inIFrame()&&(AJS.$.browser.safari||(AJS.$.browser.msie&&AJS.$.browser.version<8))){this.positioningController(new AJS.InlineLayer.IframePositioningWithoutAdoptNode())}else{if(this._inIFrame()){this.positioningController(new AJS.InlineLayer.IframePositioning())}else{this.positioningController(new AJS.InlineLayer.StandardPositioning())}}if(AJS.$.browser.msie&&this.positioningController().isOffsetIncludingScroll){this.positioningController().isOffsetIncludingScroll(false)}if(!this.offsetTarget()&&this.content()){this.offsetTarget(this.content().prev())}},_inIFrame:function(){return window.top!==self&&window.top&&window.top.jQuery},_getDefaultOptions:function(){return{alignment:AJS.INTELLIGENT_GUESS,hideOnScroll:".content-body",cushion:20,width:200}},positioningController:function(positioningController){if(positioningController){this.properties.positioningController=positioningController}else{return this.properties.positioningController}},ajaxOptions:function(ajaxOptions){if(ajaxOptions){this.properties.ajaxOptions=ajaxOptions}else{return this.properties.ajaxOptions}},content:function(content){if(content){content=AJS.$(content);if(content.length){this.properties.content=content}}else{if(this.properties.content&&this.properties.content.length){return this.properties.content}}},contentRetriever:function(contentRetriever){if(contentRetriever){this.properties.contentRetriever=contentRetriever}else{return this.properties.contentRetriever}},offsetTarget:function(offsetTarget){if(offsetTarget){offsetTarget=AJS.$(offsetTarget);if(offsetTarget.length){this.properties.offsetTarget=offsetTarget}}else{if(this.properties.offsetTarget&&this.properties.offsetTarget.length){return this.properties.offsetTarget}}},cushion:function(cushion){if(cushion){this.properties.cushion=cushion}else{return this.properties.cushion}},hideOnScroll:function(hideOnScroll){if(hideOnScroll){this.properties.hideOnScroll=hideOnScroll}else{return this.properties.hideOnScroll}},alignment:function(alignment){if(alignment){this.properties.alignment=alignment}else{return this.properties.alignment}},width:function(width){if(width){this.properties.width=width}else{return this.properties.width}}});
AJS.InlineLayer.create=function(options){var inlineLayers=[];if(options.content){options.content=AJS.$(options.content);AJS.$.each(options.content,function(){var instanceOptions=AJS.copyObject(options);instanceOptions.content=AJS.$(this);inlineLayers.push(new AJS.InlineLayer(instanceOptions))})}if(inlineLayers.length==1){return inlineLayers[0]}else{return inlineLayers}};
AJS.InlineLayer.StandardPositioning=Class.extend({set:function($layer,$offsetTarget,$placeholder){this.$layer=$layer;this.$offsetTarget=$offsetTarget;this.$placeholder=$placeholder;this.rebuiltCallbacks=[]},window:function(){return window},offset:function(){var offset=this.$offsetTarget.offset();if(this.$offsetTarget.hasFixedParent()){this.$layer.css("position","fixed");offset.top=offset.top-AJS.$(window).scrollTop()}else{this.$layer.css("position","absolute")}return offset},rebuilt:function(arg){var instance=this;if(AJS.$.isFunction(arg)){this.rebuiltCallbacks.push(arg)}else{AJS.$.each(this.rebuiltCallbacks,function(){this(instance.$layer)})}},appendToBody:function(){this.$layer.appendTo("body")},appendToPlaceholder:function(){this.$layer.appendTo(this.$placeholder)},scrollTo:function(){}});
AJS.InlineLayer.IframePositioning=AJS.InlineLayer.StandardPositioning.extend({offset:function(){var offsetInDocument=this._super(),iframeOffset=AJS.$("iframe[name="+window.name+"]",window.top.document.body).parent().offset(),topDocumentScrollTop=this._topDocumentScrollTop(),topDocumentScrollLeft=this._topDocumentScrollLeft(),iframeScrollTop=this._iframeScrollTop(),iframeScrollLeft=this._iframeScrollLeft(),scrollTopModifier=topDocumentScrollTop-iframeScrollTop,scrollLeftModifier=topDocumentScrollLeft-iframeScrollLeft;return{left:iframeOffset.left+offsetInDocument.left+scrollLeftModifier,top:iframeOffset.top+offsetInDocument.top+scrollTopModifier}},_topDocumentScrollTop:function(){return this.isOffsetIncludingScroll()?0:Math.max(window.top.document.body.scrollTop,window.top.document.documentElement.scrollTop)},_topDocumentScrollLeft:function(){return this.isOffsetIncludingScroll()?0:Math.max(window.top.document.body.scrollLeft,window.top.document.documentElement.scrollLeft)},_iframeScrollTop:function(){return this.isOffsetIncludingScroll()?2*Math.max(window.document.body.scrollTop,window.document.documentElement.scrollTop):0},_iframeScrollLeft:function(){return this.isOffsetIncludingScroll()?2*Math.max(window.document.body.scrollLeft,window.document.documentElement.scrollLeft):0},isOffsetIncludingScroll:function(offsetIncludingScroll){if(typeof this.offsetIncludingScroll==="undefined"){this.offsetIncludingScroll=true}if(typeof offsetIncludingScroll!=="undefined"){this.offsetIncludingScroll=offsetIncludingScroll}return this.offsetIncludingScroll},appendToBody:function(){window.top.jQuery("body").append(this.$layer)},window:function(){return window.top},scrollTo:function(){}});
AJS.InlineLayer.IframePositioningWithoutAdoptNode=AJS.InlineLayer.IframePositioning.extend({appendToBody:function(){this.$layer=this._rebuildLayerInParent();window.top.jQuery("body").append(this.$layer);this.rebuilt()},appendToPlaceholder:function(){this.$layer=this._rebuildLayerInIframe();this.$layer.appendTo(this.$placeholder);this.rebuilt()},_rebuildLayerInParent:function(){return window.top.jQuery("<div class='ajs-layer'>"+this.$layer.html()+"</div>")},_rebuildLayerInIframe:function(){return AJS.$("<div class='ajs-layer'>"+this.$layer.html()+"</div>")}});
AJS.DropDown=AJS.Control.extend({CLASS_SIGNATURE:"AJS_DROPDOWN",init:function(options){var instance=this;if(!(options instanceof AJS.DropDown.Descriptor)){this.options=new AJS.DropDown.Descriptor(options)}else{this.options=options}this.layerController=new AJS.InlineLayer(this.options.allProperties());this.listController=this.options.listController();this.layerController.onhide(function(){instance.hide()});this.layerController.contentChange(function(){instance.listController.removeAllItems();instance.layerController.layer().find("li").each(function(){instance.listController.addItem(new AJS.ListItem({element:this}))});instance.listController.shiftFocus(0)});this.trigger(this.options.trigger());this._applyIdToLayer()},show:function(){this.trigger().addClass(AJS.ACTIVE_CLASS);this.layerController.show();this.listController.shiftFocus(0)},hide:function(){this.trigger().removeClass(AJS.ACTIVE_CLASS);this.layerController.hide();this.listController.trigger("blur")},toggle:function(){if(this.layerController.isVisible()){this.hide()}else{this.show()}},content:function(content){if(content){this.layerController.content(content)}else{return this.layerController.content()}},trigger:function(trigger){if(trigger){if(this.options.trigger()){this._unassignEvents("trigger",this.options.trigger())}this.options.trigger(AJS.$(trigger));this.layerController.offsetTarget(this.options.trigger());this._assignEvents("trigger",this.options.trigger())}else{return this.options.trigger()}},_applyIdToLayer:function(){if(this.trigger().attr("id")){this.layerController.layer().attr("id",this.trigger().attr("id")+"_drop")}},_events:{trigger:{click:function(e){this.toggle();e.preventDefault()}}}});AJS.$.extend(AJS.DropDown,{TRIGGER_SELECTOR:".aui-dropdown-trigger",CONTENT_SELECTOR:".aui-dropdown-content"});
AJS.DropDown.Descriptor=AJS.Descriptor.extend({init:function(properties){this._super(properties);if(!this.content()&&!this.trigger()){throw new Error("AJS.DropDown.Descriptor: expected either [content] or [trigger] to be defined.")}if(this.content()&&this.trigger()){throw new Error("AJS.DropDown.Descriptor: expected either [content] or [trigger] to be defined, NOT both")}if(this.trigger()&&!this.content()){this.content(this.trigger().next(AJS.DropDown.CONTENT_SELECTOR))}else{if(this.content()&&!this.trigger()){this.content(this.trigger().next(AJS.DropDown.TRIGGER_SELECTOR))}}if(this.trigger()&&!this.content()){if(!this.ajaxOptions()){if(this.trigger().attr("href")){this.ajaxOptions(this.trigger().attr("href"))}}else{if(!this.ajaxOptions().url){this.ajaxOptions().url=this.trigger().attr("href")}else{throw new Error("AJS.DropDown.Descriptor: cannot establish ajaxOptions")}}this.contentRetriever(new AJS.AjaxContentRetriever(this.ajaxOptions()))}else{if(this.content()){this.contentRetriever(new AJS.DOMContentRetriever(this.content()))}}if(!this.listController()){this.listController(new AJS.ListItemGroup())}},_getDefaultOptions:function(){return{trigger:null,ajaxOptions:null}},content:function(content){if(content){content=AJS.$(content);if(content.length){this.properties.content=content}}else{return this.properties.content}},trigger:function(trigger){if(trigger){this.properties.trigger=trigger}else{return this.properties.trigger}},contentRetriever:function(contentRetriever){if(contentRetriever){this.properties.contentRetriever=contentRetriever}else{return this.properties.contentRetriever}},listController:function(listController){if(listController){this.properties.listController=listController}else{return this.properties.listController}},ajaxOptions:function(ajaxOptions){if(ajaxOptions){this.properties.ajaxOptions=ajaxOptions}else{return this.properties.ajaxOptions}},loop:function(loop){if(typeof loop!=="undefined"){this.properties.loop=loop}else{return this.properties.loop}},alignment:function(alignment){if(alignment){this.properties.alignment=alignment}else{return this.properties.alignment}},eventDelegator:function(eventDelegator){if(typeof eventDelegator!=="undefined"){this.properties.eventDelegator=eventDelegator}else{return this.properties.eventDelegator}}});
AJS.DropDown.create=function(options){var dropdowns=[];if(options.content&&!options.trigger){options.content=AJS.$(options.content);AJS.$.each(options.content,function(){var instanceOptions=AJS.copyObject(options);instanceOptions.content=AJS.$(this);dropdowns.push(new AJS.DropDown(instanceOptions))})}else{if(!options.content&&options.trigger){options.trigger=AJS.$(options.trigger);AJS.$.each(options.trigger,function(){var instanceOptions=AJS.copyObject(options);instanceOptions.trigger=AJS.$(this);dropdowns.push(new AJS.DropDown(instanceOptions))})}}return dropdowns};
AJS.ContentRetrieverInterface=Interface.extend({startingRequest:Function,finishedRequest:Function,cache:Function,isLocked:Function,content:Function});
AJS.AjaxContentRetriever=Class.extend(AJS.ContentRetrieverInterface,{init:function(options){var instance=this;this.ajaxOptions=options;if(typeof this.ajaxOptions==="string"){this.ajaxOptions={url:this.ajaxOptions}}this.ajaxOptions.success=function(data,textStatus,xhr){instance._requestComplete(xhr,textStatus,data,true,null)};this.ajaxOptions.error=function(xhr,textStatus){if(xhr.rc){xhr.status=xhr.rc}instance._requestComplete(xhr,textStatus,null,false,null)}},content:function(arg){if(AJS.$.isFunction(arg)){this.callback=arg;this._makeRequest(arg)}else{if(arg){this.callback(arg);delete this.callback}}return this.$content},startingRequest:function(callback){if(callback){this.startingCallback=callback}else{if(this.startingCallback){this.locked=true;this.startingCallback()}}},finishedRequest:function(callback){if(callback){this.finishedCallback=callback}else{if(this.finishedCallback){this.locked=false;this.finishedCallback()}}},cache:function(cache){if(typeof cache!=="undefined"){this.ajaxOptions.cache=cache}else{return this.ajaxOptions.cache}},isLocked:function(){return this.locked},_requestComplete:function(xhr,statusText,data,successful,errorThrown){var $content,smartAjaxResult;if(jira.ajax.SmartAjaxResult){smartAjaxResult=jira.ajax.SmartAjaxResult.apply(window,arguments)}if(successful){if(AJS.$.isFunction(this.ajaxOptions.formatSuccess)){$content=this.ajaxOptions.formatSuccess(data)}else{$content=AJS.$("<div>"+data+"</div>")}}else{if(AJS.$.isFunction(this.ajaxOptions.formatError)){$content=this.ajaxOptions.formatError(data)}else{if(smartAjaxResult){var errorClass=smartAjaxResult.status===401?"warn":"error";$content=AJS.$("<div class='notify "+errorClass+"'>"+jira.ajax.buildSimpleErrorContent(smartAjaxResult)+"</div>")}}}this.content($content);this.finishedRequest()},_makeRequest:function(){this.startingRequest();AJS.$.ajax(this.ajaxOptions)}});
AJS.DOMContentRetriever=Class.extend(AJS.ContentRetrieverInterface,{init:function(content){this.$content=AJS.$(content)},content:function(callback){if(AJS.$.isFunction(callback)){callback(this.$content)}return this.$content},cache:function(){},isLocked:function(){},startingRequest:function(){},finishedRequest:function(){}});
AJS.QueryableDropdown=AJS.Control.extend({INVALID_KEYS:[jira.keyboard.SpecialKey.TAB,jira.keyboard.SpecialKey.ESC,jira.keyboard.SpecialKey.SHIFT,jira.keyboard.SpecialKey.RIGHT],init:function(options){var instance=this;this._setOptions(options);this._queuedRequest=0;this.suggestionsVisible=false;if(this.options.ajaxOptions.minQueryLength){this.options.ajaxOptions.minQueryLength=parseInt(this.options.ajaxOptions.minQueryLength,10)}this._createFurniture();this.dropdownController=AJS.InlineLayer.create({offsetTarget:this.$field,width:this.$field.innerWidth(),content:options.element});this.listController=new AJS.List({containerSelector:options.element,groupSelector:"ul.aui-list-section",itemSelector:"li",selectionHandler:function(){instance.$field.val(AJS.params.dotLoading).css("color","#999");instance.hideSuggestions();return true}});this._assignEventsToFurniture();if(this.options.loadOnInit){this.suggestionsDisabled=true;this._requestThenResetSuggestions()}},_getDefaultOptions:function(){return{id:"default",ajaxOptions:{data:{query:""},dataType:"json",minQueryLength:0},keyInputPeriod:75}},getAjaxOptions:function(){this.options.ajaxOptions.data.query=AJS.$.trim(this.$field.val());return AJS.copyObject(this.options.ajaxOptions)},issueRequest:function(){var instance=this,ajaxOptions=this.getAjaxOptions();ajaxOptions.complete=function(xhr,textStatus,smartAjaxResult){instance.outstandingRequest=null;if(!instance.$container.is(":visible")){return}if(smartAjaxResult.successful){instance._handleServerSuccess(smartAjaxResult)}else{if(!smartAjaxResult.aborted){instance.hideSuggestions();instance._handleServerError(smartAjaxResult)}}};this.outstandingRequest=jira.ajax.makeRequest(ajaxOptions);AJS.$(this.outstandingRequest).throbber({target:this.$dropDownIcon,isLatentThreshold:500})},_handleServerSuccess:function(smartAjaxResult){if(this.options.loadOnInit||this.$field.val()==this.options.ajaxOptions.data.query){this._handleSuggestionResponse(smartAjaxResult.data)}},_handleServerError:function(smartAjaxResult){var errMsg=jira.ajax.buildSimpleErrorContent(smartAjaxResult);alert(errMsg)},_createFurniture:function(){this.$container=this._render("container").insertBefore(this.options.element);this.$field=this._render("field").appendTo(this.$container);this.$dropDownIcon=this._render("dropdownAndLoadingIcon",this._hasDropdownButton()).appendTo(this.$container);this.$suggestionsContainer=this._render("suggestionsContainer")},_hasDropdownButton:function(){return this.options.showDropdownButton||this.options.ajaxOptions.minQueryLength===0},_assignEventsToFurniture:function(){var instance=this;this.$field.preventBlurFromElements(instance.dropdownController.$layer,instance.$container);if(this._hasDropdownButton()){this._assignEvents("dropdownAndLoadingIcon",this.$dropDownIcon)}setTimeout(function(){instance._assignEvents("field",instance.$field);instance._assignEvents("keys",instance.$field)},15)},_useCachedRequest:function(){return !!(this.cachedList&&!this.options.ajaxOptions.query)},_isValidRequest:function(){return this.options.ajaxOptions.query||(!this.cachedList&&!this.outstandingRequest)},_requestThenResetSuggestions:function(ignoreBuffer){var instance=this;this.listController._latestQuery=AJS.$.trim(this.$field.val());if(this._useCachedRequest()){this._handleSuggestionResponse(this.cachedList)}else{if(this._isValidRequest()){if(ignoreBuffer&&this.outstandingRequest){this.outstandingRequest.abort();this.outstandingRequest=null}clearTimeout(this._queuedRequest);if(!this.outstandingRequest){this.issueRequest()}else{this._queuedRequest=setTimeout(function(){instance._requestThenResetSuggestions(ignoreBuffer)},this.options.keyInputPeriod)}}}},_handleSuggestionResponse:function(data){if(data!==this.cachedList){if(this._formatResponse){data=this._formatResponse(data)}else{if(this.options.ajaxOptions.formatResponse){data=this.options.ajaxOptions.formatResponse.call(this,data)}}}this.cachedList=data;this._setSuggestions(this.cachedList)},_setSuggestions:function(data){if(this.suggestionsDisabled){this.suggestionsDisabled=false;return}this.suggestionsVisible=true;if(data){this.dropdownController.show();this.dropdownController.setWidth(this.$field.innerWidth());if(this.options.ajaxOptions.query){this.listController.generateListFromJSON(data)}else{this.listController.generateListFromJSON(data,this.$field.val())}this.listController.enable()}else{this.hideSuggestions()}},_isValidInput:function(e){return this.$field.is(":visible")&&AJS.$.inArray(jira.keyboard.specialKeyEntered(e),this.INVALID_KEYS)===-1},_handleCharacterInput:function(ignoreBuffer,ignoreQueryLength){this.suggestionsDisabled=false;if(ignoreQueryLength||AJS.$.trim(this.$field.val()).length>=this.options.ajaxOptions.minQueryLength){if(this.options.ajaxOptions.url){this.$dropDownIcon.removeClass("noloading");this._requestThenResetSuggestions(ignoreBuffer)}else{this._setSuggestions(this.model.getUnSelectedDescriptors())}}else{this._setSuggestions()}},_handleDown:function(e){if(!this.suggestionsVisible){this._handleCharacterInput(true,true);e.stopPropagation()}},_rejectPendingRequests:function(){if(this.outstandingRequest){this.outstandingRequest.abort()}clearTimeout(this._queuedRequest)},hideSuggestions:function(){if(!this.suggestionsVisible){return}this._rejectPendingRequests();this.suggestionsVisible=false;this.$dropDownIcon.addClass("noloading");this.dropdownController.hide();this.listController.disable()},_deactivate:function(){this.hideSuggestions()},_handleEscape:function(e){if(this.suggestionsVisible){e.stopPropagation();if(e.type==="keyup"){this.hideSuggestions()}}},keys:{down:function(e){if(this._hasDropdownButton()){this._handleDown(e)}},up:function(e){e.preventDefault()},"return":function(e){e.preventDefault()},onEdit:function(e,character){var instance=this;this.$field.one("keyup",function(){instance._handleCharacterInput()})}},_events:{dropdownAndLoadingIcon:{click:function(e){this.$field.focus();if(this.suggestionsVisible){this.hideSuggestions()}else{this._handleDown(e)}e.stopPropagation()}},field:{blur:function(){this._deactivate()},click:function(e){e.stopPropagation()},keyup:function(e){if(e.keyCode===jira.keyboard.SpecialKey.toKeyCode(jira.keyboard.SpecialKey.ESC)){this._handleEscape(e)}}},keys:{"keydown keypress":function(e){this._handleKeyEvent(e)}}},_renders:{field:function(){return AJS.$("<input class='text' type='text' autocomplete='off' />")},container:function(){return AJS.$("<div class='queryable-select' id='"+this.options.id+"-queryable-container' />")},dropdownAndLoadingIcon:function(showDropdown){var $element=AJS.$('<span class="icon noloading"><span>More</span></span>');if(showDropdown){$element.addClass("drop-menu")}return $element},suggestionsContainer:function(){return AJS.$("<div class='aui-list' id='"+this.options.id+"' tabindex='-1'></div>")}}});
AJS.List=AJS.Control.extend({_getDefaultOptions:function(){return{matchingStrategy:"(^|.*\\s+)({0})(.*)",containerSelector:".aui-list",itemSelector:"li"}},index:0,moveToNext:function(){if(this.index<this.maxIndex){this.unfocusAll();++this.index;this.focus(this.SCROLL_DOWN)}else{if(this.$visibleItems.length>1){this.unfocusAll();this.index=0;this.focus(this.SCROLL_DOWN)}}this.motionDetector.wait()},SCROLL_UP:-1,SCROLL_DOWN:1,container:function(container){if(container){this.$container=AJS.$(container);this.containerSelector=container}else{return this.$container}},scrollContainer:function(){return this.container().parent()},unfocusAll:function(){this.$visibleItems.removeClass("active")},moveToPrevious:function(){if(this.index>0){this.unfocusAll();--this.index;this.focus(this.SCROLL_UP)}else{if(this.$visibleItems.length>0){this.unfocusAll();this.index=this.$visibleItems.length-1;this.focus(this.SCROLL_UP)}}this.motionDetector.wait()},unfocus:function(direction){if(direction!==undefined){this.scrollTo(this.$visibleItems.eq(this.index),direction)}this.$visibleItems.eq(this.index).removeClass("active")},scrollTo:function($target,direction){var $scrollContainer=this.scrollContainer(),offsetTop=$target.offset().top-this.$container.offset().top;if($target[0]===this.$visibleItems[0]){$scrollContainer.scrollTop(0)}else{if($scrollContainer.scrollTop()+$scrollContainer.height()<offsetTop+$target.outerHeight()||$scrollContainer.scrollTop()>offsetTop){if(direction===-1){$scrollContainer.scrollTop(offsetTop)}else{if(direction===1){$scrollContainer.scrollTop(offsetTop+$target.outerHeight()-$scrollContainer.height())}}}}},focus:function(direction){var $target=this.$visibleItems.eq(this.index);if(direction!==undefined){this.scrollTo($target,direction)}this.lastFocusedItemDescriptor=$target.data("descriptor");this.motionDetector.unbind();$target.addClass("active");if(!AJS.dim.dim){$target.scrollIntoView({duration:100,callback:AJS.$.proxy(this.motionDetector,"wait")})}else{this.motionDetector.wait()}},motionDetector:new jira.mouse.MotionDetector(),disable:function(){if(this.disabled){return}this._unassignEvents("document",document);this.disabled=true;this.lastFocusedItemDescriptor=null;this.motionDetector.unbind()},enable:function(){var instance=this;if(!instance.disabled){return}instance.motionDetector.wait();window.setTimeout(function(){instance._assignEvents("document",document)},0);instance.selectionManager.enable();instance.disabled=false;this.scrollContainer().scrollTop(0)},getFocused:function(){return this.$visibleItems.filter(".active")},reset:function(index){var noSuggestionsClassName=/(?:^|\s)no-suggestions(?!\S)/;var hiddenClassName=/(?:^|\s)hidden(?!\S)/;this.$container=AJS.$(this.options.containerSelector);this.items=AJS.$(this.options.itemSelector,this.$container).filter(function(){return !noSuggestionsClassName.test(this.className)});this.$visibleItems=this.items.filter(function(){return !hiddenClassName.test(this.className)});this.groups=AJS.$(this.options.groupSelector,this.$container);this.maxIndex=this.$visibleItems.length-1;this.index=this.$visibleItems[index]?index:0;this.focus()},init:function(options){options=options||{};if(options){this.options=AJS.$.extend(true,this._getDefaultOptions(options),options)}else{this.options=this._getDefaultOptions(options)}var instance=this;this.containerSelector=AJS.$(this.options.$layerContent);this.disabled=true;this.reset();this.selectionManager=new AJS.SelectionManager(document);AJS.$(this.selectionManager).bind(this.selectionManager.getCustomEventName("setNoScheme"),function(e){if(instance.getFocused().length>1){instance._handleSectionByKeyboard(e)}});if(this.options.selectionHandler){this.$container.delegate(this.options.itemSelector,"click",function(e){instance.options.selectionHandler.call(instance,e)})}this.$container.delegate(this.options.itemSelector,"mouseover",function(){if(instance.motionDetector.moved&&!instance.disabled){instance.unfocusAll();instance.index=AJS.$.inArray(this,instance.$visibleItems);instance.focus()}})},_getLinkFromItem:function(item){var link;item=AJS.$(item);if(item.is("a")){link=item}else{link=item.find("a")}if(!link.length){throw new Error("AJS.List._getLinkFromItem: could not find a link node")}else{return link}},generateListFromJSON:function(data,query){var event,$result=AJS.$("<div>"),instance=this,ungrouped=[],$listItems;this.suggestions=0;this.exactMatchIndex=-1;this.lastFocusedIndex=-1;this.lastQuery=query;AJS.$.each(data,function(i,descriptor){if(descriptor instanceof AJS.GroupDescriptor){if(ungrouped.length>0){$result.append(instance._generateUngroupedOptions(ungrouped,query));ungrouped=[]}$result.append(instance._generateOptGroup(descriptor,query))}else{if(this instanceof AJS.ItemDescriptor){ungrouped.push(descriptor)}}});if(ungrouped.length>0){$result.append(this._generateUngroupedOptions(ungrouped,query))}if($result.children().length===0){this.$container.html(this._render("noSuggestion"))}else{$result.find("ul:last").addClass("aui-last");this.$container.html($result.children())}this.$container.hide();$listItems=AJS.$("li > a",this.$container);$listItems.each(function(){var elem=AJS.$(this);elem.attr("title",elem.text())});$listItems.css({textOverflow:"ellipsis",overflow:"hidden"});this.$container.show();$listItems.textOverflow("&#x2026;",false);event=new AJS.ContentChangeEvent({target:this.$container,eventOwner:AJS.List});event.fire();this.reset(this.exactMatchIndex>=0?this.exactMatchIndex:this.lastFocusedIndex)},_generateOption:function(item,query){var replacementText;if(query){var regexEscapedQuery=RegExp.escape(query),regex=new RegExp(AJS.format(this.options.matchingStrategy,regexEscapedQuery),"i");if(!regex.test(item.label())){return null}replacementText=item.label().replace(regex,function(_,prefix,match,suffix){return AJS.$("<div>").append(AJS.$("<span>").text(prefix)).append(AJS.$("<em>").text(match)).append(AJS.$("<span>").text(suffix)).html()})}if(this.exactMatchIndex<0){var itemValue=AJS.$.trim(item.label()).toLowerCase();if(itemValue===AJS.$.trim(query).toLowerCase()){this.exactMatchIndex=this.suggestions}else{if(this.lastFocusedIndex<0&&this.lastFocusedItemDescriptor&&itemValue===AJS.$.trim(this.lastFocusedItemDescriptor.label()).toLowerCase()){this.lastFocusedIndex=this.suggestions}}}this.suggestions++;return this._render("suggestion",item,replacementText)},_generateUngroupedOptions:function(options,query){var hasSuggestion=false,instance=this,$container=this._render("ungroupedSuggestions");AJS.$.each(options,function(_,option){var $suggestion=instance._generateOption(option,query);if($suggestion){hasSuggestion=true;$container.append($suggestion)}});if(hasSuggestion){return $container}},_generateOptGroup:function(groupDescriptor,query){var res=AJS.$(),hasSuggestion,instance=this,optContainer=this._render("suggestionGroup",groupDescriptor);AJS.$.each(groupDescriptor.items(),function(i,option){var suggestion=instance._generateOption(option,query);if(suggestion){hasSuggestion=true,optContainer.append(suggestion)}});if(!hasSuggestion){return}if(groupDescriptor.showLabel()!==false){res=res.add(this._render("suggestionGroupHeading",groupDescriptor))}res=res.add(optContainer);return res},_events:{document:{keydown:function(e){this._handleKeyEvent(e)},keypress:function(e){this._handleKeyEvent(e)}}},_renders:{suggestion:function(descriptor,replacementText){var listElem=AJS.$('<li class="aui-list-item aui-list-item-'+AJS.$.trim(descriptor.label().toLowerCase()).replace(/[\s\.]+/g,"-")+'">'),linkElem=AJS.$("<a />").addClass("aui-list-item-link");if(descriptor.selected()){listElem.addClass("aui-checked")}linkElem.attr("href",descriptor.href()||"#");if(descriptor.icon()&&descriptor.icon()!=="none"){linkElem.addClass("aui-iconised-link").css({backgroundImage:"url("+descriptor.icon()+")"})}if(descriptor.styleClass()){linkElem.addClass(descriptor.styleClass())}if(descriptor.html()){linkElem.html(descriptor.html())}else{if(!replacementText){linkElem.text(descriptor.label())}else{linkElem.html(replacementText)}}if(descriptor.labelSuffix()){AJS.$("<span class='aui-item-suffix' />").text(descriptor.labelSuffix()).appendTo(linkElem)}listElem.append(linkElem).data("descriptor",descriptor);return listElem},noSuggestion:function(){return AJS.$("<div class='no-suggestions'><span style='font-style:oblique'>"+AJS.params.frotherNomatches+"</span></div>")},ungroupedSuggestions:function(){return AJS.$("<ul>")},suggestionGroup:function(descriptor){return AJS.$("<ul class='aui-list-section' />").attr("id",descriptor.label().replace(/\s/g,"-").toLowerCase()).addClass(descriptor.styleClass()).data("descriptor",descriptor)},suggestionGroupHeading:function(descriptor){var elem=AJS.$("<h5 />").text(descriptor.label()).addClass(descriptor.styleClass()).data("descriptor",descriptor);if(descriptor.description()){AJS.$("<span class='aui-section-description' />").text(" ("+descriptor.description()+")").appendTo(elem)}return elem}},_acceptSuggestion:function(item){if(!item instanceof AJS.$){item=AJS.$(item)}var linkNode=this._getLinkFromItem(item);var event=new jQuery.Event("click");linkNode.trigger(event,[linkNode]);if(!event.isDefaultPrevented()){window.location.href=linkNode.attr("href")}},_acceptUserInput:function($field){$field.triggerHandler("blur")},_handleSectionByKeyboard:function(e){var $focusedItem=this.getFocused();var $field=AJS.$(e.target);if($focusedItem.length===0){return}if($focusedItem.closest("#user-inputted-option").length>0){this._acceptUserInput($field);return}if(this._latestQuery&&$field.val()!==this._latestQuery){var inputWords=$field.val().toLowerCase().match(/\S+/g);if(inputWords){var html=this.lastFocusedItemDescriptor&&this.lastFocusedItemDescriptor.html();var $item=html?AJS.$("<div>").html(html):$focusedItem;var matches=AJS.$.map($item.find("em,b"),function($match){$match=AJS.$($match);return($match.text()+AJS.$($match.attr("nextSibling")).text().match(/^\S*/)[0]).toLowerCase()});for(var i=0;i<inputWords.length;i++){var word=inputWords[i];var n=word.length;var hasMatch=false;for(var j=0;j<matches.length;j++){if(matches[j].slice(0,n)===word){hasMatch=true;break}}if(!hasMatch){this._acceptUserInput($field);return}}}}if(this.options.selectionHandler&&!this.options.selectionHandler.call(this,e)){return}this._acceptSuggestion($focusedItem)},_isValidInput:function(){return !this.disabled&&this.$container.is(":visible")},keys:{down:function(e){this.moveToNext();e.preventDefault()},up:function(e){this.moveToPrevious();e.preventDefault()},"return":function(e){this._handleSectionByKeyboard(e)}}});
AJS.SelectModel=AJS.Control.extend({init:function(options){if(options.element){options.element=AJS.$(options.element)}else{options.element=AJS.$(options)}this._setOptions(options);this.$element=this.options.element;this.type=this.$element.attr("multiple")?"multiple":"single";this._parseDescriptors()},_getDefaultOptions:function(){return{}},setSelected:function(descriptor){var selectedItem=false;if(this.type==="single"){this.setAllUnSelected()}this.$element.find("option").filter(function(){return AJS.$(this).attr("value")===descriptor.value()}).each(function(){selectedItem=true;AJS.$(this).attr("selected","selected").data("descriptor").selected(true)});if(!selectedItem){descriptor.selected(true);var newOption=this._render("option",descriptor);newOption.attr("selected","selected");this.$element.append(newOption)}},setAllUnSelected:function(){var instance=this;AJS.$(this.getSelectedDescriptors()).each(function(){instance.setUnSelected(this)})},setUnSelected:function(descriptor){var instance=this;this.$element.find("option").filter(function(){return AJS.$(this).attr("value")===descriptor.value()}).each(function(){var $this=AJS.$(this);if(instance.options.removeOnUnSelect||$this.data("descriptor").removeOnUnSelect()){$this.remove()}else{$this.attr("selected","");$this.data("descriptor").selected(false)}})},_isOptionPresent:function(descriptor,ctx){var notFound=true;var value=descriptor.value();AJS.$("option",ctx||this.$element).each(function(){return notFound=(this.value!==value)});return !notFound},_isOptionGroupPresent:function(descriptor){var $optgroup=this.$element.find("optgroup").filter(function(){return AJS.$(this).attr("label")===descriptor.label()});return $optgroup.length>0},remove:function(descriptor){if(descriptor&&descriptor.model()){descriptor.model().remove()}},getDescriptor:function(value){var returnDescriptor;value=AJS.$.trim(value.toLowerCase());AJS.$.each(this.getAllDescriptors(false),function(e,descriptor){if(value===AJS.$.trim(descriptor.label().toLowerCase())||value===AJS.$.trim(descriptor.value().toLowerCase())){returnDescriptor=descriptor;return false}});return returnDescriptor},appendOptionsFromJSON:function(optionDescriptors){var instance=this;AJS.$.each(optionDescriptors,function(i,descriptor){var optgroup;if(descriptor instanceof AJS.GroupDescriptor&&(descriptor.replace()||!instance._isOptionGroupPresent(descriptor))){if(descriptor.replace()){optgroup=instance.$element.find('optgroup[label="'+descriptor.label()+'"]');if(optgroup.length){optgroup.find("option:not(:selected)").remove()}}if(!optgroup||!optgroup.length){optgroup=instance._render("optgroup",descriptor)}optgroup.data("descriptor",descriptor);AJS.$.each(descriptor.items(),function(i,optDescriptor){if(!instance._isOptionPresent(optDescriptor,optgroup)){optgroup.append(instance._render("option",optDescriptor))}});if(typeof descriptor.weight()!=="undefined"){var target=instance.$element.children().eq(descriptor.weight());if(target[0]!==optgroup[0]){if(target.length){optgroup.insertBefore(target)}else{optgroup.appendTo(instance.$element)}}}else{optgroup.appendTo(instance.$element)}}else{if(descriptor instanceof AJS.GroupDescriptor){optgroup=instance.$element.find('optgroup[label="'+descriptor.label()+'"]');optgroup.data("descriptor",descriptor);AJS.$.each(descriptor.items(),function(i,optDescriptor){if(!instance._isOptionPresent(optDescriptor,optgroup)){optgroup.append(instance._render("option",optDescriptor))}})}else{if(descriptor instanceof AJS.ItemDescriptor&&!instance._isOptionPresent(descriptor)){instance._render("option",descriptor).appendTo(instance.$element)}}}})},_parseOption:function(optionElem){var descriptor;optionElem=AJS.$(optionElem);if(this.options.removeNullOptions&&this._hasNullValue(optionElem)){optionElem.remove();return null}descriptor=new AJS.ItemDescriptor({value:optionElem.val(),title:optionElem.attr("title"),label:optionElem.text(),icon:optionElem.css("backgroundImage"),selected:optionElem.attr("selected")?true:false,model:optionElem});optionElem.data("descriptor",descriptor);return descriptor},_hasNullValue:function(optionElement){return optionElement.val()<0},_parseDescriptors:function(){var instance=this,items=this.$element.children();function parseOptGroup(optionGroup){optionGroup.data("descriptor",new AJS.GroupDescriptor({label:optionGroup.attr("label"),styleClass:optionGroup.attr("className"),model:optionGroup,items:retrieveAvailableOptions(optionGroup)}))}function retrieveAvailableOptions(parent){var availableOptionElems=AJS.$("option",parent),arr=[];AJS.$.each(availableOptionElems,function(){arr.push(instance._parseOption(this))});return arr}items.each(function(i){var item=items.eq(i);if(item.is("optgroup")){parseOptGroup(item)}else{if(item.is("option")){instance._parseOption(item)}}})},getSelectedDescriptors:function(){var descriptors=[];this.$element.find("option").each(function(){if(this.selected){descriptors.push(AJS.$.data(this,"descriptor"))}});return descriptors},getAllDescriptors:function(showGroups){var properties,descriptors=[];this.$element.children().each(function(){var descriptor,elem=AJS.$(this);if(elem.is("option")){descriptors.push(elem.data("descriptor"))}else{if(elem.is("optgroup")){if(showGroups!==false){properties=AJS.copyObject(elem.data("descriptor").allProperties(),false);properties.items=[];descriptor=new AJS.GroupDescriptor(properties);descriptors.push(descriptor)}elem.children("option").each(function(){var elem=AJS.$(this);if(showGroups!==false){descriptor.addItem(elem.data("descriptor"))}else{descriptors.push(elem.data("descriptor"))}})}}});return descriptors},clearUnSelected:function(){this.$element.find("option:not([selected])").remove()},getUnSelectedDescriptors:function(showGroups){var descriptors=[],selectedValues={},addedValues={};function isValid(descriptor){var descriptorVal=descriptor.value().toLowerCase();if(!selectedValues[descriptorVal]&&(!addedValues[descriptorVal]||descriptor.allowDuplicate()!==false)){addedValues[descriptorVal]=true;return true}return false}AJS.$.each(this.getSelectedDescriptors(),function(i,descriptor){selectedValues[descriptor.value().toLowerCase()]=true});this.$element.children().each(function(){var descriptor,properties,elem=AJS.$(this);if(elem.is("option")&&!this.selected){descriptor=AJS.$.data(this,"descriptor");if(isValid(descriptor)){descriptors.push(descriptor)}}else{if(elem.is("optgroup")){if(showGroups!==false){properties=AJS.copyObject(elem.data("descriptor").allProperties(),false);properties.items=[];descriptor=new AJS.GroupDescriptor(properties);descriptors.push(descriptor)}elem.find("option").each(function(){if(this.selected){return}var itemDescriptor=AJS.$.data(this,"descriptor");if(isValid(itemDescriptor)){if(showGroups!==false){descriptor.addItem(itemDescriptor)}else{descriptors.push(itemDescriptor)}}})}}});return descriptors},_renders:{option:function(descriptor){var option=new Option(descriptor.label(),descriptor.value());var $option=AJS.$(option);var iconUrl=descriptor.icon();option.title=descriptor.title();AJS.$.data(option,"descriptor",descriptor);descriptor.model($option);if(iconUrl){$option.css("backgroundImage","url("+iconUrl+")")}return $option},optgroup:function(descriptor){var elem=AJS.$("<optgroup />").addClass(descriptor.styleClass()).attr("label",descriptor.label());descriptor.model(elem);elem.data("descriptor",descriptor);return elem}}});
AJS.QueryableSelect=AJS.QueryableDropdown.extend({init:function(options){var instance=this;if(this._setOptions(options)===this.INVALID){return this.INVALID}this.options.element.hide();if(this.options.disabled){this._createFurniture(true);return this}this.model=new AJS.SelectModel({element:this.options.element,removeOnUnSelect:this.options.removeOnUnSelect});this._createFurniture();this.dropdownController=AJS.InlineLayer.create({alignment:AJS.LEFT,offsetTarget:this.$field,content:AJS.$(".aui-list",this.$container)});this.listController=new AJS.List({containerSelector:AJS.$(".aui-list",this.$container),groupSelector:"ul.aui-list-section",itemSelector:"li",matchingStrategy:this.options.matchingStrategy,selectionHandler:function(e){instance._selectionHandler(this.getFocused(),e);return false}});this._assignEventsToFurniture()},_createFurniture:function(disabled){var id=this.model.$element.attr("id");if(disabled){this.model.$element.replaceWith(this._render("disableSelectField",id))}else{this.$container=this._render("container",id);this.$field=this._render("field",id).appendTo(this.$container);this.$container.append(this._render("suggestionsContainer",id));this.$container.insertBefore(this.model.$element);this.$dropDownIcon=this._render("dropdownAndLoadingIcon",this._hasDropdownButton()).appendTo(this.$container)}},_getUserInputValue:function(){return this.options.uppercaseUserEnteredOnSelect?this.$field.val().toUpperCase():this.$field.val()},_handleUserInputOption:function(){var groupDescriptor;if(!this.hasUserInputtedOption()||this.$field.val().length===0){return}groupDescriptor=new AJS.GroupDescriptor({type:"optgroup",label:"user inputted option",weight:9999,showLabel:false,replace:true});groupDescriptor.addItem(new AJS.ItemDescriptor({value:this._getUserInputValue(),label:this.$field.val(),labelSuffix:" ("+this.options.userEnteredOptionsMsg+")",title:this.$field.val(),allowDuplicate:false}));this.model.appendOptionsFromJSON([groupDescriptor])},hasUserInputtedOption:function(){return this.options.userEnteredOptionsMsg},_handleSuggestionResponse:function(data){if(this.options.ajaxOptions.query){this.model.clearUnSelected()}this._handleUserInputOption();this._super(data)},_setSuggestions:function(data){if(data){this.model.appendOptionsFromJSON(data);this._super(this.model.getUnSelectedDescriptors())}else{this.hideSuggestions()}},_renders:{field:function(idPrefix){return AJS.$('<textarea autocomplete="off" id="'+idPrefix+'-textarea" class="aui-field" wrap="off"></textarea>')},disableSelectField:function(id){return AJS.$("<input type='text' class='long-field' name='"+id+"' id='"+id+"' />")},container:function(idPrefix){return AJS.$('<div class="multi-select" id="'+idPrefix+'-multi-select">')},suggestionsContainer:function(idPrefix){return AJS.$('<div class="aui-list" id="'+idPrefix+'-suggestions" tabindex="-1"></div>')}}});
AJS.SelectMenu=AJS.Control.extend({init:function(options){var instance=this;this.model=new AJS.SelectModel(options);this.model.$element.hide();this._createFurniture();this.dropdownController=AJS.InlineLayer.create({alignment:AJS.LEFT,width:200,content:AJS.$(".aui-list",this.$container)});this.dropdownController.layer().addClass("select-menu");this.listController=new AJS.List({containerSelector:AJS.$(".aui-list",this.$container),groupSelector:"ul.opt-group",itemSelector:"li:not(.no-suggestions)",selectionHandler:function(e){instance._selectionHandler(this.getFocused(),e);e.preventDefault()}});this._assignEventsToFurniture()},show:function(){this.dropdownController.show();this._resetSuggestions();this.listController.enable()},_assignEventsToFurniture:function(){this._assignEvents("trigger",this.$trigger)},_createFurniture:function(){var id=this.model.$element.attr("id");this.$container=this._render("container",id);this.$trigger=this.model.$element.prev("a").appendTo(this.$container);this.$container.append(this._render("suggestionsContainer"));this.$container.insertBefore(this.model.$element)},_resetSuggestions:function(){this.listController.generateListFromJSON(this.model.getAllDescriptors());this.listController.unfocusAll();this.listController.index=0;this.listController.focus()},_renders:{container:function(idPrefix){return AJS.$('<div class="select-menu" id="'+idPrefix+'-multi-select">')},suggestionsContainer:function(){return AJS.$('<div class="aui-list aui-list-checked" tabindex="-1"></div>')}},_selectionHandler:function(selected){var instance=this,intCount=0;this.model.setSelected(selected.data("descriptor"));this.dropdownController.content().find(".aui-checked").removeClass(".aui-checked");selected.addClass(".aui-checked");var myInterval=window.setInterval(function(){intCount++;selected.toggleClass(".aui-checking");if(intCount>2){clearInterval(myInterval);instance.dropdownController.hide()}},80)},_events:{trigger:{click:function(e){this.show();e.preventDefault();e.stopPropagation()}}}});
AJS.SecurityLevelMenu=AJS.SelectMenu.extend({_createFurniture:function(){AJS.populateParameters();this._super()},_selectionHandler:function(selected){var descriptor=selected.data("descriptor");if(descriptor&&!descriptor.value()){this.$trigger.find("span:first").removeClass("icon-locked").addClass("icon-unlocked");this.$container.parent().find(".current-level").text(AJS.params.securityLevelViewableByAll)}else{this.$trigger.find("span:first").removeClass("icon-unlocked").addClass("icon-locked");var htmlEscapedLabel=AJS.$("<div/>").text(descriptor.label()).html();this.$container.parent().find(".current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo,htmlEscapedLabel))}this._super(selected)},_handleDownKey:function(e){if(e.keyCode===jQuery.ui.keyCode.DOWN&&!this.dropdownController.isVisible()){e.preventDefault();e.stopPropagation();this.show()}},_events:{trigger:{keydown:function(e){this._handleDownKey(e)},keypress:function(e){this._handleDownKey(e)}}}});
AJS.MultiSelect=AJS.QueryableSelect.extend({init:function(options){if(this._super(options)===this.INVALID){return this.INVALID}var instance=this;this._setTextareaDimThresholds();this.lozengeGroup=new AJS.LozengeGroup();this._assignEvents("lozengeGroup",this.lozengeGroup);this._restoreSelectedOptions();return this},_getDefaultOptions:function(){return AJS.$.extend(true,this._super(),{minRoomForText:50,errorMessage:AJS.params.multiselectGenericError,ajaxOptions:{minQueryLength:1},showDropdownButton:true})},_createFurniture:function(disabled){if(this.model.$element.prev().hasClass("ajs-multi-select-placeholder")){this.model.$element.prev().remove()}this._super(disabled);if(!disabled){this.$errorMessage=this._render("errorMessage");this.$selectedItemsWrapper=this._render("selectedItemsWrapper").appendTo(this.$container);this.$selectedItemsContainer=this._render("selectedItemsContainer").appendTo(this.$selectedItemsWrapper)}},_assignEventsToFurniture:function(){this._super();this._assignEvents("body",document);this._assignEvents("selectedItemsContainer",this.$selectedItemsContainer)},removeItem:function(descriptor){this.model.setUnSelected(descriptor);this.updateItemsIndent()},_restoreSelectedOptions:function(){var instance=this;AJS.$.each(this.model.getSelectedDescriptors(),function(){instance._addItem(this)});this.updateItemsIndent()},_shouldEnableLozengeGroup:function(){return this.lozengeGroup.items.length>0&&this.lozengeGroup.index<0&&(this.$field.val().length===0||this.getCaret(this.$field[0])===0)},_handleBackSpace:function(){var instance=this;if(this._shouldEnableLozengeGroup()){setTimeout(function(){instance.lozengeGroup.shiftFocus(-1)},0)}else{this.$field.one("keyup",function(){instance._handleCharacterInput()})}},_handleDelete:function(){if(AJS.$.trim(this.$field.val())!==""){var instance=this;this.$field.one("keyup",function(){instance._handleCharacterInput()})}},_handleLeft:function(){if(this._shouldEnableLozengeGroup()){var instance=this;setTimeout(function(){instance.lozengeGroup.shiftFocus(-1)},0)}},_handlePaste:function(){this.$field.val(AJS.$.trim(this.$field.val()).replace(/\s+/g," "));this._handleCharacterInput()},_setTextareaDimThresholds:function(){this.maxWidth=this.options.maxWidth||this.$container.attr("scrollWidth");this.minWidth=this.options.minWidth||this.$container.attr("scrollWidth");if(this.minWidth>this.maxWidth){this.minWidth=this.maxWidth}},updateItemsIndent:function(){var inputIndent=this._getInputIndent();this.$field.css({paddingTop:inputIndent.top,paddingLeft:inputIndent.left,width:0});this.$field.css({width:this.$container.width()-inputIndent.left-21});if(this.currentTopOffset&&this.currentTopOffset!==inputIndent.top){this.$container.trigger("multiSelectHeightUpdated",[this])}if(AJS.$.browser.msie){this.$field.val(this.$field.val()+" ");this.$field.val(this.$field.val().replace(/\s$/,""))}this.currentTopOffset=inputIndent.top},_isItemPresent:function(descriptor){var duplicate=false;var label=descriptor.label();AJS.$.each(this.lozengeGroup.items,function(){if(this.options.label===label){duplicate=true;return false}});return duplicate},_addItem:function(descriptor){if(descriptor instanceof AJS.ItemDescriptor){descriptor=AJS.copyObject(descriptor.allProperties(),false)}descriptor.value=AJS.$.trim(descriptor.value);descriptor.label=AJS.$.trim(descriptor[this.options.itemAttrDisplayed])||descriptor.value;descriptor.title=AJS.$.trim(descriptor.title)||descriptor.label;descriptor=new AJS.ItemDescriptor(descriptor);if(this._isItemPresent(descriptor)){return}var lozenge=new AJS.Lozenge({label:descriptor.label(),title:descriptor.title(),container:this.$selectedItemsContainer});this.lozengeGroup.addItem(lozenge);this._assignEvents("lozenge",lozenge);this.model.setSelected(descriptor);this.updateItemsIndent();this.dropdownController.setPosition()},_addMultipleItems:function(items,removeOnUnSelect){var instance=this;AJS.$.each(items,function(i,descriptor){if(removeOnUnSelect){descriptor.removeOnUnSelect=true}instance._addItem(descriptor)})},_getTargetItemContainerWidth:function(){var lozenges=this.lozengeGroup.items,width=parseInt(this.$selectedItemsContainer.css("paddingLeft"),10)+parseInt(this.$selectedItemsContainer.css("paddingRight"),10);for(var i=lozenges.length-1;i>=0;i--){var $item=lozenges[i].$lozenge;width=width+$item.outerWidth()+parseInt($item.css("marginLeft"),10)+parseInt($item.css("marginRight"),10)}return width},_getInputIndent:function(){var top,left,iconArea=22,paddingLeft=2,paddingTop=4,indent={top:paddingTop,left:paddingLeft},lastLozengeIndex=this.lozengeGroup.items.length-1,$last;if(lastLozengeIndex>=0){$last=this.lozengeGroup.items[lastLozengeIndex].$lozenge;top=$last.attr("offsetTop");left=$last.attr("offsetLeft")+$last.outerWidth();if(left>this.$container.width()-iconArea-this.options.minRoomForText){top+=$last.attr("offsetHeight");left=0}indent.top+=top;indent.left+=left}return indent},_selectionHandler:function(selected,e){var instance=this;selected.each(function(){instance._addItem(AJS.$.data(this,"descriptor"))});this.$field.val("").focus().scrollIntoView({margin:20});this.hideSuggestions();this.hideErrorMessage();this.model.$element.trigger("change");e.preventDefault()},isValidItem:function(itemValue){var suggestedItemDescriptor=this.listController.getFocused().data("descriptor");if(!suggestedItemDescriptor){return false}itemValue=itemValue.toLowerCase();return itemValue===AJS.$.trim(suggestedItemDescriptor.label.toLowerCase())||itemValue===AJS.$.trim(suggestedItemDescriptor.value.toLowerCase())},showErrorMessage:function(value){this.$errorMessage.text(AJS.format(this.options.errorMessage,value||this.$field.val()));var $container=this.$container.parent(".field-group");if($container.length===0){$container=this.$container.parent(".frother-control-renderer");this.$errorMessage.prependTo($container)}else{this.$errorMessage.appendTo($container)}},hideErrorMessage:function(){this.$errorMessage.remove()},handleFreeInput:function(){var value=AJS.$.trim(this.$field.val()),descriptor;if(value){descriptor=this.model.getDescriptor(value);if(descriptor){this._addItem(descriptor);this.model.$element.trigger("change")}else{this.showErrorMessage(value);return}}this.hideErrorMessage();this.$field.val("")},submitForm:function(){if(this.$field.val().length===0&&!this.suggestionsVisible){AJS.$(this.$field[0].form).submit()}},_deactivate:function(){this.handleFreeInput();this.lozengeGroup.trigger("blur");this.hideSuggestions()},keys:{left:function(){this._handleLeft()},backspace:function(){this._handleBackSpace()},del:function(){this._handleDelete()},"return":function(e){this.submitForm();e.preventDefault()}},_events:{body:{tabSelect:function(){if(this.$field.is(":visible")){this._setTextareaDimThresholds();this.updateItemsIndent()}},bulkTabSelect:function(){if(this.$field.is(":visible")){this._setTextareaDimThresholds();this.updateItemsIndent()}}},field:{paste:function(){setTimeout(AJS.$.proxy(this,"_handlePaste"),0)},"keydown keypress":function(event){if(this.lozengeGroup.index>=0){if(jira.keyboard.SpecialKey.fromKeyCode(event.keyCode) in this.lozengeGroup.keys){event.preventDefault()}else{if(jira.keyboard.SpecialKey.fromKeyCode(event.keyCode)==="return"){this.submitForm();event.preventDefault()}else{var instance=this;this.$field.one("keyup",function(){instance._handleCharacterInput()});this.lozengeGroup.trigger("blur")}}}},click:function(){this.lozengeGroup.trigger("blur");this.$field.focus()}},lozengeGroup:{focus:function(){this.$field.focus();this.hideSuggestions();this._unassignEvents("keys",this.$field)},blur:function(){this._assignEvents("keys",this.$field);if(this.$field.val()){this._handleCharacterInput()}}},lozenge:{remove:function(event){this.removeItem(this.model.getDescriptor(event.target.options.label))}},selectedItemsContainer:{click:function(event){if(event.target===event.currentTarget){this.lozengeGroup.trigger("blur");this.$field.focus()}}}},_renders:{errorMessage:function(){return AJS.$('<div class="error" />')},selectedItemsWrapper:function(){return AJS.$('<div class="representation"></div>')},selectedItemsContainer:function(){return AJS.$('<ul class="items" />')}}});
AJS.IssuePicker=AJS.MultiSelect.extend({_formatResponse:function(response){var ret=[],canonicalBaseUrl=(function(){var uri=AJS.parseUri(window.location);return uri.protocol+"://"+uri.authority})();if(response&&response.sections){AJS.$(response.sections).each(function(i,section){var groupDescriptor=new AJS.GroupDescriptor({weight:i,label:section.label,description:section.sub});if(section.issues&&section.issues.length>0){AJS.$(section.issues).each(function(){groupDescriptor.addItem(new AJS.ItemDescriptor({value:this.key,label:this.key+" - "+this.summaryText,icon:this.img?canonicalBaseUrl+contextPath+this.img:null,html:this.keyHtml+" - "+this.summary}))})}ret.push(groupDescriptor)})}return ret},getAjaxOptions:function(){var ajaxOptions=this._super();if(this.$field.val().length===0){delete ajaxOptions.data.currentJQL}return ajaxOptions},hasUserInputtedOption:function(){return this.$field.val().length!==0},_launchPopup:function(){function getWithDefault(value,def){if(typeof value=="undefined"||value==null){return def}else{return value}}var url,urlParam,vWinUsers,options,instance=this;AJS.$.namespace("jira.issuepicker");jira.issuepicker.callback=function(items){if(typeof items==="string"){items=JSON.parse(items)}instance._addMultipleItems(items,true);instance.$field.focus()};options=this.options.ajaxOptions.data;url=contextPath+"/secure/popups/IssuePicker.jspa?";urlParam={singleSelectOnly:"false",currentIssue:options.currentIssueKey||"",showSubTasks:getWithDefault(options.showSubTasks,false),showSubTasksParent:getWithDefault(options.showSubTaskParent,false)};if(options.currentProjectId){urlParam["currentProjectId"]=options.currentProjectId}url+=AJS.$.param(urlParam);vWinUsers=window.open(url,"IssueSelectorPopup","status=no,resizable=yes,top=100,left=200,width="+this.options.popupWidth+",height="+this.options.popupHeight+",scrollbars=yes,resizable");vWinUsers.opener=self;vWinUsers.focus()},_createFurniture:function(disabled){var $popupLink;this._super(disabled);$popupLink=this._render("popupLink");this._assignEvents("popupLink",$popupLink);this.$container.addClass("hasIcon");$popupLink.appendTo(this.$container)},handleFreeInput:function(){var values=this.$field.val().toUpperCase().match(/\S+/g);if(values){this._addMultipleItems(jQuery.map(values,function(value){return{value:value,label:value}}))}this.$field.val("")},_events:{popupLink:{click:function(e){this._launchPopup();e.preventDefault()}}},_renders:{popupLink:function(){return AJS.$("<a class='issue-picker-popup' />").attr({href:"#",title:this.options.popupLinkMessage}).text(""+this.options.popupLinkMessage+"")}}});
AJS.LabelPicker=AJS.MultiSelect.extend({_getDefaultOptions:function(){return AJS.$.extend(true,this._super(),{ajaxOptions:{url:contextPath+"/includes/js/ajs/layer/labeldata.js",query:true},removeOnUnSelect:true,userEnteredOptionsMsg:AJS.params.labelNew})},isValidItem:function(itemValue){return !/\s/.test(itemValue)},_handleSuggestionResponse:function(data){if(data&&data.token){if(AJS.$.trim(this.$field.val())!==data.token){return}}this._super(data)},_handleDown:function(e){if(!this.suggestionsVisible){this._requestThenResetSuggestions();e.stopPropagation()}},_handleSpace:function(){if(AJS.$.trim(this.$field.val())!==""){if(this.handleFreeInput()){this.hideSuggestions()}}},keys:{space:function(e){this._handleSpace();e.preventDefault()}},_formatResponse:function(data){var optgroup=new AJS.GroupDescriptor({label:AJS.params.frotherSuggestions,type:"optgroup",weight:1,styleClass:"labels-suggested"});if(data&&data.suggestions){AJS.$.each(data.suggestions,function(){optgroup.addItem(new AJS.ItemDescriptor({value:this.label,label:this.label,html:this.html}))})}return[optgroup]},handleFreeInput:function(){var values=AJS.$.trim(this.$field.val()).match(/\S+/g);if(values){for(var value,i=0;value=values[i];i++){this._addItem({value:value,label:value})}this.model.$element.trigger("change")}this.$field.val("")}});
AJS.FlexiPopup=AJS.Control.extend({_getDefaultOptions:function(){return{height:"auto",cached:false,widthClass:"medium",ajaxOptions:{data:{inline:true,decorator:"dialog"}}}},init:function(options){if(typeof options==="string"||options instanceof jQuery){options={trigger:options}}else{if(options&&options.width){options.widthClass="custom"}}this.options=jQuery.extend(true,this._getDefaultOptions(),options);this.options.width=AJS.FlexiPopup.WIDTH_PRESETS[this.options.widthClass]||options.width;if(typeof this.options.content==="function"){this.options.type="builder"}else{if(this.options.content instanceof jQuery||(typeof this.options.content==="object"&&this.options.nodeName)){this.options.type="element"}else{if(!this.options.type&&!this.options.content||(typeof this.options.content==="object"&&this.options.content.url)){this.options.type="ajax"}}}if(this.options.trigger){this._assignEvents("trigger",this.options.trigger)}this.onContentReadyCallbacks=[];this._assignEvents("container",document)},_runContentReadyCallbacks:function(){var that=this;AJS.$.each(this.onContentReadyCallbacks,function(){this.call(that)})},_setContent:function(content,decorate){if(!content){this._contentRetrievers[this.options.type].call(this,this._setContent)}else{if(AJS.FlexiPopup.current===this){var $popup=this.get$popup();this.$content=content;this.get$popupContent().html(content);$popup.addClass("popup-width-"+this.options.widthClass);$popup.css({marginLeft:-9999}).show();if(decorate!==false){if(this.decorateContent){this.decorateContent()}AJS.$(document).trigger("dialogContentReady",[this]);this._runContentReadyCallbacks()}this._positionInCenter();if(decorate!==false){if(AJS.$.isFunction(this.options.onContentRefresh)){this.options.onContentRefresh.call(this)}}AJS.$(".aui-dialog-open").addClass("aui-dialog-content-ready")}else{if(this.options.cached===false){delete this.$content}}}},_handleInitialDoneResponse:function(data,xhr,smartAjaxResult){},_getRequestOptions:function(){var options={};if(this._getAjaxOptionsObject()===false){return false}options=AJS.$.extend(true,options,this._getAjaxOptionsObject());if(!options.url&&this.$activeTrigger){options.url=this.$activeTrigger.attr("href")}return options},_getAjaxOptionsObject:function(){var ajaxOpts=this.options.ajaxOptions;if(AJS.$.isFunction(ajaxOpts)){return ajaxOpts.call(this)}else{return ajaxOpts}},_contentRetrievers:{"element":function(callback){if(!this.$content){this.$content=jQuery(this.options.content).clone(true)}callback.call(this,this.$content)},"builder":function(callback){this.$content=this.options.content.call(this);callback.call(this,this.$content)},"ajax":function(callback){var instance=this,ajaxOptions;if(!this.$content){ajaxOptions=this._getRequestOptions();this._showloadingIndicator();this.serverIsDone=false;ajaxOptions.complete=function(xhr,textStatus,smartAjaxResult){if(smartAjaxResult.successful){var instructions=instance._detectRedirectInstructions(xhr);instance.serverIsDone=instructions.serverIsDone;if(instructions.redirectUrl){instance._performRedirect(instructions.redirectUrl)}else{if(ajaxOptions.dataType&&ajaxOptions.dataType.toLowerCase()==="json"&&instance._buildContentFromJSON){instance.$content=instance._buildContentFromJSON(smartAjaxResult.data)}else{instance.$content=smartAjaxResult.data}if(instance.serverIsDone){instance._handleInitialDoneResponse(smartAjaxResult.data,xhr,smartAjaxResult)}else{instance._hideloadingIndicator();callback.call(instance,instance.$content)}}}else{instance._hideloadingIndicator();var errorContent=jira.ajax.buildDialogErrorContent(smartAjaxResult);callback.call(instance,errorContent)}};jira.ajax.makeRequest(ajaxOptions)}}},_detectRedirectInstructions:function(xhr){var instructions={serverIsDone:false,redirectUrl:""};var doneHeader=xhr.getResponseHeader("X-Atlassian-Dialog-Control");if(doneHeader){instructions.serverIsDone=true;var idx=doneHeader.indexOf("redirect:");if(idx==0){instructions.redirectUrl=doneHeader.substr("redirect:".length)}}return instructions},_performRedirect:function(url){AJS.reloadViaWindowLocation(url)},_renders:{popupHeading:function(){return jQuery("<h2 />").addClass("aui-popup-heading")},popupContent:function(){return jQuery("<div />").addClass("aui-popup-content")},popup:function(){return jQuery("<div />").attr("id",this.options.id||"").addClass("aui-popup").hide()},loadingIndicator:function(){return jQuery("<div />").addClass("aui-loading")}},_events:{"trigger":{click:function(e,item){this.$activeTrigger=item;this.show();e.preventDefault()}},"container":{"keydown":function(e){function calendarClosingBy(e){if(window._dynarch_popupCalendar&&!window._dynarch_popupCalendar.hidden){return true}else{if(e.calendarClosed){return true}else{if(e.originalEvent&&e.originalEvent.calendarClosed){return true}}}return false}if(e.which===jQuery.ui.keyCode.ESCAPE&&!AJS.InlineLayer.current&&!jira.widget.dropdown.current&&!calendarClosingBy(e)){this.handleCancel()}}}},handleCancel:function(){this.hide()},_get$loadingIndicator:function(){if(!AJS.FlexiPopup.$loadingIndicator){AJS.FlexiPopup.$loadingIndicator=this._render("loadingIndicator").css("zIndex",9999).appendTo("body")}return AJS.FlexiPopup.$loadingIndicator},_showloadingIndicator:function(){var instance=this,heightOfSprite=440,currentOffsetOfSprite=0;clearInterval(this.loadingTimer);this._get$loadingIndicator().show();this.loadingTimer=window.setInterval(function(){if(currentOffsetOfSprite===heightOfSprite){currentOffsetOfSprite=0}currentOffsetOfSprite=currentOffsetOfSprite+40;instance._get$loadingIndicator().css("backgroundPosition","0 -"+currentOffsetOfSprite+"px")},50)},_hideloadingIndicator:function(){clearInterval(this.loadingTimer);this._get$loadingIndicator().hide()},_positionInCenter:function(){var $window=AJS.$(window),$popup=this.get$popup(),$heading=$popup.find(".aui-popup-heading"),$container=$popup.find(".content-body"),$footer=$popup.find(".content-footer");var cushion=40;var windowHeight=$window.height();if(typeof this.options.width==="number"){$popup.width(this.options.width)}$popup.css({marginLeft:-$popup.outerWidth()/2,marginTop:Math.max(-$popup.outerHeight()/2,cushion-windowHeight/2)});var top=0;var el=$popup[0];while(el){top+=el.offsetTop;el=el.offsetParent}var popupMaxHeight=windowHeight-top-cushion;var padding=parseInt($container.css("padding-top"),10)+parseInt($container.css("padding-bottom"),10);$container.css("max-height",popupMaxHeight-$heading.outerHeight()-$footer.outerHeight()-padding)},get$popup:function(){if(!this.$popup){this.$popup=this._render("popup").appendTo("body");if(this._supportsBoxShadow()){this.$popup.addClass("box-shadow")}}return this.$popup},get$popupContent:function(){if(!this.$popupContent){this.$popupContent=this._render("popupContent").appendTo(this.get$popup())}return this.$popupContent},get$popupHeading:function(){if(!this.$popupHeading){this.$popupHeading=this._render("popupHeading").prependTo(this.get$popup())}return this.$popupHeading},_watchTab:function(e){var $dialog_selectable,$first_selectable,$last_selectable;if(AJS.$(e.target).parents(this.get$popupContent()).length>0){if(AJS.$.browser.safari){$dialog_selectable=AJS.$(":input:visible:enabled, :checkbox:visible:enabled, :radio:visible:enabled",".aui-popup.aui-dialog-open")}else{$dialog_selectable=AJS.$("a:visible, :input:visible:enabled, :checkbox:visible:enabled, :radio:visible:enabled",".aui-popup.aui-dialog-open")}$first_selectable=$dialog_selectable.first();$last_selectable=$dialog_selectable.last();if((e.target==$first_selectable[0]&&e.shiftKey)||(e.target==$last_selectable[0]&&!e.shiftKey)){if(e.shiftKey){$last_selectable.focus()}else{$first_selectable.focus()}e.preventDefault()}}},show:function(){var myEvent=new AJS.$.Event("beforeShow");if(AJS.FlexiPopup.current===this){return false}AJS.$(this).trigger(myEvent);if(myEvent.result===false){return false}if(AJS.InlineLayer.current){AJS.InlineLayer.current.hide()}if(AJS.dropDown.current){AJS.dropDown.current.hide()}if(AJS.FlexiPopup.current){AJS.FlexiPopup.current.hide(false)}else{AJS.dim(false)}AJS.FlexiPopup.current=this;var $popup=this.get$popup().addClass("aui-dialog-open");if(this.options.type!=="blank"&&!this.$content){this._setContent()}else{$popup.show();this._positionInCenter()}this.tabWatcher=function(e){if(e.keyCode==9){AJS.FlexiPopup.current._watchTab(e)}};AJS.$(document).bind("keydown",this.tabWatcher);AJS.disableKeyboardScrolling()},destroy:function(){this.$popup.remove();delete this.$popup;delete this.$popupContent;delete this.$popupHeading;delete this.$content},hide:function(undim){if(AJS.FlexiPopup.current!==this){return false}var atlToken=AJS.$(".aui-dialog-open  input[name=atl_token]").attr("value");if(atlToken!==undefined){jira.xsrf.updateTokenOnPage(atlToken)}if(this.options.cached===false){this.destroy()}if(undim!==false){AJS.undim()}this.get$popup().removeClass("aui-dialog-open").removeClass("aui-dialog-content-ready").hide();AJS.FlexiPopup.current=null;AJS.$(document).trigger("hideAllLayers");AJS.enableKeyboardScrolling();if(this.tabWatcher){AJS.$(document).unbind("keydown",this.tabWatcher)}},addHeading:function(heading){this.get$popupHeading().html(heading)},onContentReady:function(func){if(AJS.$.isFunction(func)){this.onContentReadyCallbacks.push(func)}}});AJS.popup=function(options,width,id){if(typeof options!=="object"){options={width:arguments[0],height:arguments[1],id:arguments[2]}}var popup=new AJS.FlexiPopup({type:"blank",id:options.id||id,width:options.width,cached:true});return{element:popup.get$popup(),show:function(){popup.show()},hide:function(){popup.hide()},changeSize:function(){popup._positionInCenter()},remove:function(){this.element.remove();this.element=null},disable:function(){},enable:function(){}}};AJS.FlexiPopup.WIDTH_PRESETS={small:360,medium:540,large:810};
AJS.FormPopup=AJS.FlexiPopup.extend({_getDefaultOptions:function(){return AJS.$.extend(this._super(),{autoClose:false,targetUrl:"",handleRedirect:false,onUnSuccessfulSubmit:function(){},onSuccessfulSubmit:function(){},onDialogFinished:function(){if(this._hasTargetUrl()){window.location.href=this._getTargetUrlValue()}else{AJS.reloadViaWindowLocation(window.location.href)}},submitAjaxOptions:{type:"post",data:{inline:true,decorator:"dialog"},dataType:"html"}})},_getFormDataAsObject:function(){var fieldValues={};AJS.$(this.$form.serializeArray()).each(function(){var fieldVal=fieldValues[this.name];if(!fieldVal){fieldVal=this.value}else{if(AJS.$.isArray(fieldVal)){fieldVal.push(this.value)}else{fieldVal=[fieldVal,this.value]}}fieldValues[this.name]=fieldVal});return fieldValues},_getRelativePath:function(){return AJS.parseUri(this.options.url||this.$activeTrigger.attr("href")).directory},_getPath:function(action){var relPath=this._getRelativePath();if(action.indexOf(relPath)==0){return action}else{return relPath+action}},_submitForm:function(e){this.cancelled=false;this.xhr=null;this.redirected=false;this.serverIsDone=false;var instance=this,defaultRequestOptions=AJS.$.extend(true,{},this.options.submitAjaxOptions),requestOptions=AJS.$.extend(true,defaultRequestOptions,{url:this._getPath(this.$form.attr("action")),data:this._getFormDataAsObject(),complete:function(xhr,textStatus,smartAjaxResult){if(!instance.cancelled){if(smartAjaxResult.successful){instance.$form.trigger("fakesubmit");instance._handleServerSuccess(smartAjaxResult.data,xhr,textStatus,smartAjaxResult);if(!instance.redirected){instance._handleSubmitResponse(smartAjaxResult.data,xhr,smartAjaxResult)}}else{instance._handleServerError(xhr,textStatus,smartAjaxResult.errorThrown,smartAjaxResult)}}}});this.xhr=jira.ajax.makeRequest(requestOptions);AJS.$(this.xhr).throbber({target:AJS.$(".throbber",this.get$popupContent())});e.preventDefault()},_handleServerError:function(xhr,textStatus,errorThrown,smartAjaxResult){if(this.options.onUnSuccessfulSubmit){this.options.onUnSuccessfulSubmit.call(xhr,textStatus,errorThrown,smartAjaxResult)}var errorContent=jira.ajax.buildDialogErrorContent(smartAjaxResult,true);var content$=this.get$popupContent().find(".content-body");if(content$.length!==1){content$=this.get$popupContent()}var insertErrMsg=content$.length==1&&!smartAjaxResult.hasData;if(insertErrMsg){content$.prepend(errorContent)}else{this._setContent(errorContent)}},_handleServerSuccess:function(data,xhr,textStatus,smartAjaxResult){var instructions=this._detectRedirectInstructions(xhr);this.serverIsDone=instructions.serverIsDone;if(instructions.redirectUrl){if(this.options.onSuccessfulSubmit){this.options.onSuccessfulSubmit.call(this,data,xhr,textStatus,smartAjaxResult)}this._performRedirect(instructions.redirectUrl)}else{this._setContent(data)}},_handleInitialDoneResponse:function(data,xhr,smartAjaxResult){this._handleSubmitResponse(data,xhr,smartAjaxResult)},_handleSubmitResponse:function(data,xhr,smartAjaxResult){if(this.serverIsDone){if(this.options.onSuccessfulSubmit){this.options.onSuccessfulSubmit.call(this,data,xhr,smartAjaxResult)}if(this.options.autoClose){this.hide()}if(this.options.onDialogFinished){this.options.onDialogFinished.call(this,data,xhr,smartAjaxResult)}}},_performRedirect:function(url){this.hide();this.redirected=true;this._super(url)},_hasTargetUrl:function(){return this._getTargetUrlHolder().length>0},_getTargetUrlHolder:function(){return AJS.$(this.options.targetUrl)},_getTargetUrlValue:function(){return this._getTargetUrlHolder().val()},decorateContent:function(){var instance=this,$formHeading,$buttons,$cancel,$buttonContainer,$closeLink;this.$form=AJS.$("form",this.get$popupContent());$formHeading=AJS.$(":header:first",this.get$popupContent());if($formHeading.length>0){this.addHeading($formHeading.html());$formHeading.hide()}this.$form.submit(function(e){if(instance.$form.trigger("before-submit",[e,instance])){var submitButtons=AJS.$(":submit",instance.$form);submitButtons.attr("disabled","disabled");instance._submitForm(e)}});var issueId=this.$form.find("input[name=id]").val();this.$form.find("input[type=file]").inlineAttach();$cancel=AJS.$(".cancel",this.get$popupContent());$cancel.click(function(e){if(instance.xhr){instance.xhr.abort()}instance.xhr=null;instance.cancelled=true;instance.hide();e.preventDefault()});if(AJS.$.browser.msie){$cancel.focus(function(e){if(e.altKey){$cancel.click()}})}var $popupContent=this.get$popupContent();$buttons=AJS.$(".button",$popupContent);$buttonContainer=AJS.$("div.buttons",$popupContent);if($cancel.length==0&&$buttons.length==0){if($buttonContainer.length==0){$buttonContainer=AJS.$('<div class="buttons-container content-footer"><div class="buttons"/></div>').appendTo($popupContent)}AJS.populateParameters();$closeLink=AJS.$("<a href='#' class='cancel' id='aui-dialog-close'>"+AJS.params.closelink+"</a>");AJS.$($popupContent).find(".buttons").append($closeLink);$closeLink=AJS.$(".cancel",this.get$popupContent());$closeLink.click(function(e){instance.hide();e.preventDefault()})}$buttonContainer.prepend(AJS.$("<span class='icon throbber'/>"));AJS.$(".shortcut-tip-trigger",$popupContent).click(function(e){e.preventDefault();if(!$popupContent.isDirty()||confirm(AJS.params.dirtyDialogMessage)){instance.hide();AJS.$("#keyshortscuthelp").click()}});AJS.$(".svg-icon",this.get$popupContent()).each(AJS.icons.addIcon.init)},_setContent:function(content,decorate){this._super(content,decorate);if(content&&AJS.FlexiPopup.current===this){this._focusFirstField()}},_focusFirstField:function(){var triggerConfig=new jira.setFocus.FocusConfiguration();triggerConfig.context=this.get$popup()[0];if(AJS.$.browser.msie){var $triggerHack=AJS.$(".trigger-hack",triggerConfig.context);if($triggerHack.length===0){AJS.$("<input Class='trigger-hack' type='text' value=''/>").css({position:"absolute",left:"-9000px"}).appendTo(triggerConfig.context)}$triggerHack.focus()}jira.setFocus.pushConfiguration(triggerConfig);jira.setFocus.triggerFocus()},show:function(){if(this._super()===false){return false}},hide:function(undim){if(this._super(undim)===false){return false}jira.setFocus.popConfiguration()}});
AJS.LabelsPopup=AJS.FormPopup.extend((function(){var impl={};impl.init=function(options){this._super(options);this.issueId=null;this.customFieldId=null;this.labelsProvider=this.initLabelsProvider();this.labelPicker=null},impl.initLabelsProvider=function(){if(this.options.labelsProvider&&AJS.$.isFunction(this.options.labelsProvider)){return this.options.labelsProvider}else{if(this.options.labels){return this._getLabelsFromOptions}else{return this._getLabelsFromTrigger}}},impl._getLabelsFromOptions=function(){return AJS.$(this.options.labels)},impl._getLabelsFromTrigger=function(){return this.$activeTrigger.closest(".labels-wrap")},impl.decorateContent=function(){this._super();var $content=this.get$popupContent();this.issueId=$content.find("input[name=id]").val();var $customFieldId=$content.find("input[name=customFieldId]");if($customFieldId.length===1){this.customFieldId=$customFieldId.val()}else{this.customFieldId=null}};impl.focusLabelPicker=function(){this.get$popupContent().find("textarea").focus()};impl.show=function(){if(this._super()){this.focusLabelPicker()}};impl._handleSubmitResponse=function(data,xhr,smartAjaxResult){if(this.serverIsDone){if(this.options.onSuccessfulSubmit){this.options.onSuccessfulSubmit.call(this,data,xhr,smartAjaxResult)}var issueIdVal=this.get$popupContent().find("input[name=id]").val(),noLinkVal=this.get$popupContent().find("input[name=noLink]").val();if(this.options.autoClose){this.hide()}jira.app.issuenavigator.shortcuts.flashIssueRow(this.issueId);var postData={id:issueIdVal,decorator:"inline",noLink:noLinkVal};if(this.customFieldId){postData.customFieldId=this.customFieldId}var instance=this;var $labelsWrap=instance.labelsProvider(this);if($labelsWrap){jQuery(jQuery.ajax({url:contextPath+"/secure/EditLabels!viewLinks.jspa",data:postData,success:function(html){var $newLabelsWrap=jQuery("<div>").html(html).find(".labels-wrap");if(jira.app.issuenavigator.isNavigator()){$newLabelsWrap.find("a.edit-labels").remove()}$labelsWrap.html($newLabelsWrap.html())}})).throbber({target:$labelsWrap})}}};impl.handleCancel=function(){this._super();this.$content=null};return impl})());
jQuery.namespace("jira.widget.dropdown");jira.widget.dropdown=function(){var instances=[];return{addInstance:function(){instances.push(this)},hideInstances:function(){var that=this;jQuery(instances).each(function(){if(that!==this){this.hideDropdown()}})},getHash:function(){if(!this.hash){this.hash={container:this.dropdown,hide:this.hideDropdown,show:this.displayDropdown}}return this.hash},displayDropdown:function(){if(jira.widget.dropdown.current===this){return}this.hideInstances();jira.widget.dropdown.current=this;this.dropdown.css({display:"block"});this.displayed=true;var dd=this.dropdown;setTimeout(function(){var win=jQuery(window);var minScrollTop=dd.offset().top+dd.attr("offsetHeight")-win.height()+10;if(win.scrollTop()<minScrollTop){jQuery("html,body").animate({scrollTop:minScrollTop},300,"linear")}},100)},hideDropdown:function(){if(this.displayed===false){return}jira.widget.dropdown.current=null;this.dropdown.css({display:"none"});this.displayed=false},init:function(trigger,dropdown){var that=this;this.addInstance(this);this.dropdown=jQuery(dropdown);this.dropdown.css({display:"none"});jQuery(document).keydown(function(e){if(e.keyCode===9){that.hideDropdown()}});if(trigger.target){jQuery.aop.before(trigger,function(){if(!that.displayed){that.displayDropdown()}})}else{that.dropdown.css("top",jQuery(trigger).outerHeight()+"px");trigger.click(function(e){if(!that.displayed){that.displayDropdown();e.stopPropagation()}else{that.hideDropdown()}e.preventDefault()})}jQuery(document.body).click(function(){if(that.displayed){that.hideDropdown()}})}}}();jira.widget.dropdown.Standard=function(trigger,dropdown){var that=begetObject(jira.widget.dropdown);that.init(trigger,dropdown);return that};jira.widget.dropdown.Autocomplete=function(trigger,dropdown){var that=begetObject(jira.widget.dropdown);that.init=function(trigger,dropdown){this.addInstance(this);this.dropdown=jQuery(dropdown).click(function(e){e.stopPropagation()});this.dropdown.css({display:"none"});if(trigger.target){jQuery.aop.before(trigger,function(){if(!that.displayed){that.displayDropdown()}})}else{trigger.click(function(e){if(!that.displayed){that.displayDropdown();e.stopPropagation()}})}jQuery(document.body).click(function(){if(that.displayed){that.hideDropdown()}})};that.init(trigger,dropdown);return that};
new function(settings){var $separator=settings.separator||"&";var $spaces=settings.spaces===false?false:true;var $suffix=settings.suffix===false?"":"[]";var $prefix=settings.prefix===false?false:true;var $hash=$prefix?settings.hash===true?"#":"?":"";var $numbers=settings.numbers===false?false:true;jQuery.query=new function(){var is=function(o,t){return o!=undefined&&o!==null&&(!!t?o.constructor==t:true)};var parse=function(path){var m,rx=/\[([^[]*)\]/g,match=/^([^[]+)(\[.*\])?$/.exec(path),base=match[1],tokens=[];while(m=rx.exec(match[2])){tokens.push(m[1])}return[base,tokens]};var set=function(target,tokens,value){var o,token=tokens.shift();if(typeof target!="object"){target=null}if(token===""){if(!target){target=[]}if(is(target,Array)){target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}else{if(is(target,Object)){var i=0;while(target[i++]!=null){}target[--i]=tokens.length==0?value:set(target[i],tokens.slice(0),value)}else{target=[];target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}}}else{if(token&&token.match(/^\s*[0-9]+\s*$/)){var index=parseInt(token,10);if(!target){target=[]}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{if(token){var index=token.replace(/^\s*|\s*$/g,"");if(!target){target={}}if(is(target,Array)){var temp={};for(var i=0;i<target.length;++i){temp[i]=target[i]}target=temp}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{return value}}}return target};var queryObject=function(a){var self=this;self.keys={};if(a.queryObject){jQuery.each(a.get(),function(key,val){self.SET(key,val)})}else{jQuery.each(arguments,function(){var q=""+this;q=q.replace(/^[?#]/,"");q=q.replace(/[;&]$/,"");if($spaces){q=q.replace(/[+]/g," ")}jQuery.each(q.split(/[&;]/),function(){var key=decodeURIComponent(this.split("=")[0]||"");var val=decodeURIComponent(this.split("=")[1]||"");if(!key){return}if($numbers){if(/^[+-]?[0-9]+\.[0-9]*$/.test(val)){val=parseFloat(val)}else{if(/^[+-]?[0-9]+$/.test(val)){val=parseInt(val,10)}}}val=(!val&&val!==0)?true:val;if(val!==false&&val!==true&&typeof val!="number"){val=val}self.SET(key,val)})})}return self};queryObject.prototype={queryObject:true,has:function(key,type){var value=this.get(key);return is(value,type)},GET:function(key){if(!is(key)){return this.keys}var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];while(target!=null&&tokens.length!=0){target=target[tokens.shift()]}return typeof target=="number"?target:target||""},get:function(key){var target=this.GET(key);if(is(target,Object)){return jQuery.extend(true,{},target)}else{if(is(target,Array)){return target.slice(0)}}return target},SET:function(key,val){var value=!is(val)?null:val;var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];this.keys[base]=set(target,tokens.slice(0),value);return this},set:function(key,val){return this.copy().SET(key,val)},REMOVE:function(key){return this.SET(key,null).COMPACT()},remove:function(key){return this.copy().REMOVE(key)},EMPTY:function(){var self=this;jQuery.each(self.keys,function(key,value){delete self.keys[key]});return self},load:function(url){var hash=url.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var search=url.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new queryObject(url.length==search.length?"":search,url.length==hash.length?"":hash)},empty:function(){return this.copy().EMPTY()},copy:function(){return new queryObject(this)},COMPACT:function(){function build(orig){var obj=typeof orig=="object"?is(orig,Array)?[]:{}:orig;if(typeof orig=="object"){function add(o,key,value){if(is(o,Array)){o.push(value)}else{o[key]=value}}jQuery.each(orig,function(key,value){if(!is(value)){return true}add(obj,key,build(value))})}return obj}this.keys=build(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var i=0,queryString=[],chunks=[],self=this;var encode=function(str){str=str+"";if($spaces){str=str.replace(/ /g,"+")}return encodeURIComponent(str)};var addFields=function(arr,key,value){if(!is(value)||value===false){return}var o=[encode(key)];if(value!==true){o.push("=");o.push(encode(value))}arr.push(o.join(""))};var build=function(obj,base){var newKey=function(key){return !base||base==""?[key].join(""):[base,"[",key,"]"].join("")};jQuery.each(obj,function(key,value){if(typeof value=="object"){build(value,newKey(key))}else{addFields(chunks,newKey(key),value)}})};build(this.keys);if(chunks.length>0){queryString.push($hash)}queryString.push(chunks.join($separator));return queryString.join("")}};return new queryObject(location.search,location.hash)}}(jQuery.query||{});
jQuery.namespace("JIRA.ToggleBlock");JIRA.ToggleBlock=Class.extend({getDefautOptions:function(){return{blockSelector:".twixi-block",triggerSelector:".twixi",eventType:"click",collapsedClass:"collapsed",expandedClass:"expanded",cookieName:"jira.toggleblocks.cong.cookie",cookieCollectionName:"twixi-blocks",autoFocusTrigger:true}},_collapseTwixiBlocksFromCookie:function(){var block,val=readFromConglomerateCookie(this.options.cookieName,this.options.cookieCollectionName,"");val=val.replace(/\./g,"\\.");if(/#\w+/.test(val)){block=AJS.$(val);if(block.is(this.options.blockSelector)){if(!this.isPermlink()){block.removeClass(this.options.expandedClass).addClass(this.options.collapsedClass)}}}return this},_updateTwixiBlockIdInCookie:function(blockId){if(!this.isPermlink()){if(!/#\w+/.test(blockId)){return this}var val=readFromConglomerateCookie(this.options.cookieName,this.options.cookieCollectionName,""),blockLength=(","+val+",").indexOf(","+blockId+",")+1;if(blockLength){if(val.indexOf(","+blockId)+1){val=val.replace(","+blockId,"")}else{val=val.replace(blockId,"")}}else{val=val.length?val+","+blockId:blockId}saveToConglomerateCookie(this.options.cookieName,this.options.cookieCollectionName,val)}return this},contract:function(block){block=jQuery(block);if(block.is(this.options.blockSelector)){block.removeClass(this.options.expandedClass).addClass(this.options.collapsedClass);this._updateTwixiBlockIdInCookie("#"+block.attr("id"))}AJS.$(block).trigger("contractBlock");return this},expand:function(block){block=jQuery(block);if(block.is(this.options.blockSelector)){block.removeClass(this.options.collapsedClass).addClass(this.options.expandedClass);this._updateTwixiBlockIdInCookie("#"+block.attr("id"))}AJS.$(block).trigger("expandBlock");return this},toggle:function(twikiBlockChild){var block=AJS.$(twikiBlockChild).closest(this.options.blockSelector);if(!block.hasClass(this.options.collapsedClass)){this.contract(block)}else{this.expand(block)}if(this.options.autoFocusTrigger){block.find(this.options.triggerSelector+":visible").focus()}return this},isPermlink:function(){var queryString=jQuery.query.load(location.href);return(queryString.get("focusedCommentId")!==""||queryString.get("focusedWorklogId")!=="")},addTrigger:function(triggerSelector,eventType){var thisInstance=this,$doc=AJS.$(document),lastMousedown=0;if(triggerSelector){eventType=eventType||"click";if(eventType==="dblclick"){if(document.selection){$doc.delegate(triggerSelector,"dblclick",function(){document.selection.empty()})}else{$doc.delegate(triggerSelector,"mousedown",function(){var now=new Date().getTime(),allowSelection=now-lastMousedown>750;lastMousedown=now;return allowSelection})}}$doc.delegate(triggerSelector,eventType,function(){thisInstance.toggle(this)})}return this},addCallback:function(methodName,callback){jQuery.aop.after({target:this,method:methodName},callback);return this},init:function(options){var thisInstance=this;options=options||{};this.options=jQuery.extend(this.getDefautOptions(),options);AJS.$(document).delegate(this.options.triggerSelector,this.options.eventType,function(e){if(!(thisInstance.options.originalTargetIgnoreSelector&&jQuery(e.originalTarget).is(thisInstance.options.originalTargetIgnoreSelector))){thisInstance.toggle(this);e.preventDefault()}});jQuery(function(){thisInstance._collapseTwixiBlocksFromCookie()})}});
jira.widget.jsonLister=function(options){options=options||{};AJS.$.extend(options,{ajaxOptions:function(){return{url:this.trigger.attr("href"),data:"json=true&decorator=none",dataType:"json"}},formatResults:function(response){var html;AJS.$(response).each(function(){var listElNode=AJS.$("<li>"),linkNode;if(this.groupmarker){listElNode.addClass("groupmarker")}if(this.text&&this.url&&this.url!==""){linkNode=AJS.$("<a>").addClass("item").attr("href",this.url).text(this.text).appendTo(listElNode);if(this.text.length>100){linkNode.css({whiteSpace:"normal",width:400+"px"})}}else{if(this.text){listElNode.addClass("none").text(this.text)}}if(!html){html=AJS.$(listElNode)}else{html=html.add(listElNode)}});return html}});return AJS.dropDown.Ajax.call(this,options)};AJS.$.fn.jsonLister=function(options){return jira.widget.jsonLister.call(this,options)};
jQuery.fn.tooltip=function(){var defaults={activeClass:"active",delay:0.8};return function(options){var tts=[];options=jQuery.extend(defaults,options);this.each(function(){var $this=jQuery(this);$this.extend($this,{showToolTip:function(){if(!$this.hasClass(options.activeClass)){$this.showToolTip.timer=setTimeout(function(){$this.addClass(options.activeClass);if(options.onShow){options.onShow.call($this)}},options.delay*1000)}else{clearTimeout($this.hideToolTip.timer)}},hideToolTip:function(){if(!$this.hasClass(options.activeClass)){clearTimeout($this.showToolTip.timer)}else{$this.hideToolTip.timer=setTimeout(function(){$this.removeClass(options.activeClass);if(options.onHide){options.onHide.call($this)}},options.delay*1000)}}});$this.click(function(){clearTimeout($this.showToolTip.timer);$this.removeClass(options.activeClass);if(options.onHide){options.onHide.call($this)}});$this.hover($this.showToolTip,$this.hideToolTip);tts.push($this)});return jQuery(tts)}}();
jQuery.fn.overlabel=function(){this.each(function(){var label=AJS.$(this).removeClass("overlabel").addClass("overlabel-apply show").click(function(){AJS.$("#"+AJS.$(this).attr("for")).focus()});var field=AJS.$("#"+label.attr("for")).focus(function(){label.removeClass("show").hide()}).blur(function(){if(AJS.$(this).val()===""){label.addClass("show").show()}});if(field.val()!==""){label.removeClass("show").hide()}});return this};
jQuery.fn.toggleField=function(field){var that=this,field=jQuery(field),setFieldAttr=function(){field.attr("disabled",function(){if(that.attr("checked")===false){that.parent().addClass("disabled");return true}else{that.parent().removeClass("disabled");return false}}());return arguments.callee}();jQuery(document[this.attr("name")]).click(setFieldAttr).change(setFieldAttr);return this};
jQuery.fn.setSelectionRange=function(selectionStart,selectionEnd){if(this.length==0){return}if(this[0].setSelectionRange){this[0].focus();this[0].setSelectionRange(selectionStart,selectionEnd)}else{if(this[0].createTextRange){var range=this[0].createTextRange();range.collapse(true);range.moveEnd("character",selectionEnd);range.moveStart("character",selectionStart);range.select()}}},jQuery.fn.setCaretToPosition=function(position){this.setSelectionRange(position,position)};
AJS.$.fn.isDirty=function(){var isClean=true;this.find("form").add(this.filter("form")).each(function(){var initValue=AJS.$.data(this,AJS.DIRTY_FORM_VALUE);return isClean=initValue==null||initValue==AJS.$(this).find(":input[name!=atl_token]").serialize()});return !isClean};(function(){var $doc=AJS.$(document);var excluded=$doc;window.onbeforeunload=function(){if(AJS.$("form").not(excluded).isDirty()&&!AJS.isSelenium()){return AJS.params.dirtyMessage}};$doc.delegate(":input","focus",function(){var theForm=this.form;setTimeout(function(){initForm.call(theForm)},50)});AJS.$(function(){setTimeout(function(){AJS.$("form").each(initForm)},50)});function initForm(){if(AJS.$.data(this,AJS.DIRTY_FORM_VALUE)){return}if(AJS.$(this).is("#jqlform, #quicksearch, #issue-create-quick, #issue-actions-dialog-form, .userpref-form")){return}AJS.$.data(this,AJS.DIRTY_FORM_VALUE,AJS.$(this).find(":input[name!=atl_token]").serialize())}$doc.delegate("*","submit fakesubmit",muteWarnings);$doc.delegate("a.cancel,#cancelButton,#refresh-dependant-fields,form#tabForm table#field_table a","mousedown keydown click",muteWarnings);function muteWarnings(e){excluded=this.form||AJS.$(this).closest("form");if(this.id==="cancelButton"){AJS.$(this).one("click",restoreWarnings)}else{restoreWarnings()}}function restoreWarnings(){setTimeout(function(){excluded=$doc},500)}})();
jQuery.fn.preventBlurFromElements=function(){var elems=jQuery.makeArray(arguments),$fromElement=this;if(jQuery.browser.msie){$fromElement.bind("beforedeactivate",function(e){var blurEvents;if(e.toElement===document.documentElement){blurEvents=$fromElement.data("events").blur;delete $fromElement.data("events").blur;$fromElement.one("blur",function(){$fromElement.focus();window.setTimeout(function(){$fromElement.data("events").blur=blurEvents},0)})}else{jQuery.each(elems,function(){var $elem=jQuery(this);if($elem.has(e.toElement).length===1){e.preventDefault();return false}})}})}else{jQuery.each(elems,function(){this.mousedown(function(e){if(e.target!==$fromElement[0]){e.preventDefault()}})})}};
jQuery.noConflict();jQuery.ajaxSettings.traditional=true;contextPath=typeof contextPath==="undefined"?"":contextPath;(function(){var SPECIAL_CHARS=/[.*+?|^$()[\]{\\]/g;RegExp.escape=function(str){return str.replace(SPECIAL_CHARS,"\\$&")}})();(function($){$.readData=function(s){var r={},n="";$(s).children().each(function(i){if(i%2){r[n]=jQuery.trim($(this).text())}else{n=jQuery.trim($(this).text())}}).remove();$(s).remove();return r}})(jQuery);String.prototype.escapejQuerySelector=function(){return this.replace(/([:.])/g,"\\$1")};AJS.canAccessIframe=function(iframe){var $iframe=AJS.$(iframe);return !/^(http|https):\/\//.test($iframe.attr("src"))||(AJS.params.baseURL&&(AJS.$.trim($iframe.attr("src")).indexOf(AJS.params.baseURL)===0))};jQuery.aop.after({target:jQuery,method:"append"},function(elem){var iframes;if(elem.attr("tagName")==="iframe"&&AJS.canAccessIframe(elem)){if(!elem.data("iframeAppendedFired")){elem.data("iframeAppendedFired",true);jQuery(document).trigger("iframeAppended",elem)}}iframes=jQuery("iframe",elem);if(iframes.length>0){jQuery.each(iframes,function(i){var iframe=iframes.eq(i);if(!iframe.data("iframeAppendedFired")&&AJS.canAccessIframe(iframe)){iframe.data("iframeAppendedFired",true);jQuery(document).trigger("iframeAppended",iframe)}})}return elem});AJS.isSelenium=function(){var detectOn=function(obj){for(var propName in obj){if(propName.indexOf("selenium")!=-1){return true}}return false};return detectOn(window.location)||detectOn(window)};(function(){function preventScrolling(e){var keyCode=e.keyCode,keys=AJS.$.ui.keyCode;if(!jQuery(e.target).is("textarea, :text, select")&&(keyCode===keys.DOWN||keyCode===keys.UP||keyCode===keys.LEFT||keyCode===keys.RIGHT)){e.preventDefault()}}AJS.disableKeyboardScrolling=function(){AJS.$(document).bind("keypress keydown",preventScrolling)};AJS.enableKeyboardScrolling=function(){AJS.$(document).unbind("keypress keydown",preventScrolling)}})();AJS.reloadViaWindowLocation=function(url){var windowReload=function(){window.location.reload()};url=url||window.location.href;if(AJS.isSelenium()){windowReload()}else{var makeHashUrlsUnique=function(url){var MAGIC_PARAM="jwupdated";var hashIndex=url.indexOf("#");if(hashIndex==-1){return url}var secondsSinceMidnight=function(){var now=new Date();var midnight=new Date(now.getFullYear(),now.getMonth(),now.getDate(),0,0,0,0);var secs=(now.getTime()-midnight.getTime())/1000;return Math.max(Math.floor(secs),1)};var firstQuestionMark=url.indexOf("?");var magicParamValue=MAGIC_PARAM+"="+secondsSinceMidnight();if(firstQuestionMark==-1){url=url.replace("#","?"+magicParamValue+"#")}else{if(url.indexOf(MAGIC_PARAM+"=")!=-1){url=url.replace(/(jwupdated=[0-9]+)/,magicParamValue)}else{url=url.replace("?","?"+magicParamValue+"&")}}return url};url=makeHashUrlsUnique(url);if(jQuery.browser.webkit&&parseInt(jQuery.browser.version)<533){window.location=url}else{window.location.replace(url)}}};AJS.extractBodyFromResponse=function(text){var fragment=text.match(/<body[^>]*>([\S\s]*)<\/body[^>]*>/);if(fragment&&fragment.length>0){return fragment[1]}return text};(function(){var SPECIAL_CHARS=/[&"<]/g;AJS.escapeHTML=function(str){return str.replace(SPECIAL_CHARS,replacement)};function replacement(specialChar){switch(specialChar){case"<":return"&lt;";case"&":return"&amp;";default:return"&quot;"}}})();tryIt=function(f,defaultVal){try{return f()}catch(ex){return defaultVal}};begetObject=function(obj){var f=function(){};f.prototype=obj;return new f()};function submitOnEnter(e){if(e.keyCode==13&&e.target.form&&!e.ctrlKey&&!e.shiftKey){jQuery(e.target.form).submit();return false}return true}function submitOnCtrlEnter(e){if(e.ctrlKey&&e.target.form&&(e.keyCode==13||e.keyCode==10)){jQuery(e.target.form).submit();return false}return true}function getMultiSelectValues(selectObject){var selectedValues="";for(var i=0;i<selectObject.length;i++){if(selectObject.options[i].selected){if(selectObject.options[i].value&&selectObject.options[i].value.length>0){selectedValues=selectedValues+" "+selectObject.options[i].value}}}return selectedValues}function getMultiSelectValuesAsArray(selectObject){var selectedValues=new Array();for(var i=0;i<selectObject.length;i++){if(selectObject.options[i].selected){if(selectObject.options[i].value&&selectObject.options[i].value.length>0){selectedValues[selectedValues.length]=selectObject.options[i].value}}}return selectedValues}function arrayContains(array,value){for(var i=0;i<array.length;i++){if(array[i]==value){return true}}return false}function addClassName(elementId,classNameToAdd){var elem=document.getElementById(elementId);if(elem){elem.className=elem.className+" "+classNameToAdd}}function removeClassName(elementId,classNameToRemove){var elem=document.getElementById(elementId);if(elem){elem.className=(" "+elem.className+" ").replace(" "+classNameToRemove+" "," ")}}function getEscapedFieldValue(id){var e=document.getElementById(id);if(e.value){return id+"="+encodeURIComponent(e.value)}else{return""}}function getEscapedFieldValues(ids){var s="";for(var i=0;i<ids.length;i++){s=s+"&"+getEscapedFieldValue(ids[i])}return s}var GuiPrefs={toggleVisibility:function(elementId){var elem=document.getElementById(elementId);if(elem){if(readFromConglomerateCookie("jira.conglomerate.cookie",elementId,"1")=="1"){elem.style.display="none";removeClassName(elementId+"header","headerOpened");addClassName(elementId+"header","headerClosed");saveToConglomerateCookie("jira.conglomerate.cookie",elementId,"0")}else{elem.style.display="";removeClassName(elementId+"header","headerClosed");addClassName(elementId+"header","headerOpened");eraseFromConglomerateCookie("jira.conglomerate.cookie",elementId)}}}};function toggle(elementId){GuiPrefs.toggleVisibility(elementId)}function toggleDivsWithCookie(elementShowId,elementHideId){var elementShow=document.getElementById(elementShowId);var elementHide=document.getElementById(elementHideId);if(elementShow.style.display=="none"){elementHide.style.display="none";elementShow.style.display="block";saveToConglomerateCookie("jira.viewissue.cong.cookie",elementShowId,"1");saveToConglomerateCookie("jira.viewissue.cong.cookie",elementHideId,"0")}else{elementShow.style.display="none";elementHide.style.display="block";saveToConglomerateCookie("jira.viewissue.cong.cookie",elementHideId,"1");saveToConglomerateCookie("jira.viewissue.cong.cookie",elementShowId,"0")}}function restoreDivFromCookie(elementId,cookieName,defaultValue){if(defaultValue==null){defaultValue="1"}var elem=document.getElementById(elementId);if(elem){if(readFromConglomerateCookie(cookieName,elementId,defaultValue)!="1"){elem.style.display="none";removeClassName(elementId+"header","headerOpened");addClassName(elementId+"header","headerClosed")}else{elem.style.display="";removeClassName(elementId+"header","headerClosed");addClassName(elementId+"header","headerOpened")}}}function restore(elementId){restoreDivFromCookie(elementId,"jira.conglomerate.cookie","1")}function saveToConglomerateCookie(cookieName,name,value){var cookieValue=getCookieValue(cookieName);cookieValue=addOrAppendToValue(name,value,cookieValue);saveCookie(cookieName,cookieValue,365)}function readFromConglomerateCookie(cookieName,name,defaultValue){var cookieValue=getCookieValue(cookieName);var value=getValueFromCongolmerate(name,cookieValue);if(value!=null){return value}return defaultValue}function eraseFromConglomerateCookie(cookieName,name){saveToConglomerateCookie(cookieName,name,"")}function getValueFromCongolmerate(name,cookieValue){if(cookieValue==null){cookieValue=""}var eq=name+"=";var cookieParts=cookieValue.split("|");for(var i=0;i<cookieParts.length;i++){var cp=cookieParts[i];while(cp.charAt(0)==" "){cp=cp.substring(1,cp.length)}if(cp.indexOf(name)==0){return cp.substring(eq.length,cp.length)}}return null}function addOrAppendToValue(name,value,cookieValue){var newCookieValue="";if(cookieValue==null){cookieValue=""}var cookieParts=cookieValue.split("|");for(var i=0;i<cookieParts.length;i++){var cp=cookieParts[i];if(cp!=""){while(cp.charAt(0)==" "){cp=cp.substring(1,cp.length)}if(cp.indexOf(name)!=0){newCookieValue+=cp+"|"}}}if(value!=null&&value!=""){var pair=name+"="+value;if((newCookieValue.length+pair.length)<4020){newCookieValue+=pair}}return newCookieValue}function getCookieValue(name){var eq=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(eq)==0){return unescape(c.substring(eq.length,c.length))}}return null}function saveCookie(name,value,days){if(typeof contextPath==="undefined"){return}var path=contextPath;if(!path){path="/"}var ex;if(days){var d=new Date();d.setTime(d.getTime()+(days*24*60*60*1000));ex="; expires="+d.toGMTString()}else{ex=""}document.cookie=name+"="+escape(value)+ex+";path="+path}function readCookie(name,defaultValue){var cookieVal=getCookieValue(name);if(cookieVal!=null){return cookieVal}if(defaultValue){saveCookie(name,defaultValue,365);return defaultValue}else{return null}}function eraseCookie(name){saveCookie(name,"",-1)}function recolourSimpleTableRows(tableId){recolourTableRows(tableId,"rowNormal","rowAlternate",tableId+"_empty")}function recolourTableRows(tableId,rowNormal,rowAlternate,emptyTableId){var tbl=document.getElementById(tableId);var emptyTable=document.getElementById(emptyTableId);var alternate=false;var rowsFound=0;var rows=tbl.rows;var firstVisibleRow=null;var lastVisibleRow=null;if(AJS.$(tbl).hasClass("aui")){rowNormal="";rowAlternate="zebra"}for(var i=1;i<rows.length;i++){var row=rows[i];if(row.style.display!="none"){if(!alternate){row.className=rowNormal}else{row.className=rowAlternate}rowsFound++;alternate=!alternate}if(row.style.display!="none"){if(firstVisibleRow==null){firstVisibleRow=row}lastVisibleRow=row}}if(firstVisibleRow!=null){firstVisibleRow.className=firstVisibleRow.className+" first-row"}if(lastVisibleRow!=null){lastVisibleRow.className=lastVisibleRow.className+" last-row"}if(emptyTable){if(rowsFound==0){tbl.style.display="none";emptyTable.style.display=""}else{tbl.style.display="";emptyTable.style.display="none"}}}function htmlEscape(str){var divE=document.createElement("div");divE.appendChild(document.createTextNode(str));return divE.innerHTML}function atl_token(){return jQuery("#atlassian-token").attr("content")}function openDateRangePicker(formName,previousFieldName,nextFieldName,fieldId){var previousFieldValue=document.forms[formName].elements[previousFieldName].value;var nextFieldValue=document.forms[formName].elements[nextFieldName].value;var url=contextPath+"/secure/popups/DateRangePicker.jspa?";url+="formName="+formName+"&";url+="previousFieldName="+escape(previousFieldName)+"&";url+="nextFieldName="+escape(nextFieldName)+"&";url+="previousFieldValue="+escape(previousFieldValue)+"&";url+="nextFieldValue="+escape(nextFieldValue)+"&";url+="fieldId="+escape(fieldId);var vWinUsers=window.open(url,"DateRangePopup","status=no,resizable=yes,top=100,left=200,width=580,height=400,scrollbars=yes");vWinUsers.opener=self;vWinUsers.focus()}function show_calendar2(formName,fieldName){var form=document.forms[formName];var element=form.elements[fieldName];var vWinCal=window.open(contextPath+"/secure/popups/Calendar.jspa?form="+formName+"&field="+fieldName+"&value="+escape(element.value)+"&decorator=none","Calendar","width=230,height=170,status=no,resizable=yes,top=220,left=200");vWinCal.opener=self;vWinCal.focus()}jQuery.namespace("jira.app.ready");jira.app.ready=function(func){jQuery(document).ready(func)};jQuery(function(){AJS.$("label.overlabel").overlabel()});AJS.$(function(){AJS.$(".fieldTabs li").click(function(e){e.preventDefault();e.stopPropagation();var $this=AJS.$(this);if(!$this.hasClass("active")){AJS.$(".fieldTabs li.active").removeClass("active");$this.addClass("active");AJS.$(".fieldTabArea.active").removeClass("active");AJS.$("#"+$this.attr("rel")).addClass("active")}})});jQuery(function(){var $issueNav=jQuery("div.results"),$issueNavWrapWidth=$issueNav.width();$issueNav.bind("resultsWidthChanged",function(){var $issueNavWrap=jQuery(this);$issueNavWrap.css("width",100/$issueNavWrapWidth*($issueNavWrapWidth-(parseInt(jQuery(document.documentElement).attr("scrollWidth"),10)-jQuery(window).width()))+"%")});jQuery(window).resize(function(){$issueNav.trigger("resultsWidthChanged")});$issueNav.trigger("resultsWidthChanged")});jQuery(function(){var actionTwixi;actionTwixi=new JIRA.ToggleBlock({blockSelector:".twixi-block",cookieCollectionName:"twixi"}).addCallback("toggle",function(){jQuery("#stalker").trigger("stalkerHeightUpdated")}).addTrigger(".action-details","dblclick");new JIRA.ToggleBlock({blockSelector:".inverted-twixi-block",collapsedClass:"expanded",expandedClass:"collapsed",cookieCollectionName:"inverted-twixi"}).addCallback("toggle",function(){jQuery("#stalker").trigger("stalkerHeightUpdated")});new JIRA.ToggleBlock({blockSelector:"#issue-filter .toggle-wrap:not(#navigator-filter-subheading-textsearch-group)",triggerSelector:".toggle-trigger",collapsedClass:"expanded",expandedClass:"collapsed",cookieCollectionName:"navSimpleSearch"});new JIRA.ToggleBlock({blockSelector:"#navigator-filter-subheading-textsearch-group",triggerSelector:".toggle-trigger",cookieCollectionName:"navSimpleSearchText"});AJS.$("#issue-filter .error").parents(".toggle-wrap").removeClass("collapsed").addClass("expanded");new JIRA.ToggleBlock({blockSelector:"#queryBoxTable.toggle-wrap",triggerSelector:".toggle-trigger",cookieCollectionName:"navAdvanced"})});AJS.$(function(){AJS.$("#log-work-adjust-estimate-new-value,#log-work-adjust-estimate-manual-value").attr("disabled","disabled");AJS.$("#log-work-adjust-estimate-"+AJS.$("input[name=worklog_adjustEstimate]:checked,input[name=adjustEstimate]:checked").val()+"-value").removeAttr("disabled");AJS.$("input[name=worklog_adjustEstimate],input[name=adjustEstimate]").change(function(){AJS.$("#log-work-adjust-estimate-new-value,#log-work-adjust-estimate-manual-value").attr("disabled","disabled");AJS.$("#log-work-adjust-estimate-"+AJS.$(this).val()+"-value").removeAttr("disabled")})});AJS.$(function(){var radio=AJS.$("input:checked");if(radio.length!==0){if(radio.attr("id")==="forgot-login-rb-forgot-password"){AJS.$("#username,#password").addClass("hidden");AJS.$("#password").removeClass("hidden")}else{if(radio.attr("id")==="forgot-login-rb-forgot-username"){AJS.$("#username,#password").addClass("hidden");AJS.$("#username").removeClass("hidden")}}}AJS.$("#forgot-login-rb-forgot-password").change(function(){AJS.$("#username,#password").addClass("hidden");AJS.$("#password").removeClass("hidden")});AJS.$("#forgot-login-rb-forgot-username").change(function(){AJS.$("#username,#password").addClass("hidden");AJS.$("#username").removeClass("hidden")})});AJS.$(function(){AJS.$("input.upfile").each(function(){var input=AJS.$(this),container=input.closest(".field-group");input.change(function(){if(input.val().length>0){container.next(".field-group").removeClass("hidden")}})});new AJS.IssuePicker({element:AJS.$("#linkKey"),userEnteredOptionsMsg:AJS.params.enterIssueKey,uppercaseUserEnteredOnSelect:true})});jQuery(function(){new JIRA.ToggleBlock({blockSelector:"#iss-wrap",triggerSelector:"a.toggle-lhc",collapsedClass:"lhc-collapsed",cookieCollectionName:"lhc-state",autoFocusTrigger:false});new AJS.SecurityLevelMenu(jQuery("#commentLevel"));AJS.$("#iss-wrap").bind("contractBlock expandBlock",function(){jQuery(".results").trigger("resultsWidthChanged")})});
AJS.$(function(){AJS.DropDown.create({trigger:".issue-actions-trigger",ajaxOptions:{dataType:"json",cache:false,formatSuccess:jira.app.fragments.issueActionsFragment}});AJS.$("#navigator-options").find(".aui-dd-parent").dropDown("Standard",{trigger:"a.aui-dd-link"});AJS.$("div.command-bar").find(".aui-dd-parent").dropDown("Standard",{trigger:"a.drop"});AJS.$("#dashboard").find(".aui-dd-parent").dropDown("Standard",{trigger:"a.aui-dd-link"});AJS.$("#main-nav").find("a.aui-dd-link").linkedMenu({reflectFocus:"#main-nav .lnk",onFocusRemoveClass:"#main-nav .selected"});AJS.$("#navigator-options").find("a.aui-dd-link").linkedMenu()});jQuery(function(){jQuery("textarea").keypress(submitOnCtrlEnter)});jQuery(function(){var $jql=jQuery("#jqltext");if($jql.length===1){$jql.unbind("keypress",submitOnCtrlEnter).keypress(submitOnEnter)}});jQuery(function(){var $warning=AJS.$("#browser-warning");AJS.$(".icon-close",$warning).click(function(){$warning.slideUp("fast");saveCookie("UNSUPPORTED_BROWSER_WARNING","handled")})});jQuery(function(){AJS.$("form").submit(function(event){AJS.$(this).trigger("before-submit",event)})});jQuery(function(){jQuery("form").handleAccessKeys();jQuery(document).bind("dialogContentReady",function(){jQuery("form",this.$content).handleAccessKeys({selective:false})})});AJS.$(function($){var $document=$(document),selector="#comment, #environment, #description",maxTextareaHeight=200;$document.bind("tabSelect",function(e,data){data.pane.find(selector).expandOnInput()});$(selector).expandOnInput(maxTextareaHeight);$document.bind("dialogContentReady",function(e,dialog){dialog.get$popupContent().bind("tabSelect",function(e,data){data.pane.find(selector).expandOnInput(maxTextareaHeight)}).find(selector).expandOnInput(maxTextareaHeight)});$document.bind("showWikiInput",function(e,$container){$container.find(selector).expandOnInput()})});AJS.$(function(){var $auiForm=AJS.$("form.aui");AJS.$("#stqcform input:file").inlineAttach();AJS.$(".file-input-list input:file",$auiForm).inlineAttach();var $cancel=AJS.$("a.cancel",$auiForm);if(AJS.$.browser.msie&&$cancel.attr("accessKey")){$cancel.focus(function(e){if(e.altKey){AJS.$(this).mousedown();window.location.href=$cancel.attr("href")}})}});AJS.$(function(){var checkRow=function(input){AJS.$(input).closest(".availableActionRow").find("td:first :checkbox").attr("checked",true)};var $rows=AJS.$("#availableActionsTable tr.availableActionRow");$rows.children("td:last-child").find(":input").change(function(e){checkRow(this)})});
(function($){$.namespace("jira.app.attachments.screenshot");var screenshot=jira.app.attachments.screenshot;screenshot.openWindow=function(url){if(AJS.FlexiPopup.current){AJS.FlexiPopup.current.hide()}if(AJS.InlineLayer.current){AJS.InlineLayer.current.hide()}window.open(url,"screenshot","width=800,height=700,scrollbars=yes,status=yes");return false};screenshot.ScreenshotWindow=function(options){AJS.$(options.trigger).live("click",function(e){e.preventDefault();screenshot.openWindow(AJS.$(this).attr("href"))})}})(AJS.$);
AJS.$(function(){var helpDialog=new AJS.FormPopup({id:"keyboard-shortcuts-dialog",trigger:"#keyshortscuthelp",widthClass:"large",onContentRefresh:function(){var context=this.get$popupContent();AJS.$("a.submit-link",context).click(function(e){e.preventDefault();AJS.$("form",context).submit()})}});if(document.getElementById("dashboard")){var deleteDashboardDialog=new AJS.FormPopup({type:"ajax"});AJS.$(document).delegate("#delete_dashboard","click",function(e){e.stopPropagation();e.preventDefault();deleteDashboardDialog.$activeTrigger=AJS.$("#delete_dashboard");deleteDashboardDialog.init({type:"ajax",id:"delete-dshboard",ajaxOptions:{url:deleteDashboardDialog.$activeTrigger.attr("href")},targetUrl:"input[name=targetUrl]"});deleteDashboardDialog.show()});return}JIRA.DIALOGS={linkIssue:new AJS.FormPopup({id:"link-issue-dialog",trigger:"a.issueaction-link-issue",ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_linked",onContentRefresh:function(){var context=this.get$popupContent(),issuePicker=new AJS.IssuePicker({element:AJS.$("#linkKey",context),userEnteredOptionsMsg:AJS.params.enterIssueKey,uppercaseUserEnteredOnSelect:true});jQuery(".overflow-ellipsis").textOverflow();applyCommentControls(context)}}),deleteIssue:new AJS.FormPopup({id:"delete-issue-dialog",trigger:"a.issueaction-delete-issue",targetUrl:"#delete-issue-return-url",ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_deleted",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow()}}),cloneIssue:new AJS.FormPopup({id:"clone-issue-dialog",trigger:"a.issueaction-clone-issue",handleRedirect:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_cloned",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow();applyCommentControls(this.get$popupContent())}}),assignIssue:new AJS.FormPopup({id:"assign-dialog",trigger:"a.issueaction-assign-issue",ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_assigned",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow();var context=this.get$popupContent();applyCommentControls(context);jira.app.issueoperations.wireAssignToMeLink(context)}}),logWork:new AJS.FormPopup({id:"log-work-dialog",trigger:"a.issueaction-log-work",handleRedirect:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_worklogged",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow();var context=this.get$popupContent(),logWorkSelector="#log-work-adjust-estimate-new-value, #log-work-adjust-estimate-manual-value";applyCommentControls(context);applyLogworkControls(context)}}),attachFile:new AJS.FormPopup({id:"attach-file-dialog",trigger:"a.issueaction-attach-file",handleRedirect:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_attached",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow();var context=this.get$popupContent();applyCommentControls(context)}}),attachScreenshot:new jira.app.attachments.screenshot.ScreenshotWindow({id:"attach-screenshot-window",trigger:"a.issueaction-attach-screenshot"}),comment:new AJS.FormPopup({id:"comment-add-dialog",trigger:":not(.ops) > * > a.issueaction-comment-issue",handleRedirect:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_commented",onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow();applyCommentControls(this.get$popupContent())}}),editLabels:new AJS.LabelsPopup({id:"edit-labels-dialog",trigger:"a.issueaction-edit-labels,a.edit-labels",autoClose:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_labelled",labelsProvider:labelsProvider,onContentRefresh:function(){jQuery(".overflow-ellipsis").textOverflow()}}),keyboardShortcuts:helpDialog};function getAjaxOptions(){var $focusRow=jira.app.issuenavigator.get$focusedRow();var linkIssueURI=this.options.url||this.$activeTrigger.attr("href");if(/id=\{0\}/.test(linkIssueURI)){if(!$focusRow.length){return false}else{linkIssueURI=linkIssueURI.replace(/(id=\{0\})/,"id="+$focusRow.attr("rel"))}}if(jira.app.issuenavigator.isNavigator()){var result=/[?&]id=([0-9]+)/.exec(linkIssueURI);this.issueId=result&&result.length==2?result[1]:null;if(this.issueId!==$focusRow.attr("rel")){jira.app.issuenavigator.shortcuts.focusRow(this.issueId);$focusRow=jira.app.issuenavigator.get$focusedRow()}this.issueKey=jira.app.issuenavigator.getSelectedIssueKey()}return{data:{decorator:"dialog",inline:"true"},url:linkIssueURI}}function storeCurrentIssueIdOnSucessfulSubmit(){if(jira.app.issuenavigator.isNavigator()){var issueId=this.issueId;var issueKey=this.issueKey;if(!issueId){issueId=jira.app.issuenavigator.getSelectedIssueId();issueKey=jira.app.issuenavigator.getSelectedIssueKey()}if(issueId){var sessionStorge=jira.app.session.storage;sessionStorge.setItem("selectedIssueId",issueId);sessionStorge.setItem("selectedIssueKey",issueKey);sessionStorge.setItem("selectedIssueMsg",this.options.issueMsg)}}this.issueId=null;this.issueKey=null}function applyCommentControls(context){new AJS.SecurityLevelMenu(AJS.$("#commentLevel",context));var wikiRenders=jQuery(".wiki-js-prefs",context);wikiRenders.each(function(){jira.app.wikiPreview(this,context).init()})}function applyLogworkControls(context){jQuery("#log-work-adjust-estimate-new-value, #log-work-adjust-estimate-manual-value",context).attr("disabled","disabled");jQuery("#log-work-adjust-estimate-"+jQuery("input[name=worklog_adjustEstimate]:checked,input[name=adjustEstimate]:checked",context).val()+"-value",context).removeAttr("disabled");jQuery("input[name=worklog_adjustEstimate],input[name=adjustEstimate]",context).change(function(){jQuery("#log-work-adjust-estimate-new-value,#log-work-adjust-estimate-manual-value",context).attr("disabled","disabled");jQuery("#log-work-adjust-estimate-"+jQuery(this).val()+"-value",context).removeAttr("disabled")});AJS.$(function(){AJS.$(context).find("#log-work-activate").change(function(){AJS.$(context).find("#worklog-logworkcontainer").toggleClass("hidden");if(AJS.$(context).find("#worklog-timetrackingcontainer").size()>0){AJS.$(context).find("#worklog-timetrackingcontainer").toggleClass("hidden")}})})}function labelsProvider(labelsPopup){var $trigger=labelsPopup.$activeTrigger,$labelsContainer=$trigger.closest(".labels-wrap"),isSubtaskForm=$trigger.parents("#view-subtasks").length!==0;if(isSubtaskForm){$labelsContainer=$trigger.parents("tr").find(".labels-wrap")}else{if($trigger.hasClass("issueaction-edit-labels")){if(jira.app.issuenavigator.isNavigator()){$labelsContainer=jQuery("#issuetable tr.issuerow.focused td.labels .labels-wrap")}else{$labelsContainer=jQuery("#wrap-labels .labels-wrap")}}}if($labelsContainer.length>0){return $labelsContainer}return false}AJS.$.each(JIRA.DIALOGS,function(name,dialog){if(dialog instanceof AJS.FlexiPopup){AJS.$(dialog).bind("beforeShow",function(e){if(this!=JIRA.DIALOGS.keyboardShortcuts){return jira.app.issuenavigator.isRowSelected()||jira.app.issue.getIssueId()!==undefined}})}});AJS.$(document).delegate("a.issueaction-workflow-transition","click",function(event){event.preventDefault();var action=/action=(\d+)/.exec(this.href.slice(this.href.indexOf("?")));if(action){var id="workflow-transition-"+action[1]+"-dialog";var $trigger=AJS.$(this);if(!JIRA.DIALOGS[id]){JIRA.DIALOGS[id]=new AJS.FormPopup({id:id,url:$trigger.attr("href"),trigger:'a[href*="'+action[0]+'"].issueaction-workflow-transition',widthClass:"large",handleRedirect:true,ajaxOptions:getAjaxOptions,onSuccessfulSubmit:storeCurrentIssueIdOnSucessfulSubmit,issueMsg:"thanks_issue_transitioned",onContentRefresh:function(){var context=this.get$popupContent();AJS.tabs.setup();applyCommentControls(context);jira.app.issueoperations.wireAssignToMeLink(context);applyLogworkControls(context)}});JIRA.DIALOGS[id].show()}}})});
jira.app.userhover=function(context){AJS.$("a.user-hover",context).bind({"mouseenter":function(){var trigger=this,options=jira.app.userhover.INLINE_DIALOG_OPTIONS,control=AJS.$.data(trigger,"AJS.InlineDialog")||AJS.$.data(trigger,"AJS.InlineDialog",{});control.hasUserAttention=true;clearTimeout(control.timerId);control.timerId=setTimeout(function(){if(control.show){control.show()}else{var $trigger=AJS.$(trigger),$popup=AJS.InlineDialog($trigger,"user-hover-dialog-"+new Date().getTime(),function($contents,control,show){jira.app.userhover.fetchDialogContents($contents,$trigger,show)},options);$popup.show();$popup.find(".contents").bind({"mouseenter":function(){control.hasUserAttention=true},"mouseleave":function(){$trigger.mouseleave()}});control.show=$popup.show;control.hide=$popup.hide}},options.showDelay)},"mouseleave":function(){var control=AJS.$.data(this,"AJS.InlineDialog");control.hasUserAttention=false;clearTimeout(control.timerId);if(control.hide){control.timerId=setTimeout(function(){if(!control.hasUserAttention){if(AJS.dropDown.current){AJS.dropDown.current.hide()}control.hide()}},jira.app.userhover.INLINE_DIALOG_OPTIONS.showDelay)}}})};jira.app.userhover.INLINE_DIALOG_OPTIONS={urlPrefix:contextPath+"/secure/ViewUserHover!default.jspa?decorator=none&username=",showDelay:400,closeOthers:false,noBind:true,hideCallback:function(){if(AJS.dropDown.current&&AJS.$(AJS.dropDown.current.trigger).parents(".aui-inline-dialog").length>0){AJS.dropDown.current.hide()}}};jira.app.userhover.fetchDialogContents=function($contents,$trigger,firstShow){var trigger=$trigger[0],options=jira.app.userhover.INLINE_DIALOG_OPTIONS,control=AJS.$.data(trigger,"AJS.InlineDialog");if(!control.hasContent){control.hasContent=true;AJS.$.get(options.urlPrefix+$trigger.attr("rel"),function(html){if(control.hasUserAttention){firstShow()}else{var show=control.show;control.show=function(){firstShow();control.show=show}}$contents.html(html);$contents.css("overflow","visible");$contents.find(".aui-dd-parent").dropDown("Standard",{trigger:".aui-dd-link"});$contents.bind("click",options.hideCallback)})}};AJS.$(function(){jira.app.userhover(document.body)});
jQuery.namespace("jira.app.issueActionsPopup");AJS.IssueActionsPopup=AJS.FlexiPopup.extend({_getDefaultOptions:function(){return AJS.$.extend(this._super(),{cached:false,id:"issue-actions-dialog",widthClass:"small"})},_setContent:function(content,decorate){if(content){this._super(content,decorate)}else{this._super(AJS.$(["<form id='issue-actions-dialog-form' class='aui'>","<div class='content-body'>","<div id='issueactions-suggestions' class='aui-list' />","<div class='description'>",AJS.params.issueActionsHint,"</div>","</div>","</form>"].join("")),true)}if(AJS.FlexiPopup.current===this){var triggerConfig=new jira.setFocus.FocusConfiguration();triggerConfig.context=this.get$popup()[0];triggerConfig.parentElementSelectors=[".content-body"];jira.setFocus.pushConfiguration(triggerConfig);jira.setFocus.triggerFocus()}},_formatActionsResponse:function(response){function addSelected(issueId){var url=window.location.href,newUrl=url;if(/selectedIssueId=[0-9]*/.test(url)){newUrl=newUrl.replace(/selectedIssueId=[0-9]*/g,"selectedIssueId="+issueId)}else{if(jira.app.issuenavigator.isNavigator()){if(/\?/.test(url)){newUrl=newUrl+"&"}else{newUrl=newUrl+"?"}newUrl=newUrl+"selectedIssueId="+issueId}}return encodeURIComponent(newUrl)}function formatWorkflowResponse(workflowResponse){var workflows=new AJS.GroupDescriptor({label:AJS.params.workflow});AJS.$(workflowResponse).each(function(){workflows.addItem(new AJS.ItemDescriptor({href:contextPath+"/secure/WorkflowUIDispatcher.jspa?id="+response.id+"&action="+this.action+"&atl_token="+response.atlToken+"&returnUrl="+addSelected(response.id),label:this.name,styleClass:"issueaction-workflow-transition"}))});return workflows}function formatOperationResonse(operationsResponse){var operations=new AJS.GroupDescriptor({label:AJS.params.actions});AJS.$(operationsResponse).each(function(){var _returnUrl;if(this.name==="Clone"){if(jira.app.issuenavigator.isNavigator()){_returnUrl=addSelected(response.id)}else{_returnUrl=""}}else{_returnUrl=addSelected(response.id)}operations.addItem(new AJS.ItemDescriptor({href:this.url+"&returnUrl="+_returnUrl,label:this.name,styleClass:this.styleClass}))});return operations}var res=[];if(response){if(response.actions&&response.actions.length!=0){res.push(formatWorkflowResponse(response.actions))}if(response.operations&&response.operations.length!=0){res.push(formatOperationResonse(response.operations))}}return res},decorateContent:function(){var instance=this,issueKey=jira.app.issuenavigator.getSelectedIssueKey(),issueId=jira.app.issue.getIssueId()||jira.app.issuenavigator.getSelectedIssueId();if(issueKey){this.addHeading(AJS.params.dotOperations+": <span>"+issueKey+"</span>")}else{this.addHeading(AJS.params.dotOperations)}this.queryControl=new AJS.QueryableDropdown({id:"issueactions",element:this.$content.find("#issueactions-suggestions"),ajaxOptions:{minQueryLength:1,dataType:"json",url:AJS.format(contextPath+"/rest/api/1.0/issues/{0}/ActionsAndOperations?atl_token={1}",issueId,atl_token()),formatResponse:this._formatActionsResponse},showDropdownButton:true,loadOnInit:true});this.queryControl._handleServerError=function(smartAjaxResult){var errMsg=jira.ajax.buildSimpleErrorContent(smartAjaxResult);var errorClass=smartAjaxResult.status===401?"warn":"error";instance._setContent(AJS.$('<div class="ajaxerror"><div class="notify '+errorClass+'"><p>'+errMsg+"</p></div></div>"),false);instance._addCloseLink()};this.timeoutId=undefined;this._addCloseLink()},_addCloseLink:function(){var instance=this,$closeLink,$buttonContainer,$buttons;$buttonContainer=AJS.$('<div class="buttons-container content-footer"></div>').appendTo(this.get$popupContent());$buttons=AJS.$('<div class="buttons"/>').appendTo($buttonContainer);$closeLink=AJS.$("<a href='#' class='cancel' id='aui-dialog-close'>"+AJS.params.closelink+"</a>");$closeLink.appendTo($buttons,this.get$popupContent()).click(function(e){instance.hide();e.preventDefault()});this.get$popupContent().append($buttonContainer)},hide:function(undim){if(this._super(undim)===false){return false}jira.setFocus.popConfiguration()}});jira.app.issueActionsPopup=new AJS.IssueActionsPopup();AJS.$(jira.app.issueActionsPopup).bind("beforeShow",function(e){return jira.app.issuenavigator.isRowSelected()||jira.app.issue.getIssueId()!==undefined});
function dynamicSelect(id1,id2){if(document.getElementById&&document.getElementsByTagName){var sel1=document.getElementById(id1);var sel2=document.getElementById(id2);var clone=sel2.cloneNode(true);var clonedOptions=clone.getElementsByTagName("option");var sel2Options=sel2.options;for(var i=0;i<sel2Options.length;i++){if(sel2Options[i].selected){clonedOptions[i].selected=true;if(!clonedOptions[i].selected){clonedOptions[i].setAttribute("selected","true")}}}refreshDynamicSelectOptions(sel1,sel2,clonedOptions);sel1.onchange=function(){refreshDynamicSelectOptions(sel1,sel2,clonedOptions)}}}function refreshDynamicSelectOptions(sel1,sel2,clonedOptions){while(sel2.options.length){sel2.remove(0)}var pattern1=/( |^)(select)( |$)/;var pattern2=new RegExp("(:|^)("+sel1.options[sel1.selectedIndex].value+")(:|$)");for(var i=0;i<clonedOptions.length;i++){if(clonedOptions[i].className.match(pattern1)||clonedOptions[i].className.match(pattern2)){addOption(clonedOptions[i],sel2)}}}function addOption(clonedOption,sel2){if(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>0){sel2.appendChild(clonedOption.cloneNode(true))}else{var doc=sel2.ownerDocument;if(!doc){doc=sel2.document}var opt=doc.createElement("OPTION");opt.value=clonedOption.value;opt.text=clonedOption.text;opt.className=clonedOption.className;opt.style.backgroundImage=clonedOption.style.backgroundImage;sel2.options.add(opt,sel2.options.length);if(clonedOption.selected||clonedOption.getAttribute("selected")){opt.selected=true}}};
(function($){$.namespace("jira.app.session.storage");var storage=jira.app.session.storage;var MAGIC_MARK="jsessionstorage:";var nonNativeSessionStorageObjInitialised=false;var nonNativeSessionStorageObj={};var nonNativeSessionStorageImpl={nonnativeimplementation:true,_storage:function(){if(nonNativeSessionStorageObjInitialised){return nonNativeSessionStorageObj}if(typeof window.name!="string"){window.name=MAGIC_MARK+"{}"}if(window.name.indexOf(MAGIC_MARK)!=0){window.name=MAGIC_MARK+"{}"}var jsonData=window.name.substr(MAGIC_MARK.length);nonNativeSessionStorageObj=JSON.parse(jsonData);if(!nonNativeSessionStorageObj){nonNativeSessionStorageObj={}}nonNativeSessionStorageObjInitialised=true;return nonNativeSessionStorageObj},_persistStorage:function(){var storeObj=this._storage();var jsonData=JSON.stringify(storeObj);window.name=MAGIC_MARK+jsonData},length:function(){var i=0;var store=this._storage();for(var x in store){i++}return i},key:function(index){var i=0;var store=this._storage();for(var x in store){if(i==index){return x}i++}return null},getItem:function(key){return this._storage()[key]},setItem:function(key,value){this._storage()[key]=value;this._persistStorage()},removeItem:function(key){delete this._storage()[key];this._persistStorage()},clear:function(){var store=this._storage();for(var x in store){delete x}this._persistStorage()}};var _sessionStorageImpl=window.sessionStorage!=null?window.sessionStorage:nonNativeSessionStorageImpl;storage.nativesupport=window.sessionStorage!=null;storage.length=function(){if(typeof _sessionStorageImpl.length=="function"){return _sessionStorageImpl.length()}return _sessionStorageImpl.length};storage.key=function(index){return _sessionStorageImpl.key(index)};storage.getItem=function(key){return _sessionStorageImpl.getItem(key)};storage.setItem=function(key,value){_sessionStorageImpl.setItem(key,value)};storage.removeItem=function(key){_sessionStorageImpl.removeItem(key)};storage.clear=function(){_sessionStorageImpl.clear()};storage.asJSON=function(){var len=this.length();var jsData="{\n";for(var i=0;i<len;i++){var key=this.key(i);var value=this.getItem(key);jsData+=key+":"+value;if(i<len-1){jsData+=","}jsData+="\n"}jsData+="}\n";return jsData}})(jQuery);
/*
 * jQuery Text Overflow v0.7
 *
 * Licensed under the new BSD License.
 * Copyright 2009-2010, Bram Stein
 * All rights reserved.
 */
(function($){var style=document.documentElement.style,hasTextOverflow=("textOverflow" in style||"OTextOverflow" in style),domSplit=function(root,maxIndex){var index=0,result=[],rtrim=function(text){return text.replace(/\s+$/g,"")},domSplitAux=function(nodes){var i=0,tmp;if(index>maxIndex){return}for(i=0;i<nodes.length;i+=1){if(nodes[i].nodeType===1){tmp=nodes[i].cloneNode(false);result[result.length-1].appendChild(tmp);result.push(tmp);domSplitAux(nodes[i].childNodes);result.pop()}else{if(nodes[i].nodeType===3){if(index+nodes[i].length<maxIndex){result[result.length-1].appendChild(nodes[i].cloneNode(false))}else{tmp=nodes[i].cloneNode(false);tmp.textContent=rtrim(tmp.textContent.substring(0,maxIndex-index));result[result.length-1].appendChild(tmp)}index+=nodes[i].length}else{result.appendChild(nodes[i].cloneNode(false))}}}};result.push(root.cloneNode(false));domSplitAux(root.childNodes);return $(result.pop().childNodes)};$.extend($.fn,{textOverflow:function(str,autoUpdate){var more=str||"&#x2026;";if(!hasTextOverflow){return this.each(function(){var element=$(this),clone=element.clone(),originalElement=element.clone(),originalText=element.text(),originalWidth=element.width(),low=0,mid=0,high=originalText.length,reflow=function(){if(originalWidth!==element.width()){element.replaceWith(originalElement);element=originalElement;originalElement=element.clone();element.textOverflow(str,false);originalWidth=element.width()}};element.after(clone.hide().css({"position":"absolute","width":"auto","overflow":"visible","max-width":"inherit"}));if(clone.width()>originalWidth){while(low<high){mid=Math.floor(low+((high-low)/2));clone.empty().append(domSplit(originalElement.get(0),mid)).append(more);if(clone.width()<originalWidth){low=mid+1}else{high=mid}}if(low<originalText.length){element.empty().append(domSplit(originalElement.get(0),low-1)).append(more)}}clone.remove();if(autoUpdate){setInterval(reflow,200)}})}else{return this}}})})(jQuery);
AJS.$.namespace("jira.app.wikipreview");jira.app.wikiPreview=function(prefs,ctx){var field,editField,trigger,inPreviewMode=false,origText,setFields=function(){field=AJS.$("#"+prefs.fieldId,ctx),editField=AJS.$("#"+prefs.fieldId+"-wiki-edit",ctx),trigger=AJS.$("#"+prefs.trigger,ctx)},scrollSaver=function(){var elem;return{show:function(){if(!elem){elem=AJS.$("<div>").html("&nbsp;").css({height:"300px"}).insertBefore(editField)}elem.css({display:"block"})},hide:function(){elem.css({display:"none"})}}}(),toggleRenderPreview=function(){if(!inPreviewMode){editField.find(".content-inner").css({maxHeight:field.css("maxHeight")});this.showPreview()}else{editField.find(".content-inner").css({maxHeight:""});this.showInput()}},renderData=function(data){editField.originalHeight=editField.height();scrollSaver.show();editField.addClass("previewClass");origText=field.val();field.hide();trigger.removeClass("loading").addClass("selected");editField.find(".content-inner").html(data);scrollSaver.hide();inPreviewMode=true;AJS.$(document).trigger("showWikiPreview",[editField]);setTimeout(function(){trigger.focus()},0)},handleError=function(previewer){return function(XMLHttpRequest,textStatus,errorThrown){trigger.removeClass("loading");origText=field.val();if(textStatus){alert(textStatus)}if(errorThrown){alert(errorThrown)}previewer.showInput()}};return{showPreview:function(){var that=this;var pid=AJS.$("#pid",ctx).val(),issueType=AJS.$("#issuetype",ctx).val();AJS.$("#"+prefs.trigger,ctx).addClass("loading");AJS.$.ajax({url:contextPath+"/rest/api/1.0/render",contentType:"application/json",type:"POST",data:JSON.stringify({rendererType:prefs.rendererType,unrenderedMarkup:field.val(),issueKey:prefs.issueKey,projectId:pid,issueType:issueType}),dataType:"html",success:renderData,error:handleError(that)})},showInput:function(e){if(editField){scrollSaver.show();editField.css({height:""});editField.removeClass("previewClass").find(".content-inner").empty();field=AJS.$("#"+prefs.fieldId,ctx);field.val(origText);field.show();trigger.removeClass("selected");scrollSaver.hide();inPreviewMode=false;AJS.$(document).trigger("showWikiInput",[editField])}},init:function(){var that=this,$trigger;prefs=AJS.$.readData(prefs);$trigger=AJS.$("#"+prefs.trigger,ctx);$trigger.click(function(e){if(!$trigger.hasClass("loading")){setFields();toggleRenderPreview.call(that)}e.preventDefault()})}}};AJS.$(function(){var wikiRenders=AJS.$("dl.wiki-js-prefs");wikiRenders.each(function(){var render=jira.app.wikiPreview(this);render.init()})});
AJS.InlineAttach=Class.extend({_getDefaultOptions:function(){return{postUrl:contextPath+"/secure/AttachTemporaryFile.jspa"}},init:function(options){var that=this;if(typeof options==="string"){options={element:options}}options=options||{};this.options=AJS.$.extend(this._getDefaultOptions(),options);this.$container=AJS.$(this.options.element);this.$form=this.$container.closest("form");this.$container.change(function(){that.attachFile(AJS.$(this))})},_getFilename:function(fileName){if(AJS.$.browser.msie&&fileName.indexOf("\\")>=0){fileName=fileName.substring(fileName.lastIndexOf("\\")+1)}return fileName},_getAtlToken:function($element){if($element){var $form=$element.closest("form");var $atlToken=AJS.$("input[name='atl_token']",$form);if($atlToken.length>0){return $atlToken.val()}}return atl_token()},attachFile:function($input){var that=this,$fileInputContainer=$input.parent(),$originalFileInput=this._renders.fileInput($input),$attachForm=this._renders.attachForm(this.options.postUrl).append($input),$loadingSpan=this._renders.loadingSpan(this._getFilename($input.val())),postData={atl_token:this._getAtlToken($fileInputContainer)};$originalFileInput.change(function(){that.attachFile(AJS.$(this))});$fileInputContainer.parent().find("div.error").remove();AJS.$("body").append($attachForm);if(this.options.issueId){postData.id=this.options.issueId}else{postData.create=true;postData.projectId=this.options.projectId}$attachForm.ajaxForm({dataType:"json",data:postData,timeout:0,cleanupAfterSubmit:function(){$loadingSpan.remove();if(that.$form.find(".loading.file").length===0){that.$form.find("input[type=submit]").removeAttr("disabled")}$attachForm.remove()},beforeSubmit:function(){$fileInputContainer.append($loadingSpan);if($fileInputContainer.is("td")){$fileInputContainer.append(AJS.$("<div class='field-group'/>").append($originalFileInput))}else{$fileInputContainer.after(AJS.$("<div class='field-group'/>").append($originalFileInput))}if(AJS.$.browser.msie){setTimeout(function(){$originalFileInput.focus()},0)}else{$originalFileInput.focus()}that.$form.find("input[type=submit]").attr("disabled","true")},error:function(xhr){if(xhr&&xhr.responseText&&xhr.responseText.indexOf("SecurityTokenMissing")>=0){$loadingSpan.after(that._renders.errors(AJS.params.attachmentsXsrfTimeout))}else{$loadingSpan.after(that._renders.errors(AJS.params.attachmentsUnknownError))}$fileInputContainer.addClass("error");this.cleanupAfterSubmit()},success:function(response){if(response.id){$loadingSpan.after(that._renders.temporaryFileCheckbox(response))}else{if(response.errorMsg){$loadingSpan.after(that._renders.errors(response.errorMsg));$fileInputContainer.addClass("error")}}this.cleanupAfterSubmit()}});$attachForm.submit()},_renders:{attachForm:function(postUrl){return AJS.$("<form method='post' enctype='multipart/form-data' action='"+postUrl+"'/>").hide()},fileInput:function($originalInput){return $originalInput.clone().val("")},loadingSpan:function(fileName){return AJS.$("<div class='loading file'>"+fileName+"</div>")},temporaryFileCheckbox:function(response){return AJS.$("<input type='checkbox' class='checkbox' name='filetoconvert' value='"+response.id+"' title='"+response.title+"' checked><label>"+response.name+"</label>")},errors:function(errorMsg){return AJS.$("<div>"+errorMsg+"</div>")}}});jQuery.fn.inlineAttach=function(options){var res=[];this.each(function(){options=options||{};options.element=this;var context=AJS.$(this).closest("form");options.issueId=AJS.$("input[name=id]",context).val();options.projectId=AJS.$("input[name=pid]",context).val();res.push(new AJS.InlineAttach(options))});return res};
(function($){$.namespace("jira.app.issuenavigator");var jiraAppIssuenavigator=jira.app.issuenavigator;jiraAppIssuenavigator.isNavigator=function(){return $("#isNavigator").length===1};jiraAppIssuenavigator.isRowSelected=function(){return this.get$focusedRow().length!==0};jiraAppIssuenavigator.get$focusedRow=function(){return $("#issuetable tr.issuerow.focused")};jiraAppIssuenavigator.getFocsuedIssueIndex=function(){var rowIndex=$("#issuetable").find("tr.issuerow").index(jiraAppIssuenavigator.get$focusedRow());var searchOffset=parseInt($("#results-count-start").text(),10)-1;return rowIndex+searchOffset};jiraAppIssuenavigator.getSelectedIssueKey=function(){var $focusedRow=this.get$focusedRow();if($focusedRow.length!==0){return $focusedRow.attr("data-issuekey")}return undefined};jiraAppIssuenavigator.getSelectedIssueId=function(){return this.get$focusedRow().attr("rel")};jiraAppIssuenavigator.getNextIssueId=function(){return this.get$focusedRow().next("tr.issuerow").attr("rel")}})(AJS.$);
(function($){$.namespace("jira.app.issuenavigator.shortcuts");var navigatorShortcuts=jira.app.issuenavigator.shortcuts;var $rows,index,$nextPage,$previousPage,helpText,isLoadingNewPage=false;var issueIdToRowIndex={};$(document).ready(function(){if(jira.app.issuenavigator.isNavigator()){var $focusedRow;var focusedClassName=/(?:^|\s)focused(?!\S)/;var preventFocus=function(){$(this).attr("tabIndex",-1)};$rows=$("#issuetable").find("tr.issuerow");$rows.each(function(i){var $row=$(this);$("a.hidden-link",this).blur(preventFocus);if(!$focusedRow&&focusedClassName.test(this.className)){$focusedRow=$row;index=i}issueIdToRowIndex[$row.attr("rel")]=i});if(!$focusedRow){$focusedRow=$rows.first().addClass("focused")}var jqlHasFocus=jQuery("#jqltext").hasClass("focused");if(!jqlHasFocus){var triggerConfig=new jira.setFocus.FocusConfiguration();triggerConfig.focusNow=function(){focusRow(index)};jira.setFocus.pushConfiguration(triggerConfig)}$(document).keypress(function(e){if(e.keyCode=="13"&&$("div.aui-blanket").length==0){var target=e.target;if(target===undefined||target.nodeName==="HTML"||target.nodeName==="BODY"||target==document){if(hasResults()&&$rows[index]){window.location=contextPath+"/browse/"+$rows.eq(index).attr("data-issuekey")}}}});var $pager=$("p.pagination").first();$nextPage=$pager.find("a.icon-next");$previousPage=$pager.find("a.icon-previous");if($("body").hasClass("iss-nav")){$("#edit-issue").click(updateActionTemplateWithIssueId);if(hasResults()&&!jqlHasFocus){setTimeout(function(){$rows.eq(index).scrollIntoView()},0)}}if(hasResults()){navigatorShortcuts.flashIssueRow()}$(".issue-actions-trigger").click(function(){var $row=$(this).closest("tr");var issueId=$row.attr("rel");if(issueId){navigatorShortcuts.focusRow(issueId,0,true)}});$(document).bind("dialogContentReady",function(){if(setSelectedIssueAjax.callback){setSelectedIssueAjax.callback()}})}});var inDuration=1200;var flashLifeSpan=10000;var flashTimerId=null;var $flashedIssueRow=null;function clearFlashTimeout(){if(flashTimerId){window.clearTimeout(flashTimerId)}}function removeIssueRowFlash(outDuration){clearFlashTimeout();if($flashedIssueRow){$flashedIssueRow.addClass("issueactioneddissapearing").removeClass("issueactioned");$("td:first-child",$flashedIssueRow).removeClass("issueactioned");$flashedIssueRow.animate({backgroundColor:"#fff"},outDuration,function(){$(this).removeAttr("style");$(this).removeClass("issueactioneddissapearing")})}$flashedIssueRow=null}function flashIssueRowWithId(issueId,selectedIssueMsg,selectedIssueKey){if($flashedIssueRow){removeIssueRowFlash("fast")}$flashedIssueRow=$("#issuerow"+issueId);$flashedIssueRow.animate({backgroundColor:"#ffd"},inDuration,function(){$(this).css({backgroundColor:null});$(this).addClass("issueactioned")});clearFlashTimeout();flashTimerId=window.setTimeout(function(){removeIssueRowFlash("slow");$("#affectedIssueMsg").fadeOut(inDuration)},flashLifeSpan);if(!selectedIssueKey){selectedIssueKey=$flashedIssueRow.attr("data-issuekey")}if(!selectedIssueMsg){selectedIssueMsg="thanks_issue_updated"}var msgText=AJS.params[selectedIssueMsg];if(msgText&&selectedIssueKey){msgText=AJS.format(msgText,selectedIssueKey);var $msgContainer=$("#affectedIssueMsg");if($msgContainer.length>0){$msgContainer.html('<div class="noteBox">'+msgText+"</div>")}else{$msgContainer=$('<div id="affectedIssueMsg"><div class="noteBox">'+msgText+"</div></div>");$("#main-content").prepend($msgContainer)}$msgContainer.css("margin-left",(-$msgContainer.outerWidth()/2)).show().fadeIn(100)}}navigatorShortcuts.flashIssueRow=function(issueId){var sessionstorage=jira.app.session.storage;var selectedIssueMsg=null;var selectedIssueKey=null;if(!issueId){if(!issueId){issueId=sessionstorage.getItem("selectedIssueId")}if(!issueId){var result=/[?&]selectedIssueId=([0-9]+)/.exec(window.location);issueId=result&&result.length==2?result[1]:null}}if(issueId){selectedIssueKey=sessionstorage.getItem("selectedIssueKey");selectedIssueMsg=sessionstorage.getItem("selectedIssueMsg");flashIssueRowWithId(issueId,selectedIssueMsg,selectedIssueKey)}sessionstorage.removeItem("selectedIssueId");sessionstorage.removeItem("selectedIssueKey");sessionstorage.removeItem("selectedIssueMsg")};navigatorShortcuts.selectNextIssue=function(){if(hasResults()&&!isLoadingNewPage){if(index===$rows.length-1){followLink($nextPage)}else{unselectRow(index++);selectRow(index)}}};navigatorShortcuts.selectPreviousIssue=function(){if(hasResults()&&!isLoadingNewPage){if(index===0){followLink($previousPage)}else{unselectRow(index--);selectRow(index)}}};navigatorShortcuts.viewSelectedIssue=function(){if(hasResults()&&$($rows[index]).length){try{window.location=contextPath+"/browse/"+$($rows[index]).attr("data-issuekey")}catch(err){}}};navigatorShortcuts.focusRow=function(issueId,delay,supressLinkFocus){if(hasResults()){if(issueId){selectRowViaIssueId(issueId,delay,supressLinkFocus)}else{if(!supressLinkFocus){$($rows[index]).find("a:first").focus()}}}};navigatorShortcuts.focusSearch=function(){var $jqlTextArea=$("#jqltext");$("#jira").scrollIntoView();if($jqlTextArea.length>0){$jqlTextArea.focus()}else{var $leftHandColumn=$("#iss-wrap");if($leftHandColumn.hasClass("lhc-collapsed")){$(".toggle-lhc").click()}var $textSection=$("#navigator-filter-subheading-textsearch-group");if($textSection.hasClass("collapsed")){$("#searcher-pid").focus()}else{$("#searcher-query").focus()}}};function updateActionTemplateWithIssueId(){if(/id=\{0\}/.test(this.href)){var issueId=jira.app.issuenavigator.getSelectedIssueId();var url=this.href;url=url.replace(/(id=\{0\})/g,"id="+issueId);url+="?selectedIssueId="+issueId;this.href=url}}function hasResults(){return $rows&&$rows.length>0}function followLink($a){var href=$a.attr("href");if(href){isLoadingNewPage=true;window.location=href;setTimeout(function(){isLoadingNewPage=false},5000)}}function unselectRow(i){var $td=$($rows[i]).find("td:first");$($rows[i]).removeClass("focused");helpText=$td.attr("title");$td.removeAttr("title")}function selectRow(i,delay,supressLinkFocus){var $selected=$($rows[i]).addClass("focused").scrollIntoView();$selected.find("td").first().attr("title",helpText);if(!supressLinkFocus){focusRow(i)}setSelectedIssueAjax(delay||250)}function selectRowViaIssueId(issueId,delay,supressLinkFocus){var newIndex=issueIdToRowIndex[issueId];if(newIndex||newIndex===0){unselectRow(index);selectRow(index=newIndex,delay,supressLinkFocus)}}function focusRow(i){var $selected=$($rows[i]);$selected.find(".hidden-link").removeAttr("tabIndex").focus()}function setSelectedIssueAjax(delay){delay=typeof delay==="number"?delay:1000;clearDelayedTimeout();setSelectedIssueAjax.timeout=setTimeout(setSelectedIssueAjax.callback=function(){$.get(contextPath+"/secure/SetSelectedIssue.jspa",{atl_token:atl_token(),selectedIssueId:jira.app.issuenavigator.getSelectedIssueId(),selectedIssueIndex:jira.app.issuenavigator.getFocsuedIssueIndex(),nextIssueId:jira.app.issuenavigator.getNextIssueId()});clearDelayedTimeout()},delay)}setSelectedIssueAjax.callback=null;setSelectedIssueAjax.timeout=null;function clearDelayedTimeout(){clearTimeout(setSelectedIssueAjax.timeout);setSelectedIssueAjax.callback=null;setSelectedIssueAjax.timeout=null}})(AJS.$);
(function($){$.namespace("jira.app.issue");var jiraAppIssue=jira.app.issue,$keyVal;function getKeyVal(){if(!$keyVal){$keyVal=$("#key-val")}return $keyVal}jiraAppIssue.getIssueId=function(){var $keyVal=getKeyVal();if($keyVal.length!==0){return $keyVal.attr("rel")}return undefined};jiraAppIssue.getIssueKey=function(){var $keyVal=getKeyVal();if($keyVal.length!==0){return $keyVal.text()}return undefined}})(AJS.$);
(function($){$.namespace("jira.app.issueoperations");jira.app.issueoperations.wireAssignToMeLink=function(context){jQuery("#assign-to-me-trigger",context).click(function(e){e.preventDefault();var assigneeId=getHashedLinkTarget(jQuery(this).attr("href"));var currentUserOption=jQuery(assigneeId,context).find(".current-user");var val=currentUserOption.val();jQuery(assigneeId,context).val(val).change()})};function getHashedLinkTarget(url){var hashIndex=url.indexOf("#");if(hashIndex!=-1){return url.substring(hashIndex)}else{return url}}})(AJS.$);AJS.$(function(){jira.app.issueoperations.wireAssignToMeLink(document)});
(function(){var META_TOKEN_ID="atlassian-token";var PARAM_TOKEN_NAME="atl_token";var INPUT_TOKEN_NAME="atl_token";var tokenQueryParam=function(token){return AJS.format("{0}={1}",PARAM_TOKEN_NAME,token)};var replaceTokenInMeta=function(oldToken,newToken){var metaTokenSelector=AJS.format("meta#{0}",META_TOKEN_ID);AJS.$(metaTokenSelector).attr("content",newToken)};var replaceTokenInLinks=function(oldToken,newToken){AJS.$("a,link").each(function(){var link=AJS.$(this);var href=link.attr("href");if(href){link.attr("href",href.replace(tokenQueryParam(oldToken),tokenQueryParam(newToken)))}})};var replaceTokenInForms=function(oldToken,newToken){AJS.$("form").each(function(){var $form=AJS.$(this);var action=$form.attr("action");if(action){$form.attr("ACTION",action.replace(tokenQueryParam(oldToken),tokenQueryParam(newToken)))}var formInputSelector=AJS.format("input[name={0}][value={1}]",INPUT_TOKEN_NAME,oldToken);$form.find(formInputSelector).each(function(){AJS.$(this).attr("value",newToken)})})};AJS.$.namespace("jira.xsrf");if(typeof jira.xsrf.updateTokenOnPage!=="function"){jira.xsrf.updateTokenOnPage=function(newToken){var oldToken=atl_token();if(oldToken!==newToken){replaceTokenInMeta(oldToken,newToken);replaceTokenInLinks(oldToken,newToken);replaceTokenInForms(oldToken,newToken)}}}}());

