
	$(function(){
		clear_inputs_on_focus ();
		
	   $("#sub_header_slideshow").cycle({
	   	fx: 'fade',
	   	timeout: 6000
	   });

		$("#cta-media-feed").jCarouselLite({  
			vertical: true,  
			visible: 2,  
			auto: 3000,  
			speed: 2000  
		});  
  

	   $('#employees li').hover(function(e)
		{
			pos = $(this).offset(); 
			if($(this).hasClass('last')) {
				$('.tooltip', this).css({ top: pos['top']+72, left: pos['left']+107, display: 'block' }); 
			} else {
				$('.tooltip', this).css({ top: pos['top']+72, left: pos['left']+107, display: 'block' }); 
			}
		},
		function()
		{
			// css hover simulation which IE6 does not support
			//$('img', this).css({ marginTop: '0' });
			// hide tooltip
			$('.tooltip', this).css({display: 'none'})
		});
		
		if($('#googlemap').length > 0) {
			Googlemap = new GMap(document.getElementById('googlemap'));
			Googlemap.setCenter(new GLatLng(52.2, 5.33));
			KMLoverlay = new GGeoXml('http://dev.dinalog.nl/dinalog.kml' ,function() { show_KmlOverlay() } );
		}

	}); 
	
	function show_KmlOverlay() {
		if (KMLoverlay.loadedCorrectly()){
			Googlemap.addOverlay(KMLoverlay);
			Googlemap.setZoom(Googlemap.getBoundsZoomLevel(KMLoverlay.getDefaultBounds(), Googlemap.getSize())-2); 
			Googlemap.panTo(KMLoverlay.getDefaultCenter()); 
		}  else {
			window.setTimeout(show_KmlOverlay, 500);
		}
	}

	
	// Clear input fields on focus
	function clear_inputs_on_focus () {
		$("input[type=text].clear").focus(function () { 
			if(!$(this).attr("startvalue")) {  
				$(this).attr("startvalue", $(this).val());
			} 
			if($(this).val() == $(this).attr("startvalue")) {
				$(this).val('');	
			}
		}).blur(function () { 
			if($(this).val() == '') {
				$(this).val($(this).attr("startvalue"));
			}
		});
	}

	
