
(function($) {
  $.facebox = function(data, klass) {
    $.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
    else if (data.image) fillFaceboxFromImage(data.image, klass)
    else if (data.div) fillFaceboxFromHref(data.div, klass)
    else if ($.isFunction(data)) data.call($)
    else $.facebox.reveal(data, klass)
  }

  /*
   * Public, $.facebox methods
   */

  $.extend($.facebox, {
    settings: {
      opacity      : 0.2,
      overlay      : true,
      loadingImage : '/images/loading.gif',
      closeImage   : '/images/closelabel.png',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <div class="content"> \
        </div> \
        <a href="#" class="close"><img src="/images/closelabel.png" title="close" class="close_image" /></a> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()

      $('#facebox .content').empty()
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

      $('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	$(window).width() / 2 - 205
      }).show()

      $(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) $.facebox.close()
        return true
      })
      $(document).trigger('loading.facebox')
    },

    reveal: function(data, klass) {
      $(document).trigger('beforeReveal.facebox')
      if (klass) $('#facebox .content').addClass(klass)
      $('#facebox .content').append(data)
      $('#facebox .loading').remove()
      $('#facebox .body').children().fadeIn('normal')
      $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').width() / 2))
      $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
    },

    close: function() {
      $(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, $.fn methods
   */

  $.fn.facebox = function(settings) {
    if ($(this).length == 0) return

    init(settings)

    function clickHandler() {
      $.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.bind('click.facebox', clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if ($.facebox.settings.inited) return true
    else $.facebox.settings.inited = true

    $(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = $.facebox.settings.imageTypes.join('|')
    $.facebox.settings.imageTypesRegexp = new RegExp('\.(' + imageTypes + ')$', 'i')

    if (settings) $.extend($.facebox.settings, settings)
    $('body').append($.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = $.facebox.settings.closeImage
    preload[1].src = $.facebox.settings.loadingImage

    $('#facebox').find('.b:first, .bl').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
    })

    $('#facebox .close').click($.facebox.close)
    $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
  }

  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;
    }
    return new Array(xScroll,yScroll)
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var $s = $.facebox.settings

    $s.loadingImage = $s.loading_image || $s.loadingImage
    $s.closeImage = $s.close_image || $s.closeImage
    $s.imageTypes = $s.image_types || $s.imageTypes
    $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      if (target == '#') return
      $.facebox.reveal($(target).html(), klass)

    // image
    } else if (href.match($.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass)
    }
  }

  function fillFaceboxFromImage(href, klass) {
    var image = new Image()
    image.onload = function() {
      $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass) {
    $.get(href, function(data) { $.facebox.reveal(data, klass) })
  }

  function skipOverlay() {
    return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
  }

  function showOverlay() {
    if (skipOverlay()) return

    if ($('#facebox_overlay').length == 0)
      $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .click(function() { $(document).trigger('close.facebox') })
      .fadeIn(200)
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    $('#facebox_overlay').fadeOut(200, function(){
      $("#facebox_overlay").removeClass("facebox_overlayBG")
      $("#facebox_overlay").addClass("facebox_hide")
      $("#facebox_overlay").remove()
    })

    return false
  }

  /*
   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      $('#facebox .loading').remove()
      $(document).trigger('afterClose.facebox')
    })
    hideOverlay()
  })

})(jQuery);
/*
 * FeatureList - simple and easy creation of an interactive "Featured Items" widget
 * Examples and documentation at: http://jqueryglobe.com/article/feature_list/
 * Version: 1.0.0 (01/09/2009)
 * Copyright (c) 2009 jQueryGlobe
 * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
 * Requires: jQuery v1.3+
*/
;(function($) {
	$.fn.featureList = function(options) {
		var tabs	= $(this);
		var output	= $(options.output);

		new jQuery.featureList(tabs, output, options);

		return this;	
	};

	$.featureList = function(tabs, output, options) {
		function slide(nr) {
			if (typeof nr == "undefined") {
				nr = visible_item + 1;
				nr = nr >= total_items ? 0 : nr;
			}

			tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current');

			output.stop(true, true).filter(":visible").fadeOut();
			output.filter(":eq(" + nr + ")").fadeIn(function() {
				visible_item = nr;	
			});
		}

		var options			= options || {}; 
		var total_items		= tabs.length;
		var visible_item	= options.start_item || 0;

		options.pause_on_hover		= options.pause_on_hover		|| true;
		options.transition_interval	= options.transition_interval	|| 5000;

		output.hide().eq( visible_item ).show();
		tabs.eq( visible_item ).addClass('current');

		tabs.mouseover(function() {
			if ($(this).hasClass('current')) {
				return false;	
			}

			slide( tabs.index( this) );
		});

		if (options.transition_interval > 0) {
			var timer = setInterval(function () {
				slide();
			}, options.transition_interval);

			if (options.pause_on_hover) {
				tabs.mouseenter(function() {
					clearInterval( timer );

				}).mouseleave(function() {
					clearInterval( timer );
					timer = setInterval(function () {
						slide();
					}, options.transition_interval);
				});
			}
		}
	};
})(jQuery);

$(document).ready(function() {

		if($("#leaderboard").height() < 30) {
			$("#leaderboard").hide();
		}
		if($("#fullbanner-1").height() < 30) {
			$("#fullbanner-1").hide();
		}		
		if($("#fullbanner-2").height() < 30) {
			$("#fullbanner-2").hide();
		}	
	
		if($("#halfbanner-1").height() < 30 && $("#halfbanner-2").height() < 30) {
			$("#halfbanners").hide();
		}			
		
		$.featureList(
			$("#feature-tabs li a"),
			$("#feature-info li"), {
				start_item	:	0
			}
		);
							   
		
		 $('a[rel*=facebox]').facebox() 

		
		$('#column-right #select-container .title').height($('#column-left .block:first .title').height());
		
		$('#recent-items').cycle({
			fx:    'scrollHorz',
			speed:  1600,
			pause:   1,
			timeout:       6000,
			next:   '#cycle-next', 
			prev:   '#cycle-prev'	
		});
	

		$("#search-form #s").focus(function () { 
			if ($(this).val() == 'Trefwoord, Locatie of Toeleverancier') $(this).val('');	
		});
		$("#wiw-form #s").focus(function () { 
			if ($(this).val() == 'Achternaam, functie of bedrijfsnaam') $(this).val('');	
		});		
		//$("#menu .inner").clone().prependTo("#footer-navigation .inner");

		
      function addMega(){

		 $(this).addClass("hovering");
		 $(this).children().children("#menu div.mega-container-content").dropShadow().bgiframe();
		// $(this).children(".mega-container-content").dropShadow();
		 //$(".mega-container-content").dropShadow();
        }

      function removeMega(){
		 $(this).children().children("#menu div.mega-container-content").removeShadow();		  
		$(this).removeClass("hovering");


        }
	
		var megaConfig = {
			 interval: 100,
			 sensitivity: 4,
			 over: addMega,
			 timeout: 500,
			 out: removeMega
		};
	
		$("#menu li.mega").hoverIntent(megaConfig)

  $("#comment-form").submit(function(){
  	if ($("#fldComment").val().indexOf("www.") >= 0 || $("#fldComment").val().indexOf("http") >= 0  ){
		alert('In uw reactie mag u helaas ivm misbruik geen website adressen gebruiken');
		return false;	
	}	
  });

 
  $("#btnPrint a").click(function(){
  	window.print();
	return false;	
  });
    // add a "rel" attrib if Opera 7+   
    if(window.opera) {   
        if ($("#btnBookmark a").attr("rel") != ""){ // don't overwrite the rel attrib if already set   
            $("#btnBookmark a").attr("rel","sidebar");   
        }   
    }   
  
    $("#btnBookmark a").click(function(event){   
        event.preventDefault(); // prevent the anchor tag from sending the user off to the link   
        var url = this.href;   
        var title = this.title;   
  
        if (window.sidebar) { // Mozilla Firefox Bookmark   
            window.sidebar.addPanel(title, url,"");   
        } else if( window.external ) { // IE Favorite   
            window.external.AddFavorite( url, title);   
        } else if(window.opera) { // Opera 7+   
            return false; // do nothing - the rel="sidebar" should do the trick   
        } else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)   
             alert('Unfortunately, this browser does not support the requested action,'  
             + ' please bookmark this page manually.');   
        }   
  
    });   
	
    $(".supplier-list h3 a").click(function(event){   
        event.preventDefault(); // prevent the anchor tag from sending the user off to the link   
//		alert($(this).parent().next().html());
        $(this).css("background","none");
		$(this).parent().next().show("slow");
  
    }); 	
 
 			var onMouseOutOpacity = 0.50;
			$('#thumbs-adv ul.thumbs li').css('opacity', onMouseOutOpacity)
				.hover(
					function () {
						$(this).not('.selected').fadeTo('fast', 1.0);
					}, 
					function () {
						$(this).not('.selected').fadeTo('fast', onMouseOutOpacity);
					}
				);
				// Initialize Advanced Galleriffic Gallery
				if ( $('#gallery-adv').length > 0){				
					var galleryAdv = $('#gallery-adv').galleriffic('#thumbs-adv', {
						delay:                  4800,
						numThumbs:              5,
						preloadAhead:           8,
						enableTopPager:         false,
						enableBottomPager:      true,
						imageContainerSel:      '#slideshow-adv',
						controlsContainerSel:   '#controls-adv',
						captionContainerSel:    '#caption-adv',
						loadingContainerSel:    '#loading-adv',
						renderSSControls:       true,
						renderNavControls:      true,
						playLinkText:           '<img src="/images/controlbl_play.png" alt="Afspelen"/>',
						pauseLinkText:          '<img src="/images/controlbl_pause.png" alt="Pauseren"/>',
						prevLinkText:           '<img src="/images/controlbl_prev.png" alt="Vorige"/>',
						nextLinkText:           '<img src="/images/controlbl_next.png" alt="Volgende"/>',
						nextPageLinkText:       '| Volgende 5 &rsaquo;',
						prevPageLinkText:       '&lsaquo; Vorige 5 |',
						enableHistory:          true,
						autoStart:              false,
						onChange:               function(prevIndex, nextIndex) {
							$('#thumbs-adv ul.thumbs').children()
								.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
								.eq(nextIndex).fadeTo('fast', 1.0);
						},
						onTransitionOut:        function(callback) {
							$('#slideshow-adv, #caption-adv').fadeOut('fast', callback);
						},
						onTransitionIn:         function() {
							$('#slideshow-adv, #caption-adv').fadeIn('fast');
						},
						onPageTransitionOut:    function(callback) {
							$('#thumbs-adv ul.thumbs').fadeOut('fast', callback);
						},
						onPageTransitionIn:     function() {
							$('#thumbs-adv ul.thumbs').fadeIn('fast');
						}
					});
					
					if ( $('#contact').length > 0){
						galleryAdv.toggleSlideshow();
					}
				}				

 
 
  // Reset Font Size
  var originalFontSize = $('.article').css('font-size');
  $(".resetFont").click(function(){
  $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('.article').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	if (newFontSize < 26 ){
		$('.article').css('font-size', newFontSize);
		$('.article').css('line-height', 1.5);	
		$('img.decreaseFont').attr('src','/images/icon-text-size-down.gif');
	} else{
		this.src = '/images/icon-text-size-up-inactive.gif';		
	}
	return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('.article').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum/1.2;	
	if (newFontSize > 6 ){
		$('.article').css('font-size', newFontSize);
		$('.article').css('line-height',1.5);	
		$('img.increaseFont').attr('src','/images/icon-text-size-up.gif');
	} else{
		this.src = '/images/icon-text-size-down-inactive.gif';
	}
	return false;
  });
      
    });
	

  function SubmitCallMeBack(){
  	if ($("#fldPhone").val().length < 10  ){
		alert('Vul een geldig telefoon nummer in!');
		return false;	
	}		  
	else{
	  	$("#verify").val("63463");	
		var s = $("#callmeback").serialize();	
		$("#btnSubmitCallMeBack").val("Uw aanvraag wordt verzonden...").attr("disabled",true);
		$.post('/app/supplier-call-me.asp', s, function(data) {
			alert('Uw belverzoek is verzonden, er wordt op korte termijn met u contact opgenomen');
			$.facebox.close();
		});		

	}

  }	
  
  function SubmitBrochure(){
  	if ($("#fldEmail").val().length < 8  ){
		alert('Vul een geldig email adres in!');
		return false;	
	}		  
	else{
	  	$("#verify").val("65428");	
		var s = $("#brochure").serialize();	
		$("#btnSubmitBrochure").val("Uw aanvraag wordt verzonden...").attr("disabled",true);
		$.post('/app/supplier-brochure.asp', s, function(data) {
			alert('Uw brochure aanvraag is verzonden, deze wordt zo spoedig mogelijk naar u verzonden per e-mail');
			$.facebox.close();
		});		

	}

  }	  



	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-15611959-1']);  
	_gaq.push(['_trackPageview']);  
	(function() {    
			  var ga = document.createElement('script'); 
			  ga.type = 'text/javascript'; 
			  ga.async = true;    
			  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    
			  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);  
	})();

	var ord = Math.random()*10000000000000000;
