/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dijit._editor.selection"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dijit._editor.selection"]){_4._hasResource["dijit._editor.selection"]=true;_4.provide("dijit._editor.selection");_4.getObject("_editor.selection",true,_5);_4.mixin(_5._editor.selection,{getType:function(){if(_4.isIE<9){return _4.doc.selection.type.toLowerCase();}else{var _7="text";var _8;try{_8=_4.global.getSelection();}catch(e){}if(_8&&_8.rangeCount==1){var _9=_8.getRangeAt(0);if((_9.startContainer==_9.endContainer)&&((_9.endOffset-_9.startOffset)==1)&&(_9.startContainer.nodeType!=3)){_7="control";}}return _7;}},getSelectedText:function(){if(_4.isIE<9){if(_5._editor.selection.getType()=="control"){return null;}return _4.doc.selection.createRange().text;}else{var _a=_4.global.getSelection();if(_a){return _a.toString();}}return "";},getSelectedHtml:function(){if(_4.isIE<9){if(_5._editor.selection.getType()=="control"){return null;}return _4.doc.selection.createRange().htmlText;}else{var _b=_4.global.getSelection();if(_b&&_b.rangeCount){var i;var _c="";for(i=0;i<_b.rangeCount;i++){var _d=_b.getRangeAt(i).cloneContents();var _e=_4.doc.createElement("div");_e.appendChild(_d);_c+=_e.innerHTML;}return _c;}return null;}},getSelectedElement:function(){if(_5._editor.selection.getType()=="control"){if(_4.isIE<9){var _f=_4.doc.selection.createRange();if(_f&&_f.item){return _4.doc.selection.createRange().item(0);}}else{var _10=_4.global.getSelection();return _10.anchorNode.childNodes[_10.anchorOffset];}}return null;},getParentElement:function(){if(_5._editor.selection.getType()=="control"){var p=this.getSelectedElement();if(p){return p.parentNode;}}else{if(_4.isIE<9){var r=_4.doc.selection.createRange();r.collapse(true);return r.parentElement();}else{var _11=_4.global.getSelection();if(_11){var _12=_11.anchorNode;while(_12&&(_12.nodeType!=1)){_12=_12.parentNode;}return _12;}}}return null;},hasAncestorElement:function(_13){return this.getAncestorElement.apply(this,arguments)!=null;},getAncestorElement:function(_14){var _15=this.getSelectedElement()||this.getParentElement();return this.getParentOfType(_15,arguments);},isTag:function(_16,_17){if(_16&&_16.tagName){var _18=_16.tagName.toLowerCase();for(var i=0;i<_17.length;i++){var _19=String(_17[i]).toLowerCase();if(_18==_19){return _19;}}}return "";},getParentOfType:function(_1a,_1b){while(_1a){if(this.isTag(_1a,_1b).length){return _1a;}_1a=_1a.parentNode;}return null;},collapse:function(_1c){if(window.getSelection){var _1d=_4.global.getSelection();if(_1d.removeAllRanges){if(_1c){_1d.collapseToStart();}else{_1d.collapseToEnd();}}else{_1d.collapse(_1c);}}else{if(_4.isIE){var _1e=_4.doc.selection.createRange();_1e.collapse(_1c);_1e.select();}}},remove:function(){var sel=_4.doc.selection;if(_4.isIE<9){if(sel.type.toLowerCase()!="none"){sel.clear();}return sel;}else{sel=_4.global.getSelection();sel.deleteFromDocument();return sel;}},selectElementChildren:function(_1f,_20){var win=_4.global;var doc=_4.doc;var _21;_1f=_4.byId(_1f);if(doc.selection&&_4.isIE<9&&_4.body().createTextRange){_21=_1f.ownerDocument.body.createTextRange();_21.moveToElementText(_1f);if(!_20){try{_21.select();}catch(e){}}}else{if(win.getSelection){var _22=_4.global.getSelection();if(_4.isOpera){if(_22.rangeCount){_21=_22.getRangeAt(0);}else{_21=doc.createRange();}_21.setStart(_1f,0);_21.setEnd(_1f,(_1f.nodeType==3)?_1f.length:_1f.childNodes.length);_22.addRange(_21);}else{_22.selectAllChildren(_1f);}}}},selectElement:function(_23,_24){var _25;var doc=_4.doc;var win=_4.global;_23=_4.byId(_23);if(_4.isIE<9&&_4.body().createTextRange){try{var tg=_23.tagName?_23.tagName.toLowerCase():"";if(tg==="img"||tg==="table"){_25=_4.body().createControlRange();}else{_25=_4.body().createRange();}_25.addElement(_23);if(!_24){_25.select();}}catch(e){this.selectElementChildren(_23,_24);}}else{if(_4.global.getSelection){var _26=win.getSelection();_25=doc.createRange();if(_26.removeAllRanges){if(_4.isOpera){if(_26.getRangeAt(0)){_25=_26.getRangeAt(0);}}_25.selectNode(_23);_26.removeAllRanges();_26.addRange(_25);}}}},inSelection:function(_27){if(_27){var _28;var doc=_4.doc;var _29;if(_4.global.getSelection){var sel=_4.global.getSelection();if(sel&&sel.rangeCount>0){_29=sel.getRangeAt(0);}if(_29&&_29.compareBoundaryPoints&&doc.createRange){try{_28=doc.createRange();_28.setStart(_27,0);if(_29.compareBoundaryPoints(_29.START_TO_END,_28)===1){return true;}}catch(e){}}}else{if(doc.selection){_29=doc.selection.createRange();try{_28=_27.ownerDocument.body.createControlRange();if(_28){_28.addElement(_27);}}catch(e1){try{_28=_27.ownerDocument.body.createTextRange();_28.moveToElementText(_27);}catch(e2){}}if(_29&&_28){if(_29.compareEndPoints("EndToStart",_28)===1){return true;}}}}}return false;}});}}};});