$.extend($.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});$(document).ready(function(){	document.googleMaps = new GoogleMaps();	loadModule(Carrousel,'.carrousel',{initClass:'carrousel'});	loadModule(DateRange,'.daterange');	loadModule(CompactCarrousel,'.compact-carrousel',{initClass:'compact-carrousel'});	loadModule(MainNavigation,'#main-navigation');	loadModule(DateRangeSearch,'#bookhotel, #agendasearch');	loadModule(RotterdamMap,'#rotterdammap');	loadModule(RotterdamMapDynamic,'a.showonmap');	loadModule(CalendarDate, '.calendar-datepicker');		// Search results	$('.showresultsin').click(function(e) {		e.preventDefault();		var contentId = $(this).attr('contentId');		if( typeof contentId != 'undefined' && contentId != '') $('#frmSearchAgain input[name=searchSectionId]').val(contentId);		var keywords = $(this).attr('keywords');		if (keywords == '' || typeof keywords == 'undefined') {			keywords = $('#frmSearchAgain input[name=keywords]').attr('keywords');		}		if ($(this).hasClass('sectionOveride')) $('#frmSearchAgain').find('input[name=sectionOveride]').val('true');		$('#frmSearchAgain input[name=keywords]').val(keywords);		$('#frmSearchAgain').submit();	});		// Placeholder fallback	if (!Modernizr.input.placeholder) {		$('[placeholder]').focus(function(){			var input = $(this);			if (input.val() == input.attr('placeholder')) {				input.val('');				input.removeClass('cPlaceholder');			}		}).blur(function(){			var input = $(this);			if (input.val() == '' || input.val() == input.attr('placeholder')) {				input.addClass('cPlaceholder');				input.val(input.attr('placeholder'));			}		}).blur();		$('[placeholder]').parents('form').submit(function(){			$(this).find('[placeholder]').each(function(){				var input = $(this);				if (input.val() == input.attr('placeholder')) {					input.val('');				}			})		});	}		// Collapse location filter list	$('.collapselist a').click(function(e) {		e.preventDefault();		var list = $(this).closest('ul');		var slideDown = $(this).attr('slideDown') == '1';		if(slideDown) {			list.find('li').slideDown();			$(this).attr('slideDown', '0');			$(this).parent().removeClass('more').addClass('less');		} else {			list.find('li:gt(2)').not('.collapselist').slideUp();			$(this).attr('slideDown', '1');			$(this).parent().removeClass('less').addClass('more');		}	});});loadModule = function(module,selector,vars) {	if (module && selector) {		var elements = $(selector);		for (var i = elements.length; i--;) {			new module(elements[i],vars);		}	}};/*  * Main Navigation */MainNavigation = function(rootNode) {	if (rootNode) {		this.rootNode = rootNode;		this.init();	}};MainNavigation.prototype.init = function() {	var items = $('.primary > li > a', this.rootNode);	$(items).bind('mouseover',$.proxy(this.mouseOver,this));	$(items).bind('mouseout',$.proxy(function(){$(this.rootNode).removeClass('visitor press conventions traveltrade')},this));};MainNavigation.prototype.mouseOver = function(e) {	var index = $(e.target).parent().index();	var cssClass= '';	switch(index) {		case 0:cssClass = 'visitor';break;		case 1:cssClass = 'press';break;		case 2:cssClass = 'conventions';break;		case 3:cssClass = 'traveltrade';break;	}	$(this.rootNode).addClass(cssClass);};/*  * DateRange */DateRange = function(rootNode) {	if (rootNode) {		this.rootNode = rootNode;		this.rootNode.id = (this.rootNode.id != '') ? this.rootNode.id : ('datepicker' + Math.floor(Math.random()*1000));		this.datePickerClass = $(this.rootNode).attr('data-datepickerclass');		this.init();	}};DateRange.prototype.init = function() {	var _this = this;	dates = this.dates = $('#'+this.rootNode.id + ' .from input[type=hidden], #'+this.rootNode.id+' .to input[type=hidden]').datepicker({		onSelect: function( selectedDate ) {			_this.onChange(this, selectedDate, dates);		},		beforeShow: function(input,inst){			inst.dpDiv.css({marginLeft: $(inst.trigger).parents('.daterange').offset().left-$(inst.trigger).offset().left});       	},		showOn: 'button',		buttonText: '',		dateFormat: 'dd-mm-yy',		minDate: new Date()	});	if (this.datePickerClass) {		this.dates.datepicker( "widget" ).addClass(this.datePickerClass);	};	$('input', this.rootNode).bind('keydown',$.proxy(function(e){this.validateKey(e)},this));	$('input', this.rootNode).bind('blur',$.proxy(function(e){this.validateInput(e)},this));};DateRange.prototype.validateKey = function(e) {	var controlKeys = [8, 9, 13, 35, 36, 37, 39, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105];	var isControlKey = controlKeys.join(",").match(new RegExp(e.keyCode));	if (!e.keyCode || // Control keys in most browsers. e.g. Firefox tab is 0		(49 <= e.keyCode && e.keyCode <= 57) || // Always 1 through 9		(48 == e.keyCode && $(e.target).attr("value")) || // No 0 first digit		isControlKey) { // Opera assigns values for control keys.    	return;	} else {		e.preventDefault();	}};DateRange.prototype.validateInput = function(e) {	var input = $('input[type=hidden]',$(e.target).parents('fieldset'));	var day = $('.day input',$(e.target).parents('fieldset'));	var month = $('.month input',$(e.target).parents('fieldset'));	var year = $('.year input',$(e.target).parents('fieldset'));	var option = $(input).parents('fieldset').hasClass('from') ? 0 : 1;	if (day.val() != "" && month.val() != "" && year.val() != "") {		var date = new Date(year.val(), month.val()-1, day.val());		$(this.dates[option]).datepicker("setDate",date);		var date = $(this.dates[option]).datepicker("getDate");		this.onChange(input, date, this.dates);	}};DateRange.prototype.onChange = function(input, selectedDate, dates) {	var isfromdate = $(input).parents('fieldset').hasClass('from');	var option1 = isfromdate ? "minDate" : "maxDate";	var option2 = isfromdate ? "maxDate" : "minDate";	var	instance = $(input).data( "datepicker");	var date = (selectedDate instanceof Date) ? selectedDate : ($.datepicker.parseDate(			instance.settings.dateFormat ||			$.datepicker._defaults.dateFormat,			selectedDate, instance.settings ));	var date2 = $(input).datepicker("getDate");	if (date2 instanceof Date && isfromdate) {		var iteration = (isfromdate) ? 1 : -1;		for (var i = 0; i < 30; i++) {			if (iteration == -1 && (date2.toDateString() == new Date().toDateString())) break;			date2 = new Date(date2.setDate(date2.getDate()+iteration));		}		dates.not( input ).datepicker( "option", option2, date2);	}	if (isfromdate) dates.not( input ).datepicker( "option", option1, date);	$('.day input',$(input).parents('fieldset')).val(instance.currentDay);	$('.month input',$(input).parents('fieldset')).val(instance.currentMonth+1);	$('.year input',$(input).parents('fieldset')).val(instance.currentYear);};/*  * DateRangeSearch */DateRangeSearch = function(rootNode) {	if (rootNode) {		this.rootNode = rootNode;		this.requiredErrorFrom = $('fieldset.from', this.rootNode).attr('data-requirederror');		this.requiredErrorTo = $('fieldset.to', this.rootNode).attr('data-requirederror');		this.requiredErrorAfter = $('input[type=submit]', this.rootNode).attr('data-requirederrorafter');		this.requiredErrorDifference = $('input[type=submit]', this.rootNode).attr('data-requirederrordifference');		this.init();	}};DateRangeSearch.prototype.init = function() {	$(this.rootNode).bind('submit',$.proxy(function(e){this.validate(e, true)},this));};DateRangeSearch.prototype.validate = function(e, submit) {	$('.daterange input', this.rootNode).removeClass('error');	var from = $('fieldset.from input[value=]', this.rootNode);	var to = $('fieldset.to input[value=]', this.rootNode);	var date1 = new Date();	date1.setDate($('#in-dd', this.rootNode).val());	date1.setMonth($('#in-mm', this.rootNode).val() - 1);	date1.setYear($('#in-jjjj', this.rootNode).val());	var date2 = new Date();	date2.setDate($('#out-dd', this.rootNode).val());	date2.setMonth($('#out-mm', this.rootNode).val() - 1);	date2.setYear($('#out-jjjj', this.rootNode).val());	var after = (date1 instanceof Date && date2 instanceof Date) ? date2 > date1 : false;	var difference = (date2 - date1) / (1000*60*60*24);	if (from.length>0 || to.length>0 || !after || ($(this.rootNode).is('#bookhotel') && (difference < 0 || difference > 31)) ) {		e.preventDefault();		from.addClass('error');		to.addClass('error');		if (submit && this.requiredErrorFrom && this.requiredErrorTo) {			if (!this.errors) {				this.errors = $('<ul class="errors">');				$('.daterange', this.rootNode).prepend(this.errors);			}			$(this.errors).empty();			if(from.length>0){$(this.errors).append($('<li>'+this.requiredErrorFrom+'</li>'))};			if(to.length>0){$(this.errors).append($('<li>'+this.requiredErrorTo+'</li>'))};			if(!after){$(this.errors).append($('<li>'+this.requiredErrorAfter+'</li>'))};			if($(this.rootNode).is('#bookhotel') && (difference < 0 || difference > 31)){$(this.errors).append($('<li>'+this.requiredErrorDifference+'</li>'))};		}	}	else if (this.errors) {		$(this.errors).hide();	}};/*  * Calendar Date */CalendarDate = function(rootNode) {	if (rootNode) {		this.rootNode = rootNode;		this.rootNode.id = (this.rootNode.id != '') ? this.rootNode.id : ('datepicker' + Math.floor(Math.random()*1000));		this.datePickerClass = $(this.rootNode).attr('data-datepickerclass');		this.init();	}}CalendarDate.prototype.init = function() {	var _this = this;	$(_this.rootNode).datepicker({		onSelect: function( selectedDate ) {			_this.onChange(this, selectedDate);		},		beforeShow: function(input,inst){			var p = $(_this.rootNode).parent();			var button = $('.calendar-datepicker-button');			var rootparent = p.parents('.overview-tools-alt');			var parentright = rootparent.offset().left + rootparent.outerWidth(true);			var buttonleft = parentright - button.outerWidth(true) - 10;			var left = parentright - buttonleft - inst.dpDiv.outerWidth()			var top = (rootparent.offset().top + rootparent.height()) - p.offset().top + p.height();			inst.dpDiv.css({				marginTop: top,				marginLeft: left			});       	},		dateFormat: 'mm-dd-yy',		minDate: $(_this.rootNode).attr('data-mindate'),		maxDate: $(_this.rootNode).attr('data-maxdate')	});		$(_this.rootNode).datepicker('widget').addClass('ui-datepicker-agendasearch');	$('.calendar-datepicker-button').bind('click',function(e) {_this.show(e)});}CalendarDate.prototype.show = function(e) {	e.preventDefault();	$(this.rootNode).datepicker("show");}CalendarDate.prototype.onChange = function(element, date) {	window.location = "?startdate="+date;}/*  * Carrousel  */Carrousel = function(rootNode,vars) {	if (rootNode) {		this.rootNode = rootNode;		this.initClass = vars.initClass ? vars.initClass : 'carrousel';		var dataInterval = $(this.rootNode).attr('data-interval');		this.interval = 4000;		if(dataInterval) {this.interval = (dataInterval > 1500) ? dataInterval : 1500;}		else if (vars.interval) {this.interval = (vars.interval > 1500) ? vars.interval : 1500;}		var dataNextlabel = $(this.rootNode).attr('data-nextlabel');		this.nextLabel = dataNextlabel ? dataNextlabel : 'Volgende item';		this.init();	}};Carrousel.prototype.init = function() {	var items = $('li', this.rootNode);	this.length = items.length;	if (this.length>2) {		$(this.rootNode).removeClass(this.initClass);		var wrapper = $('<div class="'+this.initClass+'" />');		$(wrapper).insertBefore(this.rootNode);		$(wrapper).append(this.rootNode);		this.rootNode = wrapper;		$(this.rootNode).bind("mouseover",$.proxy(function(){clearInterval(this.timer)},this));		$(this.rootNode).bind("mouseout",$.proxy(function(){this.play()},this));		var nextButton = $('<a class="nav next" href="#"><span class="btn"><span>'+this.nextLabel+'</span></span></a>');		$(nextButton).bind('click',$.proxy(function(e){this.next(e, true)},this));		$(nextButton).bind('focus',$.proxy(function(e){clearInterval(this.timer)},this));		$(nextButton).bind('blur',$.proxy(function(e){this.play()},this));		$(nextButton).bind('mouseout',$.proxy(function(e){clearInterval(this.timer)},this));		$(this.rootNode).append(nextButton);		this.list = $('<ul/>');		for (var i = this.length; i--;) {			var item = $(items[i]).clone();			var wrapper = $('<div />');			var anchor = $('a', item);			$(wrapper).append($(anchor).html());			$(anchor).empty();			$(anchor).append(wrapper);			$(anchor).append($('img', item));			if (i > 0) {				$(this.list).append(item);			}			else {				$(this.list).prepend(item);			}		}		$('ul',this.rootNode).replaceWith(this.list);		this.current = $('<div class="slide current"/>');		$(this.rootNode).prepend(this.current);		$(this.current).append($('li:first-child',this.list).clone().html());		var rootNode = this.rootNode;		if(Modernizr.csstransitions) {			setTimeout(function(){$(rootNode).addClass('loaded')},1);//FIX: delay to prevent safari transitionbug on dynamic elements		}		else {			$(this.rootNode).animate({opacity: 1},1000);		}		this.itemHeight = $($('li',this.list).get(0)).outerHeight();		this.play();	}};Carrousel.prototype.play = function() {	var _this = this;	this.timer = setInterval(function(){_this.next()},this.interval);};Carrousel.prototype.next = function(e, clearTimer) {	if (e) {e.preventDefault();}	if (clearTimer) {clearInterval(this.timer);}	if (!this.animate) {		this.animate = true;		var _this = this;		var next = $('<div class="slide"/>');		var nextItem = $('li:last-child',this.list);		$(next).append($(nextItem).clone().html());		$(this.rootNode).prepend(next);		if (Modernizr.csstransitions) {			$(this.rootNode).addClass('animate');			$(this.list).css('bottom',-this.itemHeight);			$(this.current).css('opacity','0');			setTimeout(function(){_this.nextLoaded(next, nextItem)},1000);		}		else {			$(this.list).animate({bottom: -this.itemHeight},1000);			$(this.current).animate({opacity: 0},1000,'swing',function(){_this.nextLoaded(next, nextItem)});		}	}};Carrousel.prototype.nextLoaded = function(next, nextItem) {	$(this.current).remove();	this.current = next;	$(this.current).addClass('current');	$(this.list).prepend(nextItem);	$(this.rootNode).removeClass('animate');	$(this.list).css({bottom: 0});	this.animate = false;};/*  * Compact Carrousel  */CompactCarrousel = function(rootNode,vars) {	if (rootNode) {		this.rootNode = rootNode;		this.initClass = vars.initClass ? vars.initClass : 'carrousel';		var dataInterval = $(this.rootNode).attr('data-interval');		this.interval = 4000;		if(dataInterval) {			this.interval = (dataInterval > 1500) ? dataInterval : 1500;		}		else if (vars.interval) {			this.interval = (vars.interval > 1500) ? vars.interval : 1500;		}		var dataNextlabel = $(this.rootNode).attr('data-nextlabel');		this.nextLabel = dataNextlabel ? dataNextlabel : 'Volgende item';		var dataPreviouslabel = $(this.rootNode).attr('data-previouslabel');		this.dataPreviouslabel = dataPreviouslabel ? dataPreviouslabel : 'Vorig item';		this.animate = false;		this.currentIndexBtn = null;		this.init();	}};CompactCarrousel.prototype.init = function() {	var items = $('li', this.rootNode);	var animate = true;	this.length = items.length;	if (this.length) {				if( this.length == 1 ){			animate = false;		}		$(this.rootNode).removeClass(this.initClass);		var wrapper = $('<div class="'+this.initClass+'" />');		$(wrapper).insertBefore(this.rootNode);		$(wrapper).append(this.rootNode);		this.rootNode = wrapper;		this.list = $('ul',this.rootNode);		$(this.list).addClass('slides');		if(animate){			$(this.rootNode).bind("mouseover",$.proxy(function(){clearInterval(this.timer)},this));			$(this.rootNode).bind("mouseout",$.proxy(function(){this.play()},this));			var nextButton = $('<a class="nav next" href="#"><span class="btn"><span>'+this.nextLabel+'</span></span></a>');			$(nextButton).bind('click',$.proxy(function(e){this.change(e, 1, true)},this));			$(nextButton).bind('focus',$.proxy(function(e){clearInterval(this.timer)},this));			$(nextButton).bind('blur',$.proxy(function(e){this.play()},this));			$(this.rootNode).append(nextButton);			var previousButton = $('<a class="nav previous" href="#"><span class="btn"><span>'+this.dataPreviouslabel+'</span></span></a>');			$(previousButton).bind('click',$.proxy(function(e){this.change(e, -1, true)},this));			$(previousButton).bind('focus',$.proxy(function(e){clearInterval(this.timer)},this));			$(previousButton).bind('blur',$.proxy(function(e){this.play()},this));			$(this.rootNode).append(previousButton);						$(this.list).width((this.length+1)*$(this.rootNode).width());			this.indexList = $('<ul class="index">');			for (var i = this.length; i--;) {				var indexItem = $('<li><a href="#"><span>'+$('img',items[i]).attr('alt')+'</span></a></li>');				var index = i;				if(i==0){					this.currentIndexBtn = $(indexItem);					$(indexItem).addClass('current');				};												$('img',items[i]).each(function() {					var ratio = 636 / 424;					var width = $(this).width();					var height = $(this).height();					if (width == 0 || height == 0) {						$(this).load(function() {							var width = $(this).width();							var height = $(this).height();							if (ratio < width / height) $(this).addClass('constrainheight');						})					} else if (ratio < width / height) $(this).addClass('constrainheight');				})				/*				if (typeof $(items[i]).attr('data-youtube') != 'undefined' && typeof swfobject != 'undefined') {					$(items[i]).html('<div id="youtube'+i+'"/>');					swfobject.embedSWF($(items[i]).attr('data-youtube'), 'youtube'+i, "636", "495", "9.0.0", "expressInstall.swf", {}, { wmode: "transparent" }, {});				}*/								if(animate){					$('a', indexItem).bind('click',{indexItem:indexItem},$.proxy(function(e){this.changeIndex(e, index)},this));				}				$(this.indexList).prepend(indexItem);			}			$(this.rootNode).append(this.indexList);		}		var rootNode = this.rootNode;		if(Modernizr.csstransitions) {			setTimeout(function(){$(rootNode).addClass('loaded')},100);//FIX: delay to prevent safari transitionbug on dynamic elements		}		else {			$(this.rootNode).animate({opacity: 1},1000);		}		if( animate ){			this.play();		}		}};CompactCarrousel.prototype.play = function() {	var _this = this;	//this.timer = setInterval(function(){_this.change(null, 1, false)},this.interval);};CompactCarrousel.prototype.changeIndex = function(e) {	if (e) {e.preventDefault();}	if (!this.animate) {		var indexChange = ($(e.data.indexItem).index() - $('.current',this.indexList).index());		this.change(null, indexChange, true);	}	return false;};CompactCarrousel.prototype.change = function(e, indexChange, clearTimer) {	if (e) {e.preventDefault();}	if (clearTimer) {clearInterval(this.timer);}	if (!this.animate) {		this.animate = true;		var _this = this;		var newIndex = $(this.currentIndexBtn).index()+indexChange;		if (indexChange > 0) {			var left = (-100*indexChange)+'%';			newIndex = (newIndex > (this.length-1)) ? (newIndex-this.length) : newIndex;		}		else {			var left = 0;			$(this.list).css('left', (100*indexChange)+'%');			$(this.list).prepend($('li:gt('+((this.length-1)+indexChange)+')',this.list));			newIndex = (newIndex < 0) ? (this.length+newIndex) : newIndex;		}		$(this.currentIndexBtn).removeClass('current');		this.currentIndexBtn = $('li',this.indexList).get(newIndex);		$(this.currentIndexBtn).addClass('current');			if (Modernizr.csstransitions) {			var rootNode = this.rootNode;			var list = this.list;			setTimeout(function(){				$(rootNode).addClass('animate');				$(list).css('left', left);			},100);//FIX: delay to prevent safari transitionbug on dynamic elements			setTimeout(function(){_this.changeLoaded(indexChange)},1000);		}		else {			$(this.list).animate({left: left},1000,'swing',function(){_this.changeLoaded(indexChange)});		}	}};CompactCarrousel.prototype.changeLoaded = function(indexChange) {	$(this.rootNode).removeClass('animate');	if (indexChange > 0) {		$(this.list).css('left', 0);		$(this.list).append($('li:lt('+(indexChange)+')',this.list));	}	this.animate = false;};/* * RotterdamMapDynamic */RotterdamMapDynamic = function(rootNode) {	this.rootNode = rootNode;	this.lightbox = null;	this.init();};RotterdamMapDynamic.prototype.init = function() {	this.organisationId = $(this.rootNode).attr('data-organisationid');	if(this.organisationId) {		$(this.rootNode).bind('click',$.proxy(function(e){this.open(e)},this));	}};RotterdamMapDynamic.prototype.open = function(e) {	e.preventDefault();	if (Lightboxes['rotterdammaplightbox']) {		this.lightbox = Lightboxes['rotterdammaplightbox'];	}	else if (!this.lightbox) {		this.lightbox = new Lightbox($('#rotterdammaplightbox'));		this.lightbox.inner.attr("showmarker", $('#rotterdammaplightbox').attr("data-marker"));		new RotterdamMap( this.lightbox.inner.get(0), this.organisationId);		Lightboxes['rotterdammaplightbox'] = this.lightbox;	}	this.lightbox.show();};/*  * Rotterdam Map  */RotterdamMap = function(rootNode, highlightId) {	if (rootNode) {		this.rootNode = rootNode;		this.mapGroups = {};		this.highlightId = highlightId;		this.infoBox = null;		this.init();	}};RotterdamMap.prototype.init = function() {	var _this = this;	this.groupCheckboxes = $('li input:not([value=all])', this.rootNode);	for (var i = this.groupCheckboxes.length; i--;) {		if(this.highlightId) {this.groupCheckboxes[i].checked=true};		var mapGroup = new MapGroup(this.groupCheckboxes[i]);		mapGroup.init();		this.mapGroups["tag"+mapGroup.tagId] = mapGroup;		$(this.groupCheckboxes[i]).bind('change',$.proxy(function(e){this.request()},this));	}	var categoryCheckboxes = $('input[value=all]', this.rootNode);	for (var i = categoryCheckboxes.length; i--;) {		if(this.highlightId) {categoryCheckboxes[i].checked=true};		$(categoryCheckboxes[i]).bind('change',$.proxy(function(e){this.toggleCategory(e)},this))	}	var toggles = $('.toggle', this.rootNode);	$(toggles).bind('click',$.proxy(function(e){this.toggle(e)},this));	document.googleMaps.load(function(){_this.load()});};RotterdamMap.prototype.toggle = function(e) {	e.preventDefault();	this.filtergroup = $(e.target).parents('.filtergroup');	this.list = $('ul',this.filtergroup);	if ($(this.filtergroup).hasClass('open')) {		$('div', this.filtergroup).height(0);		$(this.filtergroup).removeClass('open');	}	else {		$('div', this.filtergroup).height($(this.list).outerHeight(true));		$(this.filtergroup).addClass('open');	}	};RotterdamMap.prototype.load = function() {	if ($(this.rootNode).attr('showmarker') !== undefined) {		var coords = $(this.rootNode).attr('showmarker').split(',');		if(coords.length == 1) {			// latitude, longitude missing. Search by zipcode & street number			var geocoder = new google.maps.Geocoder();			var me = this;			geocoder.geocode( { 'address': coords[0]}, function(results, status) {				if (status == google.maps.GeocoderStatus.OK) {					me.myLatlng = results[0].geometry.location;					me.loadMap();				} else {					me.myLatlng = new google.maps.LatLng(51.915, 4.47);					me.loadMap();				}			});		}		this.myLatlng = new google.maps.LatLng(coords[0], coords[1]);		this.loadMap();	} else {		this.myLatlng = new google.maps.LatLng(51.915, 4.47);		this.loadMap();	}};RotterdamMap.prototype.loadMap = function() {	var myOptions = {	    zoom: 14,	    center: this.myLatlng,	    mapTypeId: google.maps.MapTypeId.ROADMAP,	    mapTypeControl: false	}	this.map = new google.maps.Map($('.map', this.rootNode).get(0), myOptions);		this.request();		if ($(this.rootNode).attr('showmarker') !== undefined) this.addMarker(0, [{'latitude':this.myLatlng.lat(),'longitude':this.myLatlng.lng(),'name':''}], '', [], '', true, false, 999999999);}RotterdamMap.prototype.toggleCategory = function(e) {	var checkboxes = $('input', $(e.target).parents('fieldset'));	for (var i = checkboxes.length; i--;) {		checkboxes[i].checked = e.target.checked;	}	this.request();};RotterdamMap.prototype.request = function() {	var updateArray = new Array();	for (tagId in this.mapGroups) {		var mapGroup = this.mapGroups[tagId];		if (mapGroup.checkbox.checked && !mapGroup.markers) {			updateArray.push(mapGroup.tagId);		}		else if (mapGroup.checkbox.checked && mapGroup.hidden) {			for (marker in mapGroup.markers) {				mapGroup.markers[marker].setVisible(true);				mapGroup.hidden = false;			}		}		else if (!mapGroup.checkbox.checked && !mapGroup.hidden) {			for (marker in mapGroup.markers) {				mapGroup.markers[marker].setVisible(false);				mapGroup.hidden = true;			}		}	}	if (updateArray.length > 0) {		$.ajax({			url: '/locations.cfm',			dataType: 'json',			data: {tagIdList: updateArray.toString(),limit:''},			success: $.proxy(function(data){				this.onsucces(data);			},this),			error: $.proxy(function(jqXHR, textStatus, errorThrown){				this.onError(jqXHR, textStatus, errorThrown);			})		});	}	// JSON request for new markers	};RotterdamMap.prototype.onsucces = function(data) {	for (markerGroup in data) {		var mapGroup = this.mapGroups['tag'+data[markerGroup].tagId];		var organisations = data[markerGroup].organisations;		var markers = new Array();		if (mapGroup.markerImage) {			var markerImage = new google.maps.MarkerImage(mapGroup.markerImage,				new google.maps.Size(mapGroup.markerWidth, mapGroup.markerHeight),				new google.maps.Point(0,0),				new google.maps.Point(mapGroup.markerWidth/2, mapGroup.markerHeight)				);		}		else {			markerImage = null;		}		for (obj in organisations) {			var highlight = false;			if(this.highlightId == organisations[obj].organisationId) {				highlight = true;			}			this.addMarker(obj, organisations, markerImage, markers, mapGroup, highlight);		}	}};RotterdamMap.prototype.addMarker = function(obj, organisations, markerImage, markers, mapGroup, highlight, events, zindex) {	var organisation = organisations[obj];	var latlng = new google.maps.LatLng(organisation.latitude,organisation.longitude);	if (highlight && !this.highlighted) {		var markeroptions = {			position: latlng, 			map: this.map,			icon: '/NL/includes/themes/rotterdaminfo/images/marker-highlight.png',			title:organisation.name		}		if (typeof zindex != 'undefined') markeroptions.zIndex = zindex;		var marker = new google.maps.Marker(markeroptions);		this.map.setCenter(latlng);		this.map.setZoom(16);		this.highlighted = true;	}	else {		var markeroptions = {			position: latlng, 			map: this.map,			icon: markerImage,			title:organisation.name,			color:mapGroup.markerColor		}		if (typeof zindex != 'undefined') markeroptions.zIndex = zindex;		var marker = new google.maps.Marker(markeroptions);	}		markers.push(marker);	mapGroup.markers = markers;	mapGroup.hidden = false;	if(events != false) {		infoBox = this.infoBox;				google.maps.event.addListener(marker, 'click', function() {       			if(infoBox) infoBox.setMap(null);			var color = marker.color ? marker.color : '#000';						var content = ''			if (organisation.name) {content += '<a href="'+organisation.link+'"><h3>'+organisation.name+'</h3></a>'}			if (organisation.summary) {content += '<p>'+organisation.summary.substring(0,100)+'... <a href="'+organisation.link+'">meer</a></p><br />'}			if (organisation.tagurl && organisation.linktext) {content += '<a href="'+organisation.tagurl+'">'+organisation.linktext+'</p>'}						if (organisation.img) {				infoBox = new InfoBox({latlng: this.getPosition(), map: this.map, title : 'Details', content : '<div class="wrapper" style="border-color:'+color+';"><img src="'+organisation.img+'"><div class="text">'+content+'</div></div><div class="bottom" style="border-right-color:'+color+';"></div>'});						}			else {				infoBox = new InfoBox({latlng: this.getPosition(), map: this.map, title : 'Details', content : '<div class="wrapper" style="border-color:'+color+';">'+content+'</div><div class="bottom" style="border-right-color:'+color+';"></div>'});			}		});		google.maps.event.addListener(marker, 'visible_changed', function() {			if(infoBox) infoBox.setMap(null);		});		google.maps.event.addListener(this.map, 'click', function() {			if(infoBox) infoBox.setMap(null);		});	}};RotterdamMap.prototype.onError = function(jqXHR, textStatus, errorThrown) {	alert(errorThrown);};MapGroup = function(checkbox) {	this.checkbox = checkbox;	this.markers = null;	this.hidden = true;};MapGroup.prototype.init = function() {	this.tagId = $(this.checkbox).val();	this.markerColor = $(this.checkbox).attr('data-color');	this.markerImage = $(this.checkbox).attr('data-marker');	this.markerWidth = $(this.checkbox).attr('data-marker-width') ? $(this.checkbox).attr('data-marker-width') : 22;	this.markerHeight = $(this.checkbox).attr('data-marker-height') ? $(this.checkbox).attr('data-marker-height') : 38;};/*  * Google Maps  */GoogleMaps = function() {	this.loaded = false;	this.infoBoxCount = 0;};GoogleMaps.prototype.load = function(callback) {	this.callback = callback;	if (!this.loaded) {		var script = document.createElement("script");		script.type = "text/javascript";		script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=document.googleMaps.call";		document.body.appendChild(script);	}	else {		callback();	}	this.loaded = true;};GoogleMaps.prototype.call = function() {	script = document.createElement("script");	script.type = "text/javascript";	script.src = "/NL/includes/themes/rotterdaminfo/js/libs/gmaps.infobox.js";	document.body.appendChild(script);	this.testInfoBox();};GoogleMaps.prototype.testInfoBox = function() {	var _this = this;	if (typeof InfoBox != 'undefined') {		this.callback();	}	else if (this.infoBoxCount == 20) {		alert("GoogleMaps Error");	}	else {		this.infoBoxCount += 1;		setTimeout(function() {_this.testInfoBox();}, 250);	}};/*  * Lightbox  */var Lightboxes = {};Lightbox = function(content) {	this.content = content;	this.init();};Lightbox.prototype.init = function() {	this.wrapper = $('<div class="lightbox"><div class="opacitylayer"></div><div class="container"><div class="inner"></div></div></div>');	this.opacitylayer = $('.opacitylayer',this.wrapper).get(0);	this.container = $('.container',this.wrapper).get(0);	this.inner = $('.inner',this.wrapper);	if (this.content) {$(this.inner).append(this.content)};	$(document.body).append(this.wrapper);	$(this.wrapper).bind('click', $.proxy(function(e){this.onClick(e)},this));};Lightbox.prototype.onClick = function(e) {	if (e.target == $(this.opacitylayer).get(0)) {		this.close();	}};Lightbox.prototype.show = function() {	var _this = this;	$(this.wrapper).show();	$(this.wrapper).height($(document.body).outerHeight(true));	var top = $(document).scrollTop()+10;	$(this.container).css('top',top);	if(Modernizr.csstransitions) {		setTimeout(function(){$(_this.opacitylayer).css('opacity',0.5)},100);		setTimeout(function(){$(_this.container).css('opacity',1)},600);	}};Lightbox.prototype.close = function() {	var _this = this;	if(Modernizr.csstransitions) {		$(this.container).css('opacity',0);		setTimeout(function(){$(_this.opacitylayer).css('opacity',0	)},500);		setTimeout(function(){$(_this.wrapper).hide();},1000);	}	else {		$(this.wrapper).hide();	}			};
