//
// This is a collection of javascript functions used by NYU SoMIT
//
// by Tyler 7/2003
//
// TODO:
//	Make scripts run using a relative path, while still working for hostnames other
//	than *.med.nyu.edu.
//

// Emails the URL of the current page by invoking the user's local mail client.
function emailPageViaClient() {
	mailto_str = "mailto:?subject=" + escape(document.title) +
		"&body=Here is a page at the NYU School of Medicine website I thought may interest you: " +  
		escape(location.href);
	location.href = mailto_str;
}

// Emails the URL of the current page through a web form & script,
// which sends the mail from our web server.
function emailPageViaBrowser() {
	winEmailToAFriend = window.open('http://www.med.nyu.edu/cgi-bin/emailtoafriend.cgi?url=' + escape(document.location) +
		'&title=' + escape(document.title),
		'emailtoafriend',
		'width=475,height=550,toolbar=no,scrollbars=yes,resizable=yes');
	winEmailToAFriend.focus();
}

// Calls a cgi script to format and display a printer-friendly version of the current page.
// **NOTE: Only works with pages that use the standard SoM Dreamweaver template.
//         Otherwise it simply displays the whole page as it was.
function printableVersion() {
	winPrintable = window.open('http://www.med.nyu.edu/cgi-bin/it/web/printable.cgi?url=' +
		escape(document.location),
		'printable',
		'');
	winPrintable.focus();
}
