/**
 * tweet this
 */
function tweetThis(title, longUrl) {
	bitlyLogin = 'pulsewebsite';
	bitlyApiKey = 'R_4fba115b4efa24d4eaac754ab737f705';
	url = 'http://api.bit.ly/shorten?version=2.0.1&longUrl=' + longUrl
			+ '&login=' + bitlyLogin + '&apiKey=' + bitlyApiKey;
	$.ajax( {
		type :'GET',
		dataType :'jsonp',
		url :url,
		async :false,
		success : function(data, textStatus) {
			for ( var i in data.results) {
				tweetUrl = "http://twitter.com/home?status=" + title + "%20"
						+ data.results[i].shortUrl;
				if (tweetUrl.length < 107) {
					tweetUrl += "%20%23java%20%23opensource%20%23cms"
				} else if (tweetUrl.length < 112) {
					tweetUrl += "%20%23java%20%23opensource";
				} else if (tweetUrl.length < 118) {
					tweetUrl += "%20%23opensource";
				} else if (tweetUrl.length < 124) {
					tweetUrl += "%20%23java";
				}
				$('#tweetThis').attr('href', tweetUrl);
				break;
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			return;
		}
	});
	return false;
}
/**
 * API link
 */
function linkExchange(type, link) {
	if (type == 'API') {
		document.location.href = 'http://pulse.torweg.org/javadoc/index.html?' + link + '.html';
		return false;
	} else {
		alert('Unknown link type!');
	}
	return false;
}
/*******************************************************************************
 * toggle search result overviews
 ******************************************************************************/
function toggleSearchResult(id) {
	el = $("#searchResult" + id);
	i = $("#searchDetailButton" + id);
	if (el.css('display') == 'none') {
		//alert(el.height());
		if (el.height() < 150) {
			el.slideDown('fast');
		} else {
			el.slideDown('slow')
		}
		i.attr('class', 'sprite-up');
	} else {
		el.slideUp('normal');
		i.attr('class', 'sprite-down');
	}
}

/*****
 * stats
 */
 
