jQuery().ready(function()
{
	var current = 'none';
	$('.province').removeAttr('href');
	$('.province').click(function()
	{
		current = $(this).attr('id');
		loadwebshop(current);
		
	});
	$('#tab_shops').click(function()
	{
		if(current == 'none')
		{
			$('#shopslist').html('Klik op een provincie om te zien<br />waar de winkels liggen.');
			$('#shopslist').css('background-position', '0 0');
		}
		else
		{
			loadwebshop(current);
			//$('#shopslist').load('ajax.php', { get: 'shops', province: current });
		}
	});
	$('#tab_webshops').click(function()
	{
		$('#shopslist').load('ajax.php', { get: 'webshops' });
		$('#shopslist').css('background-position', '-290px 0');
	});
});

function loadwebshop(current)
{
	$.get('ajax.php', { get: 'shops', province: current }, function(data)
	{
		$('#shopslist').css('background-position', '0 0');
		$('#shopslist').html(data);
		$('.province_loc').css({ display: 'none' });
		$('#' + current + '_loc').css({ display: 'block' });
		$('#shopslist .mousehover').appendTo('body');
		$('.mousehover').hide();
		$('#shopslist strong').mousemove(function(event)
		{
			$('.mousehover#m' + $(this).attr('id').substr(1)).show().css({ left: (event.pageX + 10) + 'px', top: (event.pageY + 10) + 'px'});
		}).mouseout(function()
		{
			$('.mousehover').hide();
		});
	});
}
