/*
 * jQuery DOUBLE MINT Backstretch 1.0 by jlancaster after looking at intial backstretch
 * http://srobbin.com/jquery-plugins/jquery-backstretch/
 *
 * Add a dynamically-resized background image to the page
 *
 * Copyright (c) 2009 Scott Robbin (srobbin.com)
 * Dual licensed under the MIT and GPL licenses.
*/

(function($) {

  $.doublebackstretch = function(src, options, callback) {
    var settings = {
          hideUntilReady: true, // Hide the image until it's finished loading
          speed: 1000 // fadeIn speed for background after image loads (e.g. "fast" or 500)
        },
        imgRatio;
    
    // Extend the settings with those the user has provided
    if(options && typeof options == "object") $.extend(settings, options);
    
    // Initialize
    $(document).ready(_init);
  
    // For chaining
    return this;
    
    
    function _init() {
    	var width = $(window).width();
    	var height = $(document).height();
    	var ratio = 0;

		$('#bg').css({'width':width});

	   $('#bg #rotator').css("margin-left", ( $(window).width() - $('#bg #rotator').width() ) / 2+$(window).scrollLeft() + "px");
    }    
  };
  
})(jQuery);

