var checkTime = 0;

function showAktuelles(){
	if(checkTime == 0){
		if($('#Aktuelles').hasClass('active')){
			
		}else{
			$('.box').fadeOut('slow');
			$('.box').removeClass('active');
			$('#Aktuelles').fadeIn('slow');
			$('#Aktuelles').addClass('active');	
			return false;
		}
	}else{
		return false;
	}
}
	$(document).ready(function() {
	   $('a[rel*=lightbox]').lightBox();
	   
	   $('#Aktuelles').fadeIn(1500);
	   $('#Aktuelles').addClass('active');
	   
	   $('a.close').each(function(){
	   		var getHtml = $(this).html();
			$(this).html('<'+'span>&nbsp;<'+'/span>'+getHtml);
			Cufon.refresh();
	   });
	   
	   $('#navi').addClass('js');
	   $('#navi li ul').css('display','none');
	   $('.js li').hover(function(){
	   		$(this).children('ul').stop('true','true').slideDown();
	   }, function(){
	   		$(this).children('ul').stop('true','true').slideUp();
	   });
	   
	   $('a.close').hover(function(){
	   		$(this).children('span').stop('true','true').fadeIn();
	   }, function(){
	   		$(this).children('span').stop('true','true').fadeOut();
	   });
	   
	   $('a.close').click(function(){
	   		$(this).parent('.box').fadeOut('slow');
	   });
	   
	   $('#slider').nivoSlider({
			effect:'random', 
			slices:15,
			animSpeed:1000,
			pauseTime:4000,
			controlNav:false
		});
		
		$('.nivo-directionNav a').hover(function(){
			$(this).children('span').stop('true','true').fadeIn();
		}, function(){
			$(this).children('span').stop('true','true').fadeOut();
		});
		
		$('#headerAdd .box a').each(function(){
			var getHtml = $(this).html();
			if(getHtml == 'mehr'){
				$(this).addClass('mehr');
			}
		});
		
		$('#naviAdd li a').each(function(){
		
			$(this).mouseover(function(){
				checkTime = 1;
				var getBoxName = $(this).attr('class');
				$('.box.active').fadeOut('slow');
				$('.box.active').removeClass('active');
				$('#'+getBoxName).fadeIn('slow');	
				$('#'+getBoxName).addClass('active');
				return false;
			});
			
			$(this).mouseout(function(){
				checkTime = 0;
				setTimeout('showAktuelles();',2000);
			});
		});
		
		$('.box').mouseover(function(){
			checkTime = 1;	
		});
		
		$('.box').mouseout(function(){
			checkTime = 0;	
			setTimeout('showAktuelles();',2000);
		});
		
		$('#naviIndex').removeClass();
				
		$('#naviIndex li').hover(function(){
			$(this).children().children('span').stop('true','true').fadeIn();
		}, function(){
			$(this).children().children('span').stop('true','true').fadeOut();
		});
		
		$('#naviIndex li').hover(function(){
			$(this).children('div').stop('true','true').fadeIn('slow');	
			$(this).css('z-index','2');
		}, function(){
			$(this).children('div').stop('true','true').fadeOut('slow');	
			$(this).css('z-index','1');
		});
		
		$('#sitemap').removeClass();
		$('#sitemap li.showSitemap').hover(function(){
			$(this).children('span').stop('true','true').fadeIn();
			$(this).children('ul:first').fadeIn();
			$(this).children('a').children('span').addClass('active');
		}, function(){
			$(this).children('ul:first').stop('true','true').fadeOut();
			$(this).children('a').children('span').fadeOut();
			$(this).children('a').children('span').removeClass('active');
		});
		
		$('#AktuellesHolder').load("includes/aktuelles-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#PolstermoebelHolder').load("includes/polstermoebel-include.php", function() {
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#PolstermoebelHolder').load("includes/polstermoebel-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		   pushContent();
		});
		
		$('#WohnmoebelHolder').load("includes/wohnmoebel-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#CouchUndBeistelltischeHolder').load("includes/couch-und-beistelltische-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#EssgruppenHolder').load("includes/essgruppen-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#SchlafzimmerHolder').load("includes/schlafzimmer-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#LeuchtenUndAccessoiresHolder').load("includes/leuchten-und-accessoires-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('#BesonderheitenHolder').load("includes/besonderheiten-include.php", function() {		
		   $('a[rel*=lightbox]').lightBox();
		   Cufon.refresh();
		});
		
		$('a.accordeonOpen').click(function(){
			if($(this).hasClass('active')){
				$(this).parent('.accordeonBox').children('.accordeonContent').slideUp();
				$(this).parent('.accordeonBox').children('.accordeonContent').removeClass('active');
				$(this).removeClass('active');
			}else{
				$('a.accordeonOpen').removeClass('active');
				$(this).addClass('active');
				$('.accordeonContent.active').slideUp();	
				$(this).parent('.accordeonBox').children('.accordeonContent').slideDown();	
				$(this).parent('.accordeonBox').children('.accordeonContent').addClass('active');
			}
		});
		
		$('a.external').click(function(){
			$(this).attr('target','_blank');
		});
		pushContent();
						
		
	});
		function pushContent(){
			$('.ewcms_news_link').each(function(){
				var getHref = $(this).attr('href');
				$(this).attr('href',getHref+'#contentMain');
			});
			var changeLightboxGlalery=1;
			$('.ewcms_newsloop_img_a').each(function(){
				var getRel = $(this).attr('rel');
				$(this).attr('rel',getRel+'[gallery'+changeLightboxGlalery+']');
				changeLightboxGlalery = changeLightboxGlalery+1;
			});
			$('.ewcms_news_feed_p').each(function(){
				var getHtml = $(this).html();
				$(this).html(getHtml+'...');
			});
		}
	
	Cufon.replace(['#headerAdd h3','#headerAdd h4','#contentMain h2','#contentMain h3'],{fontFamily: 'CenturyGothic'});
	Cufon.replace('#headerAdd h4',{fontFamily: 'baskerville'});
	Cufon.replace(['#navi li a','#contentMain a.plus','#naviEinrichtungen li a strong','#contentMain .accordeonOpen'], {hover: true, fontFamily: 'CenturyGothic'});
	
	
