﻿// plugin for 'delay'
$.fn.delay = function(time) {
    var that = this;
    return this.queue(function() {
        setTimeout(function() { that.dequeue(); }, time);
    });
};


// Determine the position of an element within
// the matched set of elements
$.fn.index = function(elem) {
    if (!elem || typeof elem === "string") {
        return jQuery.inArray(this[0],
        // If it receives a string, the selector is used
        // If it receives nothing, the siblings are used
				elem ? jQuery(elem) : this.parent().children());
    }
    // Locate the position of the desired element
    return jQuery.inArray(
    // If it receives a jQuery object, the first element is used
			elem.jquery ? elem[0] : elem, this);
};