tabreeds=0;

function maaklichtbox()
{
	
$(document).ready(function(){
		   
   $("#gallery a").lightBox
({
	overlayBgColor: '#000000',
	overlayOpacity: 0.0,
	imageLoading:			'images/lightbox-loading.gif',		// (string) Path and the name of the loading icon
	imageBtnPrev:			'images/lightbox-prev.gif',			// (string) Path and the name of the prev button image
	imageBtnNext:			'images/lightbox-next.gif',			// (string) Path and the name of the next button image
	imageBtnClose:			'images/lightbox-close.gif',		// (string) Path and the name of the close btn
	imageBlank:				'images/lightbox-leeg.gif',			// (string) Path and the name of a blank image (one pixel)
	containerResizeSpeed: 550,
	txtImage: 'Plaatje',
	txtOf: 'van'
   });

 });
};

function maaktab()
{


   $(document).ready(function(){  
     /*Since all the tabs are hidden with css we are displaying the tab with class .active_tab using fadeIn() 
     function. If you just want it to show with no effect, just put show() instead of fadeIn() */  
    $('.active_tab').fadeIn(); 
	var content = $('.tab_link_selected').attr('rel');
	var container_id = $('.tab_link_selected').attr('name'); 
  $(container_id).load(content,
			function(){
				});
				
				
  if (tabreeds==0)
  {
	  
	  tabreeds=1;
    //when a tab link is clicked...  
    $('.tab_link').live('click', function(event){  
  
        /*...prevent the default behaviour...*/  
        event.preventDefault();  
  
        /* ...remove the tab_link_selected class from current active link... */  
        $('.tab_link_selected').removeClass('tab_link_selected');  
  
        /* ...and add it to the new active link */  
        $(this).addClass('tab_link_selected');  
  
        /*...get the title attribute (which corensponds to the id of the needed text container), 
        but you can use any attribute you want*/  
        var container_id = $(this).attr('name');
		var content = $(this).attr('rel'); 
  
        //...animate the current active_tab by changing it's height and opacity ...'  
        $('.active_tab').animate({  
  
            height : 'toggle' , opacity : 'toggle'
  
        //...and when that animation ends...  
        },function(){  
  
            //...remove the active_tab class from the current active tab...  
            $(this).removeClass('active_tab');  
  
            //...and add that class to the tab that corensponds the clicked link...  
            $(container_id).addClass('active_tab');
			$(container_id).load(content,
			function(){
			           });

  
            //...and animate the new active_tab by using toggle on height and opacity again...  
            $('.active_tab').animate({  
  
                height : 'toggle' , opacity : 'toggle'
  
 
			}); 
			
        });  
										 
    });  
	 };
});  

};

function maakmenublob(){

	
$(document).ready(function(){
menuplaats=345;
  $('<div id="navigation_blob"></div>').css({
top:$('#nav li:first a').offset().top-5,
		width: $('#nav li:first a').width() + 10,
		height: $('#nav li:first a').height() + 10
	}).appendTo('#nav').hide();

  $('#nav a').hover(function(){ 
    // Mouse over function
	  $('#navigation_blob').animate(
      {width: $(this).width() + 10, left: $(this).offset().left-menuplaats},
	    {duration: 'slow', easing: 'easeOutElastic', queue: false}
    );
  }, function() { 
	  // Mouse out function
	  var leftPosition = $(this).offset().left-menuplaats;
	  $('#navigation_blob').animate(
      {width:'hide'},
			{duration:'slow', easing: 'easeOutCirc', queue:false}
		).animate({left: leftPosition}, 'fast' );
  });
});
	
	
}

function maakmenu2blob(){

	
$(document).ready(function(){
menuplaats=345;

  $('<div id="navigation_blob2"></div>').css({
top:$('#nav2:first a').offset().top,
		width:0,
		left:0,
		height: $('#nav2:first a').height()
	}).appendTo('#nav2').hide();



  $('#nav2 a').hover(function(){ 
    // Mouse over function
	  $('#navigation_blob2').animate(
      {width: $(this).width() + 10, left: $(this).offset().left-menuplaats},
	    {duration: 'slow', easing: 'easeOutElastic', queue: false}
    );
  }, function() { 
	  // Mouse out function
	  var leftPosition = $(this).offset().left-menuplaats;
	  $('#navigation_blob2').animate(
      {width:'hide'},
			{duration:'fast', easing: 'easeOutCirc', queue:false}
		).animate({left: leftPosition}, 'fast' );
	  $('#navigation_blob2').left=0;
  });
  
});
	
	
}


function maakmenurol(){

$(document).ready(function () {   
      
    $('#nav li').hover(  
        function () {  
            //show its submenu  
            $('ul', this).slideDown(300);  
  
        },   
        function () {  
            //hide its submenu  
            $('ul', this).slideUp(0);           
        }  
    );  
      
}); 

}

