shareLink = function(url) {
	var here  = encodeURIComponent(window.location.href);
	var title = encodeURIComponent(document.title);
	url = url.replace('%url%', here).replace('%title%', title);
	window.open(url, 'share', 'width=640,height=480,menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=yes');
};

emailLink = function(frm) {
	handler = function(data, status) {
		if (status === 'success') {
			jQuery('#emailResponse').html(data).show('fast');
		}
	};
	jQuery.post('/social_widgets/share', jQuery(frm).serialize(), handler, 'html');
};

togglePanel = function(e) {
	var children = e.childNodes;
	for (var i = 0, count = children.length; i < count; i++) {
		if (children[i].tagName == 'H3') {
			children[i].className = (children[i].className == 'collapsed') ? '' : 'collapsed';
		} else if (children[i].tagName == 'DIV') {
			children[i].style.display = (children[i].style.display == 'none') ? '' : 'none';
		}
	}
};
