$.fn.resizenow = function() {
  	return this.each(function() {

		//Define image ratio
		var ratio = 937/1400;

		//Gather browser and current image size
		var imagewidth = $(this).width();
		var imageheight = $(this).height();
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		var offset;

		//Resize image to proper ratio
		if ((browserheight/browserwidth) > ratio){
		    $(this).height(browserheight);
		    $(this).width(browserheight / ratio);
		    $(this).children().height(browserheight);
		    $(this).children().width(browserheight / ratio);
		} else {
		    $(this).width(browserwidth);
		    $(this).height(browserwidth * ratio);
		    $(this).children().width(browserwidth);
		    $(this).children().height(browserwidth * ratio);
		}

		return false;
	});
};

$(window).bind("load", function(){
	$('#loading').hide();
});

$(window).bind("resize", function(){
	$('#supersize').resizenow(); 
});

	jQuery(document).ready(function(){	
	
		
		$('#supersize, #desc').cycle({ 
	   		prev:   '#prevslide', 
	    	next:   '#nextslide', 
	    	timeout: 0 
		});
		
		$(function () {
		    $('a[href~="http://"]:not([href~="http://www.provide.be/"])').attr({target: "_blank"});
		});
		
		$('#about').hide();
		$('#contact').hide();
		$('#imprint').hide();
		$('.about').click(function(){
			$('#contact, #imprint').fadeOut(1500);
			$('#about').fadeIn(500);
			return false;
		});
		$('.contact').click(function(){
			$('#about, #imprint').fadeOut(1500);
			$('#contact').fadeIn(500);
			return false;
		});
		$('.imprint').click(function(){
			$('#contact, #about').fadeOut(1500);
			$('#imprint').fadeIn(500);
			return false;
		});
		$('.close').click(function(){
			$(this).parent().fadeOut();
			return false;
		});
		$('#supersize').resizenow(); 
	});
	
	$('#prevslide, #nextslide').click(function(){
		return false;
	});

