function submit_email(title, link) {
	var fromaddr = $F('sharesender');
	var toaddr = $F('sharerecipiants');
	var url = window.location;
	if(String(url).match('/newscenter/')) {
		var templates = 'gallery';
	}else if(String(url).match('/gallery/')){
		var templates = 'gallery';
	}else{
		var templates = 'hubblesite';
	}
	

	new Ajax.Request('/shared/send_to_a_friend/send.php', {method:'POST', parameters:{email: toaddr, from:fromaddr, link: link, template:templates, title:title}});
	$('sharebox').hide();
}




function setup_callback_for(links) {
	var myLinks = $A(links);
	myLinks.each(function(link){
		$(link).observe('click', call_shared(link.innerhtml, link.href));
	});
}


function call_shared(type, url) {
	new Ajax.Request('/shared/shared.php?type=' + type + '&url=' + url);
}