$(document).ready(function() {


  // TEST LOGGIN CONSOLE
  jQuery.logThis = function( text ){
	  if( (window['console'] !== undefined) ){
		  console.log( text );
	  }
  }



  // FIX DROPDOWN DISABLED <IE8
  try {
    if ($.browser.msie && parseFloat($.browser.version) < 8) {
      $('option[disabled]').css({'color': '#ccc'});
      $('select').change(function() {
        if(this.options[this.selectedIndex].disabled) {
          if(this.options.length == 0) {
            this.selectedIndex = -1;
          } else {
            this.selectedIndex--;
          }
          $(this).trigger('change');
        }
      });
      $('select').each(function(it) {
        if(this.options[this.selectedIndex].disabled)
          this.onchange();
      });
    }
  } catch (ex) {
    $.logThis('FIX DROPDOWN DISABLED: ' + ex)
  }


	$("a.zoom").fancybox({
		overlayShow					: true,
		hideOnContentClick	: false,
		zoomSpeedIn					: 10,
		zoomSpeedOut				: 10,
		zoomSpeedChange			: 10,
		titlePosition	: 'inside'
	});

	$("a.youtube").fancybox({
		frameWidth					: 640,
		frameHeight					: 360,
		overlayShow					: true,
		hideOnContentClick	: false,
		zoomSpeedIn					: 0,
		zoomSpeedOut				: 0,
		zoomSpeedChange			: 0,
		titlePosition	: 'inside'
	});

	$("a.zoomdyn").fancybox({
		frameWidth					: 640,
		frameHeight					: 560,
		overlayShow					: true,
		hideOnContentClick	: false,
		zoomSpeedIn					: 0,
		zoomSpeedOut				: 0,
		zoomSpeedChange			: 0,
		titlePosition	: 'inside'
	});
	

	$("a.image_popup").fancybox({
		overlayShow		: true,
		zoomSpeedIn		: 10,
		zoomSpeedOut	: 10,
		zoomSpeedChange	: 10,
		titlePosition	: 'inside'
	});


  $('a.zoomdyn').each(function(){ 
		try {
			var fWidth = parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=','')); 
			var fHeight =  parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=','')); 
			$(this).fancybox({'frameWidth':fWidth,'frameHeight':fHeight});
		} catch(e) {}
  }); 


	if ($('#popup_auto').length) {
		$('#popup_auto').fancybox().trigger('click');
	}


	if ($('#divTabs').length) {
		$("#divTabs").tabs();
	}





//  // ********** EXTERNAL LINKS ************
//  $("a[target='_blank'").not("[href*='beheer/']").each(function() {
//      $(this).addClass('external_link');
//  });




});

