window.addEvent('domready', function(){
	
	new SmoothScroll();
	
	var scroll = new Fx.Scroll('slideshow', {
		wait: false,
		duration: 500,
		offset: {'x': -0, 'y': -0 },
		transition: Fx.Transitions.Quad.easeInOut
	});
	var pos = 0;
	var slides = $$('#slideshow .slidewrapper');
	var slidelinks = $$('.slideshownav li a');
	
	scroll.toElement(slides[0].id);
	
	$$('.next').each(function(next, i) {
		next.addEvent('click', function(event) {
			event = new Event(event).stop();
			slidelinks[pos].removeClass('active');
			if(pos < slides.length -1) {
				pos++;
				scroll.toElement(slides[pos].id);
			} else {			        
				pos = 0;
				scroll.toElement(slides[pos].id);
			}
			slidelinks[pos].addClass('active');
		});
	});
	
	slidelinks.each(function(section , i) {
		if(i < slides.length)
		{
			section.addEvent('click', function(event){
				event = new Event(event).stop();
				section.blur();
				scroll.toElement(slides[i].id);
				slidelinks[pos].removeClass('active');
				section.addClass('active');
				pos = i;
			});
		}
	});
});


function getoverlay(type) {
	var thekml = "/home/homekml.inc.php?type="+type; 
	map.clearOverlays();
	
	function checkMark(marker,name,desc,imagefile,n) {
		var deviceIcon = new GIcon(G_DEFAULT_ICON);
		deviceIcon.image = "http://maps.google.com/mapfiles/ms/micons/yellow.png";
		deviceIcon.shadow = "";
		deviceIcon.iconSize = new GSize(24, 24);
		markerOptions = { icon:deviceIcon };
		var Dmarker = new GMarker(new GLatLng(marker.getLatLng().lat(), marker.getLatLng().lng()), markerOptions);
		var infostuff = name + desc;
		GEvent.addListener(Dmarker, 'click', function() {
			Dmarker.openInfoWindowHtml(infostuff);
			}
		);
		//gmarkers.push(Dmarker);
		map.addOverlay(Dmarker);
	}
	
	var homemaps = new EGeoXml("homemaps", map, thekml, {nozoom:true,addmarker:checkMark});
	homemaps.parse();
}