$(document).ready(function(){

	$('#header #navigation li:not(.active) a')
	.mouseover(function(){
		$(this).stop().animate({
			backgroundColor:'#'+$(this).parent().attr('class').replace('sharp_', '')
		}, 200);
	})
	.mouseout(function(){
		$(this).stop().animate({
			backgroundColor:'#40474F'
		}, 200);
	});
	
	/* IS NOT WEBKIT AND IS NOT SAFARI */
	if($.browser.webkit != true && $.browser.safari != true )
	{
	}
	/* IS WEBKIT OR IS SAFARI */
	if($.browser.webkit == true || $.browser.safari == true )
	{
		$('#content .line_top').css({
			'padding-top':'4px'
		});
	}
	/* IS OPERA */
	if($.browser.opera == true )
	{
		$('#content .line_bottom').css({
			'padding-bottom':'2px'
		});
		
		$('.home_projekte .projekt .projekt_img a .expand').css({
			'top':'0px'
		});
	}
	
	/* PROJEKT EXPAND */
	$('.projekt .projekt_img a').mouseover(function(e){
		$(this).find('img').stop().fadeTo(400, 0.1)
		.parent('a').find('.expand').stop().fadeTo(400, 1.0);
	});
	$('.projekt .projekt_img a').mouseout(function(e){
		$(this).find('img').stop().fadeTo(400, 1.0)
		.parent('a').find('.expand').stop().fadeTo(400, 0.0);
	});
	
	
	/* CONTENT_WRAP PROJEKT EXPAND */
	$('#content_wrap a.box-content-projekt').mouseover(function(e){
		$(this).find('img').stop().fadeTo(400, 0.1)
		.parent('a').find('.expand').stop().fadeTo(400, 1.0);
	});
	$('#content_wrap a.box-content-projekt').mouseout(function(e){
		$(this).find('img').stop().fadeTo(400, 1.0)
		.parent('a').find('.expand').stop().fadeTo(400, 0.0);
	});
	
	
	/* AHMET4PLAN */
	$('#ahmet4plan').addClass('active_0');
	var ahmet4plan_top = 0;
	ahmet4plan_top = $('#ahmet4plan .plan .plan-title').css('padding-top');
	$('#ahmet4plan:not(.active) .plan').hover(
		function(){
			$(this).addClass('active');
			var active = $('#ahmet4plan .plan.active');
			
			var active_number = active.attr('id').replace('ahmet4plan_', '');
			$('#ahmet4plan').addClass('active').addClass('active_'+active_number);
			
			active.find('.plan-title').stop().animate({
				paddingTop: '0px'
			}, function(){
				active.find('.plan-description').fadeIn('slow');
			});
			
		}, function(){
			var active = $('#ahmet4plan .plan.active');
			$(this).removeClass('active');
			
			active.find('.plan-description').fadeOut('slow', function(){
				active.find('.plan-title').stop().animate({
					paddingTop: ahmet4plan_top
				}, function(){
					var active_number = active.attr('id').replace('ahmet4plan_', '');
					$('#ahmet4plan').removeClass('active').removeClass('active_'+active_number);
				});
			});
			
		}
	);
	
	/* Show Projecs */
	$('.home_projekte.hidden').hide();
	var open_work = function( open ) {
		var id = '#'+open.replace('zeige_', '');
		
		$('.zeige_projekte').removeClass('active');
		$('.home_projekte.active').removeClass('active').addClass('hidden').hide();

		$('#'+open).addClass('active');
		$(id).addClass('active').removeClass('hidden').fadeIn('slow');
	}
	$('.zeige_projekte').click(function(){			
		open_work( $(this).attr('id') );
		
		return false;
	});
});
