
/*
//Google maps functions
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;

    function initialize()
		{
      if (GBrowserIsCompatible()) {      
      	geocoder = new GClientGeocoder(); 
        map = new GMap2(document.getElementById("map_canvas"));
        gdir = new GDirections(map, document.getElementById("directions"));
        map.addControl(new GLargeMapControl());
				map.addControl(new GMapTypeControl());
				map.setCenter(new GLatLng(52.143181, 5.398407), 12);
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
	        
				if(document.getElementById("printSummary"))
				{
					setDirections(getVar("from"), "Muurhuizen 159, 3811 EG Amersfoort", "nl_NL");
				}
				else
				{
					setDirections("Amsterdam", "Muurhuizen 159, 3811 EG Amersfoort", "nl_NL");
				}
      }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
    	var waypoints = new Array(2);
    	waypoints[0] = fromAddress;
    	//waypoints[1] = "Stichtse rotonde Amersfoort Nederland";
    	//waypoints[1] = new GLatLng(52.141177, 5.359194).toString();
    	waypoints[1] = toAddress;

    
    	gdir.loadFromWaypoints(waypoints,
               { "locale": locale });
               

               
//http://maps.google.com/maps?f=d&source=s_d&saddr=52.141177,5.359194&daddr=Utrechtseweg,+Amersfoort,+The+Netherlands&hl=en&geocode=%3BCTUHvqcXFyhWFQedGwMdi8ZRAA&mra=mi&mrsp=0&sz=20&sll=52.141179,5.359354&sspn=0.000588,0.001743&ie=UTF8&ll=52.141207,5.3592&spn=0.000435,0.001743&t=h&z=20               
  //  http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Transpute&sll=52.48278,5.449219&sspn=9.5619,28.564453&ie=UTF8&ll=52.139388,5.356809&spn=0.000588,0.001743&t=h&z=20
      //gdir.load("from: " + fromAddress + " to: " + toAddress,
      //          { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}

	function onGDirectionsLoad()
	{ 
	      // Use this function to access information about the latest load()
	      // results. 
	 var marker = gdir.getMarker(1);	//Hide marker at the roundabout
	 marker.setLatLng(new GLatLng(90,0)); 
      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
		if(document.getElementById("printSummary"))
		{
			//Only do this when we are in printView
			var distance =  gdir.getDistance()['html'];
			var duration =  gdir.getDuration()['html'];
			document.getElementById("summaryText").innerHTML = distance + " - ongeveer " + duration  ;
			document.getElementById("header_end").innerHTML = "Muurhuizen 159, 3811 EG Amersfoort";
			document.getElementById("header_start").innerHTML = getVar("from");	
			
			window.print();
			
			 //mapStart = new GMap2(document.getElementById("startMap"));
			 //mapStart.setCenter(gdir.getMarker(1).getLatLng(), 16);
			 //mapStart.addOverlay(mapStart.getCenter());
	
		}			
	}	
	//End google map code
	*/
	
	
	//Slide code
	/* Wait for the DOM to be available before doing any work */
	window.addEvent('domready', function() { 		
		var sliders = $$(".slide");		
		var triggers = $$(".slide_trigger") ;		 
		/* sliders and triggers are arrays!! */

		/* For each instance of .slide_trigger triggers[x] (note the anonymous function)*/ 
		triggers.each(function( o, x ){ 		
							
			triggers[x].parentNode.className = "dicht";	
			
			triggers[x].parentNode.parentNode.className = "slideList";	
												
			var sl = new Fx.Slide( sliders[x], {duration: 250} );	// Instantiate a new slider effect on the matching .slide element 
		 
				$(triggers[x]).addEvent('click',function(e){  // Add a click event to the [x]th trigger 
					//Get the reference to the link
					tags = this.getElementsByTagName('a');
					
					//var span = $E('span',o);					
					var span = o.getElementsByTagName('span');					
					
					if(sl.open)
						triggers[x].parentNode.className = "dicht";
					else
						triggers[x].parentNode.className = "open";
					
					/*
					if(span[0]){
							var newHTML = span[0].innerHTML == '+' ? '-' : '+';
							span[0].innerHTML = newHTML;
						}*/

								 
					/*if(sl.open)
						tags[0].innerHTML = "Meer";
					else
						tags[0].innerHTML = "Minder";*/
						
					e = new Event(e);			  // the event 
					sl.toggle();				  // Toggle the slider condition
					e.stop(); 				 // Stop the event from bubbling					
				})
				//Add click even to the images
				$(triggers[x].parentNode).addEvent('click',function(e){
					if(sl.open)
						triggers[x].parentNode.className = "dicht";
					else
						triggers[x].parentNode.className = "open";
					e = new Event(e);			  // the event 
					sl.toggle();				  // Toggle the slider condition
					//e.stop(); 
				})
				
									  
				sl.hide(); 				  // Hide the slider 
			});	// end of triggers.each 
	}) // end of window.addevent	
	
	window.addEvent('domready', function(){
 
});
		

	function toggleSlideSection()
	{	
		var mySlide = new Fx.Slide('test');
		var section = document.getElementById('test').style.display;
		alert(mySlide.open);
		if(section == "")
			mySlide.hide();	
		else
			mySlide.show();
	}
	
	
	//Open the print window
	function openPrintRouteWindow()
	{
		strOptions="resizable,menubar,status,location,toolbar,scrollbars";
		strFromAddress = document.getElementById("fromAddress").value;
		strToAddress = document.getElementById("toAddress").value;		
		window.open("/printGoogleRoute.htm?from=" + strFromAddress + "&daddr=" + strToAddress, "Print route", strOptions);
	}
	
	
	function hidePrintMap()
	{
		//document.getElementById("map_canvas").style="blocked";
	}
	
	
	//Use to get variables from url
	function getVar(name)
  {
	 get_string = document.location.search;         
	 return_value = '';
	 
	 do { //This loop is made to catch all instances of any get variable.
			name_index = get_string.indexOf(name + '=');
			
			if(name_index != -1)
				{
				get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
				
				end_of_value = get_string.indexOf('&');
				if(end_of_value != -1)                
					value = get_string.substr(0, end_of_value);                
				else                
					value = get_string;                
					
				if(return_value == '' || value == '')
					 return_value += value;
				else
					 return_value += ', ' + value;
				}
			} while(name_index != -1)
			
	 //Restores all the blank spaces.
	 space = return_value.indexOf('+');
	 while(space != -1)
				{ 
				return_value = return_value.substr(0, space) + ' ' + 
				return_value.substr(space + 1, return_value.length);
				 
				space = return_value.indexOf('+');
				}
		
	 return(return_value);        
     }
