
//jQuery.fn.addEvent = jQuery.fn.bind;
	
$(function(){
	
	if ($.browser.msie && $.browser.version < 7)
		$('img[src$=.png]').pngfix();

	$('img[hover],input[hover]').imghover();
		
	$('input.reset-default').focus(function() {
        if(this.value == this.defaultValue) {
	        $(this).removeClass('reset-default');
	        this.value = '';
        }
    }).blur(function() {
        if($(this).attr('value').replace(/ +/, '') == '') {
	        $(this).addClass('reset-default');
            this.value = this.defaultValue;
        }
    }).parents('form').submit(function() {
        $('input.reset-default', this).attr('value', '');
    });

	// language choice
	$('#languageSwitch').change(function () {
		var loc = $("select option:selected").val();
		 var base = $('base').attr('href');
        document.location.href = base + loc;
	});


	/* accordions */
	$(".accordion dt a").click(function () {
		var temp = this;
        if ( $(this).parent().next().is(":hidden") ) {			
			$(this).parent().next().slideDown("slow", function(){
				//$(temp).text("Sluit");
				$(temp).addClass('active'); 
			}); 
            return false;			
        } else {
			$(this).parent().next().slideUp("slow", function(){
				//$(temp).text("Meer info");
				$(temp).removeClass('active');
			});		
		    return false;
        }
    });


	var timers = [];

	$('#map area').hover(function(){
		var cid = $(this).attr('rel');
		hoverRegion( cid, true);
	},function(){
		var cid = $(this).attr('rel');
		hoverRegion( cid, false);
	});

	function hoverRegion( countryId, state ) {
		var regionSrc = $('#mapimg');
		var regionId = regionSrc.attr('rel');
		var id = jQuery.data( this );
		if (state) {
			regionSrc.attr('src','images/regionmap/'+regionId+'_over_'+countryId+'.gif');
			$("#region_" +countryId).fadeIn( 100 );
		} else {
			regionSrc.attr('src','images/regionmap/'+regionId+'.gif');
			$("#region_" +countryId).fadeOut( 100 );

		}
	}
	
		$('#mapbig area').hover(function(){
		var cid = $(this).attr('rel');
		hoverRegionBig( cid, true);
	},function(){
		var cid = $(this).attr('rel');
		hoverRegionBig( cid, false);
	});

	function hoverRegionBig( countryId, state ) {
		var regionSrc = $('#mapimg');
		var regionId = regionSrc.attr('rel');
		var id = jQuery.data( this );
		if (state) {
			regionSrc.attr('src','images/regionmap/big/'+regionId+'_over_'+countryId+'.gif');
			$("#region_" +countryId).fadeIn( 100 );
		} else {
			regionSrc.attr('src','images/regionmap/big/'+regionId+'.gif');
			$("#region_" +countryId).fadeOut( 100 );

		}
	}
});




;(function($){

	$.fn.pngfix = function () {	
		if ($.browser.msie && $.browser.version < 7) {
			return this.each (function () {
				$(this).css({
					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.src+"')"
				});
				this.src = 'images/blank.gif';
			});
		} else {
			return this;
		}
	};

	$.prefetch = function() {
		for(var i = 0; i<arguments.length; i++)  {
			$("<img>").attr("src", arguments[i]);
		}
	}

	$.fn.imghover = function () {
		return this.each (function () {
			$(this).data('__img__original', this.src);
			$.prefetch($(this).attr('hover'));
		}).hover(function(){
			this.src = $(this).attr('hover');
		},function(){
			this.src = $(this).data('__img__original');
		});
	};
	
	
	
})(jQuery);
