// location

$(document).ready(
	function() {
		$("img.kreuz").click(function() {
			$(this).parent().hide();
		});
		$('#weltkarte area').each(
			function() {
				$(this).hover(
					function(e) {
						kontinent = $(this).attr('id');
						var uri = '/globalHome/images/weltkarte_' + kontinent + '.jpg';
						$('img.kartenbild').attr('src',uri);
						var relativeX = e.pageX  - this.offsetLeft - 150;
						var relativeY = e.pageY - this.offsetTop - 180;
						$('#'+kontinent+'_infobox').css({top:relativeY+'px',left: relativeX+'px'});
						$('div.location').hide();
						$('#'+kontinent+'_infobox').show();
						$(this).mousemove(
							function(f){
// 								console.log(f);
								var relativeX = f.pageX - $("#page").offset().left;
								var relativeY = f.pageY - $("#page").offset().top - 180;
								$('#'+kontinent+'_infobox').css({top: relativeY +'px',left: relativeX +'px'});
							}
						);
						$(this).click(
							function(g){
								$('#'+kontinent+'_laenderbox').show();
//								$('#'+kontinent+'_laenderbox img.kreuz').click(
//									function() {
//										$('#'+kontinent+'_laenderbox').hide();
//									}
//								);
							}
						);
					},
					function(e) {
						$('img.kartenbild').attr('src','/globalHome/images/weltkarte_laender.jpg');
						kontinent = $(this).attr('id');
						$('#'+kontinent+'_infobox').hide();
					}
				);
			}
		);
	}
);

/**
$(document).ready(function() {
	$('div.karte area').mouseout(function() {
		$('img.kartenbild').attr('src','design/img/karten/weltkarte_laender.jpg');
		$('div.infobox').hide();
	});
	showDetails('europe', 'Europe');
	showDetails('asia', 'Asia');
	showDetails('africa', 'Africa');
	showDetails('middleeast', 'Middleeast');
	showDetails('northamerica', 'North America');
	showDetails('southamerica', 'South America');
	showDetails('australiapacific', 'Australia');
});

function showDetails(identifier,headline) {
	$('#'+identifier).mouseover(function() {
		$('img.kartenbild').attr('src','design/img/karten/weltkarte_'+identifier+'.jpg');
		$('#'+identifier).mousemove(function(e){
			var mouseX, mouseY;
			if('undefined'!=typeof e.pageX) {
				mouseX = e.pageX;
				mouseY = e.pageY;
			} else {
				mouseX = e.clientX + document.body.scrollLeft;
				mouseY = e.clientY + document.body.scrollTop;
			}
			$('div.infobox').css({top: (mouseY + 15) +'px', left: mouseX+'px' })
		});
	});
	$('div.infobox').html("<h3>"+headline+"</h3><span style='font-size: 11px;'>including ...</span>").show();
	$('#'+identifier).click(function() {$('.'+identifier).show();});
	$('img.kreuz').click( function() {$('.'+identifier).hide(); });
} **/
