var cwls = document.querySelector('script[id="cituro-widget-loader"]') || document.querySelector('script[id="cituroWidgetLoader"]') ;
window.buildCituroOptions = function(o,ds){if(ds){for(var d in ds){var v=ds[d];if(d == 'linkedAccounts' || d == 'presetCategories'){var v=ds[d];if(v.indexOf(" ")>0){v=v.replace(" ", ",")}}o[d]=v}}}
//@deprecated
function buildCituroOptionsDep(o,e,n){if(e.hasAttribute(n)){o[n]=e.getAttribute(n);}}
if(!window.cituroOptions){window.cituroOptions = {};}
if(cwls){	
	//@deprecated
	if(cwls.hasAttribute('presetService')){
		console.warn("WARNING: The usage of 'presetService' is deprecated and will be removed in future versions. Use 'data-preset-service' instead.");
		buildCituroOptionsDep(cituroOptions,cwls,'presetService');
	}
	if(cwls.hasAttribute('presetResource')){
		console.warn("WARNING: The usage of 'presetResource' is deprecated and will be removed in future versions. Use 'data-preset-resource' instead.");
		buildCituroOptionsDep(cituroOptions,cwls,'presetResource');
	}	
	if(cwls.hasAttribute('presetCategory')){
		console.warn("WARNING: The usage of 'presetCategory' is deprecated and will be removed in future versions. Use 'data-preset-category' instead.");
		buildCituroOptionsDep(cituroOptions,cwls,'presetCategory');
	}
	if(cwls.hasAttribute('presetCategories')){
		console.warn("WARNING: The usage of 'presetCategories' is deprecated and will be removed in future versions. Use 'data-preset-categories' instead.");
		buildCituroOptionsDep(cituroOptions,cwls,'presetCategories');
	}	
	
	buildCituroOptions(cituroOptions, cwls.dataset);
}
if (typeof cituroLoader === 'undefined') {
	var cituroLoader = {
		init : function(){
			cituroWidget.initWidget(false);
		},
		load : function (){	
		    var script = document.createElement('script');
		    script.type = 'text/javascript';
		    script.clref = this;
		    if (script.readyState){
		        script.onreadystatechange = function(){
		            if (script.readyState == 'loaded' || script.readyState == 'complete'){
		                script.onreadystatechange = null;
		                this.clref.init();
		            }
		        };
		    } 
		    else {
		        script.onload = function(){
		        	this.clref.init();
		        };
		    }	
		    script.src = 'https://app.cituro.com/bookingwidget/stadtwetterruhr';
		    script.defer = true;
		    document.getElementsByTagName('head')[0].appendChild(script);
		}
	}	
		
	cituroLoader.load();	
}
else{
	cituroWidget.initWidget(true);
}