var language_timer = 0; // timer for language box
var search_timer = 0; // timer for search box

/**
 * Hide language div
 *
 * Hides the language div when timer runs out
 *
 **/
function hideLanguage() {
	$('#topstrip .language').removeClass('hover');
}

function hideSearch() {
	$('#topstrip .search').removeClass('hover');
}

$(document).ready(function(){

	$('#topstrip .language').mouseenter(function(){
		clearTimeout(language_timer);
		$(this).addClass('hover');
	});
	$('#topstrip .language').mouseleave(function(){
		language_timer=setTimeout("hideLanguage()",500);
	});
	
	$('#topstrip .search').mouseenter(function(){
		clearTimeout(search_timer);
		$(this).addClass('hover');
	});
	$('#topstrip .search').mouseleave(function(){
		search_timer=setTimeout("hideSearch()",500);
	});
	
	$('#nav > div > ul > li').each(function(i){
		$(this).mouseover(function(){
			$(this).addClass('sfhover');
		}).mouseout(function(){
			$(this).removeClass('sfhover');
		});
	});
	

	$('.safemailto').each(function(){
		email = $(this).html();
		email = email.replace(/\[at\]/gi,'@');
		email = email.replace(/\[dot\]/gi, '.');
		$(this).replaceWith('<a href="mailto:' + email + '">'+ email +'<a/>');
	});


}); // document ready.
