// caution: change double quote to &#34; and single quote/apostrophe to &#39; and ampersand to &amp; in any text; URIs don't work. 
// punctuation for ", ', . and @, use the following equivalents (the vertical bar is a separator):  "  &#34;  |  '  &#39;  |  .  &#46;  |  @  &#64;  |

function updated () {document.write("This page was last updated " + document.lastModified);}

function footer () {document.write("<hr /><address><br><strong>URL:</strong> "+document.URL+"<br>was last updated "+document.lastModified+"<br>&nbsp; </address><a href='http://www.pa-spaug.org' target='_blank'>Return to the SPAUG Home Page</a>");}

function eMail (theName, theISP, text) {
	document.write("<a href="+"mail"+"to:"+theName+"&#64;"+theISP+" onMouseover=\"window.status='mailto'; return true\" onMouseOut=\"window.status=''; return true\">"+text+"</"+"a>");
	}

// define methods for meeting 
function Disp_Meet() {
	var d = "<span style=\"font-weight:bold\">" + MDY(this.date) + "</span>";
	var n = (this.name == "")? "": "<br><span style=\"font-weight:bold\">Speaker: </span>" + this.name;
	var a = (this.afil == "")? "": ", " + this.afil;
	var t = (this.title == "")? "": "<br><span style=\"font-weight:bold\">Topic: </span>" + this.title;
	var s = (this.summary == "")? "":"<br><br>" + this.summary;
	if ((n+t) != "") {document.write("<li style=\"margin-top:16px; margin-bottom:16px;\">" +
	d + n + a + t + s + "</li>");}
}
	
function Display_Mtg() {
	var my = MY(this.date);
	document.write("<li>(" + my + ") - " + this.name + ", " + this.afil + ", on " + this.title + "</li>");
	}

// define constructor for meeting
function Meeting(d,n,a,t,s) {
	this.date = d; 	// date of meeting
	this.name = n; 	// name of speaker
	this.afil = a;	// afiliation of speaker
	this.title = t;	// title of talk
	this.summary = s; // summary of topic
	this.Display = Disp_Meet; 
	this.Brief = Display_Mtg;
}

// define method for meeting
function display_meeting() {
	document.write(this.date + "<br>" + this.name + ", " + this.afil + ", " + this.title);
}
Meeting.prototype.display = display_meeting;

// store all meeting data in one array - add new meetings in separate .js files
var mtgs = new Array();
 
function nextGenMtg() {
	var now = new Date();
	var my1 = this.shift(); 
	var my2 = this.shift();
	while(my1 && my2) {
		if(now <= my2.date && now > my1.date) {
			my2.Display();
		}
	}
	my1 = my2;
	my2 = this.shift();
}
Array.prototype.nextMtg = nextGenMtg;

// function to display dates
function MDY(d) {			// parameter must be a Date object
	y = d.getFullYear(); 	// extract year
	m = d.getMonth() + 1; 	// extract month - counts from 0
	d = d.getDate(); 		// get day of month
	return (m + "/" + d + "/" + y);
	}
	
function MY(d) {			// parameter must be a Date object
	y = d.getFullYear(); 	// extract year
	m = d.getMonth() + 1; 	// extract month - counts from 0
	var Mon = "";
	switch (m) {
		case 1: Mon = 'Jan'; break;
		case 2: Mon = 'Feb'; break;
		case 3: Mon = 'Mar'; break;
		case 4: Mon = 'Apr'; break;
		case 5: Mon = 'May'; break;
		case 6: Mon = 'Jun'; break;
		case 7: Mon = 'Jul'; break;
		case 8: Mon = 'Aug'; break;
		case 9: Mon = 'Sep'; break;
		case 10: Mon = 'Oct'; break;
		case 11: Mon = 'Nov'; break;
		case 12: Mon = 'Dec'; break;
		default: Mon = '###';
		}
	return (Mon + " " + y);
	}
		
function MonYear(d) {			// parameter must be a Date object
	var y = d.getFullYear(); 	// extract year
	var m = d.getMonth() + 1; 	// extract month - counts from 0
	var Mon = "";
	switch (m) {
		case 1: Mon = 'Jan'; break;
		case 2: Mon = 'Feb'; break;
		case 3: Mon = 'Mar'; break;
		case 4: Mon = 'Apr'; break;
		case 5: Mon = 'May'; break;
		case 6: Mon = 'Jun'; break;
		case 7: Mon = 'Jul'; break;
		case 8: Mon = 'Aug'; break;
		case 9: Mon = 'Sep'; break;
		case 10: Mon = 'Oct'; break;
		case 11: Mon = 'Nov'; break;
		case 12: Mon = 'Dec'; break;
		default: Mon = '###';
		}
	return (Mon + y);
	}
	
function display_mtg(d) {	// parameter must be a Date object
	var my = MY(d.date);
	return("<li>(" + my + ") - " + d.name + ", " + d.afil + ", on " + d.title + "</li>");
	}
	
