/*  
 *  (c) 2010 Lawriter
 *
 *  Some helper functions in order to provide a search bar at the top and
 *  and a 'floating' toolbar at the bottom.
 *
 *--------------------------------------------------------------------------*/

$(document).ready(function(e) {
	$('#search_Box')
		.bind("focus keyup", function() {
			if ($('#search_Box').val() != '') {
				$('div._clear_button').css('display', 'block');
			} else {
				$('div._clear_button').css('display', 'none');
			}
		})

	$('._clear_button').click(function() {
		$('#search_Box').val('');
		$('div._clear_button').css('display', 'none');
		$('#search_Box').focus()
	});
});

$(document).ready(function() {
		$(document).bind('scroll', setFooter);
		var footerElement = $("#footer");
		var height = (document.all) ? document.body.clientHeight : window.innerHeight;

		footerElement.css('top', (height + myScroll - 49) + 'px');

		//setFooter();
});

function setFooter() {
	var height = (document.all) ? document.body.clientHeight : window.innerHeight;
	var myScroll = (document.all) ? document.body.scrollTop : window.pageYOffset;

	var footerElement = $("#footer");
	footerHeight = footerElement.height();
	footerHeight = footerElement.offsetHeight;
	//footerElement.css('top', (height + myScroll - 49) + 'px');
}

