<!--
function newwindow()
{
	msgWindow = open(action + '?process=addr_only&cmd=msg_new&utoken=' + putoken,'ADDRESSBOOK','width=600,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes','POPUP');
	if (msgWindow.opener == null) msgWindow.opener = self;
        if (msgWindow.opener.sendform == null) msgWindow.opener.sendform = document.sendform;
	msgWindow.focus();
}

function setTitle(){
	window.top.document.title = title + " - Create new message";
}

function setSig(){
	if(document.sendform._default_profile.options[0].selected){
		document.sendform.addsig.value = "off";
	}
	else{
		document.sendform.addsig.value = "on";
	}
}

function setBody(url){
	if(parent.frames[1].itembody != "true"){
		parent.frames[1].document.location.replace(url);
	}
}

var sending1 = new Image();
var sending2 = new Image();
sending1.src = nwimg + "/sending.gif";
sending2.src = nwimg + "/send.gif";

function sendingOff(){
	document.sendImg.src = sending2.src;
	setTimeout("sending()", 500);
}

function sending(){
	document.sendImg.src = sending1.src;
	setTimeout("sendingOff()", 500);
}

function mySend(cmd){
	if(cmd=="send"){
		sending();
		if(isdraft && document.sendform._del_draft.checked){
			document.sendform.cmd.value = 'delitem-' + uidl;
			document.sendform.process.value = cmd;
		}
		else
			document.sendform.cmd.value = cmd;
	}
	else
		document.sendform.cmd.value = cmd;
	document.sendform.message.value = window.parent.frames[1].document.bodyform.message.value;
	document.sendform.submit();
}

function saveDraft(){
	document.sendform.message.value = window.parent.frames[1].document.bodyform.message.value;
	if(isdraft){
		if (confirm("Do you wish to replace the current Draft message?")) {
			document.sendform.cmd.value = 'delitem-' + uidl;
			document.sendform.process.value = "save_draft";
			document.sendform.submit();
			return;
		}
	}
	document.sendform.cmd.value = "save_draft";
	document.sendform.submit();
}

function hotkey(event){
	switch (event.keyCode) {
	   case 10 : // Ctrl-Enter || Ctrl-Shift-J - send
			mySend("send");
			break;
	   case 2 : // Ctrl-Shift-B - open address book
			newwindow();
			break;
	   case 19 : // Ctrl-Shift-S - check spelling
			mySend("spell_check");
			break;
	   case 1 : // Ctrl-Shift-A - add attachment
			mySend("add_attach");
			break;
	   default :
			break;
	}
}

function hotkeyoverload(){
	hotkey(event);
}

if(netscape_version){
	document.captureEvents(Event.KEYPRESS);
	document.onkeypress = hotkey;
}

function wys_update()
{
	if (wys) {
		window.parent.frames[1].wys_update();
	}
}

function do_wys()
{
	wys_update();
	document.sendform.message.value = window.parent.frames[1].document.bodyform.message.value;
	document.sendform.not_new.value = "true";
	document.sendform.cmd.value = "attach_msg";
	if (wys) {
		document.sendform.msg_alternative.value="";
		document.sendform.content_type.options[0].selected = true;
		document.sendform._auto_wysiwyg.value="false";
	}
	else {
		document.sendform.msg_alternative.value="true"; 	
		document.sendform._auto_wysiwyg.value="true";
	}
	parent.frames[1].itembody = "false";
	document.sendform.submit();
}
//-->