/* algemene javascriptfuncties */


/* De variabele actievePopup bevat de waarde null als er nog geen scherm geopend is, */
/* Anders het windowobject dat geopend is */
/* Wanneer het window wordt gesloten zet dit scherm zelf de variabele weer op null */
actievePopup = null;


/*
 * popUp()   Toont een popup scherm met de gegeven URL en de gegeven breedte en hoogte
 */

function popUp( url, hoogte, breedte)
{

/* even het actieve Popupeffect uitschakelen (A.S 29-11-02)*/
	actievePopup = null;
/* einde persoonlijk geklooi */

    var schermNaam, nu;

    nu = new Date;
    schermNaam = 'w' + nu.getMilliseconds();

    if( actievePopup == null) {
        actievePopup = window.open( url, schermNaam, 
'scrollbars=no,resizable=no,menubar=no,status=no,width=' + breedte +  ',height=' + hoogte);
    }
    else {
        actievePopup.focus();
        actievePopup.onUnload = sluitPopup;
   }
}





/*
 * isLeeg( string)    Controleert of de gegeven string leeg is of alleen maar spaties bevat
 *
 * returnt true wanneer de string leeg is anders false
 */

function isLeeg( deString)
{
   return( trim( deString).length == 0);
}

/*
 * isGeldigEmailadres( deString)    Controleert of de gegeven string een goed emailadres is
 * returnt true wanneer de string een geldig emailadres is
 */

function isGeldigEmailadres( deString)
{
	var EmailOk  = true;
	var AtSym    = deString.indexOf('@');
	var Period   = deString.lastIndexOf('.');
	var Space    = deString.indexOf(' ');
	var Length   = deString.length - 1;   // Array is from 0 to length-1

	if((AtSym < 1) ||                   // '@' cannot be in first position
	(Period <= AtSym+1) ||               // Must be atleast one valid char btwn '@' and '.'
	(Period == Length ) ||               // Must be atleast one valid char after '.'	
	(Space  != -1))                      // No empty spaces permitted
   	{
     	EmailOk = false;
   	}
   	return EmailOk;
}


function trim(inputString) {
	// Removes leading and trailing spaces from the passed string. Also removes
	// consecutive spaces and replaces it with one space. If something besides
	// a string is passed in (null, custom object, etc.) then return the input.
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
	return retValue; // Return the trimmed string back to the user
}





// functies voor de slideshow (op basis van JQuery)

function slideShow(speed) {

	//append a LI item to the UL list for displaying caption
	$('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');

	//Set the opacity of all images to 0
	$('ul.slideshow li').css({opacity: 0.0});
		
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li:first').css({opacity: 1.0});
		
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery()',speed);
		
	//pause the slideshow on mouse over
	$('ul.slideshow').hover(
	function () {
		clearInterval(timer);	
	}, 	
	function () {
		timer = setInterval('gallery()',speed);			
	}
);
		
}

function gallery() {


	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));
		

	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	
	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');

}







// functies voor de google-maps-functie



function checkMap53_2pt5n_0(){
	if (tst53_2pt5n_0)
	if (tst53_2pt5n_0.offsetWidth != tst53_2pt5n_0.getAttribute("oldValue")) {
			tst53_2pt5n_0.setAttribute("oldValue",tst53_2pt5n_0.offsetWidth);

			if (tst53_2pt5n_0.getAttribute("refreshMap")==0)
			if (tst53_2pt5n_0.offsetWidth > 0) {
				clearInterval(tstint53_2pt5n_0);
				getMap53_2pt5n_0();
				tst53_2pt5n_0.setAttribute("refreshMap", 1);
			} 
	}
}
function getMap53_2pt5n_0(){
	if (tst53_2pt5n_0.offsetWidth > 0) {
		map53_2pt5n_0 = new GMap2(document.getElementById('googlemap53_2pt5n_0'));
		map53_2pt5n_0.getContainer().style.overflow='hidden';
		new GKeyboardHandler(map53_2pt5n_0);
		map53_2pt5n_0.addMapType(G_PHYSICAL_MAP);map53_2pt5n_0.addMapType(G_SATELLITE_3D_MAP);
		var point = new GLatLng( 44.888000, 2.955000);
		var centerpoint = point;map53_2pt5n_0.setCenter(centerpoint, 4);
		map53_2pt5n_0.addControl(new GLargeMapControl3D());map53_2pt5n_0.addControl(new GMapTypeControl());map53_2pt5n_0.addControl(new GScaleControl());map53_2pt5n_0.setMapType(G_NORMAL_MAP);
		map53_2pt5n_0.enableContinuousZoom();
		map53_2pt5n_0.enableDoubleClickZoom();
		var marker53_2pt5n_0 = new GMarker(point);map53_2pt5n_0.addOverlay(marker53_2pt5n_0);
	}
}
