$(document).ready(function(){ 
	$('.content-cell.hover').hover(function(){
		$(".cover", this).stop().animate({top:'330px'},{queue:false,duration:500});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:500});
	});
	
	$('.content-cell.fade').hover(function(){
		$(".caption", this).fadeIn(300);
		if($(this).hasClass('booknav')){
			$(".overlay-text span", this).css('color', '#FFFFFF');
		}
	}, function() {
		$(".caption", this).fadeOut(300);
		if($(this).hasClass('booknav')){
			$(".overlay-text span", this).css('color', '#000000');
		}
	});
	
	$('.content-cell').click(function(){
		window.location = $(this).attr('href'); 	
	});

	if ($.browser.mozilla && (parseFloat($.browser.version) < 1.9)) {
	    $('#content .content-cell').css({display: 'block', float: 'left'} );
	    $('.content-project .ce_text').css({display: 'block', float: 'left'} );
		$('#header img').css({left: '5%', margin: '0px'});
	}
	if (jQuery.browser.safari) {
	   $('#content').css({letterSpacing: '-3px'} );
	}
	
/*
	$("a[href $='impressum.html#imprint']").nyroModal({
	  	width: 544, // default Width If null, will be calculate automatically
	  	height: null, // default Height If null, will be calculate automatically /548
	  	titleFromIframe: false,
	  	title: null,
	  	minWidth: 544, // Minimum width
	  	minHeight: '100%', // Minimum height
		resizable: false,
		autoSizable: false,
		showContent: showContent,
		hideContent: hideContent,
		windowResize: false,
		resize: resize,
		closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="schließen">schließen</a>', // Adding automaticly as the first child of #nyroModalWrapper 
		showBackground: showBackground
	 
	});
	$("a[href $='imprint.html#imprint']").nyroModal({
	  	width: 544, // default Width If null, will be calculate automatically
	  	height: null, // default Height If null, will be calculate automatically/ 548
	  	titleFromIframe: false,
	  	title: null,
	  	minWidth: null, // Minimum width
	  	minHeight: '100%', // Minimum height
		resizable: false,
		autoSizable: false,
		showContent: showContent,
		hideContent: hideContent,
		windowResize: false,
		resize: resize,
		closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="close">close</a>', // Adding automaticly as the first child of #nyroModalWrapper 
		showBackground: showBackground
	 
	});
*/

	$("a[href $='impressum.html#imprint']").nyroModal({
		closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="schließen">schließen</a>',	// Close button HTML
		showCloseButton: true,
		sizes: {	// Size information
		    initW: 624,	// Initial width
		    w: 624
		  }
		});
	$("a[href $='imprint.html#imprint']").nyroModal({
		closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="schließen">schließen</a>',	// Close button HTML
		showCloseButton: true,
		sizes: {	// Size information
		    initW: 624,	// Initial width
		    w: 624
		  }
	});

	
	
	
	function showContent(elts, settings, callback) {
	  elts.contentWrapper
	    .css({ // Reset the CSS at the start position

			      opacity: 0,
					top: '208px',
					marginLeft: settings.marginLeft+'px'
		
	    })
	    .show()
	    .animate({ 
	      opacity: 1
	    }, {complete: callback, duration: 350});
	}
	function hideContent(elts, settings, callback) {
	  elts.contentWrapper
	    .css({ // Reset the CSS at the start position
	      opacity: 1
	    })
	    .show()
	    .animate({ 
	      opacity: 0
	    }, {complete: callback, duration: 400});
	}
	
	function resize(elts, settings, callback) {
		elts.contentWrapper
			.animate({
				marginLeft: settings.marginLeft+'px'
			}, {complete: callback, duration: 400});
	}
	
	function showBackground(elts, settings, callback) {
				elts.bg.css({opacity:0}).fadeTo(400, 0.85, callback);
	}
	
});
