var s;

function setLocation(locatie)
{
  var a = locatie.split('_');
  /* ajax request */
  var myRequest = new Request({method: 'get', url: url, onComplete:function(response){$('placingdays').set('html', response);}  });
  myRequest.send('action1=ajax1&locatieID='+a[1]);
}

function setContent()
{
  /* ajax request */
  var myRequest = new Request({method: 'get', url: url, onComplete:function(response){$('setContent').set('html', response);}  });
  myRequest.send('action1=ajax&isPeuterspeelzaal='+($('peuterzaal').checked == true?'1':'0'));
}

function showDagdelen(value)
{
  value =value.split(" ").join("_");
  $$('div[name=placingdays]').each(function(el){
    el.setStyle('display', 'none');
  });
  $(value).setStyle('display', '');
}

function highLight(id,highlight){
	if(highlight == true)
		$('rowHighlight_'+id).setStyle('background-color','#D6E6EC');
	if(highlight == false)
		$('rowHighlight_'+id).setStyle('background-color','#fff');
}

// Popup tbv Google maps
function sizeInfo() {

	// get scroll top
	var top = window.getScrollTop() + 150;

	if( ( zoom = $('sizeInfo') ) && zoom.getStyle('display') == 'none' )
	{

		zoom.setStyles( {
			'display': 'block',
			'opacity':0
		} );

		new Fx.Style( 'sizeInfo', 'opacity', { duration:500 } ).start( 1 );

		if( window.ie6 ) {
			$$('select').setStyle('visibility','hidden');
		}

		initialize();
	}
	zoom.setStyle('top', top);
}
function sizeInfoClose() {
	if( ( zoom = $('sizeInfo') ) )
	{
		new Fx.Style( 'sizeInfo', 'opacity', { duration:500, onComplete: function() {
			zoom.setStyle('display', 'none');
		} } ).start( 0 );
		if( window.ie6 ) {
			$$('select').setStyle('visibility','visible');
		}
		return false;
	}
}

// Google maps
function load() {
  if($('map_canvas')){
	  if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(37.4419, -122.1419), 18);
	  }
  }
}
    var map;
    var geocoder;

    function initialize() {
	if($('map_canvas')){
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(34, 0), 14);
      geocoder = new GClientGeocoder();
	  map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
	}
    }

    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(s);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
      var address = document.forms[0].q.value;
      var marker = geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(label, adres, nummer, postcode, plaats, address) {
      s = "<strong>"+label+"</strong><br />"+adres+' '+nummer+"<br />"+postcode+' '+plaats+"<br />";
      document.forms[0].q.value = address;
      showLocation(label, adres, nummer, postcode, plaats, address);
    }

    function setMessage()
    {
      var size1 = window.getScrollSize();
      var size2 = window.getSize();
      var size3 = window.getScroll();
      var left = (size2.x - 600 ) / 2;
      var top = size3.y + 100;
      $('showMessage').setStyle('left', left+'px');
      $('showMessage').setStyle('top', top+'px');
      $('overlay').setStyle('opacity', '0.7');
      $('overlay').setStyle('width', size1.x+'px');
      $('overlay').setStyle('height', size1.y+'px');
      $('showMessage').setStyle('display', '');
      $('showMessage').setStyle('opacity', 0);
       (function (){ $('showMessage').fade('in')}).delay(100);
    }

    function closeMessage()
    {
      $('overlay').fade('out');
      $('showMessage').fade('out');
      (function (){ $('showMessage').destroy();}).delay(2000);
      (function (){ $('overlay').destroy();}).delay(2000);
    }
/**

* WINDOW ONLOAD ---------------------------------

* keep at end of this file

*/
window.addEvent('load', function() {
  if ( $ ( 'flvplayer' ) )
  {
    var so = new SWFObject ( '/layout/default/mplayer/kinderopvang.swf', 'kinderopvang', '240', '200', 8 );
    so.addParam ( 'wmode', 'transparent' );
    so.write ( 'flvplayer' );
	  if ($('showMessage')) {
      setMessage();
    }
  }

});
