$(document).ready(function(){
	imageSpace();
    $('ul.sf-menu').superfish();   
	$('h3.front, #content-right>h2').each(function() {			
		$(this).css('backgroundImage', 'url(/png/index/text/' + $(this).text().replace(/ /g, '+') + ')');			
	})
	maps_initialize();
}); 

 function imageSpace() 
 {
 	$('img').each(function ()
 	{
 		var vspace = $(this).attr('vspace');		
 		if(vspace>0)
 		{			
 			$(this).removeAttr('vspace');
 			$(this).css('marginTop', vspace)	
 			$(this).css('marginBottom', vspace)
 		}
 		var hspace = $(this).attr('hspace');
 		if(hspace>0)
 		{
 			$(this).removeAttr('hspace');
 			$(this).css('marginLeft', hspace)	
 			$(this).css('marginRight', hspace)
 		}		
 		var align = $(this).attr('align');
 		switch (align)
 		{
 			case 'left':
 			case 'right':
 				$(this).css('float', align);break;
 			case 'absBottom':
 				$(this).css('vertical-align', 'bottom');break;
 			case 'absMiddle':
 				$(this).css('vertical-align', 'middle');break;
 			case 'baseline':
 				$(this).css('vertical-align', 'baseline');break;
 			case 'bottom':		
 				$(this).css('vertical-align', 'bottom');break;
 			case 'middle':
 				$(this).css('vertical-align', 'middle');break;
 			case 'textTop':
 				$(this).css('vertical-align', 'text-top');break;
 			case 'top':		
 				$(this).css('vertical-align', 'top');break;
 		}				
 	}) 	
 }
 
 

 function maps_initialize() { 
     if ($('#map_canvas').length > 0) {
 		if (GBrowserIsCompatible()) {
 			var map = new GMap2(document.getElementById("map_canvas"));		
 			var latlng = new GLatLng(45.231756,0.985218);      		
 			function createMarker(latlng, number) {			
 				var marker = new GMarker(latlng);
 				marker.value = number;
 				GEvent.addListener(marker,"click", function() {
 				  map.openInfoWindowHtml(latlng, '<h2>La Barge Dordonge</h2><p>(Het huis staat nog niet op Google Maps)</p>');
 				});
 				return marker;
 			}		
 			map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(8,30)));
 			map.addControl(new GMenuMapTypeControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(8,30)));		
 			map.setCenter(latlng, 16);
 			map.setMapType(G_SATELLITE_MAP);
 			map.addOverlay(createMarker(latlng ,1));				
 			map.openInfoWindowHtml(map.getCenter(),'<h3>La Barge Dordonge</h3><p>(Het huis staat nog niet op Google Maps)</p>');      
 			
 		}
 	}
 }

