$(document).ready(function() {

	
	// #### Fade to White on Click. 
	$('.mask').fadeOut('slow', function(){
	  
	  $('#right .text').animate({marginLeft: '0px'}, 'slow',function () 
	      { 
	      //callback function
	      //########## slideshow
	      $('.slideshow').cycle({
	      	fx: 'fade',
	      	pause:  1,
	      	startingSlide: 0
	      });
	      
	      }
	  );
	  
	  
	  
	});
	

	
	
	$('a').click(function(event){
		var url = $(this).attr('href');
		
		if($(this).hasClass('ext')){
				window.open(url,'mywindow','width=800,height=450')
				//parent.document.location.href = url;
			  return false;
		}
		
	  event.preventDefault();
	  
	  if($(this).hasClass('goto')){
	  	  var num = parseInt($(this).attr('rel'));
		  $('.slideshow').cycle(num);
		  return false;
	  }
	  
	
	  $('.mask').fadeIn('slow', function(){
	    document.location.href = url;
	  });
	
	  return false;
	});
	/*
	$('.goto').click(function(event) {  
		event.preventDefault();
		var abc = parseInt("5");
		$('.slideshow').cycle(abc);  
	}); 
	

	*/
       //##########
     
    $('#cont .caption span').css('margin-top','0px');
    
	$('#cont .caption').mouseenter(function(){
		$(this).find('span').stop().animate({marginTop: '-50px'}, 500);
		//$(this).
	}).mouseleave(function(){
		$(this).find('span').stop().animate({marginTop: '0px'}, 500);
	});
	
	
	// Slider Impressionen
	/*$('a.goto').click(function(){
	
		$(this).each(function(){
		
			var imgUrl = $(this).attr('rel');
			alert('<img src="'+imgUrl+'" alt="" />');
			$('.slideshow').html('<img src="'+imgUrl+'" width="445" height="330" alt="" />');
		
		});
	
	});*/
	
	
		
	
    
});
