loc = {
	"great-western-malting" : {
		"x":240,
		"y":58,
		"y-type":"left",
		"text":"Supplying the highest quality malts to brewers, distillers and food processors throughout the United States, Canada, Asia and South America."},
	"canada-malting-co-limited" : {
		"x":230,
		"y":20,
		"y-type":"left",
		"text":"Supplying quality malts to brewers, distillers and food processors throughout Canada and around the world."},
	"barrett-burston" : {
		"x":170,
		"y":180,
		"y-type":"right",
		"text":"A pioneer in Australian malting and leading supplier to the domestic brewing industry and Asian export markets."},
	"bairds-malt" : {
		"x":435,
		"y":30,
		"y-type":"left",
		"text":"One of the United Kingdom’s premier malt producers, supplying the Scotch whiskey industry and major brewers around the world."}
};


$(function(){
	$(".accordion").accordion({"autoHeight":false});
	if( $("#map-location").length > 0 )
	{
		$("div.aboutbox a").hover(show_location,hide_location);
		$("#map-location").hide();
	}

	if( $("#sf").length > 0 )
	{
		adjust_map();
		$(window).resize(adjust_map);
	}
});


function adjust_map()
{
	// max 340, min 120
	var diff = $(window).height() - $(".main-holder").height();

	if(diff < 100) diff = 100;
	else if(diff > 340) diff = 340;

	$("#footer").height(diff);
}


function show_location()
{
	var $t = $(this), id = $t.attr("id");

	if( loc[id] )
	{
		$("#map-location")
			.show()
			.css({ "left":"auto", "right":"auto", "top" : loc[id]["y"]+"px", "background-position" : loc[id]["y-type"]+" top" })
			.css(loc[id]["y-type"], loc[id]["x"]+"px")
			.html(loc[id]["text"]);
	}
}


function hide_location()
{
	$("#map-location").hide();
}
