// load initial framework and sitewide script
google.load('jquery', '1.6.1');
google.setOnLoadCallback(function() {
	$.ajaxSetup({cache:true});
	$.getScript('http://www.nrw-tourismusmagazin.de/assets/js/site.js');
});

function jsLoad(js, map) {
	// load google maps first when needed and next js from array
	if (map) {
		google.load('maps', '2', {'language' : 'de'});
		google.setOnLoadCallback(function() {
			load_js(js);
		});
	}
	// otherwise load js array, when previous are loaded
	else {
		load_js(js);
	}
}

function load_js(js) {
	// preset variables
	var url = 'http://www.nrw-tourismusmagazin.de/assets/js/';
	var suff = '.js';
	$.ajaxSetup({cache:true}); // set ajax caching
	if (js.length > 0) {
		$.getScript(url+js[0]+suff, function() {
			js.splice(0, 1); // reduce array
			load_js(js); // and calling again
		});
	}
}
