(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,right:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)

/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);


function in_array (needle, haystack, argStrict) {

    var key = '', strict = !!argStrict; 
    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {
                return true;            }
        }
    } else {
        for (key in haystack) {
            if (haystack[key] == needle) {                return true;
            }
        }
    }
    return false;
}

var keywordarray = new Array();

function addKeyword(keyword) {
	if(keyword) {
		if($('.zoekwoorden div').length < 10) {
			if($('.zoekwoorden input[value=\''+keyword+'\']').length == 0){
				newid = keywordarray.length;
				keywordarray[newid] = keyword;' + (newid + already) + '
				$('.zoekwoorden').append('<div class="keyword" id="tag"><img src="cancel.png" />' + keyword + '<input type="hidden" name="zoekwoord[]" value="' + keyword + '""/></div>');				
				$('#zoekwoorden').val('').focus();
			}
			else {
				alert('Dit zoekwoord is al in gebruik.');
				$('#zoekwoorden').val('').focus();
			}
		}
		else {
			alert('Maximum aantal zoekwoorden is bereikt.');
			$('#zoekwoorden').focus();
		}
	}
	initkeywords();
}
function initkeywords(){
	$('.zoekwoorden div img').each(function(i){
		$(this).unbind('click').click(function(){
			 $(this).parent().remove();
		});
	});	
	$('#zoekwoorden').unbind('keydown').keydown(checkForEnter);

}
function checkForEnter(event) {
  if (event.keyCode == 13) {
  	addKeyword($('#zoekwoorden').val());
	return false;
  }  
}
var totalsize = 0;

	var totalheight = 135;


$(document).ready(function () {
	$('.sizer .spot').each(
		function() {
			totalsize = totalsize + $(this).width() + 220;
		}
	);
	$('.sizer').width(totalsize);
	initkeywords();
	$(".nbcheck").checkbox({
	  cls:'jquery-safari-checkbox',
	  empty: 'images/spacer.gif'
	});
	$('.step1, .submitter').click(function(){
		$('#advertentieform').submit();
		return false;
	});
	$('[help]').each(function(){
		$(this).hover(
			function(event){$(this).css({'position':'relative'}).find('td:first').prepend('<div class="tooltip" style="left:-130px;">'+$(this).attr('help')+'</div>')},
			function(event){$(this).find(".tooltip").fadeOut(100,function(){$(this).remove();})}
		)
	});
	
	$("#accordion").accordion({
		autoHeight: false,
		active: false
	});
	$("#algvwbutton").fancybox({
		'titleShow'			: false,
		'autoDimensions'	: false,
		'width'         	: 780,
		'height'        	: 'auto'
	});
		$('#menu ul li').each(function() {
		totalheight = totalheight + 36;						   
	});
	$('#container').css('backgroundPosition', '50% -' + (515 - totalheight) + 'px');


});


var slidedistance 	= 695;
var itemsinscreen 	= 3;
var position 		= 0;
var slidepositions 	= 0;

function slideLeft() {
	initSlider();
	position -= 1;
	if(position < -(slidepositions-1) ) position = -(slidepositions-1);
	slideSlider();
}

function slideRight() {
	initSlider();
	position += 1;
	if(position > 0) position = 0;
	slideSlider();
}

function slideSlider(){
	$('.sizer').stop().animate({marginLeft: (position * slidedistance) + 'px' }, 400);
}
function initSlider(){
	if(!$('.sizer').attr('init')){
		items 			= $('.sizer').find('a').length;
		slidepositions 	= Math.ceil(items/itemsinscreen)
		$('.sizer').attr('init',1);	
		$('.sizer').css('marginLeft','0px');
	}
}


function changeStatus(id, status) {
	$.post('saver.php', {active: status, formaction: 'setstatus', setid: id}, function() {
		if(status == 1) {
			$('#row_' + id).find('img').attr('src', 'images/icon-active.gif').unbind('click').bind('click', function(){
				changeStatus(id, 0); return false;						   
			});
		}
		else {
			$('#row_' + id).find('img').attr('src', 'images/icon-blocked.gif').unbind('click').bind('click', function(){
				changeStatus(id, 1); return false;						   
			});
		}
	});
}

var isOpen = false;
function showOverlayBox() {
	if( isOpen == false ) return;
	$('.overlayBox').css({
		display:'block',
		left:( $(window).width() - $('.overlayBox').width() )/2,
		top:(( $(window).height() - $('.overlayBox').height() )/2 -20) + $(window).scrollTop(),
		position:'absolute'
	});
	$('.bgCover').css({
		display:'block',
		width: $(window).width(),
		height:$(document).height()
	});
}
function doOverlayOpen() {
	isOpen = true;
	showOverlayBox();
	$('.bgCover').css({opacity:0}).animate( {opacity:0.9, backgroundColor:'#255b8c'} );
	return false;
}
function doOverlayClose() {
	isOpen = false;
	$('.overlayBox').css( 'display', 'none' );
	$('.bgCover').animate( {opacity:0}, null, null, function() { $(this).hide(); } );
}

$(window).bind('resize',showOverlayBox);
$(window).bind('scroll', showOverlayBox);
$('a.launchLink').live('click', function(e) {
	if(!$('.overlayContent').html()) {
		$('.overlayContent').load('loader.php?type=contactform', {id: $(this).attr('id')});
	}
	doOverlayOpen();
	e.preventDefault();
});
$('a.closeLink').live('click', function(e){ 
										doOverlayClose();
										e.preventDefault();
});

