
$(document).ready(function(){

    $("a[rel=fancybox]").fancybox({
		//'titleShow'     : false,
		'titlePosition'	:	'inside',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200,
		'overlayColor': '#000',
		'overlayOpacity': 0.7 
    });
    $("a[rel=lightbox]").fancybox({
		//'titleShow'     : false,
		'titlePosition'	:	'inside',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200,
		'overlayColor': '#000',
		'overlayOpacity': 0.7 
    });
    $("a.fancy").fancybox({
		//'titleShow'     : false,
		'titlePosition'	:	'inside',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200,
		'overlayColor': '#000',
		'overlayOpacity': 0.7 
    });	
/* 	 $("a.fancy").click(function(e) {
      $('#images').cycle('pause'); 
	  alert('pause');
      return false;
    }); */
		
   //Adjust height of overlay to fill screen when page loads
   $("#fuzz").css("height", $(document).height());

   //When the link that triggers the message is clicked fade in overlay/msgbox
   $("#countryitem").click(function(){
      $("#countryselect").toggle();
      $("#fuzz").toggle();
	  var zindex = $(this).css("z-index");

	  if(zindex == "102")
	  {
		$("#country").css("color","#fff");
		$("#country").css("background-color","#0167A9");
		$("#countryitem").css("z-index","1");		
		$("#countryitem").removeClass("menuactive");
	  }
	  else
	  {
		$("#country").css("color","#0167A9");
		$("#country").css("background-color","#fff");
		$("#countryitem").css("z-index","102");
		$("#countryitem").addClass("menuactive");
	  }  
      return false;
   });
   
    //When the link that triggers the message is clicked fade in overlay/msgbox
   $("#searchitem").click(function(){
      $("#livesearch").toggle();
	  $(".search-text").focus();
      $("#fuzz").toggle();
	  var zindex = $(this).css("z-index");
	  if(zindex == "102")
	  {
		$("#search").css("color","#fff");
		$("#search").css("background-color","#0167A9");
		$("#searchitem").css("z-index","1");
		$("#searchitem").removeClass("menuactive");		
	  }
	  else
	  {
		$("#search").css("color","#0167A9");
		$("#search").css("background-color","#fff");
		$("#searchitem").css("z-index","102");
		$("#searchitem").addClass("menuactive");
	  }
      return false;
   });   

   //When the message box is closed, fade out
   $("#fuzz").click(function(){
	  var zindexCountryItem = $("#countryitem").css("z-index");
	  if(zindexCountryItem == "102")
	  {
		$("#countryselect").fadeOut();
		$("#fuzz").fadeOut();
		$("#country").css("color","#fff");
		$("#country").css("background-color","#0167A9");
		$("#countryitem").css("z-index","1");
		$("#countryitem").removeClass("menuactive");

	  }
	  else if ($("#livesearch").is(":visible")){
		$("#livesearch").fadeOut();
		$("#fuzz").fadeOut();
		//$("#language").removeClass("selected");	  
		$(".search-text-active").addClass("search-text");		  
		$(".search-text-active").removeClass("search-text-active");
		$("#search").css("color","#fff");
		$("#search").css("background-color","#0167A9");
		$("#searchitem").css("z-index","1");	
		$("#searchitem").removeClass("menuactive");			
	  }
      return false;
   });
   
   /*$("#countryselect").click(function(){
      $("#countryselect").fadeOut();
      $("#fuzz").fadeOut();
	  $("#country").removeClass("selected");

      return true;
   }); */ 
 /*  
// for PDF auto-detection 
$('a[href$=".pdf"]').addClass('fancybox-pdf'); 
// setup FB for PDF using onStart to alter content 
// leaving transition effects intact ! 
$('a.fancybox-pdf').fancybox({ 
    'type'        : 'html', 
    'margin'        : 0, 
    'titlePosition'    : 'inside', 
    'transitionIn'    : 'elastic', 
    'transitionOut'    : 'fade', // for cross-browser compatibility 
    'onStart'        : function(selectedArray, selectedIndex,selectedOpts) 
	{ selectedOpts.content = '<embed src="' + selectedArray[selectedIndex].href + 
	'#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="' + 
	Math.round( $(window).height() * 0.9 ) + 
	'" width="' + Math.round( $(window).width() * 0.9 ) + '" />' } 
}); */   

});



//Adjust height of overlay to fill screen when browser gets resized
$(window).bind("resize", function(){
   $("#fuzz").css("height", $(window).height());
});
	
	//jQuery(function($) {
	//	$('#newsbar img').wrap(function() {
	//		return '<span alt="' + $(this).attr('alt') + '" style="background-image:url(' + $(this).attr('src') + '); height: '+ $(this).height() + 'px; width: '+ $(this).width() + 'px;" class="rounded" />';
	//	});
	//});
	
	function showResult(str, lang)
	{
	if (str.length < 3)
	  { 
	  document.getElementById("livesearchresults").innerHTML="";
	  //document.getElementById("livesearch").style.display="none";
	  return;
	  }
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("livesearchresults").innerHTML=xmlhttp.responseText;
		//document.getElementById("livesearch").style.display="block";
		//
		//$("#searchitem").addClass("country_search_active menuactive");
		
		//$("#fuzz").fadeIn();
		}
	  }
	if(lang=="nl")
	{
		var params = "mact=Search%2Ccntnt01%2Cdosearch%2C0&cntnt01returnid=70&cntnt01searchinput=" + str + "&submit=Zoek";
	}
	else if(lang=="en")
	{
		var params = "mact=Search%2Ccntnt01%2Cdosearch%2C0&cntnt01returnid=130&cntnt01searchinput=" + str + "&submit=Zoek";
	}
	else if(lang=="fr")
	{
		var params = "mact=Search%2Ccntnt01%2Cdosearch%2C0&cntnt01returnid=131&cntnt01searchinput=" + str + "&submit=Zoek";
	}
	xmlhttp.open("POST","index.php",true);
	//Send the proper header information along with the request
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");

	xmlhttp.send(params);
		
	//xmlhttp.send();
	}


	$(function() {
	  $('#images')
	  .cycle({
		timeout: 5000,
		speed: 500,
		pause: 1,
		fit: 1,
		pager: '#texts',
		pagerEvent: 'mouseover',
	  });
	});
	function onBefore() { 
		//$('#text_' + this.id) 
		//	.addClass('selected_item'); 
	};
	function onAfter() { 
		//$('#text_' + this.id) 
		//	.removeClass('selected_item'); 
	};	
		  // ]]>

