window.abridgeu = {

	init: function()
	{
		try { document.getElementsByTagName('iframe')[0].style.display = 'none'; } catch (e) {}
		try { document.getElementsByName('recaptcha_challenge_field')[0].style.display = 'none'; } catch (e) {}
		window.abridgeu.makeAddressesClickable();
		if (document.getElementById('recent_hits') && document.location.hash == '#hits') {
			window.abridgeu.showRecentHits();
		}
	},

	open: function(text, url)
	{
		window.open(
			'http://twitter.com/share?text=' + encodeURIComponent(text) + '&url=' + encodeURIComponent(url),
			'twitter',
			'width=800,height=500,left=100,top=100,scrollbars=yes,status=yes,resizable=yes'
		).focus();
		return false;
	},

	makeAddressesClickable: function()
	{
		var el = document.getElementsByTagName('address');
		for (var i in el) {
			var e = el[i];
			if (e.textContent && e.textContent.indexOf('http://') == 0) {
				e.onclick = new Function('document.location.href = "' + e.textContent + '"');
				e.style.cursor = 'pointer';
			}
		}
	},

	showRecentHits: function()
	{
		with (document.getElementById('recent_hits').getElementsByTagName('h4')[0]) {
			textContent += ':';
			style.cursor = 'auto';
			onclick = void(0);
		}
		document.getElementById('recent_hits_list').style.display = 'block';
	}

};

window.onload = window.abridgeu.init;
