var recipientTarget = new Array(null,null,null,null);
var bodySource = null;
var bodyTarget = null;
var attachmentElement = null;
var popUpWin = null;
var messageForm = null;
var actionButton = null;
var envelopeWin = null;
var bodyWin = null;
var submitOK = false;
var charset = "UTF-8";
var fillFactor = 7;
var attachURL="/FAV3-001041DA/FOV3-001041DF/%23723760/Attach?UnSent=1";
function sendMessage(sendMode) {
var recipientNames;
var proceed = true;
var fieldIDs = new Array(9,11,30);
submitOK = false;
if(!sendMode && (field[9].length + field[11].length)==0 && field[30].length > 0 && (131))
proceed = confirm("Warning:\n Your message contains only BCC recipients.\n It may be marked as spam/junk email.\n Send it anyway?");
if(!sendMode && (field[9].length + field[11].length + field[30].length)==0) {
if(50)
alert("Error: No recipient names, Unable to send message");
} else if(proceed && customSend(sendMode)) {
if(bodySource)
bodyTarget.value = bodySource.value;
if(messageForm.elements["Priority"])
messageForm.elements["Priority"].value = field[36];
if(messageForm.elements["Sensitivity"])
messageForm.elements["Sensitivity"].value = field[34];
for(var type=0; type < fieldIDs.length; type++)
if(typeof(field[fieldIDs[type]]) != "undefined" && field[fieldIDs[type]].length) {
for(var index=0, recipientNames=""; index < field[fieldIDs[type]].length; index++) {
recipientNames += field[fieldIDs[type]][index][1];
if(index != field[fieldIDs[type]].length-1)
recipientNames += "\n";
}
recipientTarget[type].value = recipientNames;
}
if(sendMode==0 || sendMode==2)
actionButton.name = "Send";
else if(sendMode==1)
actionButton.name = "Save";
submitOK = true;
}
}
function makeTargetElements(outDoc,includeBody,includeCc,includeBcc) {
outDoc = (outDoc?outDoc:envelopeWin.document);
outDoc.write("");
messageForm = outDoc.forms[outDoc.forms.length - 1];
outDoc.write("");
actionButton = messageForm.elements[messageForm.elements.length - 1];
outDoc.write("");
recipientTarget[0] = messageForm.elements[messageForm.elements.length - 1];
if(includeBody) {
outDoc.write("");
bodyTarget = messageForm.elements[messageForm.elements.length - 1];
}
if(includeCc) {
outDoc.write("");
recipientTarget[1] = messageForm.elements[messageForm.elements.length - 1];
}
if(includeBcc) {
outDoc.write("");
recipientTarget[2] = messageForm.elements[messageForm.elements.length - 1];
}
outDoc.write("");
outDoc.write("");
outDoc.write("");
outDoc.write("");
outDoc.write("");
}
function makePostmark() {
if(formEnabled)
return " ";
else
return "";
}
function openPopUp(evnt,file,width,height,options) {
killPopUpWin();
var optionsString = "innerWidth=" + width + ",innerHeight=" + height + ",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbars=no";
popUpWin = window.open((file.charAt(0)!="/"?"/.templates/":"") + file + (file.charAt(0)!='/'?"?charset=UTF-8":""),"PopUpWindow",optionsString);
return false;
}
function openAbsolutePopUp(evnt, file, width, height, options) {
killPopUpWin();
var optionsString = "innerWidth=" + width + ",innerHeight=" + height + ",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbars=no";
popUpWin = window.open(file,"PopUpWindow",optionsString);
return false;
}
function killPopUpWin(popUpFunction) {
if(popUpWin != null && !popUpWin.closed && (popUpFunction?popUpWin.currentFunction==popUpFunction:true))
popUpWin.close();
}
function validateFormat() {
for(var formatArg = 1; formatArg < arguments.length; formatArg++)
arguments[0][formatArg] = arguments[0][formatArg]?arguments[0][formatArg]:arguments[formatArg];
return arguments[0];
}
function changeCheckboxState(ID,source,dataType,CBtype) {
CBtype = (CBtype?3:2);
field[ID] = (field[ID]+1)%CBtype;
switch(field[ID]) {
case 1: source.src = "/Icons/15001"; break;
case 2: source.src = "/Icons/15003"; break;
default: source.src = "/images/pixel.gif"; break;
}
switch(ID) {
case 39: messageForm.elements["ReadRcpt"].value = field[39];
break;
case 40: messageForm.elements["DeliveryRcpt"].value = field[40];
break;
case 41: messageForm.elements["RouteRcpt"].value = field[41];
break;
default: messageForm.elements["FieldID:" + ID + "=" + dataType].value = field[ID];
break;
}
}
function makeBody(element) {
if(typeof(element)=="undefined" || element==null) {
if(typeof(bodyWin.document.forms[0].elements[0]) == "undefined")
element = null;
else
element = bodyWin.document.forms[0].elements[0];
}
bodySource = element;
}
function customSend(){ return true; }
function addFile(filename) {
if(typeof(field) != "undefined" && typeof(field[13]) != "undefined") {
var ID = field[13].length;
field[13][ID] = new Array("-7004", filename, "", "/FAV3-001041DA/FOV3-001041DF/SendFunctions.inc." + ID + "/" + filename);
envelopeWin.location.reload(false);
}
}