$.trackPage('UA-19214714-1');

Cufon.replace('#quicklinks ul li ul li a, .navigation a,.specialnavi a,h1,h2, .btn, .acco_start, .acco_end, #right ul, #breadcrumb, h3, h4, a.back, .dwnl',{fontFamily:'calibri',hover: true});
Cufon.replace('.teaser, .project h2',{fontFamily:'philosopher',hover: true});

$(document).ready(function(){
$('head').append('<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>');

	$(".tab_content").hide(); //Hide all content
	if(!window.location.hash) { 
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	} else {
		var hash = "#"+window.location.hash.substring(1); //Puts hash in variable, and removes the # character
      	//alert (hash);
      	$("a[href^='"+hash+"']").parent("li").addClass("active").show();
      	$(hash).show();
	}

	//On Click Event
	$("ul.tabs li").click(function() {
		
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		window.location.hash = activeTab;
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	
	$(".object_desc a").fancybox();
	$("ul.gal a").fancybox();
	$("ul.variants a").fancybox();
	$("div.pic a").fancybox();
	$('#mainpicholder img').css('opacity',0).one("load",function(){
		$(this).animate({opacity:1},{queue:false,duration:1000});
	})
	.each(function(){
		if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6))
		$(this).trigger("load");
	});

	$('#hovernavi')
.append(
	$('<div />')
		.attr('id','navistopper')
		.css({height:$('#hovernavi').height(),position:'absolute',width:$('#hovernavi').width()})
		.mouseenter(function(){
			$(this).animate({whatever:0},{duration:500,complete:function(){
				$(this).hide();
			}})
		})
		.mouseleave(function(){
			$(this).stop(true);
		})
)
		.removeClass('nojs')
		.find('li')
			.each(function(i,e){
					$(e).find('a').clone()
						.addClass('active')
						.css({opacity:0})
						.appendTo($(e));
					$(e)
						.bind('mouseenter',function(){
							$(this).children('a:last-child')
								.animate({opacity:1},{queue:false,duration:1000});

if(!$('#pic'+$(this).attr('id')).is(':last-child')){

								$('#mainpicholder')
									.append(
										$('#pic'+$(this).attr('id'))
											.css({top:0,opacity:0})
											.animate({opacity:1},{queue:false,duration:1000})
										);
}
						})
						.bind('mouseleave',function(){
								$(this).children('a:last-child')
									.animate({opacity:0},{queue:false,duration:1000});
						})
			});
	$('#hovernavi').mouseleave(function(){
$('#navistopper').stop(true).show();
if(!$('#mainpicholder .mainview').is(':last-child')){
		$('#mainpicholder')
			.append(
				$('#mainpicholder .mainview')
					.css({opacity:0})
					.animate({opacity:1},{queue:false,duration:1000})
			);
}
	});
	
	$(".number").blur(function(){
	    $(this).format({format:"#,###.00", locale:"de"});
	});
	$('.acco .gal').each(function(i,e){
		$(e).append($('<li />').css({float:'none',display:'block',clear:'both'}))
		$(e).css({display: 'block',height:$(e).height(),width:$(e).parent().width()});
	});
	jQuery('.acco').hide();
	jQuery('.acco_start').click(function()
	{
		$(this).next(".acco").slideDown("slow");
		$(this).hide();
	});
	jQuery('.acco_end').click(function()
	  {
		$(this).parent().slideUp("slow");
		$(this).parent().prev(".acco_start").show();
	  });
	  
	  jQuery('ul li ul').hide();
	  
	  $('#quicklinks h1').click(function(){
	  		 if(!($(this).hasClass('open'))) {
		  		$('#quicklinks ul h1.open').next('ul').slideUp();				$('#quicklinks ul h1.open').removeClass('open'); 
				$('#quicklinks ul li.open').removeClass('open'); 
				$(this).addClass('open');
			    $(this).next('ul').slideDown();
			    $(this).parent('li').addClass('open');
	  		 } else {
	  		 	$(this).next('ul').slideUp();				$(this).removeClass('open'); 
				$(this).parent('li').removeClass('open'); 
	  		 }		    return false;		});
	
});
$(document).ready(function(){
	$('body').prepend(
		$('<div />')
			.attr('id','maptt')
			.css({position:'absolute',zIndex:999})
			.hide()
	)
	$('.partnermap').find('a').bind('mouseenter',function(){
		$('#maptt')
			.html($(this).html())
			.css({top:$(this).offset().top-($('#maptt').height()+15),left:$(this).offset().left+15})
			.fadeIn()
		return false;
	}).bind('mouseleave',function(){
		$('#maptt').hide();
	});
	
	$('.hessenmap').find('a').bind('mouseenter',function(){
		$('#maptt')
			.html($(this).html())
			.css({top:$(this).offset().top-($('#maptt').height()+15),left:$(this).offset().left+15})
			.fadeIn()
		return false;
	}).bind('mouseleave',function(){
		$('#maptt').hide();
	});
});

