var currentTab;
var currentTabButton;


$(document).ready(function(){

	//$('ul').bgiframe(); //fix IE6 z-index problem with combo-boxs.

	currentTab=$('#TopBar'+lSearchType);
	currentTabButton=$('#TopTabButton'+lSearchType);
	$('#TopBar'+lSearchType).show();


	centerLoginBox();
	$('#LoginBox').mouseleave(function () {
		hideLoginBox();
	});

	$('#lnkLogin').mouseenter(function () {
		showLoginBox();
	});


	$('.HomepageIcons td img')
		.mouseenter(function () { $(this).animate({ top: -6 }, 'fast'); })
		.mouseleave(function () { $(this).animate({ top: +0 }, 'slow'); });

	$(window).resize(function () {
		centerLoginBox();
	});



});


function centerLoginBox() 
{
	$('#LoginBox')
		.css ('left',$('#lnkLogin').offset().left+$('#lnkLogin').width()-$('#LoginBox').outerWidth())
		.css ('top',$('#lnkLogin').offset().top+$('#lnkLogin').height());

}
	
function switchTab(id)
{
	currentTab.hide();
	currentTab=$('#TopBar' + id);
	currentTab.show();

	currentTabButton.find('img:first').attr('src','images/TopTabRight-Off.gif');
	currentTabButton.find('td:eq(1)').attr('class','TopTabOff');
	currentTabButton.find('img:last').attr('src','images/TopTabLeft-Off.gif');

	currentTabButton = $('#TopTabButton' + id);

	currentTabButton.find('img:first').attr('src','images/TopTabRight-On.gif');
	currentTabButton.find('td:eq(1)').attr('class','TopTabOn');
	currentTabButton.find('img:last').attr('src','images/TopTabLeft-On.gif');
}

function showLoginBox()
{
	$('#LoginBox').slideDown();
	window.setTimeout(function() {$('#LoginEmail').focus();},10);
}

function hideLoginBox()
{
	$('#LoginBox').slideUp();

}
