
var loginClose = function(pixel, opacity){
    $('#loginCont li.login-02').children('ul').stop(false, true).delay(800).animate({
		height: pixel+'px',
		opacity: opacity,
		filter: ''
	}, 800, function(){
		
		if(opacity==0){
			$(this).css('display', 'none');
			$('#foot').css('z-index', 6);
		} else {
			/*$(this).css('display', 'block');*/	
		}
	});
}

$(document).ready(function(){
			 	
				$(".galleryCarousel").jcarousel({
			 	initCallback: gallery_initCallback,
				wrap: 'circular'
				});	
				
				$(".pictureCarousel").jcarousel({
			 	//initCallback: content_initCallback,
				});	
				
				$w = $(window);
											
				$("a.fancybox").fancybox({
					'transitionIn'	:	'elastic',
					'transitionOut'	:	'elastic',
					'speedIn'		:	700, 
					'speedOut'		:	350,
					'cyclic'		: 	true,
					'titlePosition'	:	'outside',
					'easingIn'      : 'easeOutBack',
					'easingOut'     : 'easeInBack',
					'overlayOpacity':	'0.9',
					'overlayColor'	:	'#000',
					'padding'		:	1,
					'onStart'		:	function() {
											$('object').hide();
										}, 
					'onClosed'		:	function() {
											$('object').show();
										},
					'onComplete'	:	function() {
						clearTimeout(jQuery.fancybox.slider);
						jQuery.fancybox.slider=setTimeout("jQuery.fancybox.next()",11000);
					}
				});

				$(".showit").fancybox({
					'width'				: 620,
					'height'			: 500,
					'autoScale'     	: false,
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'type'				: 'iframe',
					'overlayOpacity'	: '0.9',
					'overlayColor'		: '#000',
					'scrolling'			: 'no',
					'titlePosition'	:	'outside'
				});
				
				$(".animoto").fancybox({
					'width'				: 452,
					'height'			: 260,
					'autoScale'     	: false,
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'type'				: 'swf',
					'overlayOpacity'	: '0.9',
					'overlayColor'		: '#000',
					'scrolling'			: 'no'

				});
				
				$("#background").fullBg();
				
			// Login Slider - START
			// if IE6 -> keine Animation
			if ( $.browser.msie && $.browser.version<7 ) {
				$('#loginCont li.login-02').hover(function(){
					if($('#fancybox-wrap').is(':hidden') || $('#fancybox-wrap').attr('display') == 'none'){
						$('#foot').css('z-index', 51);
					}
					$(this).children('ul').show();
				}, function(){
					$(this).children('ul').hide();
					$('#foot').css('z-index', 6);
				});
			} else {
				
				$('#loginCont li.login-02 ul').css('height', 0).css('opacity', 0).hide();
				$('#loginCont li.login-02').hover(function(){
					
					// Login Container über Galerie Carousel positionieren
					if($('#fancybox-wrap').is(':hidden') || $('#fancybox-wrap').attr('display') == 'none'){
						$('#foot').css('z-index', 51);
					}
					
					$(this).children('ul').stop(true, false).animate({
						height: '160px',
						opacity: 1,
						filter: ''
					}, 300, function(){
						$(this).css('display', 'block');
					});
					
				}, function(){
					if($('#loginCont input.focus').length == 0){
						loginClose(0, 0);
					}
				
					return false;
				});
			}
			
			$('#loginCont input').click(function(){
				$(this).addClass('focus');
			});
			
			$(document).click(function(e) {
				if (!$(e.target).parents().andSelf().is('#loginCont input')) {
					$('#loginCont input').removeClass('focus');
					if($('#loginCont li.login-02 ul').height() == 160){
						loginClose(0, 0);
					}
					
				}
			});
			// Login Slider - END	
			
			$('#loginCont input[type=text], #loginCont input[type=password]').click(function(){
				if($(this).attr('value') == $('#loginCont input.compare').attr('value')){
					$(this).removeAttr('value');
				}
			});
		});
