function akst_share(id, url, title, mail_url) {

	var form = $('akst_form');
	var post_id = $('akst_post_id');
	
	if (form.style.display == 'block' && post_id.value == id) {
		form.style.display = 'none';
		return;
	}
	
	var link = $('akst_link_' + id);

	var offset = Position.cumulativeOffset(link);

	$("akst_delicious").href = akst_share_url("http://del.icio.us/post?url={url}&title={title}", url, title);
	$("akst_digg").href = akst_share_url("http://digg.com/submit?phase=2&url={url}&title={title}", url, title);
//	$("akst_magnolia").href = akst_share_url("http://ma.gnolia.com/bookmarklet/add?url={url}&title={title}", url, title);
//	$("akst_stumbleupon").href = akst_share_url("http://www.stumbleupon.com/submit?url={url}&title={title}", url, title);
//	$("akst_furl").href = akst_share_url("http://furl.net/storeIt.jsp?u={url}&t={title}", url, title);
	$("akst_newsvine").href = akst_share_url("http://www.newsvine.com/_tools/seed&save?popoff=0&u={url}&h={title}", url, title);
	$("akst_yahoo_myweb").href = akst_share_url("http://myweb2.search.yahoo.com/myresults/bookmarklet?u={url}&t={title}&ei=UTF-8", url, title);
//	$("akst_reddit").href = akst_share_url("http://reddit.com/submit?url={url}&title={title}", url, title);
	$("akst_google_bmarks").href = akst_share_url("  http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}", url, title);
	$("akst_facebook").href = akst_share_url("http://www.facebook.com/share.php?u={url}", url, title);
	$("akst_technorati").href = akst_share_url("http://technorati.com/faves?add={url}", url, title);

	post_id.value = id;

	$("akst_email_iframe").src = mail_url.replace('{entry_id}',id);

	form.style.left = offset[0] + 'px';
	form.style.top = (offset[1] + link.offsetHeight + 3) + 'px';
	form.style.display = 'block';
}

function akst_share_url(base, url, title) {
	base = base.replace('{url}', url);
	return base.replace('{title}', title);
}

function getIFrameDocument(aID){ 
 var rv = null; 

 // if contentDocument exists, W3C compliant (Mozilla) 
 if (document.getElementById(aID).contentDocument){ 
   rv = document.getElementById(aID).contentDocument; 
 } else { 
   // IE 
   rv = document.frames[aID].document; 
 } 

 return rv; 
  } 
  
function akst_share_tab(tab) {

	var tab1 = document.getElementById('akst_tab1');
	var tab2 = document.getElementById('akst_tab2');
	var body1 = document.getElementById('akst_social');
	var body2 = document.getElementById('akst_email');
	
	switch (tab) {
		case '1':
			tab2.className = '';
			tab1.className = 'selected';
			body2.style.display = 'none';
			body1.style.display = 'block';
			break;
		case '2':
			tab1.className = '';
			tab2.className = 'selected';
			body1.style.display = 'none';
			body2.style.display = 'block';
//			getIFrameDocument("akst_email_iframe").getElementById('email').focus();
			setTimeout("getIFrameDocument('akst_email_iframe').getElementById('email').focus();",0); // for Firefox

			break;
	}
}
