
$(document).ready(function() {
	$('#topplaat').hide();
	$('a.thumblink').click(function(event){
        event.preventDefault();
        var str = this.href;
        document.getElementById('topplaatimg').src = str;
        //$('#topplaat').show("slow");
        $('#topplaat').show();
        return false;
    });
    $('#topplaatimg').click(function(event){
        event.preventDefault();
        //$('#topplaat').hide("slow");
        $('#topplaat').hide();
        return false;
    });
    
    if ( $('#topslider').length > 0 ){
    	 $('#topslider').nivoSlider({
    	 	effect:   'fold',
    	 	slices:   12, // For slice animations
			boxCols:  12, // For box animations
			boxRows:   4,
			captionOpacity: 0.0, // Universal caption opacity
        	prevText: 'Vorige', // Prev directionNav text
        	nextText: 'Volgende', // Next directionNav text
        	pauseTime: 6000, // How long each slide will show
        	randomStart: false, // Start on a random slide
        	afterChange: function(){
        		//$('.nivo-caption').hide();
        		//if (window.console) console.log($('.nivo-caption').html());
        	}
    	 });
    }
    $('#topslider').hover(
       function(){ $('.nivo-caption').css({ display:'block', opacity:'0.6' }); },
       function(){ $('.nivo-caption').css({ display:'none', opacity:'0.0' }); }
	)
    
    
});


var checkAStwice;
$(document).ready(function(){
	if ( $('#ajaxSearch_input').length > 0 ){
    	checkAStwice=setTimeout('checkASagain()',1200);
    	
    }
    
    
});
var ow;
function checkASagain() {
	ow=$('#ajaxSearch_input').val();
	if (window.console) console.log(ow);
	//aslengthtest = $('.AS_ajax_result a').length();
	if ( $('.AS_ajax_result').length == 0 ){
		if (ow.length>2){
			$('#ajaxSearch_input').val($.trim(ReplaceLastWord(ow, ''))).keyup();
			checkAStwice=setTimeout('checkASagain()',800);
		} else {
			// geen relaties gevonden
			$('#relationeel').fadeOut();
			
		}
	}
	
	
	//asvar[0]='{"vsn":"1.9.2","adv":"oneword","sub":"","bxt":"Zoek hier...","cfg":"&advSearch=`oneword` &whereSearch=`content:NULL|tv` &rank=`documentTags:100,pagetitle:10,extract` &showIntro=`0` &extract=`0` &landingPage=`152` &liveSearch=`1` &moreResultsPage=`152` &jscript=`jquery` &addJscript=`0` "}'
}
function ReplaceLastWord(str, newStr) {
   return str.replace(/\w*$/, newStr);
}
