$(document).ready(function(){
	
	$.ifixpng('/images/pixel.gif');
	$('.png').ifixpng();
	$('img[src$=.png]').ifixpng(); // apply IE6 transparent PNG fix
	
	// homepage: expand contract banner image
	$('#hide_show_area').toggle(
		function(){
			$('.hide_show_div').slideUp(1000);
			$('#home_banner').animate({height:"665px"}, 1000);
			$('#btn_expand').hide();
			$('#btn_contract').show();
		},
		function(){
			$('.hide_show_div').slideDown(1000);
			$('#home_banner').animate({height:"490px"}, 1000);
			$('#btn_contract').hide();
			$('#btn_expand').show();
		}
	);
	
	// directory page: dirnav
	$('#dirnav').menuTree();
	
	$('#dirnav .child a').click(function(){
		
		$('#map_wrap .shop_info_wrap').hide();
		
		$('#dirnav .child a').removeClass('current');
		$(this).addClass('current');
		
		var shopname = $(this).attr('name');
		var shopWrap = $("#map_wrap #"+shopname+" .shop_info_wrap");
		var left = $("#map_wrap #"+shopname).css("left");
		left = parseInt(left.replace(/px/,''));
		
		if(left >= $('#map_wrap').width()/2){
			shopWrap.children(':first').children('.pointer').addClass('rhs');
			shopWrap.css('left','-300px');
		}
		shopWrap.css('top','-'+shopWrap.height()+'px');
		shopWrap.show();
		
		return false;
	});
	
	/*$('#dirnav .child a').mouseover(function(){
		$(this).trigger('click');
	});*/
	
	// forms
	$('.checkbox input').click(function(){
		if(($(this).parent().children('label').html() == "ALL") && ($(this).attr('checked') == true)){
			$(this).parent().parent().children('div').children('input').attr('checked',true);
		}
	});
	
});
