	var globalSwitched = new Array();
	var gwps = new wps.base();
	
	function doSwitch(subject){
		var hasSlideUp = false;
		if (!globalSwitched.length){
			globalSwitched.push(subject);
			new Effect.BlindDown(subject, {duration : 0.5});
			return;
		}
		var localglobalSwitched = new Array();
		for (var i=0;i<globalSwitched.length;i++){
			if (globalSwitched[i] == subject){
				new Effect.BlindUp(subject, {duration : 0.5});
				globalSwitched.pop(i);
				hasSlideUp = true;
			}
		}
		if (!hasSlideUp){
			new Effect.BlindDown(subject, {duration : 0.5});
			globalSwitched.push(subject);
		}
	}
	
	function closeSplash(){
		$(document.body).setStyle('overflow:auto;');
		new Effect.Fade($$('.splashOverlay')[0], {duration:0.5});
		new Effect.Fade($$('.splashImage')[0], {duration:0.5});
	}
	
	function hiLite(oObj){
		if (oObj.className == 'navItemActive') return;
		new Effect.Highlight(oObj, {startcolor:'#4caadd', endcolor:'#F2F308', restorecolor:'#F2F308'});
		//new Effect.Highlight(oObj, {startcolor:'#F2F308', endcolor:'#4caadd', restorecolor:'#4caadd'});
		if (oObj.getElementsByTagName('a').item(0)){
			oObj.getElementsByTagName('a').item(0).style.color = '#FFFFFF';
		}
	}
	
	function resetHiLite(oObj){
		if (oObj.className == 'navItemActive') return;
		//new Effect.Highlight(oObj, {startcolor:'#4caadd', endcolor:'#F2F308', restorecolor:'#F2F308'});
		if (oObj.getElementsByTagName('a').item(0)){
			oObj.getElementsByTagName('a').item(0).style.color = '#E4003B';
		}
	}
	
	function checkForm(){
		var form = $('contactForm');
		var ok = true;
		//check names:
		if ( (form.elements['name'].value == '' )  ){
			ok = false;
			$('nameError').style.display = 'inline';
		}else{
			$('nameError').style.display = 'none';
		}
		if (!form.elements['email'].value || !gwps.is_email(form.elements['email'].value)){
			ok = false;
			$('emailError').style.display = 'inline';
		}else{
			$('emailError').style.display = 'none';
		}
		
		if (!form.elements['message'].value){
			ok = false;
			$('messageError').style.display = 'inline';
		}else{
			$('messageError').style.display = 'none';
		}
				
		if (ok){
			//finish form make up and send the mofo:
			var func = function(req){ postContactForm(req, form);}
			var wpsRPC = new wps.rpc;
			wpsRPC.debug = true;
			wpsRPC.createCall('mailer', func);
			wpsRPC.setURI('/mailer/')
			wpsRPC.call('authenticatePost');
		}	
		return false;
	}

	function postContactForm(req, form){
		var GUID = req.responseXML.getElementsByTagName('message').item(0).childNodes.item(0).nodeValue;
		var func = function(req){$('contactForm').update("Uw email is verzonden")}
		var wpsRPC = new wps.rpc;
		wpsRPC.debug = true;
		wpsRPC.createCall('mailer', func);
		wpsRPC.setURI('/mailer/')
		wpsRPC.call('sendMail', 'mailerID=2', 'GUID=' + GUID, 'emailTo=info@kiddies.nl', 'emailFrom=' + form.elements['email'].value, 'mailerName=' + form.elements['name'].value, 'isKlant=' + form.elements['isKlant'].options[form.elements['isKlant'].selectedIndex].value, 'clientMessage=' + form.elements['message'].value);
	}
	
	
	gPageLoaded = true;