$(document).ready(function(){
	// Drop downs
	$("li.top_menu").hover(function(){
		$(this).find(".sub_menu").show();
	}, function(){
		$(this).find(".sub_menu").hide();
	});
	
	// Gallery
	if($(".gallery").length > 0){
		$(".gallery a").overlay({
			// each trigger uses the same overlay with the id "gallery"
			target: '#gallery',
			// optional exposing effect
			expose: '#f1f1f1',
			// remove images cached on close
			onClose: function(){
				if($("#gallery #img").length > 0){
					$("#gallery #img").remove();
					$("#gallery").attr("style", '');
				}
			}
		// let the gallery plugin do its magic!
		}).gallery({
			// the plugin accepts its own set of configuration options
			speed: 800,
			preload: false
		});
	}	
	
	// Resume page sliders
	if($("#accordion").length > 0){
		$("#accordion").accordion();
		$("#accordion h3").click(function(){
			this.blur();
		});
	}
	
	// Append link targets
	$(".open_new_window").attr("target", "_blank");
	
	
	// Popup to alert IE6 users that it may not look right in IE6
	if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
		$("#facebox").overlay({
			top: 272,
			expose: {
				color: '#fff',
				loadSpeed: 200,
				opacity: 0.5
			},
			onClose: function(){
				$("#facebox").remove();
			},
			closeOnClick: true,
			api: true
		}).load();
	}
});