
(function( $ ){

  $.fn.applyTabIndex = function(options) {
		
	return this.each( function ()
							{	
								// find all the <form> elements and adjust there tab indexes so that the
								// tabs on each form are unique, meaning that the cursor won't just from form
								// to form in the case where several forms on the page have the same tab indexes
								var tabindex = 1;
								$(this).find('form').each(
												 function() { $(this).find('*[tabindex]').each( function() { $(this).attr('tabindex',tabindex); tabindex++; } ); tabindex = (Math.floor(tabindex / 1000)+1) * 1000; }						 
											  )
							}
					);		
  }
})( jQuery );
