function akst_share(id, url, title, html_id, pubid) {
	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_' + html_id);
	var offset = Position.cumulativeOffset(link);

	if (document.getElementById('akst_social')) {

		$("akst_shouke").href = akst_share_url("http://www.shouker.com/mc/col/post2.aspx?title={title}&surl={url}&tags=%E5%8F%AF%E8%83%BD%E5%90%A7", url, title, pubid);
		$("akst_qqbookmark").href = akst_share_url("http://shuqian.qq.com/post?title={title}&uri={url}", url, title, pubid);
		$("akst_baidu").href = akst_share_url("http://cang.baidu.com/do/add?it={title}&iu={url}&dc=&fr=ien#nw=1", url, title, pubid);
		$("akst_google_bmarks").href = akst_share_url("  http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}", url, title, pubid);
		$("akst_fanfou").href = akst_share_url("http://fanfou.com/sharer?u={url}&t={title}", url, title, pubid);
		$("akst_diglog").href = akst_share_url("http://www.diglog.com/submit.aspx?act=like&returnurl=true&title={title}&url={url}&description=", url, title, pubid);
		$("akst_misterwong").href = akst_share_url("http://www.mister-wong.cn/addurl/?bm_url={url}&bm_description={title}", url, title, pubid);
		$("akst_digbuzz").href = akst_share_url("http://www.digbuzz.com/submit.php?url={url}&qs_title={title}", url, title, pubid);
		$("akst_gomobi").href = akst_share_url("http://www.gomobi.org/submit.php?url={url}&qs_title={title}", url, title, pubid);
		$("akst_hexun").href = akst_share_url("http://bookmark.hexun.com/post.aspx?title={title}&url={url}", url, title, pubid);
		$("akst_tolib").href = akst_share_url("http://www.tolib.com/geturl.php?url={url}&title={title}", url, title, pubid);
		$("akst_funp").href = akst_share_url("http://funp.com/push/submit/add.php?url={url}&title={title}", url, title, pubid);
		$("akst_yahoo_myweb").href = akst_share_url("http://myweb.cn.yahoo.com/popadd.html?url={url}&title={title}", url, title, pubid);
		$("akst_365key").href = akst_share_url("http://www.365key.com/storeit.aspx?t={url}&h={title}", url, title, pubid);
		$("akst_poco").href = akst_share_url("http://my.poco.cn/fav/storeIt.php?t={url}&title={title}", url, title, pubid);
		$("akst_sina-vivi").href = akst_share_url("http://vivi.sina.com.cn/collect/icollect.php?pid=28&title={title}&url={url}", url, title, pubid);
		$("akst_hemidemi").href = akst_share_url("http://www.hemidemi.com/user_bookmark/new?title={title}&url={url}", url, title, pubid);
		$("akst_gss").href = akst_share_url("http://www.google.com/s2/sharing/widget?key=AAAAJMGxJrCAEUeImqNvmQm9rgpHvKN0aO_oH2CCthqY9lASFF5FKXfC1frt8q0zQKwwQQ&url={url}", url, title, pubid);
		$("akst_technorati").href = akst_share_url("http://www.technorati.com/faves?add={url}", url, title, pubid);
		$("akst_windows_live").href = akst_share_url("https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={url}&title={title}&top=1", url, title, pubid);
		$("akst_9fav").href = akst_share_url("http://www.9fav.com/profile/user_url/add?u={url}&t={title}", url, title, pubid);
		$("akst_quzhai").href = akst_share_url("http://www.quzhai.com/main/newurl.jsp?title={title}&url={url}", url, title, pubid);
		$("akst_yesky").href = akst_share_url(" http://hot.yesky.com/dp.aspx?t={title}&u={url}", url, title, pubid);
		$("akst_facebook").href = akst_share_url("http://www.facebook.com/share.php?u={url}", url, title, pubid);
		$("akst_digg").href = akst_share_url("http://digg.com/submit?phase=2&url={url}&title={title}", url, title, pubid);
		$("akst_delicious").href = akst_share_url("http://del.icio.us/post?url={url}&title={title}", url, title, pubid);
	}

	if (document.getElementById('akst_email')) {
		post_id.value = 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, pubid) {
	base = base.replace('{url}', url).replace('{title}', title);
	return 'http://r.sharethis.com/web?destination=' + encodeURIComponent(base) + '&publisher=' + pubid;
}

function akst_share_tab(tab) {
	var tab1 = document.getElementById('akst_tab1');
	if (typeof tab1 == 'undefined') {
		tab1 = document.createElement('div');
	}
	var tab2 = document.getElementById('akst_tab2');
	if (typeof tab2 == 'undefined') {
		tab2 = document.createElement('div');
	}
	var body1 = document.getElementById('akst_social');
	if (typeof body1 == 'undefined') {
		body1 = document.createElement('div');
	}
	var body2 = document.getElementById('akst_email');
	if (typeof body1 == 'undefined') {
		body1 = document.createElement('div');
	}
	
	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';
			break;
	}
}
