function next_overlay(url){
	var wrap = $("div#overlay").find(".contentWrap"); 
	$("div#overlay").fadeOut(
		"slow",
		function () {
			wrap.load(
				url,
				function (){
					$("#imagefile").load(
						function () {
							$("div#overlay").css("left", ($(window).width()-$("div#overlay").width())/2+"px");
							$("div#overlay").fadeIn("slow");
						}
					);
				}
			);
		}
	);            
}
function set_overlay(){
	$("a[rel]").overlay({ 
 
        expose: 'black',
        onBeforeLoad: function() { 
 
            // grab wrapper element inside content 
            var wrap = this.getContent().find(".contentWrap"); 
 
            // load the page specified in the trigger 
            wrap.load(this.getTrigger().attr("href"),
				function (){
					$("#imagefile").load(
						function () {
							$("div#overlay").css("left", ($(window).width()-$("div#overlay").width())/2+"px");
							$("div#overlay").fadeIn("slow");
						}
					);
        		}
			)
		}
 
    }); 
}
$(function(){
	set_overlay();
});

