
function doAjax(page,div,onlywhenempty) {
	
	if (onlywhenempty)	{
		var checkdiv = document.getElementById(div);
		if (checkdiv.innerHTML == '')	{var doUpdate = 'yes';}
	}
	else	{
		var doUpdate = 'yes'	
	}
	
	if (doUpdate)	{
		jQuery.ajax({
		  url: page,
		  cache: false,
		  success: function(html){
		    $(document.getElementById(div)).html(html);
				toggleBox(div,1);
		  }
		});
	}
}


function makeTall(){  $(this).animate({"height":150},500);}
function makeShort(){ $(this).animate({"height":26},200);}
	
		
				
$(document).ready(function() {
	/*
    $("#searchform").ajaxForm({
        success: function(responseText){
            $.fancybox({
                'content' : responseText
            });
        }
    }); 
	*/
	$(function(){
		$("body.popup input, body.popup textarea, body.popup select, body.popup button").uniform();
		$("#newsletterform input, #newsletterform textarea, #newsletterform select, #newsletterform button").uniform();
	});

	
/*
	$('#menu').bind('mouseenter mouseleave', function(event) {
    switch(event.type) {
        case 'mouseenter':
           $("#menu").animate({height: menucollapsedHeight}, 500 );
        break;
        case 'mouseleave':
         $("#menu").animate({height: menuHeight}, 500 );
        break;
  	  }
	});
 */
			$("#menu").hoverIntent({
				over: makeTall, 
				timeout: 500, 
				out: makeShort
			});
	
	
									
	 $('#search_input').val('').toggleVal({
			populateFrom: 'label',
				removeLabels: true,
				focusClass: 'focused'
		});			

	 $('#searchprogramme_input').val('').toggleVal({
			populateFrom: 'label',
				removeLabels: true,
				focusClass: 'focused'
		});			
				
	 $('#email_input').val('').toggleVal({
			populateFrom: 'label',
				removeLabels: true,
				focusClass: 'focused'
		});			
				
		

	 $("#binnenkortlist a, #binnenkort_news a, #showlist li a, #content #news li a, #topbasket, a.fancybox, #popuplink").fancybox({
				'width'				: '96%',
				'height'			: '100%',
				'autoScale'			: true,
				'transitionIn'		: 'elastic', 
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'titlePosition'	: 'inside'
			});
		
	});


