(function($){

	

	// debug
	// Avoid error message in ie
	$.fn.extend({debug: function(msg){
		return $(document).each(function() {
			if (window.console && window.console.log) window.console.log(msg);
		});
	}

	});	

	

	// string

	$.fn.extend({tabify: function() {            

		return this.each(function(anchorTagClass, containerClass) {

			$('.' + anchorTag).click(function(e)
			{
				e.preventDefault();
				// we add the greyed out class to all tabs
				$('.' + anchorTag).addClass('hiddentab');
				// we remove the greyed out class on the cliked tab
				$(this).removeClass('hiddentab');
				// we hide all containers
				$('.' + containerClass).fadeOut();
				// and show the proper one
				$('.' + containerClass).eq($(this).index()).fadeIn();
			})		

		});

	}

	});	



	// Extends Element 
	// @usage = $('#el').aPosition().left || $('#el').aPosition().top

	$.fn.extend({aPosition: 
		function() 
		{
			return this.each(
				function() 
				{
					thisLeft = this.offset().left;
		    		thisTop = this.offset().top;
    				thisParent = this.parent();
				    parentLeft = thisParent.offset().left;
				    parentTop = thisParent.offset().top;

				    return 	{
			    	    left: thisLeft-parentLeft,
    	    			top: thisTop-parentTop
			    	};
				}
			);
		}
	});

	

	// array

	$.fn.extend({pluginname1: function() {
		return this.each(function() {
			alert('plugin1')
		});
	}
	});	

	

	// date

	$.fn.extend({pluginname1: function() {
		return this.each(function() {
			alert('plugin1')
		});
	}
	});

	

	// misc

	$.fn.extend({removable: function() {
		return this.each(function() {
			$(this).click(function(){$(this).fadeOut('slow',function(){	$(this).slideUp('slow')})});
		});
	}
	});

	

	$.fn.extend({deleteConfirm: function() {
		return this.each(function() {
			$(this).click(function (e) {
				var answer = confirm('Are you sure ?');
				return answer ? answer : e.preventDefault();
			});
		});
	}
	});

	

})(jQuery);
