// Search field focus
function searchActive()
{
	box = document.getElementById( 'keywords' );
	if( box.value == 'Enter keywords...' )
	{
		box.value = '';
	}
}

// Search field lost focus
function searchClear()
{
	box = document.getElementById( 'keywords' );
	if( box.value == '' )
	{
		box.value = 'Enter keywords...';
	}
}

// jQuery
$(document).ready(function() {
	if( window.location.protocol != 'https:' ) {
/*
		$.getScript('http://platform.twitter.com/anywhere.js?id=f6EON5dALalZGKFPWVqDiA&v=1', function() {
			twttr.anywhere(function(twitter) {
				twitter('#pageBody').hovercards();
			});
		});
*/
	}
	$('.hideItem').click( function() {
		id = $(this).attr('id').replace('hideItem','');
		$(this).html('<small>moment</small>');
		$.get('/api/get/html/kill.item.'+ id, function(data) {
			$('#hideItem'+ id).html( data );
		});
	});
	$(".itemFlag").click( function() {
		id = $(this).attr('id').replace('itemFlag','');
		$.get('/api/get/html/spamflag.item.'+ id, function(data) {
			$('#itemFlag'+ id).html( data );
		});
	});
	$("#searchFeeds").keydown( function() {
		$.get( "/api/get/html/findfeeds/"+ $("#searchFeeds").val(), false, function(data) {
			$("#sources").html( data );
		});
	});
	$(".breakdownBtn").click( function() {
		name = '#'+ $(this).attr('id') +'breakdown';
		$(name).toggle();
	});
	$("a[rel^='extitem']").click( function() {
		id = $(this).attr('rel').replace('extitem','');
		$.get('api/get/plain/click.item.'+ id);
		return true;
	});
	$("a[rel^='extfeed']").click( function() {
		id = $(this).attr('rel').replace('extfeed','');
		$.get('api/get/plain/click.feed.'+ id);
		return true;
	});
});
