//
// Common Custom Email Functions
//

// this function blulk emails the 'Member'
function emailBulkALL(type, MTypeIDs, to, subj, bcc) {
var attr1 = "top=10,left=50,width=700,height=600,scrollbars=Yes,status=No,resizable,toolbar=No,menubar=No";
theLocation = "mailto:" + to + "?Subject=" + subj + "&BCC=" + "<Minimize this window to SEE 'copy and paste' addresses>";
window.open(theLocation, "Email", attr1);

var attr2 = "top=30,left=200,width=800,height=600,scrollbars=Yes,status=No,resizable,toolbar=No,menubar=No";
theLocation = "../Email/BulkEmailLongDL.cfm?Type=" + type + "&MTypeIDs=" + MTypeIDs;
winpops = window.open(theLocation, "Email", attr2);
winpops.focus(); 
}

// this function looks for checked emails
function emailBulkID(to, subj, bcc) {
var attr = "top=20,width=800,height=600,scrollbars=Yes,status=No,resizable,toolbar=No,menubar=No";
var i;
var l = document.form.email.length;
var s = '';
	for (i=0; i<(l); i++) {
		if (document.form.eChk[i].checked) {
			if (document.form.email[i].value != null){
				s = s + document.form.email[i].value + ',';
			}
		}
	}
s = s + bcc;
if (s.length > 1024) {	
	theLocation = "../Email/BulkEmailLongDL.cfm";
	winpops = window.open(theLocation, "_mailinst", attr);
	winpops.focus(); 
	theLocation = "mailto:" + to + "?Subject=" + subj + "&BCC=" + "<Minimize this window to SEE 'copy and paste' addresses>";
	winpops = window.open(theLocation, "Email", attr)
	winpops.focus(); 
	}
  else {
	theLocation = "mailto:" + to + "?Subject=" + subj + "&BCC=" + s;
	winpops = window.open(theLocation, "Email", attr)
	}	
}

function emailBulk(to, subj, s) {
var attr = "top=20,width=800,height=600,scrollbars=Yes,status=No,resizable,toolbar=No,menubar=No";
if (s.length > 1024) {	
	theLocation = "../../Email/BulkEmailLongDL.cfm";
	winpops = window.open(theLocation, "_mailinst", attr);
	winpops.focus(); 
	theLocation = "mailto:" + to + "?Subject=" + subj + "&BCC=" + "<Minimize this window to SEE 'copy and paste' addresses>";
	winpops = window.open(theLocation, "Email", attr)
	winpops.focus(); 
	}
  else {
	theLocation = "mailto:" + to + "?Subject=" + subj + "&BCC=" + s;
	winpops = window.open(theLocation, "Email", attr)
	}	
}

function emailDL(to, subj, bcc) {
var theMailTo = "Mailto:"  + to + "?Subject=" + subj + "&BCC=" + bcc;
parent.location=theMailTo;
}

function goEmail(t, n) {
var w = 650;
var h = 400;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
var attr = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',titlebar=no,location=no,scrollbars=no,status=no,resizable,toolbar=no,menubar=no';
theLocation = "../EMail/Email.cfm?To=" + t + "&N=" + n;
winpops = window.open(theLocation, "Email", attr)
winpops.focus(); 
return false;
}


