$(document).ready(function(){
	
	/* 	LIGHTBOX */

	$("#lightbox").hide();
	$("#lb_content").hide();
	$("#lightbox, #lb_content").animate({
		opacity: 0
	},0);
	
	function showLightbox(){
		$("#lightbox").show();
		$("#lb_content").show();
		$("#lightbox").animate({
			opacity: 0.8
		},300);
		$("#lb_content").animate({
			opacity: 1
		},300);
	};
	
	function hideLightbox(){
		$("#lightbox").animate({
			opacity: 0
		},300);
		$("#lb_content").animate({
			opacity: 0
		},300, function(){
			$("#lightbox").hide();
			$("#lb_content").hide();
			$("#lb_content").css({'width':'400px','margin-left':'-200px','top':'150px'});
			$('#wait').show();
			$('#ajax_load').html('');
		});
	};
	
	$("#close").click(function(){
		hideLightbox();
	});
	
	$(".openlightbox,.news, #terminVereinbaren").click(function(){
		showLightbox();
	});
	
	/* SUB BRANDS */
	
	$(".bubble").animate({
		opacity: 0
	},0);
	
	$(".sub_logo_icons").mouseenter(function(event){
		$(this).clearQueue();
		$(this).prev(".bubble").clearQueue();
		$(this).animate({ 
			width: "84px",
			height: "60px"
			}, 200, function(event) {
			$(this).prev(".bubble").animate({
				opacity: 1
			},200 );
		});
	});
	
	$(".sub_logo_icons").click(function(event){
		$(this).animate({ 
			width: "67px",
			height: "48px"
			}, 200, function(event) {
			$(this).prev(".bubble").animate({
				opacity: 0
			},200 );
		});
	});
	
	$(".sub_logo_icons").mouseleave(function(event){
		$(this).prev(".bubble").clearQueue();
		$(this).animate({ 
			width: "67px",
			height: "48px"
			}, 200, function(event) {
			$(this).prev(".bubble").animate({
				opacity: 0
			},200 );
		});
	});
	
		$('noscript').hide();
		$('#wait').show();
		
		$(".download, #download_teaser").click(function(){
			$("#lb_content").css({'width':'450px','margin-left':'-225px'});
			if(location.host == 'infoboard.biz' || location.host == 'infoBoard.biz' || location.host == 'www.infoboard.biz' || location.host == 'www.infoBoard.biz'){
				var download_url = location.protocol + '//' + location.host + '/' + land + '/ajax/download_form.php';
			}else{
				var download_url = location.protocol + '//' + location.host + '/ajax/download_form.php';
			}
			
			$.ajax({
				type: 'POST',
				url: download_url,
				data: ({
					bereich:	window.location.pathname
				}),
				cache: false,
				complete: function(data) { $('#wait').hide(); },
				success: function(data) {$('#ajax_load').html(data);}
			});
		});
		
		$("#catalog_order_teaser").click(function(){
			$("#lb_content").css({'width':'450px','margin-left':'-225px'});
			if(location.host == 'infoboard.biz' || location.host == 'infoBoard.biz' || location.host == 'www.infoboard.biz' || location.host == 'www.infoBoard.biz'){
				var catalog_order_url = location.protocol + '//' + location.host + '/' + land + '/ajax/katalog_form.php';
			}else{
				var catalog_order_url = location.protocol + '//' + location.host + '/ajax/katalog_form.php';
			}
			$.ajax({
				type: 'POST',
				url: catalog_order_url,
				cache: false,
				complete: function(data) { $('#wait').hide(); },
				success: function(data) {$('#ajax_load').html(data);}
			});
		});
	
});
