$(document).ready(function(){
	$('#fade').hide();
	$('.slogan').hide();
	$('.bgimage').load(function() {
            showBGImage();
        });

        initWindowEvent();

});



showBGImage	= function() {

			adjustImageSize($('.bgimage'));
                        $('.bgimage').fadeIn(800);
                        $('.slogan').fadeIn(200);
                        $('#fade').fadeIn(1400);



			}
			
adjustImageSize		= function($img) {
						var w_w	= $(window).width(),
						w_h	= $(window).height(),
						r_w	= w_h / w_w,
						i_w	= $img.width(),
						i_h	= $img.height(),
						r_i	= i_h / i_w,
						new_w,new_h,
						new_left,new_top;
							
						if(r_w > r_i){
							new_h	= w_h;
							new_w	= w_h / r_i;
						}
						else{
							new_h	= w_w * r_i;
							new_w	= w_w;
						}

						$img.css({
							width	: new_w + 'px',
							height	: new_h + 'px',
							left	: (w_w - new_w) / 2 + 'px',
							top		: (w_h - new_h) / 2 + 'px'
						});
					}
					
initWindowEvent		= function() {
					/* on window resize, resize background */
						$(window).bind('resize.Menu' , function(e) {
							adjustImageSize($('.bgimage')); });
                                    }







$(function() {
// OPACITY OF BUTTON SET TO 50%
$(".navbig").css("opacity","0.5");
		
// ON MOUSE OVER
$(".navbig").hover(function () {
										  
// SET OPACITY TO 100%
$(this).stop().animate({
opacity: 0.7
}, "fast");
},
		
// ON MOUSE OUT
function () {
			
// SET OPACITY BACK TO 50%
$(this).stop().animate({
opacity: 0.5
}, "fast");
});
});


$(function() {
// OPACITY OF BUTTON SET TO 50%
$(".navsmall").css("opacity","0.5");
		
// ON MOUSE OVER
$(".navsmall").hover(function () {
										  
// SET OPACITY TO 1000%
$(this).stop().animate({
opacity: 0.7
}, "fast");
},
		
// ON MOUSE OUT
function () {
			
// SET OPACITY BACK TO 50%
$(this).stop().animate({
opacity: 0.5
}, "fast");
});
});
$(function() {
// OPACITY OF BUTTON SET TO 50%
$(".navsmallfirst").css("opacity","0.5");
		
// ON MOUSE OVER
$(".navsmallfirst").hover(function () {
										  
// SET OPACITY TO 100%
$(this).stop().animate({
opacity: 0.7
}, "fast");
},
		
// ON MOUSE OUT
function () {
			
// SET OPACITY BACK TO 50%
$(this).stop().animate({
opacity: 0.5
}, "fast");
});
});





