/* --------- sharethis -------------------- */
function akst_share(id, url, title, ts) {
	var form = jQuery('#akst_form');
	var post_id = document.getElementById('akst_post_id');

	if (form.css('display') == 'block' && post_id.value == id) {
		form.css('display', 'none');
		return;
	}

	var link = jQuery('#akst_link_' + id);

	// Set up the form
	post_id.value = id;

document.getElementById("akst_reddit").href = akst_share_url("http://reddit.com/submit?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_digg").href = akst_share_url("http://digg.com/submit?phase=2&url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_facebook").href = akst_share_url("http://www.facebook.com/share.php?u={url}&ts={ts}", url, title, ts);
document.getElementById("akst_myspace").href = akst_share_url("http://www.myspace.com/Modules/PostTo/Pages/?l=3&u={url}&t={title}&ts={ts}", url, title, ts);
document.getElementById("akst_delicious").href = akst_share_url("http://del.icio.us/post?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_stumbleupon").href = akst_share_url("http://www.stumbleupon.com/submit?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_technorati").href = akst_share_url("http://www.technorati.com/faves?add={url}&ts={ts}", url, title, ts);
document.getElementById("akst_google_bmarks").href = akst_share_url("http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_yahoo_bmarks").href = akst_share_url("http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u={url}&t={title}&ts={ts}", url, title, ts);
document.getElementById("akst_yahoo_myweb").href = akst_share_url("http://myweb2.search.yahoo.com/myresults/bookmarklet?u={url}&t={title}&ts={ts}", url, title, ts);
document.getElementById("akst_windows_live").href = akst_share_url("https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={url}&title={title}&top=1&ts={ts}", url, title, ts);
document.getElementById("akst_propeller").href = akst_share_url("http://www.propeller.com/submit/?U={url}&T={title}&ts={ts}", url, title, ts);
document.getElementById("akst_friendfeed").href = akst_share_url("http://friendfeed.com/share?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_newsvine").href = akst_share_url("http://www.newsvine.com/_tools/seed&save?popoff=0&u={url}&h={title}&ts={ts}", url, title, ts);
document.getElementById("akst_n4g").href = akst_share_url("http://www.n4g.com/tips.aspx?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_mixx").href = akst_share_url("http://www.mixx.com/submit?page_url={url}&ts={ts}", url, title, ts);
document.getElementById("akst_blinklist").href = akst_share_url("http://blinklist.com/index.php?Action=Blink/addblink.php&Url={url}&Title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_furl").href = akst_share_url("http://furl.net/storeIt.jsp?u={url}&t={title}&ts={ts}", url, title, ts);
document.getElementById("akst_magnolia").href = akst_share_url("http://ma.gnolia.com/bookmarklet/add?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_mister_wong").href = akst_share_url("http://www.mister-wong.com/index.php?action=addurl&bm_url={url}&bm_description={title}&ts={ts}", url, title, ts);

document.getElementById("akst_blogmarks").href = akst_share_url("http://blogmarks.net/my/new.php?mini=1&url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_faves").href = akst_share_url("http://www.faves.com/Authoring.aspx?u={url}&t={title}&ts={ts}", url, title, ts);
document.getElementById("akst_current").href = akst_share_url("http://current.com/clipper.htm?url={url}&title={title}&src=st&ts={ts}", url, title, ts);
document.getElementById("akst_simpy").href = akst_share_url("http://www.simpy.com/simpy/LinkAdd.do?href={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_slashdot").href = akst_share_url("http://slashdot.org/bookmark.pl?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_meneame").href = akst_share_url("http://meneame.net/submit.php?url={url}&ts={ts}", url, title, ts);
document.getElementById("akst_yigg").href = akst_share_url("http://www.yigg.de/neu?exturl={url}&exttitle={title}&ts={ts}", url, title, ts);
document.getElementById("akst_oknotizie").href = akst_share_url("http://oknotizie.alice.it/post?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_fresqui").href = akst_share_url("http://ocio.fresqui.com/post?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_diigo").href = akst_share_url("http://secure.diigo.com/post?url={url}&title={title}&ts={ts}", url, title, ts);
document.getElementById("akst_care2").href = akst_share_url("http://www.care2.com/news/compose?share[link_url]={url}&share[title]={title}&ts={ts}", url, title, ts);
document.getElementById("akst_funp").href = akst_share_url("http://funp.com/pages/submit/add.php?title={title}&url={url}&via=tools&ts={ts}", url, title, ts);
document.getElementById("akst_kirtsy").href = akst_share_url("http://www.kirtsy.com/submit.php?url={url}&ts={ts}", url, title, ts);
document.getElementById("akst_hugg").href = akst_share_url("http://www.hugg.com/node/add/storylink?edit[title]={title}&edit[url]={url}&ts={ts}", url, title, ts);
document.getElementById("akst_sphinn").href = akst_share_url("http://sphinn.com/submit.php?url={url}&ts={ts}", url, title, ts);

	if (link.parent().is('li')) {
		link.parent().parent().after(form); //after <ul>
	} else {
		link.after(form);
	}

	//form.css('display', 'block');
	form.slideDown('fast');
}

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

