$hoverable = true;
$hover_love = false;
$love_expanding = false;
$love_expanded = false;
$hover_hate = false;
$hate_expanding = false;
$hate_expanded = false;
$(document).ready(function(){
	$('#love_section').hover(function(){
		$hover_love = true;
		if($hoverable == true){
			$hoverable = false;
			expand_love();
		}
	}, function(){
		$hover_love = false;
		if($hover_hate == false){
			reset_love_hate();
		}
	});
	$('#hate_section').hover(function(){
		$hover_hate = true;
		if($hoverable == true){
			$hoverable = false;
			expand_hate();
		}
	}, function(){
		$hover_hate = false;
		if($hover_love == false){
			reset_love_hate();
		}
	});
	$('#love_section').click(function(){
		window.location = "contact.php";
	});
	$('#hate_section').click(function(){	
		window.location = "contact.php";
	});
});
function reset_love_hate(){
	$love_expanding = false;
	$hate_expanding = false;
	$('#love_section').animate({
			height: '225px'
		},
		500
	);
	$('#love_section_title').animate({
			top: '10px'
		},
		500
	);
	$('#love_content').animate({
			opacity: '0'
		},
		500
	);
	$('#hate_section').animate({
			height: '225px'
		},
		500
	);
	$('#hate_section_title').animate({
			bottom: '10px'
		},
		500
	);
	$('#hate_content').animate({
			opacity: '0'
		},
		500,
		function(){
			setTimeout('allow_hover()',250);
			if($hate_expanded == true){
				flip_hate_back();
			}
			$love_expanded = false;
			$hate_expanded = false;
		}
	);
}
function expand_love(){
	$love_expanding = true;
	$hate_expanding = false;
	$('#love_section').animate({
			height: '450px'
		},
		500
	);
	$('#love_content').css('display','block');
	$('#love_content').animate({
			opacity: '1'
		},
		500
	);
	$('#hate_section').animate({
			height: '0px'
		},
		500
	);
	$('#hate_section_title').animate({
			bottom: '-2250px'
		},
		500
	);
	$('#hate_content').animate({
			opacity: '0'
		},
		500,
		function(){
			$love_expanding = false;
			$love_expanded = true;
			$hate_expanded = false;
		}
	);
}
function expand_hate(){
	$love_expanding = false;
	$hate_expanding = true;
	$('#love_section').animate({
			height: '0px'
		},
		500
	);
	$('#love_section_title').animate({
			top: '-225px'
		},
		500
	);
	$('#hate_section').animate({
			height: '450px'
		},
		500
	);
	$('#hate_content').css('display','block');
	$('#hate_content').animate({
			opacity: '1'
		},
		500,
		function(){
			$love_expanded = false;
			$hate_expanding = false;
			$hate_expanded = true;
			flip_hate();
		}
	);
}
function flip_hate(){
	$('#hate').animate({
			height: '5px', top: '28px'
		},
		250,
		function(){
			$('#hate').css('background-image','url("images/hate_b.png")');
			$('#hate').animate({
					height: '56px', top: '-3px'
				},
				250
			);
		}
	);
}
function flip_hate_back(){
	$('#hate').animate({
			height: '5px', top: '28px'
		},
		250,
		function(){
			$('#hate').css('background-image','url("images/hate.png")');
			$('#hate').animate({
					height: '56px', top: '-3px'
				},
				250
			);
		}
	);
}
function allow_hover(){
	$hoverable = true;
}
