$(document).ready(function() {
	//SEARCH BOX
	$(".search_link").click(function(e) {
		e.preventDefault();
		$("fieldset#search_options").toggle();
		$("#keywords").focus();
		$(".search_link").toggleClass("search_open");
	});

	$("fieldset#search_options").mouseup(function() {
		return false;
	});

	//ADD BOX
	$(".add_link").click(function(e) {
		e.preventDefault();
		$("fieldset#add_options").toggle();
		$("#keywords").focus();
		$(".add_link").toggleClass("add_open");
	});

	$("fieldset#add_options").mouseup(function() {
		return false;
	});

	//ADD CHILD BOX
	$(".add_children_button").click(function() {
		$(".add_children_box").slideToggle();
	});

	$(document).mouseup(function(e) {
		if($(e.target).parent("a.add_link").length==0) {
			$(".add_link").removeClass("add_open");
			$("fieldset#add_options").hide();
		}
	});

	$("#scroll_up").mouseover(function() {
		$("#storelist").scrollTo(3000, {duration:4000, axis:'y'});
	}).mouseout(function() {
		$("#storelist").stop();
	});

	$("#scroll_down").mouseover(function() {
		$("#storelist").scrollTo(0, {duration:4000, axis:'y'});
	}).mouseout(function() {
		$("#storelist").stop();
	});

	jQuery(function() {
		if ( jQuery('.map_storedir').length > 0 ) {
			jQuery('.map_storedir').maphilight({
				fill: true,
				fillColor: 'FF0000',
				fillOpacity: 0.7,
				fade: true,
				stroke: false
			});
		}
	});

	jQuery(".promo_text_container").mouseover(function() {
		jQuery(this).siblings('.promo_date_container').children('.promo_date_day').addClass('promo_date_day_hover');
	}).mouseout(function() {
		jQuery(".promo_date_day").removeClass('promo_date_day_hover');
	});
	
	jQuery('.link_header_facebook').mouseover(function() {
		jQuery('#fb').css("background-image", "url('assets/template/img/logo_FB_over.png')");
	}).mouseout(function() {
		jQuery('#fb').css("background-image", "url('assets/template/img/logo_FB.png')");
	});
	
	jQuery('.link_header_twitter').mouseover(function() {
		jQuery('#tw').css("background-image", "url('assets/template/img/logo_TW_over.png')");
	}).mouseout(function() {
		jQuery('#tw').css("background-image", "url('assets/template/img/logo_TW.png')");
	});
});
