if(typeof mw=='undefined'){mw={};} mw.usability={'messages':{}} mw.usability.load=function(deps,callback){var needJUI=false;for(var i=0;imaxTI){maxTI=ti;}});return maxTI;};(function($){$.whileAsync=function(opts) {var delay=Math.abs(opts.delay)||10,bulk=isNaN(opts.bulk)?500:Math.abs(opts.bulk),test=opts.test||function(){return true;},loop=opts.loop||function(){},end=opts.end||function(){};(function(){var t=false,begin=new Date();while(t=test()) {loop();if(bulk===0||(new Date()-begin)>bulk) {break;}} if(t) {setTimeout(arguments.callee,delay);} else {end();}})();} $.eachAsync=function(array,opts) {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i').css('whiteSpace','nowrap').text($this.text());$this.empty().append($trimmableText);} var text=$container.text();var trimmableText=$trimmableText.text();var w=$container.width();var pw=$protectedText?$protectedText.width():0;if(!(text in cache)){cache[text]={};} if(options.matchText&&!(text in matchTextCache)){matchTextCache[text]={};} if(options.matchText&&!(options.matchText in matchTextCache[text])){matchTextCache[text][options.matchText]={};} if(!options.matchText&&w in cache[text]){$container.html(cache[text][w]);if(options.tooltip) $container.attr('title',text);return;} if(options.matchText&&options.matchText in matchTextCache[text]&&w in matchTextCache[text][options.matchText]){$container.html(matchTextCache[text][options.matchText][w]);if(options.tooltip) $container.attr('title',text);return;} if($trimmableText.width()+pw>w){switch(options.position){case'right':var l=0,r=trimmableText.length;do{var m=Math.ceil((l+r)/2);$trimmableText.text(trimmableText.substr(0,m)+'...');if($trimmableText.width()+pw>w){r=m-1;}else{l=m;}}while(lw&&i[0]>0){$trimmableText.text(trimmableText.substr(0,i[0])+'...'+trimmableText.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} break;case'left':var r=0;while($trimmableText.outerWidth()+pw>w&&r400){r.version='2.0';} if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';} if(r.name==='opera'&&$.browser.version>=9.8){r.version=i.match(/version\/([0-9\.]*)/i)[1]||10;} r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome|PLAYSTATION 3/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape'],['PLAYSTATION 3','PS3']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3|docomo)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);(function($){$.fn.collapsibleTabs=function($$options){if(!this.length)return this;var $settings=$.extend({},$.collapsibleTabs.defaults,$$options);this.each(function(){var $this=$(this);$.collapsibleTabs.instances=($.collapsibleTabs.instances.length==0?$this:$.collapsibleTabs.instances.add($this));$this.data('collapsibleTabsSettings',$settings);$this.children($settings.collapsible).each(function(){$.collapsibleTabs.addData($(this));});});if(!$.collapsibleTabs.boundEvent){$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});} $.collapsibleTabs.handleResize();return this;};$.collapsibleTabs={instances:[],boundEvent:null,defaults:{expandedContainer:'#p-views ul',collapsedContainer:'#p-cactions ul',collapsible:'li.collapsible',shifting:false,expandCondition:function(eleWidth){return($('#left-navigation').position().left+$('#left-navigation').width())<($('#right-navigation').position().left-eleWidth);},collapseCondition:function(){return($('#left-navigation').position().left+$('#left-navigation').width())>$('#right-navigation').position().left;}},addData:function($collapsible){var $settings=$collapsible.parent().data('collapsibleTabsSettings');$collapsible.data('collapsibleTabsSettings',{'expandedContainer':$settings.expandedContainer,'collapsedContainer':$settings.collapsedContainer,'expandedWidth':$collapsible.width(),'prevElement':$collapsible.prev()});},getSettings:function($collapsible){var $settings=$collapsible.data('collapsibleTabsSettings');if(typeof $settings=='undefined'){$.collapsibleTabs.addData($collapsible);$settings=$collapsible.data('collapsibleTabsSettings');} return $settings;},handleResize:function(e){$.collapsibleTabs.instances.each(function(){var $this=$(this),data=$.collapsibleTabs.getSettings($this);if(data.shifting)return;if($this.children(data.collapsible).length>0&&data.collapseCondition()){$this.trigger("beforeTabCollapse");$.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));} if($(data.collapsedContainer+' '+data.collapsible).length>0&&data.expandCondition($.collapsibleTabs.getSettings($(data.collapsedContainer).children(data.collapsible+":first")).expandedWidth)){$this.trigger("beforeTabExpand");$.collapsibleTabs.moveToExpanded(data.collapsedContainer+" "+data.collapsible+':first');}});},moveToCollapsed:function(ele){var $moving=$(ele);if($moving.size()==0){return;} var data=$.collapsibleTabs.getSettings($moving);var dataExp=$.collapsibleTabs.getSettings(data.expandedContainer);dataExp.shifting=true;$moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings',data);dataExp.shifting=false;$.collapsibleTabs.handleResize();},moveToExpanded:function(ele){var $moving=$(ele);if($moving.size()==0){return;} var data=$.collapsibleTabs.getSettings($moving);var dataExp=$.collapsibleTabs.getSettings(data.expandedContainer);dataExp.shifting=true;$moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings',data);dataExp.shifting=false;$.collapsibleTabs.handleResize();}};})(jQuery);(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);} fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});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]),parseInt(result[2]),parseInt(result[3])];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)];return colors[jQuery.trim(color).toLowerCase()];} function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.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]};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;} var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} expires='; expires='+date.toUTCString();} var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i=0){var spannode=document.createElement('span');spannode.className='highlight';var middlebit=node.splitText(pos);middlebit.splitText(pat.length);var middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);}}else if(node.nodeType==1&&node.childNodes&&!/(script|style)/i.test(node.tagName)&&!(node.tagName.toLowerCase()=='span'&&node.className.match(/\bhighlight/))){for(var i=0;i').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).mousemove(function(e){context.data.selectedWithMouse=true;$.suggestions.highlight(context,$(this).closest('.suggestions-results div'),false);}).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{if(context.config.highlightInput){matchedText=context.data.prevText;} $result.append($('').css('whiteSpace','nowrap').text(text));var $span=$result.children('span');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth()+(context.data.$container.width()-$span.parent().width());} $autoEllipseMe=$autoEllipseMe.add($result);}} if(expWidth>context.data.$container.width()){var maxWidth=context.config.maxExpandFactor*context.data.$textbox.width();context.data.$container.width(Math.min(expWidth,maxWidth));} $autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true,matchText:matchedText});}} break;case'maxRows':context.config[property]=Math.max(1,Math.min(100,value));break;case'delay':context.config[property]=Math.max(0,Math.min(1200,value));break;case'maxExpandFactor':context.config[property]=Math.max(1,value);break;case'submitOnClick':case'positionFromLeft':case'highlightInput':context.config[property]=value?true:false;break;}},highlight:function(context,result,updateTextbox){var selected=context.data.$container.find('.suggestions-result-current');if(!result.get||selected.get(0)!=result.get(0)){if(result=='prev'){if(selected.is('.suggestions-special')){result=context.data.$container.find('.suggestions-result:last')}else{result=selected.prev();if(selected.length==0){if(context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}else{result=context.data.$container.find('.suggestions-results div:last');}}}}else if(result=='next'){if(selected.length==0){result=context.data.$container.find('.suggestions-results div:first');if(result.length==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}else{result=selected.next();if(selected.is('.suggestions-special')){result=$([]);}else if(result.length==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}} selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} if(updateTextbox){if(result.length==0||result.is('.suggestions-special')){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();} context.data.$textbox.trigger('change');}},keypress:function(e,context,key){var wasVisible=context.data.$container.is(':visible');var preventDefault=false;switch(key){case 40:if(wasVisible){$.suggestions.highlight(context,'next',true);context.data.selectedWithMouse=false;}else{$.suggestions.update(context,false);} preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',true);context.data.selectedWithMouse=false;} preventDefault=wasVisible;break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 13:context.data.$container.hide();preventDefault=wasVisible;selected=context.data.$container.find('.suggestions-result-current');if(selected.size()==0||context.data.selectedWithMouse){$.suggestions.cancel(context);context.config.$region.closest('form').submit();}else if(selected.is('.suggestions-special')){if(typeof context.config.special.select=='function'){context.config.special.select.call(selected,context.data.$textbox);}}else{if(typeof context.config.result.select=='function'){$.suggestions.highlight(context,selected,true);context.config.result.select.call(selected,context.data.$textbox);}else{$.suggestions.highlight(context,selected,true);}} break;default:$.suggestions.update(context,true);break;} if(preventDefault){e.preventDefault();e.stopImmediatePropagation();}}};$.fn.suggestions=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('suggestions-context');if(typeof context=='undefined'||context==null){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false,'maxExpandFactor':3,'positionFromLeft':true,'highlightInput':false}};} if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.suggestions.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.suggestions.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this),'selectedWithMouse':false};var newCSS={'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'width':context.data.$textbox.outerWidth(),'display':'none'} if(context.config.positionFromLeft){newCSS['left']=context.config.$region.offset().left;newCSS['right']='auto';}else{newCSS['left']='auto';newCSS['right']=$('body').width()-(context.config.$region.offset().left+context.config.$region.outerWidth());} context.data.$container=$('
').css(newCSS).addClass('suggestions').append($('
').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;} $.suggestions.highlight(context,$result,true);context.data.$container.hide();if(typeof context.config.result.select=='function'){context.config.result.select.call($result,context.data.$textbox);} context.data.$textbox.focus();})).append($('
').addClass('suggestions-special').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-special');}).mouseup(function(e){var $special=$(e.target).closest('.suggestions-special');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($special.get(0)!=$other.get(0)){return;} context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);} context.data.$textbox.focus();}).mousemove(function(e){context.data.selectedWithMouse=true;$.suggestions.highlight(context,$(e.target).closest('.suggestions-special'),false);})).appendTo($('body'));$(this).attr('autocomplete','off').keydown(function(e){context.data.keypressed=(e.keyCode==undefined)?e.which:e.keyCode;context.data.keypressedCount=0;switch(context.data.keypressed){case 40:e.preventDefault();e.stopImmediatePropagation();break;case 38:case 27:case 13:if(context.data.$container.is(':visible')){e.preventDefault();e.stopImmediatePropagation();}}}).keypress(function(e){context.data.keypressedCount++;$.suggestions.keypress(e,context,context.data.keypressed);}).keyup(function(e){if(context.data.keypressedCount==0){$.suggestions.keypress(e,context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.length>0){return;} context.data.$container.hide();$.suggestions.cancel(context);});} $(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.textSelection=function(command,options){var fn={getContents:function(){return this.val();},getSelection:function(){var e=this.get(0);var retval='';if($(e).is(':hidden')){}else if(document.selection&&document.selection.createRange){e.focus();var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} return retval;},encapsulateSelection:function(options){return this.each(function(){function checkSelectedText(){if(!selText){selText=options.peri;isSample=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);options.post+=' ';}} var isSample=false;if(this.style.display=='none'){}else if(this.selectionStart||this.selectionStart=='0'){$(this).focus();var selText=$(this).textSelection('getSelection');var startPos=this.selectionStart;var endPos=this.selectionEnd;var scrollTop=this.scrollTop;checkSelectedText();if(options.ownline){if(startPos!=0&&this.value.charAt(startPos-1)!="\n"){options.pre="\n"+options.pre;} if(this.value.charAt(endPos)!="\n"){options.post+="\n";}} this.value=this.value.substring(0,startPos)+options.pre+selText+options.post+ this.value.substring(endPos,this.value.length);this.scrollTop=scrollTop;if(window.opera){options.pre=options.pre.replace(/\r?\n/g,"\r\n");selText=selText.replace(/\r?\n/g,"\r\n");options.post=options.post.replace(/\r?\n/g,"\r\n");} if(isSample&&options.selectPeri){this.selectionStart=startPos+options.pre.length;this.selectionEnd=startPos+options.pre.length+selText.length;}else{this.selectionStart=startPos+options.pre.length+selText.length+ options.post.length;this.selectionEnd=this.selectionStart;}}else if(document.selection&&document.selection.createRange){$(this).focus();if(context){context.fn.restoreStuffForIE();} var selText=$(this).textSelection('getSelection');var scrollTop=this.scrollTop;var range=document.selection.createRange();if(options.ownline&&range.moveStart){var range2=document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range2.text!=""){options.pre="\n"+options.pre;} var range3=document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){options.post+="\n";}} checkSelectedText();range.text=options.pre+selText+options.post;if(isSample&&options.selectPeri&&range.moveStart){range.moveStart('character',-options.post.length-selText.length);range.moveEnd('character',-options.post.length);} range.select();this.scrollTop=scrollTop;} $(this).trigger('encapsulateSelection',[options.pre,options.peri,options.post,options.ownline,options.replace]);});},getCaretPosition:function(options){function getCaret(e){var caretPos=0,endPos=0;if($.browser.msie){var preFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!preFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){preFinished=true;}else{preRange.moveEnd("character",-1) if(preRange.text==preText){rawPreText+="\r\n";}else{preFinished=true;}}} if(!periFinished){if(periRange.compareEndPoints("StartToEnd",periRange)==0){periFinished=true;}else{periRange.moveEnd("character",-1) if(periRange.text==periText){rawPeriText+="\r\n";}else{periFinished=true;}}} if(!postFinished){if(postRange.compareEndPoints("StartToEnd",postRange)==0){postFinished=true;}else{postRange.moveEnd("character",-1) if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!preFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;endPos=caretPos+rawPeriText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;endPos=e.selectionEnd;} return options.startAndEnd?[caretPos,endPos]:caretPos;} return getCaret(this.get(0));},setSelection:function(options){return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){if(options.start>this.selectionEnd){this.selectionEnd=options.end;this.selectionStart=options.start;}else{this.selectionStart=options.start;this.selectionEnd=options.end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=this.value.length;var newLines=this.value.match(/\n/g);if(newLines)length=length-newLines.length;selection.moveStart('character',options.start);selection.moveEnd('character',-length+options.end);try{selection.select();}catch(e){}}});},scrollToCaretPosition:function(options){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} function getCaretScrollPosition(e){var text=e.value.replace(/\r/g,"");var caret=$(e).textSelection('getCaretPosition');var lineLength=getLineLength(e);var row=0;var charInLine=0;var lastSpaceInLine=0;for(i=0;ilineLength){if(lastSpaceInLine>0){charInLine=charInLine-lastSpaceInLine;lastSpaceInLine=0;row++;}}} var nextSpace=0;for(j=caret;jlineLength&&caret<=lineLength){charInLine=caret-lastSpaceInLine;row++;} return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;} return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){var scroll=getCaretScrollPosition(this);if(options.force||scroll<$(this).scrollTop()||scroll>$(this).scrollTop()+$(this).height()) $(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.body.createTextRange();var savedRange=document.selection.createRange();var pos=$(this).textSelection('getCaretPosition');var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop) this.scrollTop+=range.offsetTop;else if(options.force){range.move('character',-1);range.select();} savedRange.select();} $(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false,'selectPeri':true},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined) options.end=options.start;if(options.endContainer==undefined) options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;} var context=$(this).data('wikiEditor-context');var hasIframe=typeof context==='object'&&context&&typeof context.$iframe!=='undefined';var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;} retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();} return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'netscape':[['>=',9]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'netscape':[['>=',9]],'blackberry':false,'ipod':false,'iphone':false}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){if(module&&typeof module.name!='undefined'&&(module.name=='toc'||module.name=='highlight')&&typeof wgReallyGiveMeTOC=='undefined'){return module.supported=false;} var mod=module&&'browsers'in module?module:$.wikiEditor;if(typeof mod.supported!=='undefined'){return mod.supported;} return mod.supported=mw.usability.testBrowser(mod.browsers);},'isRequired':function(module,requirement){if(typeof module['req']!=='undefined'){for(req in module['req']){if(module['req'][req]==requirement){return true;}}} return false;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;} return src+'?'+wgWikiEditorIconVersion;},'autoIconOrOffset':function(icon,offset,path,lang){lang=lang||wgUserLanguage;if(typeof offset=='object'&&lang in offset){return offset[lang];}else if(typeof icon=='object'&&lang in icon){return $.wikiEditor.autoIcon(icon,undefined,lang);}else{return $.wikiEditor.autoLang(offset,lang);}}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} var context=$(this).data('wikiEditor-context');if(!context||typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'oldDelayedSel':null,'savedSelection':null,'history':[],'historyPosition':-1,'oldDelayedHistoryPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} for(var module in modules){if(typeof module=='string'&&$.wikiEditor.isSupported($.wikiEditor.modules[module])){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}} if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}} return false;} break;case 86:if(event.ctrlKey&&$.browser.msie){context.evt.paste(event);} break;} return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';} if(context.$content.children().length==0){context.$content.append('

');} return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(!$.browser.msie&&t&&t.node.nodeName=='#text'&&t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("

");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}} context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('

'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();var offset=0;var oldLength=context.fn.getContents().length;context.$content.find('*').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');} setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();var $selection=context.$content.find(':not(.wikiEditor)');var nodeToDelete=[];var firstDirtyNode;if($selection.length==0){firstDirtyNode=context.fn.getOffset(cursorPos[0]).node;}else{firstDirtyNode=$selection.eq(0)[0];} while(firstDirtyNode!=null){while(firstDirtyNode.parentNode.nodeName!='BODY'&&!$(firstDirtyNode.parentNode).hasClass('wikiEditor')){firstDirtyNode=firstDirtyNode.parentNode;} while(firstDirtyNode.previousSibling!=null&&!$(firstDirtyNode.previousSibling).hasClass('wikiEditor')){if($(firstDirtyNode.previousSibling).hasClass('#comment')){$(firstDirtyNode).remove();}else{firstDirtyNode=firstDirtyNode.previousSibling;}} var $lastDirtyNode=$(firstDirtyNode);var cc=makeContentCollector($.browser,null);while(firstDirtyNode!=null&&!$(firstDirtyNode).hasClass('wikiEditor')){cc.collectContent(firstDirtyNode);cc.notifyNextNode(firstDirtyNode.nextSibling);pastedContent=cc.getLines();if((pastedContent.length<=1||pastedContent[pastedContent.length-1]!=="")&&firstDirtyNode.nextSibling){nodeToDelete.push(firstDirtyNode);firstDirtyNode=firstDirtyNode.nextSibling;cc.collectContent(firstDirtyNode);cc.notifyNextNode(firstDirtyNode.nextSibling);} nodeToDelete.push(firstDirtyNode);firstDirtyNode=firstDirtyNode.nextSibling;} var ccData=cc.finish();var pastedContent=ccData.lines;if(pastedContent.length==0&&firstDirtyNode){offset+=$(firstDirtyNode).text().length;} if(nodeToDelete.length>0){$lastDirtyNode=$(nodeToDelete[nodeToDelete.length-1]);} var testVal='';testVal=$(nodeToDelete[0]).text();var pastedPretty='';for(var i=0;i/g,'>').replace(/\r?\n/g,'\\n');match=pastedContent[i].match(/^[\s]+[^\s]/);if(match!=null&&match.length>0){index=match[0].length;leadingSpace=match[0].replace(/[\s]/g,' ');pastedPretty=leadingSpace+pastedPretty.substring(index,pastedPretty.length);} $newElement=$('

');if(pastedPretty){$newElement.html(''+pastedPretty+'');}else{$newElement.html('
');} $newElement.insertAfter($lastDirtyNode);offset+=pastedPretty.length;$lastDirtyNode=$newElement;} while(nodeToDelete.length>0){$(nodeToDelete.pop()).remove();} $selection=context.$content.find(':not(.wikiEditor)');if($selection.length==0){firstDirtyNode=null;}else{firstDirtyNode=$selection.eq(0)[0];}} context.$content.find('.wikiEditor').removeClass('wikiEditor');var restoreTo=cursorPos[1]+offset;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} if(typeof event.data=='undefined'){event.data={};} if(name in context.evt){if(!context.evt[name](event)){return false;}} var returnFromModules=null;for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){var ret=$.wikiEditor.modules[module].evt[name](context,event);if(ret!=null){if(returnFromModules==null){returnFromModules=ret;}else{returnFromModules=returnFromModules&&ret;}}}} if(returnFromModules!=null){return returnFromModules;}else{return true;}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('