/*
 * general javascript(jquery)
 *
 * @author		Milish <milishhh@gmail.com>
 * @version		0.1
 */

var windowHeight = $(window).height(); 
var windowWidth = $(window).width();

$('document').ready(function(){
	pageHeight = windowHeight - 240;
	$('.page').css('min-height', pageHeight);
});

/*
 * animation enter page
 */
function enterEffect() {
	$('.page').hide();
	$('#footer .title h1').hide();
	setTimeout(function(){ 
		$('.page').fadeIn();
		$('#footer .title h1').fadeIn();
	}, 200);
}
/*
 * Scroll anchor	
 *
 * @version		1.1
 */
(function($){
	$.fn.Manchor = function(options) {
	var Wheight = $(window).height();
	var Dheight = $(document).height();
	var DheightPlus = Dheight - 400;
	
		var defaults = {
			speed : 800,
			scroll: true
		}
		
		var options = $.extend(defaults, options);
			return this.each(function() {
				obj = $(this);
				mSpeed = options.speed;
				mScroll = options.scroll;
				
				obj.click(function(event){
					event.preventDefault();
					
					var full_url = this.href;
					var parts = full_url.split("#");
					var trgt = parts[1];
					var target_offset = $("#"+trgt).offset();
					var target_top = target_offset.top;

					$('html, body').animate({scrollTop:target_top}, mSpeed);
				});
				
				if(mScroll == false) {
					if(Wheight < DheightPlus) {
						obj.css('dispaly', 'block');
					} else {
						obj.css('display', 'none');
					}
				}
				
			});  
	}  
})(jQuery); 


$(document).ready(function() {
	var slider = $('#background-slider').bxSlider({
	    mode: 'fade',
	    auto:	true,
		randomStart: false,
		pager:	false,
		pause:	10000,
		speed:	1000,
		controls:	false
	  });
	
	$('#go-prev, #go-next').hide();
	
	$('.gallery').toggle(function(){
		$('.text',this).text('Hintergrund Galerie schließen');
		$('.arrow-up',this).removeClass('arrow-up').addClass('arrow-down');
		$('.box-content').slideUp(500);
		$('#go-prev, #go-next').fadeIn(500);
	}, function(){
		$('.text', this).text('Hintergrund Galerie ansehen');
		$('.arrow-down',this).removeClass('arrow-down').addClass('arrow-up');
		$('#go-prev, #go-next').fadeOut(500);
		$('.box-content').slideDown(500);
	});
	
	
	
	
	
	  $('#go-prev').click(function(){
	    slider.goToPreviousSlide();
	    return false;
	  });
	
	  $('#go-next').click(function(){
	    slider.goToNextSlide();
	    return false;
	  });	
});





