function nueva_ventana(url, ancho, alto, barra) {
	izquierda = (screen.width) ? (screen.width-ancho)/2 : 100
	arriba = (screen.height) ? (screen.height-alto)/2 : 100
	opciones = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + barra + ',resizable=0,width=' + ancho + ',height=' + alto + ',left=' + izquierda + ',top=' + arriba + ''
	window.open(url, 'popUp', opciones)
}
function modelesswin(url,mwidth,mheight){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"", "help:0;resizable:0;scrollbars=0;dialogWidth:'+mwidth+ 'px;dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"pop", "width='+mwidth+'px,height='+mheight+ 'px,resizable=0,scrollbars=0")')
}

var supportsKeys = false

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.mens.focus();
	} else {
		f.msgTo.focus();
	}
}
function calcCharLeft(f) {
		lenUSig = f.lenSSig.value
		maxLength = 300 - f.lenSysSig.value - lenUSig
        if (f.mens.value.length > maxLength) {
	        f.mens.value = f.mens.value.substring(0,maxLength)
		    charleft = 0
        } else {
			charleft = maxLength - f.mens.value.length
		}

        f.msgCL.value = charleft
}

function calcCharLeft_link(f) {
		lenUSig = f.lenSSig.value
		maxLength = 255 - f.lenSysSig.value - lenUSig
        if (f.mens.value.length > maxLength) {
	        f.mens.value = f.mens.value.substring(0,maxLength)
		    charleft = 0
        } else {
			charleft = maxLength - f.mens.value.length
		}

        f.msgCL.value = charleft
}

function textKey(f) {
	supportsKeys = true
	calcCharLeft(f)
}

function textKey_link(f) {
	supportsKeys = true
	calcCharLeft_link(f)
}