$(function(){
	$("#home").hover(
		function(){
			if($(".active").attr("id")!='red'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '960').animate({
					'width' : '0'
				});
				$("#red").stop().css('width', '0').animate({
					'width' : '960'
				});
			}
		},
		
		function(){
			if($(".active").attr("id")!='red'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '0').animate({
					'width' : '960'
				});
				$("#red").stop().css('width', '960').animate({
					'width' : '0'
				});
			}
		}	
	);
	
	$("#als").hover(
		function(){
			if($(".active").attr("id")!='red'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '960').animate({
					'width' : '0'
				});
				$("#red").stop().css('width', '0').animate({
					'width' : '960'
				});
			}
		},
		
		function(){
			if($(".active").attr("id")!='red'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '0').animate({
					'width' : '960'
				});
				$("#red").stop().css('width', '960').animate({
					'width' : '0'
				});
			}
		}	
	);
	
	$("#cars").hover(
		function(){
			if($(".active").attr("id")!='blue'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '960').animate({
					'width' : '0'
				});
				$("#blue").stop().css('width', '0').animate({
					'width' : '960'
				});
			}
		},
		
		function(){
			if($(".active").attr("id")!='blue'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '0').animate({
					'width' : '960'
				});
				$("#blue").stop().css('width', '960').animate({
					'width' : '0'
				});
			}	
		}
	);
	
	$("#contact").hover(
		function(){
			if($(".active").attr("id")!='green'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '960').animate({
					'width' : '0'
				});
				$("#green").stop().css('width', '0').animate({
					'width' : '960'
				});
			}
		},
		
		function(){
			if($(".active").attr("id")!='green'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '0').animate({
					'width' : '960'
				});
				$("#green").stop().css('width', '960').animate({
					'width' : '0'
				});
			}
		}
	);
	
	$("#login").hover(
		function(){
			if($(".active").attr("id")!='orange'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '960').animate({
					'width' : '0'
				});
				$("#orange").stop().css('width', '0').animate({
					'width' : '960'
				});
			}
		},
		
		function(){
			if($(".active").attr("id")!='orange'){
				$("#red").stop().css('width', '0');
				$("#blue").stop().css('width', '0');
				$("#green").stop().css('width', '0');
				$("#orange").stop().css('width','0');
				$(".active").stop().css('width', '0').animate({
					'width' : '960'
				});
				$("#orange").stop().css('width', '960').animate({
					'width' : '0'
				});
			}
		}
	);
	
	$('#adminLoginLink').click(function(){
		$("#adminLogin").animate({
			left: (($(window).width()/2)-$(this).width())-($(this).width()*2),
			top: ($(window).scrollTop()+($(window).height()/2))-($(this).height()*8)
		}, 800);
		return false;
	});
	
	$('#login').click(function(){
		$("#adminLogin").animate({
			left: (($(window).width()/2)-$(this).width())-($(this).width()*2)+50,
			top: ($(window).scrollTop()+($(window).height()/2))-($(this).height()*8)
		}, 800);
		return false;
	});
	
	$('#bottomLogin').click(function(){
		$("#adminLogin").animate({
			left: (($(window).width()/2)-$(this).width())-($(this).width()*2)+50,
			top: ($(window).scrollTop()+($(window).height()/2))-($(this).height()*8)
		}, 800);
		return false;
	});
	
	$('#adminLoginClose').click(function(){
		$("#adminLogin").animate({
			left: -5000,
			top: 0
		}, 1000);
		$("#loginError").html("");
		return false;
	});
	
	$('#assetsLink').click(function(){
		$("#assets").animate({
			left: (($(window).width()/2)-$(this).width())-($(this).width()*2),
			top: ($(window).scrollTop()+($(window).height()/2))-($(this).height()*8)
		}, 800);
		return false;
	});
	
	$('#assetsClose').click(function(){
		$("#assets").animate({
			left: -5000,
			top: 0
		}, 1000);
		return false;
	});
});
