(function($){

  $.fn.boxWindow = function(url, width, height) {
  
	 /* INIT */
	  
	 $("body").prepend("<div id='box-window'></div>")
	 $("body").prepend("<iframe scrolling='no' frameborder='0' id='box-window-frame' style='margin-top: " + ( $(window).height() - height ) / 2 + "px; margin-left: " + ( $(window).width() - width) / 2 + "px;' src='" + url + "'  width='" + width + "' height='" + height + "'></iframe>");
	 $("body").prepend("<div style='top: " + ((($(window).height() - height ) / 2) + 15) + "px; right: " + ((($(window).width() - width) / 2) + 35) + "px;' id='close-window'>close window</div>"); 
	 $("body").css({'overflow' : 'hidden'})
	 $("#box-window").width($(document).width()).height($(document).height());
	 $("#box-window").hide()
	 $("#box-window-frame").hide()
	 $("#close-window").hide()
	 $("#box-window").fadeTo(550, 0.70)
	 $("#box-window-frame").fadeTo(550, 1)
	 $("#close-window").fadeTo(550, 1)
	 
	 $("#box-window, #close-window").click(function(){
		 $("#box-window").fadeOut(500, function(){ $(this).remove();  $("body").css({'overflow' : 'auto'});  });
		 $("#box-window-frame").fadeOut(500, function(){ $(this).remove(); });
		 $("#close-window").fadeOut(500, function(){ $(this).remove(); });
	 })
	 
	 
	 
  };
})(jQuery);

