// JavaScript Document

function getImpressum(){
		dojoGet('../businessLogic/ajax/getImpressum.php', 'Impressum');
}

function getTeam(){
	dojoGet('../businessLogic/ajax/getTeam.php', 'Team');
}

function getAnfrage(){
	dojoGet('../businessLogic/ajax/getAnfrage.php', 'Anfrage');
}

function getUeberUns(){
	dojoGet('../businessLogic/ajax/getUeberUns.php', 'Über uns');
}

function submitForm() {
                dojo.xhrPost ({
                        // The page that parses the POST request
                        url: '../businessLogic/ajax/postAnfrage.php',
                
                        // Name of the Form we want to submit
                        form: 'anfrage',
                
                        // Loads this function if everything went ok
                        load: function (data) {
							if(data.substr(0,20) == "<font color='green'>"){
								document.anfrage.reset();	
							}
							dojo.byId('anfrage_status').innerHTML = data;
                        },
                        // Call this function if an error happened
                        error: function (error) {
                        	//
                        }
           });
}

function dojoGet(url, 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('support_main') != null){
						dojo.byId('support_main').innerHTML = data;
						dojo.byId('aktuelle_auswahl').innerHTML = label;
					}
				},
        
                // Called if there was an error (such as a 404 response)
                error: function (data) { }
            });
		}
		
getTeam();

		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();
