
<!--
var supportsKeys = false
function onLoad() {
	tick()
	document.newMsg.msgTo.focus()
}
function tick() {
		calcCharLeft(document.forms[0])
		if (!supportsKeys) timerID = setTimeout("tick()",50)
}
function favChange(rnum) {
	f = document.newMsg;
	
	if (f.favs.selectedIndex >=0) {
		f.msgTo.value = f.favs.options[f.favs.selectedIndex].value
	}

	if (f.favs.selectedIndex > 0 && f.favs.selectedIndex <= rnum + 1) {
		f.msgText.focus();
	} else {
		f.msgTo.focus();
	}
}
function calcCharLeft(f) {
		lenUSig = f.lenSSig.value
		maxLength = 255 - f.lenSysSig.value - lenUSig
        if (f.msgText.value.length > maxLength) {
	        f.msgText.value = f.msgText.value.substring(0,maxLength)
		    charleft = 0
        } else {
			charleft = maxLength - f.msgText.value.length
		}

        f.msgCL.value = charleft
}

function textKey(f) {
	supportsKeys = true
	calcCharLeft(f)
}

function numEscape(num) {
	newnum = ''
	for (i=0; i < num.length; i++) {
		if (num.charAt(i) == ' ') continue;
		newnum = newnum + num.charAt(i)
	}
	num = escape(newnum);
	newnum = ''
	for (i=0; i < num.length; i++) {
		if (num.charAt(i) == '+') {
			newnum = newnum + '%2B'
			continue
		}
		newnum = newnum + num.charAt(i)
	}
	return newnum
}


function smile(tekst) {	
    var iv = document.gastform.msgText;
    if (document.selection) {
        var range = document.selection.createRange();
        if (range.parentElement() == iv) {
            range.text = tekst;
            return;
        }
    }
    else if (iv.selectionStart || iv.selectionStart == '0') {    
        var str = iv.value;
        var a = iv.selectionStart, b = iv.selectionEnd;
        iv.value = str.substring(0,a) + tekst + str.substring(b, str.length);
        return;
    }
    iv.value += tekst;
	tick();

}
-->
