$(function(){

	$('#nav li').click(function(){
		loading();
		$(this).addClass("active");
		$(".impressum").show();
		$(".datenschutz").show();
	});
	function loading () {
		$(".active").removeClass("active");
		$('#content').hide();
		$('#loadingbar').show();
	}
	function ready () {
		$('#content').fadeIn("fast");
		$('#loadingbar').hide();
	}
	$('li.home').click(function(e){
		e.preventDefault();
		$('#content').load('index.php?oartikel=0', function() {
			ready();
		});
	});
	$('#logo').click(function(e){
		e.preventDefault();
		loading();
		$('#content').load('index.php?oartikel=0', function() {
			ready();
		});
	});
    $('li.projekte').click(function(e){
		e.preventDefault();
		$('#content').load('index.php?oartikel=1', function() {
			ready();
		});
	});
	$('li.profil').click(function(e){
		e.preventDefault();
		$('#content').load('index.php?oartikel=2', function() {
			ready();
		});
	});
	$('li.leistungen').click(function(e){
		e.preventDefault();
		$('#content').load('index.php?oartikel=3', function() {
			ready();
		});
	});
	$('li.kontakt').click(function(e){
		e.preventDefault();
		$('#content').load('index.php?oartikel=4', function() {
			ready();
		});
	});
	$('.impressum').click(function(e){
		e.preventDefault();
		loading();
		$(".impressum").hide();
		$(".datenschutz").show();
		$('#content').load('index.php?oartikel=7', function() {
			ready();
		});
	});
	$('.datenschutz').click(function(e){
		e.preventDefault();
		loading();
		$(".datenschutz").hide();
		$(".impressum").show();
		$('#content').load('index.php?oartikel=8', function() {
			ready();
		});
	});
	$('#contactform').live('submit',function() { // catch the form's submit event 
		$.ajax({ // create an AJAX call... 
	        data: $(this).serialize(), // get the form data 	
	        type: $(this).attr('method'), // GET or POST 
	   		url: $(this).attr('action'), // the file to call 
		    success: function(response) { // on success.. 
	           $('#contactform').html(response); // update the DIV 
	        }
	    }); 
	    return false; // cancel original event to prevent form submitting 
	});
/*	$('#content').live(function() {
		$("#content img").tipTip();
	});*/
});
