
var over = false;
var timeOut = null;
var timeToSwitch = 300; // miliseconds

$(function(){
	
	if ($.browser.msie) $('.top .round').append('<div class="ie-corner"></div>');
	
	$('.top>ul a').hover(
		function(){
			over = true;
			clearTimeout(timeOut);
			$('.round').removeClass('language');
			$('.top>ul a.hover').removeClass('hover');
			id = $(this).attr('rel');
			$(this).addClass('hover');
			$('.round .act').hide().removeClass('act');
			if (id=='#contacts') $('.round').addClass('language');
			$(id).addClass('act').show();
			if ($.browser.msie) {
				$('.top>ul ignore').hide();
				$(this).prev().show();
			}
		},
		function(){
			over = false;
			timeOut = setTimeout(function(){showLoginForm(id);},timeToSwitch);
		}
	);
	
	$('#contacts, #languages').hover(
		function(){
			over = true;
			clearTimeout(timeOut);
		},
		function(){
			over = false;
			timeOut = setTimeout(function(){showLoginForm($(this).attr('id'));},timeToSwitch);
		}
	);
	
	$('.forgot_password_link a').click(function(){
		$('#loginForm, #forgottenPass').toggle().toggleClass('act');
		return false;
	});
});
	
function showLoginForm(what){
	if (over==false){
		$('.round .act:not(#loginForm)').hide().removeClass('act');
		$('#loginForm:not(.act)').show().addClass('act');
		$('.top>ul a').removeClass('hover');
		if(what=='#contacts') $('.round').removeClass('language');
		if ($.browser.msie) $('.top>ul ignore').hide();
	}
}
