// JavaScript Document

		function getPrognoseHeute() {
			dojoGet('../businessLogic/ajax/getPrognoseHeute.php', 'prognose', 'Prognose Heute');
			dojoGet('../businessLogic/ajax/getSchneefallGrenzeHeute.php', 'grenzeSchneefall', 'Prognose Heute');
			dojoGet('../businessLogic/ajax/getNebelGrenzeHeute.php', 'grenzeNebel', 'Prognose Heute');
        }
		getPrognoseHeute();
			
		function getPrognoseMorgen() {
			dojoGet('../businessLogic/ajax/getPrognoseMorgen.php', 'prognose', 'Prognose Morgen');
			dojoGet('../businessLogic/ajax/getSchneefallGrenzeMorgen.php', 'grenzeSchneefall', 'Prognose Morgen');
			dojoGet('../businessLogic/ajax/getNebelGrenzeMorgen.php', 'grenzeNebel', 'Prognose Morgen');
        }
		
		function getPrognoseWoche() {
			dojoGet('../businessLogic/ajax/getPrognoseWoche.php', 'prognose', 'Ausblick');
			dojoGet('../businessLogic/ajax/getGrenzeWoche.php?grenze=schneefall', 'grenzeSchneefall', 'Ausblick');
			dojoGet('../businessLogic/ajax/getGrenzeWoche.php?grenze=nebel', 'grenzeNebel', 'Ausblick');
        }
		
		function dojoGet(url, div, label){
	            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: url,
				useCache: false, 
       			preventCache: true ,
        
                // Called when the page loaded successfully
                load: function (data) { 
					if(dojo.byId(div) != null){
						dojo.byId(div).innerHTML = data;
						dojo.byId('aktuelle_auswahl').innerHTML = label;
					}
				},
        
                // Called if there was an error (such as a 404 response)
                error: function (data) { }
            });
		}
		
				var getUserOnlineReady = true;
		function getUserOnline() {
			if(getUserOnlineReady == true){
				getUserOnlineReady = false;
				dojo.xhrGet ({
					// Location of the HTML content we want to grab
					url: '../businessLogic/ajax/getUserOnline.php',
					useCache: false, 
					preventCache: true ,
			
					// Called when the page loaded successfully
					load: function (data) { 
						//nothing to do
					},
			
					// Called if there was an error (such as a 404 response)
					error: function (data) { }
				});
			}
			setTimeout("getUserOnline()", 30000);
        }
		getUserOnline();
		
		
		var getIPrognoseReady = true;
		 function getIPrognose() {
			if(getIPrognoseReady == true){
				getIPrognoseReady = false;	
				dojo.xhrGet ({
					// Location of the HTML content we want to grab
					url: '../businessLogic/ajax/getIPrognose.php',
					useCache: false, 
					preventCache: true ,
			
					// Called when the page loaded successfully
					load: function (data) { 
						if(dojo.byId('widget_iprognose') != null){
							dojo.byId('widget_iprognose').innerHTML = data;
							getIPrognoseReady = true;
						}
					},
			
					// Called if there was an error (such as a 404 response)
					error: function (data) { }
				});
			}
			setTimeout("getIPrognose()", 180000);
        }
		getIPrognose();