function Contact() {			// method for Member
	var n = ("<li>" + this.name + "</li>");
	var p = (this.phone != "")? ("<li>Phone: " + this.phone + "</li>"): "";
	var f = (this.fax != "")? ("<li>FAX: " + this.fax + "</li>") : "";
	var e2 = (this.email2 != "" && this.isp2 != "")? ("<li><a href=mailto:" + this.email2 + "&#64;" + this.isp2 + " onMouseover=\"window.status='contact'; return true\" onMouseOut=\"window.status=''; return true\">email</a></li>"): "";
	var e = (this.email != "" && this.isp != "")? ("<li><a href=mailto:" + this.email + "&#64;" + this.isp + " onMouseover=\"window.status='contact'; return true\" onMouseOut=\"window.status=''; return true\">" + this.name + (e2 !=""? " or ": "") + "</a></li>"): "";
	return( (e != "")? e + e2+ p + f : n + p + f );
	}

function EMAIL () {
	var e2 = (this.email2 != "" && this.isp2 != "")? ("<li><a href=mailto:" + this.email2 + "&#64;" + this.isp2 + " onMouseover=\"window.status='mailto'; return true\" onMouseOut=\"window.status=''; return true\">email</a></li>"): "";
	var e = (this.email != "" && this.isp != "")? ("<li><a href=mailto:" + this.email + "&#64;" + this.isp + " onMouseover=\"window.status='mailto'; return true\" onMouseOut=\"window.status=''; return true\">email" + (e2 !=""? " or ": "") + "</a></li>"): "";
	return(e + e2);
}
	
function Expert() {			// method for Member
	var x = this.exprt;
	var n = ("<li>" + this.name + "</li>");
	var p = (this.phone != "")? ("<li>Phone: " + this.phone + "</li>") : "";
	var f = (this.fax != "")? ("<li>FAX: " + this.fax + "</li>") : "";
	var e = (this.email != "" && this.isp != "")? ("<li><a href=mailto:" + this.email + "&#64;" + this.isp + " onMouseover=\"window.status='expert'; return true\" onMouseOut=\"window.status=''; return true\">"+this.name+"</a></li>"): "";
	return(x +((e != "")? e + p + f : n + p + f));
	}
	
function Officer() {		//  method for Member
	var o = ("<li><strong>" + this.office + "</strong></li>");
	var n = ("<li>" + this.name + "</li>");
	var p = (this.phone != "")? ("<li>Phone: " + this.phone + "</li>") : "";
	var f = (this.fax != "")? ("<li>FAX: " + this.fax + "</li>") : "";
	var e = (this.email != "" && this.isp != "")? ("<li><a href=mailto:" + this.email + "&#64;" + this.isp + " onMouseover=\"window.status='officer'; return true\" onMouseOut=\"window.status=''; return true\">"+this.name+"</a></li>"): "";
	return(o + ((e != "")? e + p + f :n + p + f ));
	}
	
function Member(n,em,i,o,ex,p,c,f,em2,i2) {
	this.name = n;
	this.email = em;
	this.isp = i;
	this.office = o;
	this.exprt = ex;
	this.phone = p;
	this.cell = c;
	this.fax = f;
	this.email2 = em2;
	this.isp2 = i2;
	this.expert = Expert;
	this.officer = Officer;
	this.contact = Contact;
	this.EMAIL = EMAIL;
}

function nextMtg(zzz) {
	var xxx = zzz.slice(0);
	var now = new Date();
	var my1 = xxx.shift(); 
	var my2 = xxx.shift();
	while(my1 && my2) {
		if(now <= my2.date && now > my1.date) {
			my2.Display();
			break;
		}
	my1 = my2;
	my2 = xxx.shift();
	}
}

// define constructor for SIG
function SIG(n, l, e) {
	this.name = n;		// name of SIG
	this.leader = l;	// name of leader/contact
	this.email = e;
	this.caption = SIG_caption;
}

function SIG_caption () {
	var n = this.name;
	var l = this.leader;
	var e = this.email;
	document.write("<div style=\"color:green;\">"+n+" &mdash; <a href=mailto:"+e+">contact"+"</a>/leader: "+l+"</div>");
}

function SIG_display () {
	var d = "<span style=\"font-weight:bold\">" + MDY(this.date) + "</span>";
	var n = (this.name == "")? "": "<br><span style=\"font-weight:bold\">Speaker: </span>" + this.name;
	var a = (this.afil == "")? "": ", " + this.afil;
	var t = (this.title == "")? "": "<br><span style=\"font-weight:bold\">Topic: </span>" + this.title;
	var s = (this.summary == "")? "":"<br><span style=\"color:red;\">" + this.summary + "</span>";
	if ((d+n+t) != "") {document.write("<div style=\"margin-top:3px; color:black; margin-bottom:6px;\">" +
	d + n + a + t + "</div>");}
}

// define constructor for meeting
function SIG_Meeting(d,n,a,t,s) {
	this.date = d; 	// date of meeting
	this.name = n; 	// name of speaker
	this.afil = a;	// afiliation of speaker
	this.title = t;	// title of talk
	this.summary = s; // summary of topic
	this.Display = SIG_display; 
	this.Brief = Display_Mtg;
}

var SITEID = 40847150 
// for main.htm Breaking News from Ziff-Davis
