/* JavaScript for page tools
 * $Id: tools.js,v 1.1 2006/05/03 04:05:21 justin Exp $
 */

// display printer-friendly view in new window
function printPage(url) {
	window.open(url);
}

// open email to friend form in popup
function emailLink() {
	popDo("/emailFriend.php?url="+URLencode(document.location.href),330,475);
}

// open/resize a popup
function popDo(url,w,h) {
	var size;

	if (w>0 && h>0) {
		size = 'width='+w+',height='+h+',innerwidth='+w+',innerheight='+h+',';
	} else {
		size = '';
	}
	var params = size+'dependent=yes,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,location=no,resizable=yes';
	var popup = window.open(url,'popup',params);
	popup.resizeTo(w,h);
	popup.focus();
}

function URLencode(sStr) {
	return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}