var resizeBg = function() { 
		var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	  	var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  		var elem = $('#backgroundImage');

	  	if($('.container').height() > h) {
  			h = $('.container').height();
  		}
  		
  		 h += 30;
 
	  	$('#background').height(h);
  
  		if (w / h > 982 / 1886) {
    		elem.width(w);
			elem.height(w * 1886 / 982);
	  	} else {
    		elem.height(h);
    		elem.width(h * 982 / 1886);
	  	}
	}

	
	$(document).ready(function(){
    	$('.sb-nav li a').corner();
		$(".sb-nav ul li a").hover(function() {
			$(this).parent().find(".bpf").show();
		}, function(){ 
			$(this).parent().find(".bpf").hide();
		});
		$(".sb-nav ul li a.current").hover(function() {
			$(this).parent().find(".bpf").show();
		}, function(){ 
			$(this).parent().find(".bpf").show();
		});
		
		
    	$(window).resize(function(){
		    resizeBg();
		});
		
		$('#backgroundImage').load(resizeBg);
		
		$('.slideshow_wrapper').cycle({
			fx: 'fade'
		});

		resizeBg();
	});
	
resizeBg();

