// JavaScript Document
//<!--
///////////////////////////////////Include Section start/////////////////////////////////////
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images

// mit license. paul irish. 2010.
// webkit fix from Oren Solomianik. thx!

// callback function is passed the last image to load
//   as an argument, and the collection as `this`


$.fn.imagesLoaded = function(callback){
  var elems = this.filter('img'),
      len   = elems.length,
      blank = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
      
  elems.bind('load',function(){
      if (--len <= 0 && this.src !== blank){ callback.call(elems,this); }
  }).each(function(){
     // cached images don't fire load sometimes, so we reset src.
     if (this.complete || this.complete === undefined){
        var src = this.src;
        // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
        // data uri bypasses webkit log warning (thx doug jones)
        this.src = blank;
        this.src = src;
     }  
  }); 

  return this;
};
//////////////////////////////////Include Section end//////////////////////////////////////////////////////

$(function(){
var userAgent = navigator.userAgent.toLowerCase();
var userBrowserName  = navigator.appName.toLowerCase();
// Figure out what browser is being used
$.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
	safari: /webkit/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
	name:userBrowserName
};
});

function loadPage(obj,target)
{
		
	obj.live("click", function(e){
							e.preventDefault();
							
							
							var urlW = $(this).attr('href');
							var pf = "js";
							var url = pf + urlW; 
							if($('#im')){
							$('#im').remove();}
							$(this).children('.tm').before('<img id="im" src="spinner.gif" style="position:absolute;background-color:#fff;width:16px; height:16px;padding:112px 112px 112px 112px;z-index:1000;float:none;"/>');
						
							$('.autoContent').fadeOut(600,function(){ $('.autoContent h3').remove();
							
																										 
							target.load(url,function(e){
							$('.over').removeClass('out');
							$('.autoContent img').imagesLoaded(function() {
							$('#im').remove();
								$('.autoContent').fadeIn(600,function(){$(document).scrollTop(0);});																				  

								},true);
								});
								});
							});
	
};



$(document).ready(function(){
						   

if($.browser.name == "microsoft internet explorer" && $.browser.version < 9){return;}

//$('.sideMenu li a').removeClass('lihover');
$('.over').removeClass('out');
loadPage($('.ac'),$('.autoContent'));
loadPage($('.nextTable a:first'),$('.tables'));


$('.over').live("mouseenter",function(e){ $(this).stop(false,false).animate({opacity:'0'},400); });	
$('.over').live("mouseleave",function(e){ $(this).stop(false,false).animate({opacity:'1'},400);	});



//var normal = {fontSize:11};
//var bigger = {fontSize:20};

//wenn javascript enabled dann entferne css hover style



// $('.sideMenu li a').hover( function(e){$(this).stop(false,false).animate(bigger,200).css({color:'#fff'});   },
					   
//                         function(e){ $(this).stop(false,false).animate(normal,200).css({color:'#5e5f54'});	});



//ende else

});/////////////////////////////////////////// ready ende////////////////////////////////////////// -->



