//var $ = jQuery.noConflict();

$(document).ready(function() {
	var min = $('.name').height();
	var max = $('#nav').height();
	

	$('#nav').addClass('drag');
	// $('.drag').animate({
	//     height: min
	//   }, 500, function() {
	//     // Animation complete.
	//   });
	// $('.open').animate({opacity: 1.0});
	
	$('.drag')
		.drag("start",function( ev, dd ){
			dd.width = $( this ).width();
			dd.height = $( this ).height();
		})
		.drag(function( ev, dd ){
			var addition = Math.max(0, dd.height + dd.deltaY - max);
			// if (dd.height + dd.deltaY < max) {
			// 				$('.open').animate({opacity: 1.0});
			// 				
			// 			} else {
			// 				$('.open').animate({opacity: 0.0});
			// 			}
			
			$( this ).css({
				//width: Math.max( 20, dd.width + dd.deltaX ),
				height: Math.min(Math.max( min+1, dd.height + dd.deltaY ),max),
				//fontSize: 15+addition/20+"px"
			});
			
			// $('div#nav li a, div#nav .tagline').css({
			// 				lineHeight: 26+addition/20+"px"
			// 			});
			},{ handle:'.handle' });
		
	// $('.open').click(function() {
	// 			$('.drag').animate({
	// 			    height: max
	// 			  }, 500, function() {
	// 			    // Animation complete.
	// 			  });
	// 			$(this).animate({opacity: 0.0});
	// 	});
		
	 // $('#ex1').jqResize('.jqResize');

    // $('.gallery').cycle({
    // 		fx:     'fade', 
    // 	    speed:   700, 
    // 	    timeout: 0, 
    // 		fit: 1,
    // 	    next:   '.gallery', 
    // 	    pause:   1,
    // 		before:  onBefore, 
    // 	    after:   onAfter
    // 	});

	// function onBefore() { 
	   // $('.gallery_description').html("Scrolling image:<br>" + this.src); 
	// } 
	// function onAfter() { 
	    //$('.gallery_description').html("Scroll complete for:<br>" + this.src).append('<h3>' + this.alt + '</h3>'); 
	// }
	
	
	$(":header").wrapInner('<span class="invert"/>');
	$(".player").click(function(){
		var p = $(this);
		p.height(p.children('.attachment-gallery').height());
		// p.width(p.children('.attachment-gallery').width());
		p.fadeTo('fast', 0.0, function() {
			p.html(inhalt);
			p.fadeTo('fast', 1.0);
		});
		
		
		//alert(this.height);
	});
	// $("#nav").addClass("jqDnR");
	
	
	
	
	
	

	// DEACTIVATED, SADLY TOO ANNOYING :(
	// $(".works a").mouseover(function() {
	// 	var imageUrl = $(this).attr('rel');
	// 	//alert(imageUrl);
	//     $(this).css('background', 'url(' + imageUrl + ') no-repeat center center');
	//     $(this).css('color', 'white');
	//     $(this).css('padding', '2px 3px');
	//     $(this).css('border-style', 'none');
	//   }).mouseout(function(){
	//     $(this).css('background', '');
	//     $(this).css('color', '');
	//     $(this).css('padding', '');
	//     $(this).css('border-style', '');
	//   });



});
