(function($) {
			$.fn.fullBg = function(){
				var bgImg = $(this);
				
				bgImg.addClass('fullBg');
				
				function resizeImg() {
					var imgwidth = bgImg.width();
					var imgheight = bgImg.height();
					
					var winwidth = $(window).width();
					var winheight = $(window).height();
					
					var widthratio = winwidth / imgwidth;
					var heightratio = winheight / imgheight;
					
					var widthdiff = heightratio * imgwidth;
					var heightdiff = widthratio * imgheight;
				
					if(heightdiff>winheight) {
						bgImg.css({
							width: winwidth+'px',
							height: heightdiff+'px'
						});
					} else {
						bgImg.css({
							width: widthdiff+'px',
							height: winheight+'px'
						});		
					}
				} 
				resizeImg();
				$(window).resize(function() {
					resizeImg();
				}); 
			};
		})(jQuery)
		
jQuery(function($) {
	$("#bg").fullBg();
	$("#bg2").fullBg();
});

$(document).ready(function() {
	$('#logo').delay(1000).fadeIn(2000);	


	$('#slidebottom').hover(function(){
		$('#inner').slideToggle("slow")
	});

	$('#slidebottom #inner').hover(function(){
		$('#inner').stop;
	});

	$('#slidebottom #inp').hover(function(){
		$('#inner').stop;		
	});	
	

	/*
	$('.cover').delay(1500).fadeIn(400);
	$('.text1').delay(1700).fadeIn(2000, function(){
		$('.text2').fadeIn(2000);
		$('.text1').fadeOut(2000, function(){			
			$('.text2').fadeOut(2000, function(){
				$('.text3').fadeIn(1000, function(){
					$('.text3').fadeOut(1000, function(){
						$('.text4').fadeIn(1000, function(){
							$('.text4').fadeOut(1000, function(){
								$('.text5').fadeIn(1000, function(){
									$('.text5').fadeOut(1000, function(){
										$('.text6').fadeIn(1000, function(){
											$('.text6').fadeOut(1000, function(){
												$('.text7').fadeIn(1000, function(){
													$('.text7').fadeOut(1000, function(){
														$('.cover').fadeOut(1000);
	*/													
														/* this was already out
																fading(photos.shift());
														
																function fading(image){
																image.delay(500).fadeIn(2000, function(){
																	if(photos.length > 0){
																		fading(photos.shift());
																	} 
																	else
																	{
																		fading(photos.unshift());
																	}
																});
														*/
    $('#fade_wrap').cycle({
		fx: 'fade'
	});				/*											

													})
												})
											})
										})
									})
								})
							})
						});							
					})
				});
			});	

		});
		
	});	
*/

	$(".t").live('click', function(){
		var img = $(this).attr("alt");
			$("#fade_wrap").fadeOut("slow", function(){
				$("#fade_wrap").html("<img src='photos/room/"+img+"' class='mm'>");			
				$("#fade_wrap").fadeIn("slow");
			});
	});
});


