
var wandelenFietsen;jQuery(document).ready(function(){wandelenFietsen=function(){var test=function(){var config={test:'test'};var init=function(arg,page){zoekformulier=arg;var targ=jQuery(zoekformulier);if(zoekformulier=='bladerbalk'){var type='get';var myaction=page.target.toString();}else{var type='post';var myaction=targ.attr('action');var data=targ.serialize();}
if(jQuery('#content.appZoeken').length>0){jQuery(zoekformulier+' li.aantal').html('<span class="loading"></span>');}
jQuery.ajax({type:type,url:myaction,data:data,success:function(html){html=html.replace(/[\r\n]/g,"");if(zoekformulier=='bladerbalk'){var vala=html.match(/<div[^>]*?id="resultaatlijst"[^>]*?>(.*)<\/div>\w*<div id="map"/i)[1];jQuery('#resultaatlijst').html(vala);return false;}else if(zoekformulier=='form.sorteer'){var vala=html.match(/<div[^>]*?id="resultaatlijst"[^>]*?>(.*)<\/div>\w*<div id="map"/i)[1];jQuery('#resultaatlijst').html(vala);return false;}else{jQuery(zoekformulier+' ul.results li').removeClass('inactive');jQuery(zoekformulier+" button[type='submit']").removeAttr('disabled');if(jQuery('#content.appZoeken').length>0){var oneval=html.match(/<span id="totalNrOfHits">(.*?)<\/span>/i)[1];jQuery(zoekformulier+' li.aantal').html('Totaal aantal gevonden routes: <strong>'+oneval+'</strong');if(oneval==0){jQuery(zoekformulier+' ul.results li').addClass('inactive');jQuery(zoekformulier+" button[type='submit']").change().attr('disabled','disabled');}}
if(jQuery('#content.appResultaten').length>0){var vala=html.match(/<div class="sub"[^>]*?>(.*)<\/div>\w*<div class="extras"/i)[1];var valb=html.match(/<div[^>]*?id="resultaatlijst"[^>]*?>(.*)<\/div>\w*<div id="map"/i)[1];var valc=html.match(/<div id="map"[^>]*?>(.*)<\/div>\w*<script id="route-definition/i)[1];var vald=html.match(/<script id="route-definition".*?>(.*?)<\/script>/i)[1];var vale=html.match(/<span id="totalNrOfHits">(.*?)<\/span>/i)[1];jQuery('.sub').html(vala);jQuery('#resultaatlijst').html(valb);if(!jQuery('#map').hasClass('ui-tabs-hide')){eval(vald);localDataProvider.itemSet=AnwbMapsItemSet.create({items:getRoutes(routeStrings)});localDataLayer.dataBoundary=null;localDataLayer.refresh(map.getViewBoundary(),function(){});map.gotoDefaultViewport();}else{window.resetMap=true;window.resetMapScript=vald;}
jQuery('#totalNrOfHits').html(vale);jQuery('#routeName').keydown(function(){suggestOneshot(doAutoSuggest,1000)}).focus();if(jQuery('select#minimumRouteLength, select#maximumRouteLength').length>0){jQuery('select#minimumRouteLength, select#maximumRouteLength').accessibleUISlider({width:150});}}}}});};return{init:init};}();if(jQuery('#content.appZoeken').length>0)
{test.init('#zoekLocatie');autoPopulate.init();};jQuery('.main').click(jQuery.delegate({'input':function(){test.init('#zoekLocatie');},'.blader':function(page){test.init('bladerbalk',page);return false;},'#radius':function(e){jQuery(e.target).change(function(){test.init('#zoekLocatie');});}}));jQuery('#radius').change(function(){test.init('#zoekLocatie');});jQuery('#content.appResultaten').click(jQuery.delegate({'.IEcheckbox':function(){test.init('#zoekLocatie');},'.IEradio':function(){test.init('#zoekLocatie');},'#orderby':function(){jQuery("#orderby").change(function(){test.init('form.sorteer');});},'.popovertop':function(){jQuery('.popovertop').children().toggleClass('hide');},'.close':function(){jQuery('.popovertop').children().toggleClass('hide');},'.allesWissen':function(){alert('ja');jQuery('.zoekcriteria input').change().attr('checked','');jQuery('#zoekLocatie').submit();}}));jQuery('#content.appResultaten').mouseover(jQuery.delegate({'label':function(e){jQuery(e.target).addClass("hover");}}));jQuery('#content.appResultaten').mouseout(jQuery.delegate({'label':function(e){jQuery(e.target).removeClass("hover");}}));if(jQuery('#mapProvincie').length>0){var mapToRadio=function(){jQuery('area').click(function(){kaart=jQuery(this).parent().parent().attr('id');if(kaart=='mapProvincie'){var coords=$(this).attr('id').split('prov')[1];jQuery(".lijstProvincie input").removeClass();jQuery('.lijstProvincie input[@value='+coords+']').change().attr('checked','checked');jQuery('#mapProvincie li').removeClass();jQuery('#mapProvincie li#li-prov'+coords+'').addClass('activated')}
if(kaart=='mapStreek'){var coords=$(this).attr('id').split('streek')[1];jQuery('.lijstStreek input[@value='+coords+']').change().attr('checked','checked');jQuery('#mapStreek span').removeClass().addClass('streek'+coords);}
test.init('#zoekLocatie');return false;});jQuery("#mapProvincie area").mouseover(function(){var coordsover=$(this).attr('id').split('prov')[1];jQuery('#mapProvincie li#li-prov'+coordsover+'').addClass('hover');});jQuery("#mapProvincie area").mouseout(function(){var coordsout=$(this).attr('id').split('prov')[1];jQuery('#mapProvincie li#li-prov'+coordsout+'').removeClass('hover');});}();var radioToMap=function(){jQuery('input[type="radio"]').click(function(){coords=jQuery(this).attr('value');kaart=jQuery(this).parent().parent().parent().parent().attr('id');if(kaart=='formStreek'){jQuery('#mapStreek span').removeClass().addClass('streek'+coords);}
if(kaart=='formProvincie'){jQuery("#mapProvincie li").removeClass();jQuery('#mapProvincie li#li-prov'+coords+'').addClass('activated');}});}();};if(jQuery('ul.zoekopties').length>0){jQuery('ul.zoekopties li').click(function(){var coords=$(this).attr('id').split('zoek')[1];jQuery('ul.zoekopties li').removeClass();jQuery(this).addClass('ui-tabs-selected');jQuery('#formProvincie').removeClass().addClass('hide');jQuery('#formStreek').removeClass().addClass('hide');jQuery('#formBuurt').removeClass().addClass('hide');jQuery('#form'+coords+'').removeClass().addClass('show');jQuery('#searchType').val(coords);test.init('#zoekLocatie');return false;});};jQuery('form#zoekNaam').click(function(){jQuery('form#zoekLocatie').removeClass().addClass('inactive');jQuery('form#zoekNaam').removeClass().addClass('active');});jQuery('form#zoekLocatie').click(function(){jQuery('form#zoekLocatie').removeClass().addClass('active');jQuery('form#zoekNaam').removeClass().addClass('inactive');jQuery('#routeName').change().val('vul (deel) van de naam in').addClass('defaultInput');});jQuery('#routeName').focus(function(){jQuery('form#zoekLocatie').removeClass().addClass('inactive');jQuery('form#zoekNaam').removeClass().addClass('active');});function oneshot(){var timer;return function(fun,time){clearTimeout(timer);timer=setTimeout(fun,time);};}
var suggestOneshot=oneshot();var doAutoSuggest=function()
{test.init('#zoekNaam');};jQuery('#routeName').keydown(function()
{suggestOneshot(doAutoSuggest,1000);});if((jQuery('#verfijnResultaten').length>0)||(jQuery('#wrapper.appJubileumroute').length>0)){jQuery("ul.tabs li").toggleClass('ui-tabs-selected');jQuery("#resultaatlijst").toggleClass('ui-tabs-hide');jQuery("#map").toggleClass('ui-tabs-hide');}else{window.resetMap=true;window.resetMapScript=jQuery('#route-definition').text();window.reInitialize=true;}
jQuery("li.map a").click(function(){if(window.resetMap){jQuery('#map').removeClass('ui-tabs-hide');if(window.reInitialize){initializeMaps(window.routeStrings);window.reInitialize=false;}
eval(window.resetMapScript);localDataProvider.itemSet=AnwbMapsItemSet.create({items:getRoutes(routeStrings)});localDataLayer.dataBoundary=null;localDataLayer.refresh(map.getViewBoundary(),function(){});map.gotoDefaultViewport();window.resetMap=false;}});jQuery('.popovertop').removeClass('hide');jQuery('#buurt').autocomplete('http://ws.geonames.org/searchJSON',{dataType:'jsonp',minChars:2,extraParams:{country:'NL',featureClass:'P',lang:"nl"},parse:function(data){var parsed=[];var isPC=data.postalCodes?true:false;data=data.geonames||data.postalCodes;for(var i=0;i<data.length;i++){data[i].isPC=isPC;parsed[parsed.length]={data:data[i],value:isPC?data[i].placeName:data[i].name,result:isPC?data[i].postalCode+" "+data[i].placeName:data[i].name+", "+data[i].adminName1};}
return parsed;},formatItem:function(row){if(!row)return"";return row.isPC?row.postalCode+" "+row.placeName:row.name+", "+row.adminName1;},url:function(query){var match=query.match(/^\s*\d{0,4}/)[0];return match?'http://ws.geonames.org/postalCodeSearchJSON':'http://ws.geonames.org/searchJSON';},data:function(query,max,params){var match=query.match(/^\s*\d{0,4}/)[0];return match?jQuery.extend({postalcode_startsWith:match,maxRows:max},params):jQuery.extend({name_startsWith:query,maxRows:max},params);}});jQuery('#buurt').result(function(event,data,formatted){jQuery('#latitude').val(data.lat);jQuery('#longitude').val(data.lng);test.init('#zoekLocatie');});jQuery('.popovertop').addClass('hide');jQuery('.poisub a').parent().hide();jQuery('.poisub a').click(function(){var coords=jQuery(this).attr("class");jQuery(".poimain ul").addClass('hide');jQuery(".poisub li").removeClass('selected');jQuery(".poimain ul#"+coords).removeClass('hide');jQuery(this).parent().addClass('selected');poiLayer.itemManager.setActiveCategory(coords);return false;});if(/MSIE [567]\./i.test(window.navigator.userAgent)){jQuery('form').find('button[type=submit]').click(function(){jQuery(this.form).bind('submit',{button:jQuery(this)},function(event){var $button=event.data.button;var m=$button.get(0).outerHTML.match(/value\s*=\s*['"]([^'"]*)['"]/);var val=(m?m[1]:'');var $input=jQuery('<input type="hidden" '+
($button.attr('name')?'name="'+$button.attr('name')+'" ':'')+'" value="'+val+'" />');jQuery(this).append($input);jQuery.each(jQuery(this).find('button'),function(){jQuery(this).attr('name','fgh');});});});}
return{test:test};}();});