$(document).ready(function() {
			$('#impressum').click(function(){
				$('#content').load('impressum.php');
				return false;
			});
			$('#start').click(function(){
				$('#content').load('index2.php');
				return false;
			});
			$('#termine').click(function(){
				$('#content').load('termine.php');
				return false;
			});
			$('#galerien').click(function(){
				$('#content').load('gal.php');
				return false;
			});
			$('#gemeinden').click(function(){
				$('#content').load('gemeinden.php');
				return false;
			});
			$('#team').click(function(){
				$('#content').load('team.php');
				return false;
			});
			$('#links').click(function(){
				$('#content').load('links.php');
				return false;
			});
			$('#gb').click(function(){
				$('#content').load('gb.php');
				return false;
			});
			$('#logon').load('linke_sidebar.php');
			$('#Foto').load('random_foto.php').fadeIn("slow");
			$("#Shouts").fadeOut("slow",function(){
					$("#Shouts").load("shout1.php",function(response, status, xhr){
						$("#Shouts").fadeIn("slow");
						});
					});
		 });  
		 
function logout()
		{
			$.get("login.php?login=logout", function(data){alert(data);});
			$("#logon").load("linke_sidebar.php?logout=1");
			$('#Foto').fadeOut('slow',function(){
					$('#Foto').load('random_foto.php',function(response, status, xhr){
						$('#Foto').fadeIn("slow");
						});
					});
			$('#rechts').load("rechts.php");
			return false;
		};   	
 
function login()
		{		
			var username = $("#username").val();
			var password = $("#password").val();
			var keks=$("#cookie").val();
			
			if ((username == '') || (password == ''))
			{
   	 		$("#info").html('');
    			$("#warning").html("Benutzername und Kennwort erforderlich !");
			} 
			else
			{
   			$.post("login.php", {login:"login", username:username, password:password, keks:keks}, function(rc) {
   			$("#info").html(rc);
   			if (rc == 1)
				{
					$("#warning").html("");
					$("#info").html('Login erfolgreich!');
					$("#logon").load('linke_sidebar.php');
					
					$('#Foto').fadeOut('slow',function(){
						$('#Foto').load('random_foto.php',function(response, status, xhr){
							$('#Foto').fadeIn("slow");
							$('#rechts').load('rechts.php', function(){
								$("#Shouts").load("shout1.php");
							});
							
						});
					});
					
				}
       		else 
				{
					$("#info").html(rc);
					$("#warning").html('Login nicht erfolgreich!');
					//$("#logon").load("linke_sidebar.php");
					
				}
				});
			}
			return false;
		}

function shout()
		{		
			var shouttext = $("#shouttext").val();
			
			if (shouttext == '')
			{
   	 		//tu nix
			} 
			else
			{
   			$("#Shoutbox").fadeOut();
   			$.post("rechts.php", {eingabe:shouttext}, function(rc) {
   			$("#Shouts").load("shout1.php");
   			$("#rechts").html(rc).fadeIn();
   			});	
			}
			$("#Shouts").fadeOut("slow",function(){
					$("#Shouts").load("shout1.php",function(response, status, xhr){
						$("#Shouts").fadeIn("slow", function(){
							$("#shouttext").focus();
						});
					});
			});
			
			return false;
		}	

