$(document).ready(function() {
	$("#chevron-target-buyers").mouseenter(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/target-buyers-on.gif");
	});
	$("#chevron-target-buyers").mouseleave(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/target-buyers.gif");
	});
	
	$("#chevron-profile-needs").mouseenter(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/profile-needs-on.gif");
	}).mouseleave(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/profile-needs.gif");
	});
	
	$("#chevron-connect-to-sales").mouseenter(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/connect-to-sales-on.gif");
	}).mouseleave(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/connect-to-sales.gif");
	});
	
	$("#chevron-cultivate-leads").mouseenter(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/cultivate-leads-on.gif");
	}).mouseleave(function () {
		$(this).attr("src", TEMPLATE_DIR + "images/cultivate-leads.gif");
	});
});

var home = {
	timeout: null,
	initChevron : function(){
		$('a[rel*=facebox]').facebox({overlay:false, left:145, top: 90});
		
		$("#chevron-target-buyers").mouseenter(function () {
			clearTimeout(home.timeout);
			$("#link-target-buyers").click();
		});
		
		$("#chevron-profile-needs").mouseenter(function () {
			clearTimeout(home.timeout);
			$("#link-profile-needs").click();
		});
		
		$("#chevron-connect-to-sales").mouseenter(function () {
			clearTimeout(home.timeout);
			$("#link-connect-to-sales").click();
		});
		
		$("#chevron-cultivate-leads").mouseenter(function () {
			clearTimeout(home.timeout);
			$("#link-cultivate-leads").click();
		});
		
		// close any facebox on mouse over
		$("#chevron").mouseleave(function () {
			home.timeout = setTimeout(function(){
				$.facebox.close();
			}, 10000);
		});
	}
}
