// <![CDATA[
/**
 * dependency of this plugin:
 *
 * //@var global string http_root
 * //@var global string rp_global_image
 * //@var global string img_loader
 * //@var global string rp_cms
 *
 * //@function close_popup()
 *
*/

// You need an anonymous function to wrap around your function to avoid conflict
(function($){
 
    // Attach this new method to jQuery
    $.fn.extend({ 
         
        // This is where you write your plugin's name
        get_topZindex: function(options) {
		
			// Set the default values, use comma to separate the settings, example:
            var defaults = {
				increment: 0 // The increment number.
            }
                 
            var options = $.extend(defaults, options);

            // Must always put this line outside of each loop.
			var index_highest = 0;
			
			var $cm = this.each(function(){
				
				var o = options;
				var object = $(this);
				
				if(object.css("zIndex") > 0)
				{
					// Always use a radix when using parseInt.
					var index_current = parseInt(object.css("zIndex"), 10) + o.increment;
					if(index_current > index_highest) index_highest = index_current;
				}

			});
			
			return index_highest;
        }
    });
     
//pass jQuery to the function, 
//So that we will able to use any valid Javascript variable name 
//to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )       
})(jQuery);

// ]]>
