(function(){var method;var noop=function noop(){};var methods=['assert','clear','count','debug','dir','dirxml','error','exception','group','groupCollapsed','groupEnd','info','log','markTimeline','profile','profileEnd','table','time','timeEnd','timeStamp','trace','warn'];var length=methods.length;var console=(window.console=window.console||{});while(length--){method=methods[length];if(!console[method]){console[method]=noop;}}}());function getCaretPosition(ctrl){var caretPos=0;if(document.selection){ctrl.focus();var sel=document.selection.createRange();sel.moveStart('character',-ctrl.value.length);caretPos=sel.text.length;}else if(ctrl.selectionStart||ctrl.selectionStart=='0'){caretPos=ctrl.selectionStart;}
return caretPos;}
function setCaretPosition(ctrl,pos){if(ctrl.setSelectionRange){ctrl.focus();ctrl.setSelectionRange(pos,pos);}else if(ctrl.createTextRange){var range=ctrl.createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}}