﻿/*
Javascript to Get or set current Caret position (cursor location) in textarea/input, to get selected value under textarea/input and replace selected value.
author: Vipul Limbachiya
http://vipulilmbachiya.com
*/

/* 
 * This program is free software. It comes without any warranty, to the extent permitted by applicable law. 
 * You can redistribute it and/or modify it without any terms.
 * Save developers, use Firefox http://firefox.com
*/

/*
    $textArea.GetCaretPos(element) -> Returns no as current cursor position at characters
    
    $textArea.SetCaretPos(element, position) -> Sets cursor position to mentioned character index
    
    $textArea.GetSelectedVal(element) -> Returns text selected value
    
    $textArea.ReplaceSelectedVal(element,text) -> Replaces selected text with text supplied
*/
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 $r={q:d(1){3 c=0;5(a.b){1.g();3 2=a.b.h();2.o(\'j\',-1.s().i);c=2.4.i}e 5(1.6||1.6==\'0\'){c=1.6}m c},p:d(1,8){5(1.f){1.g();1.f(8,8)}e 5(1.n){3 2=1.n();2.x(y);2.w(\'j\',8);2.o(\'j\',8);2.v()}},u:d(1){3 7="";5(1.f){7=1.9.k(1.6,1.l)}e{7=a.b.h().4}1.g();m 7},t:d(1,4){3 7="";5(1.f){1.9=(1.9.k(0,1.6)+4+1.9.k(1.l,1.9.i))}e{a.b.h().4=4}}};',35,35,'|elm|curRange|var|text|if|selectionStart|selectedText|position|value|document|selection|currentPos|function|else|setSelectionRange|focus|createRange|length|character|substring|selectionEnd|return|createTextRange|moveStart|SetCaretPos|GetCaretPos|textArea|value|ReplaceSelectedVal|GetSelectedVal|select|moveEnd|collapse|true'.split('|'),0,{}))