function akst_share_tab(tab) {
	var tab1 = document.getElementById('akst_tab1');
	var tab2 = document.getElementById('akst_tab2');
	var tab3 = document.getElementById('akst_tab3');
	var body1 = document.getElementById('akst_social');
	var body2 = document.getElementById('akst_email');
	var body3 = document.getElementById('akst_post');
	
	switch (tab) {
		case '1':
			tab2.className = '';
			tab3.className = '';
			tab1.className = 'selected';
			body3.style.display = 'none';
			body2.style.display = 'none';
			body1.style.display = 'block';
			break;
		case '2':
			tab1.className = '';
			tab3.className = '';
			tab2.className = 'selected';
			body1.style.display = 'none';
			body3.style.display = 'none';
			body2.style.display = 'block';
			break;
		case '3':
			tab1.className = '';
			tab2.className = '';
			tab3.className = 'selected';
			body1.style.display = 'none';
			body2.style.display = 'none';
			body3.style.display = 'block';
			break;
	}
}

function akst_morelinks() {
	var innerHtml = $('#akst_more_link').html();
	if ($('#akst_morelinks').is(':visible')) {
		$('#akst_morelinks').hide();
		innerHtml = innerHtml.replace('less', 'more', 'g');
		$('#akst_more_link').html(innerHtml);
	} else {
		$('#akst_morelinks').show();
		innerHtml = innerHtml.replace('more', 'less', 'g');
		$('#akst_more_link').html(innerHtml);
	}
}
/*function akst_post_showform(network) {
	$('#akst_post_links').hide();
	$('#akst_post_'+network).show();
}
function akst_post_lj(id, url, title, ts) {
	form = $('#akst_post_livejournal form');
	
	var options = { 
//	    url:        $(form).attr('action'),
	    url:        'http://cghub/systems/test',
	    success:	akst_post_response_lj,
	    beforeSubmit: akst_post_beforeSubmit_lj,
	    iframe:	true
	}; 
	$(form).ajaxForm(options); 
	
	$("#akst_post_livejournal input[@name='url']").val(url);
	$("#akst_post_livejournal input[@name='title']").val(title);
}
function akst_post_response_lj(xml, statusText) {
	alert(xml);
	alert(statusText);
	$('#working_livejournal').hide();
	var status = $('#status', $(xml)).text();
	
	if (status != 'SUCCESS') {
		$('#error_span_livejournal').html('Error while trying to post to your blog.');
		$('#error_span_livejournal').css('color', 'red');
		$('#error_span_livejournal').show();
	} else {
		$('#error_span_livejournal').html('Successfully posted to your Live Journal blog');
		$('#error_span_livejournal').css('color', 'green');
		$('#error_span_livejournal').show();
	}
}
function akst_post_beforeSubmit_lj() {
	var comment = $("#akst_post_livejournal textarea[@name='c']").val();
	var url = $("#akst_post_livejournal input[@name='url']").val();
	var title = $("#akst_post_livejournal input[@name='title']").val();
	$("#akst_post_livejournal textarea[@name='c']").val(comment+'<br /><br /><a href="'+url+'">'+title+'</a>');
	$("#akst_post_livejournal input[@name='t']").val(title);
	$('#working_livejournal').show();
}*/
/* ----------------- end of sharethis ------------ */