// Copyright http://www.loraco.nl
function requestPage(param, target_id){
         new Ajax.Updater(target_id, '/loadpage.php', {method:'get', parameters: param, 
                            onComplete: function(transport){
                                      initLW();
                                      }}); 
         }


function requestMail() {
		new Ajax.Request("/contact_process.php", {
			   method: 'post',
			   postBody: "to="+$F("to")+"&name="+$F("name")+"&email="+$F("email")+"&subject="+$F("subject")+"&message="+$F("message"),
			   onComplete: showResponse

		});
	}


/* AJAX ACTIVITY INDICATOR AND MESSAGE : ----------------------------------------------------------------- */
Ajax.Responders.register({
         onCreate: function() {
         ($('ajaxActivityIndicator') && Ajax.activeRequestCount > 0)
          document.getElementById('ajaxActivityIndicator').style.display = 'block';
         },
         onComplete: function() {
            if($('ajaxActivityIndicator') && Ajax.activeRequestCount == 0)
            Effect.Fade('ajaxActivityIndicator',{duration: 0.25, queue: 'end'});
            }
         });

function highlightMenu(selObj){
        $(selObj).parentNode.className = "active";

        // Loop elements to disable by classname
        var menuItems = new Array('menu0','menu1','menu2','menu3','menu4'); 
        for (i=0;i<menuItems.length;i++) {
            if (menuItems[i] != $(selObj).parentNode.id) {
                $(menuItems[i]).className = "inactive";
                } 
              } 
        }

function initLW(){
         if (myLightWindow) {
             Event.unloadCache();
			 myLightWindow._setupLinks();
			 myLightWindow._addLightWindowMarkup(false);
			 }
         }


function showResponse(req){
         var res=/contact met uw op/;
	  
         if(req.responseText.match(res)){
           $('contactErrors').style.border= "1px solid green";
           $('contactErrors').style.color="green";
           }else{
                 $('contactErrors').style.border= "1px solid red";
                 $('contactErrors').style.color="red";
                 }
         $('contactErrors').innerHTML=  req.responseText;
         }