/*
*  Initieren van FancyBox
*
*  Api functies staan hier http://fancybox.net/api
*
*  .fancyIframe      =>   locatie van de A wordt als doel voor iframe gezien
*  .fancyIframeRefresh    =>   locatie van de A wordt als doel voor iframe gezien
*              na sluiten van frame wordt de hele pagina ververst (handig voor formulieren en dingen)
*  .fancyImage      =>  locatie van A wordt in frame geladen als een afbeelding en past zich aan qua maat.
*/

$(document).ready(function() {
    // always give a width and height!
    $(".fancyIframe").each(function(){
	var dWidth  = parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=',''));  
	var dHeight =  parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=',''));
	
	$(this).fancybox({
	    'transitionIn'       : 'fade',
	    'transitionOut'      : 'fade',
	    'type'               : 'iframe',
	    'titleShow'          : false,
	    'opacity'            : true,
	    'width'              : dWidth,
	    'height'             : dHeight,
	    'padding'            : 0,
	    'margin'             : 0,
	    'overlayColor'       : '#0a5170',
	    'overlayOpacity'     : 0.7,
	    'scrolling'          : 'no',
	    'autoScale'          : false
	});
    });
    
    $(".fancyIframeRefresh").fancybox({
        'transitionIn'    : 'elastic',
      'transitionOut'    : 'elastic',
      'type'        : 'iframe',
      'titleShow'      : false,
      'opacity'      : true,
      'padding'      : 0,
      'width'      : 700,
      'height'      : 700,
      'onClosed'      : function(){document.location = document.location;}
  });
    $(".fancyImage").fancybox({
        'transitionIn'    : 'elastic',
      'transitionOut'    : 'elastic',
      'titleShow'      : false,
      'opacity'      : true,
      'padding'      : 0
  });
});