function mijngegevensjq()
{
$('#mgwijs').click(function(e){

var ID=document.getElementById("mgvoorl")
if ((ID.value==null)||(ID.value=="")){
alert("Je moet jouw voorletters invullen")
ID.focus()
return false
}

var ID=document.getElementById("mgachter")
if ((ID.value==null)||(ID.value=="")){
alert("Je moet jouw achternaam invullen")
ID.focus()
return false
}

var ID=document.getElementById("mgstraat")
if ((ID.value==null)||(ID.value=="")){
alert("Je moet de straat en huisnummer invullen")
ID.focus()
return false
}

var ID=document.getElementById("mgpostc")
if ((ID.value==null)||(ID.value=="")){
alert("Je moet de postcode invullen")
ID.focus()
return false
}


var ID=document.getElementById("mgplaats")
if ((ID.value==null)||(ID.value=="")){
alert("Je moet de plaats invullen")
ID.focus()
return false
}

$.post("mijngegevenswijs.asp", $("#mgform").serialize());

content='mijngegevensklaar.asp'
$('#main').load(content,
function(){
 });

});
}


function maakgallery(){
	alert("JA")
$(document).ready(function () { 
							
							alert("JA")
$('#id_of_gallery').gallery({
  interval: 5500,
  height: '400px',
  width: '500px'
});
});
}




function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibs  = $active.siblings();
     var rndNum = Math.floor(Math.random() * $sibs.length );
     var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

$('.menu1lb').live('mouseover mouseout', function(event) {
												  	
var kl=$(this).attr('rel');
var id=$(this).attr('id');
var lk=$('#div'+id).attr('rel');
var l= lk.split("#");
var punt=kl.indexOf(".")
var k= kl.split("#");
  if (event.type == 'mouseover') {
$('#div'+id).css("color", "#"+l[1]);	  
	  if (punt==-1) {
$(this).css('background-color',"#"+k[1]);
	  } else {
$('#img'+id).attr("src", k[1]);
	  }
  } else {
$('#div'+id).css("color", "#"+l[0]);
	  if (punt==-1) {
$(this).css('background-color',"#"+k[0]);
	  } else {
$('#img'+id).attr("src", k[0]);
	  }
  }
});

$('.menu1lb').live('click', function() {

var kl=$(this).attr('rel');
var k= kl.split("#");
//$('#main').css('background-color',"#"+k[0]);
});

$(function() {
    $('#plaatjelb').each(function() {
        var maxWidth = 100; // Max width for the image
        var maxHeight = 100;    // Max height for the image
        var width = $(this).width();    // Current image width
        var height = $(this).height();  // Current image height
        // Check if the current width is larger than the max
        if(width>height && width>maxWidth)
        {
            ratio = maxWidth / width;   // get ratio for scaling image
            $(this).css("width", maxWidth); // Set new width
            $(this).css("height", height * ratio); // Scale height based on ratio
        }
        else if(height>width && height>maxHeight)
        {
            ratio = maxHeight / height; // get ratio for scaling image
            $(this).css("height", maxHeight);   // Set new height
            $(this).css("width", width * ratio);    // Scale width based on ratio
        }
    });
});


// om op een klein plaatje te kunnen klikken
$('.nieuwsplaatjeklein').live('click', function() {
var s=$(document).scrollTop();
$("body").css("overflow", "hidden");
$("#buitenkant").css("left", -11);
$('#zwart').css("top",s );
$('#zwartp').css("top",s );
var p=$(this).attr('rel');	
var gp="/cms/plaatjes/"+p
$('#nieuwsplaatjegroot').attr("src", gp);
$('#zwart').css("opacity",0 );
$('#zwart').css("display", 'block');
$('#zwartp').css("opacity",0 );
$('#zwartp').css("display", 'block');
$('#zwart').animate({
    opacity: .7
  }, 100, function() {
    // Animation complete.

  });
	$('#zwartp').animate({
    opacity: 1
  }, 700, function() {
    // Animation complete.
  });
});

$('#zwart').live('click', function() {
$("body").css("overflow", "auto");
$("#buitenkant").css("left",0);
$('#zwart').animate({
    opacity: 0
  }, 10, function() {
    // Animation complete.
  });
$('#zwartp').animate({
    opacity: 0
  }, 10, function() {
    // Animation complete.
  });
$('#zwart').css("display", 'none');
$('#zwartp').css("display", 'none');
});

$('#zwartp').live('click', function() {
$("#buitenkant").css("left",0);
$("body").css("overflow", "auto");
$('#zwart').animate({
    opacity: 0
  }, 10, function() {
    // Animation complete.
  });
$('#zwartp').animate({
    opacity: 0
  }, 10, function() {
    // Animation complete.
  });
$('#zwart').css("display", 'none');
$('#zwartp').css("display", 'none');
});
