function init() {

   if ($('#map_canvas').length > 0)
      init_google_maps() ;

	// set up rollover pour le menu
	$("img.rollover").hover(
		function() {
			this.src = this.src.replace("-off","-on");
		},
		function(){
			this.src = this.src.replace("-on","-off");
		}
	);

   if ($('#slideshow').length > 0) {
      $('#slideshow').cycle({});
   }

   if ($('#content a.lightview').length > 0) {
      $('#content a.lightview').lightBox({
         imageBlank: '/includes/jquery-lightbox-0.5/images/lightbox-blank.gif',
         imageLoading: '/includes/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
      	imageBtnClose: '/includes/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
      	imageBtnPrev: '/includes/jquery-lightbox-0.5/images/lightbox-btn-prev.gif',
      	imageBtnNext: '/includes/jquery-lightbox-0.5/images/lightbox-btn-next.gif',
      	containerResizeSpeed: 350,
      	txtImage: 'Image',
      	txtOf: '/'
      });
      // Google Analytics
      $('#content a.lightview').click(function(el){
         file = $(el.currentTarget).attr('href').substr($(el.currentTarget).attr('href').lastIndexOf('/')+1);
         _gaq.push(['_trackEvent', 'click', 'image', file]);
     });
   }

/*
   if ($('#content a.lightview').length > 0) {
   	$('#content a.lightview').lightBox({
         imageBlank: '/includes/jquery-lightbox-0.5/images/lightbox-blank.gif',
         imageLoading: '/includes/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
      	imageBtnClose: '/includes/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
      	imageBtnPrev: '/includes/jquery-lightbox-0.5/images/lightbox-btn-prev.gif',
      	imageBtnNext: '/includes/jquery-lightbox-0.5/images/lightbox-btn-next.gif',
      	containerResizeSpeed: 350,
      	txtImage: 'Image',
      	txtOf: '/'
      });
      // Google Analytics
      $('#content a.lightview').click(function(el){
         file = $(el.currentTarget).attr('href').substr($(el.currentTarget).attr('href').lastIndexOf('/')+1);
         _gaq.push(['_trackEvent', 'click', 'image', file]);
     });
   }
*/

}


$.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++)
	{
		$("<img>").attr("src", arguments[i]);
	}
}


function init_google_maps() {

// V2
   var map = new GMap2(document.getElementById("map_canvas"));
   map.addControl(new GMenuMapTypeControl());
   map.addControl(new GSmallZoomControl3D() );
   
   map.setCenter(new GLatLng(46.528185, 6.529979), 15);

   var baseIcon = new GIcon(G_DEFAULT_ICON);
   baseIcon.shadow = "/content/themes/example_1/images/logo_shadow.png";
   baseIcon.iconSize = new GSize(100, 50);
   baseIcon.shadowSize = new GSize(130, 50);
   baseIcon.iconAnchor = new GPoint(50, 50);
   baseIcon.infoWindowAnchor = new GPoint(50, 50);
   baseIcon.image = "/content/themes/example_1/images/logo.png";

   var marker = new GMarker(new GLatLng(46.52808,6.530067), { icon: new GIcon(baseIcon), title:'Biollay' }) ;

   map.addOverlay(marker); // 46.207161,6.146164

   
   GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml($('#adresse').html());
   });





// V3
/*
   var latlng = new google.maps.LatLng(46.528185, 6.529979 );
   var settings = {
   	zoom: 15,
   	center: latlng,
   	mapTypeControl: true,
   	mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
   	navigationControl: true,
   	navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
   	mapTypeId: google.maps.MapTypeId.ROADMAP};
   var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
   var contentString = $('#adresse').html() ;
   var infowindow = new google.maps.InfoWindow({
   	content: contentString
   });

   var companyImage = new google.maps.MarkerImage('/content/themes/example_1/images/logo.png',
   	new google.maps.Size(100,50),
   	new google.maps.Point(0,0),
   	new google.maps.Point(50,50)
   );

   var companyShadow = new google.maps.MarkerImage('/content/themes/example_1/images/logo_shadow.png',
   	new google.maps.Size(130,50),
   	new google.maps.Point(0,0),
   	new google.maps.Point(65, 50));

   var companyPos = new google.maps.LatLng(46.52808,6.530067 );

   var companyMarker = new google.maps.Marker({
   	position: companyPos,
   	map: map,
   	icon: companyImage,
   	shadow: companyShadow,
   	title:"Biollay SA",
   	zIndex: 3});


   google.maps.event.addListener(companyMarker, 'click', function() {
   	infowindow.open(map,companyMarker);
   });

*/
}

$(document).ready(init);

