

 $(document).ready(function(){
							
	$.preload( 
	  ['landbau','gesundheit','bildung','energie','kleingewerbe','patenschaften'], {
	  base: 'layout/zs-entwicklungshilfe/img/',
	  ext: '_off.jpg'
	});
	
	// Spenden-Button: dynamic fixed height
	var mainmenuHeight = $('#mainmenu').height();
	var contentHeight = $('#content').height();
	// console.log(mainmenuHeight);
	if(mainmenuHeight < 450 && !$('#b77').length){
		if(contentHeight < 450) {
			buttonTop = contentHeight - 47;
		} else {
			buttonTop = 450;
		}
		var marginTop = buttonTop - mainmenuHeight;
		$('#online-spenden').css({'margin-top': marginTop+'px'});
		$('#pate-werden').css({'margin-top': marginTop+'px'});

		if(contentHeight < 500) {
			$('#content').css('height','500px');
		}
	}
	// if WELTKARTE - submenu hover: get the country on the map
	if($('#map').length) {
		//console.log('JA');
		$('#submenu a').hover(function() {
			var linkText = $(this).text();
			// get rid of numbers in the link
			var countryName = linkText.replace(/\d+\s+/,'');
			countryName = $.trim(countryName);
			//console.log(countryName);
			var countryId = $('#map area[title="'+countryName+'"]').attr('id');
			if(countryId !== undefined) {
				//console.log(countryId);								
				// $('#map img').attr('src','layout/zs-entwicklungshilfe/map/map_'+countryId+'.gif');
				$('#map img').attr('src','fileadmin/entwicklungshilfe/map/map_'+countryId+'.gif');
			}
	  		// return false; 
		},
		function() { 
			// on mouseout get the original map
			// $('#map img').attr('src','layout/zs-entwicklungshilfe/map/world-map.gif');	
			 $('#map img').attr('src','fileadmin/entwicklungshilfe/map/world-map.gif');	
	  		//return false; 						 
		});
	}
	
	$('#map area').hover(function() { 
		var url = $(this).attr('href');
		var country = $(this).attr('title'); 
		var countryId = $(this).attr('id'); 
		// var mapImage = 'layout/zs-entwicklungshilfe/map/map_'+countryId+'.gif';
		var mapImage = 'fileadmin/entwicklungshilfe/map/map_'+countryId+'.gif';
		// var host = jQuery.url.attr("host");
		// var test = 'http://'+host+'/'+mapImage
		$('#map img').attr('src', mapImage);
		var src = $('#map img').attr('src');
		// alert(src)
		var countryLink = $('#submenu a:contains("'+country+'")');
		countryLink.css({'color':'#B51047', 'text-decoration':'underline'});
		// console.log(z);
	  	//return false; 
	},
	function() { 									 
		$('#map img').attr('src','fileadmin/entwicklungshilfe/map/world-map.gif');			
		var country = $(this).attr('title');
		var countryLink = $('#submenu a:contains("'+country+'")');
		countryLink.removeAttr('style');		
	  	// return false; 						 
	});						   
		
	
						
});