
//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', '');
    });

// init subnavigation
	$("ul#mainNavigation").superfish();
	
	
// accordions 
	/*$(".accordion .newsItem p.readon a").click(function () {
		var accordionBox = $(this).parent().parent();
		
		// first, close all panes and reset all styles
		$(".accordion .newsItem .extendedText").slideUp("slow", function(){
			$(this).parent().removeClass('extended');
		});
				
        if ( $(accordionBox).children('.extendedText').is(":hidden") ) {
			$(accordionBox).children('.extendedText').slideDown("slow", function(){
				$(accordionBox).addClass('extended'); // active item
				$(accordionBox).find('p.readon a').html('<span>-</span> Sluit');
			});
            return false;
        } else {
			$(accordionBox).children('.extendedText').slideUp("slow", function(){
				$(accordionBox).removeClass('extended');
				$(accordionBox).find('p.readon a').html('<span>+</span> Lees meer');
			});
		    return false;
        }
    });*/


// home quotation scrollable
	$("#quotationsList .scrollable .wrapper").scrollable({
		size: 1, 
		clickable: false, 
		keyboard: false		
	}).circular().autoscroll({
		autoplay:true,
		steps:1, 
		interval:10000 
	});		
	
// werkwijze team scrollable
	$(".teamoverview .scrollable .wrapper").scrollable({
		size: 1, 
		clickable: false, 
		keyboard: false
	}).circular().navigator('#teamoverviewNav .navi').autoscroll({
		autoplay:true, 
		steps:1, 
		interval:5000 
	});			
	
// activate paging
	paging();
	
	
	$("div.boxconLeft div.box:last").css('border','none');
	$("div.boxconRight div.box:last").css('border','none');
	$("div#rightColInnercon div.box:last").css('border','none');

});


function paging(){

    if ( $('div#casesList').length > 0 ) {
        $('div#casesList').paging({
            itemsPerPage: 3,
            elementType: 'div',
            prevText: '<span>&lt;</span>',
            nextText: '<span>&gt</span>',
			firstText: '<span>&lt;&lt;</span>',
            lastText: '<span>&gt;&gt</span>',
            selectedClass: 'selected',
            navClass: 'customnav',
            addNav: 'after',
            showPageNumbers: 'false'
        }).bind('pagingBeforePageChange',function(){
            }).bind('pagingAfterPageChange',function(){
            });
    };
}


;(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);

