﻿/// <reference path="jquery-1.4.1-vsdoc.js" />
/// <reference path="jquery.scrollTo.js" />
$.fn.nextify = function (options) {
	$(this).each(function (idx) {
		//		var id = $(this).parent().parent().attr('id');
		var id = $(this).closest('.tab').attr('id');
		if (this.tagName == 'a' || this.tagName == 'A') $(this).attr('href', '#');
		$(this).click(function (e) {
			var pid = $('#' + id).parent().parent().attr('id');
			$('#' + id).parent().find('.tab').each(function (idx) {
				var nextid = $('#' + id).parent().find('.tab:eq(' + (idx + 1) + ')').attr('id');
				if (nextid == null) {
					nextid = $('#' + id).parent().find('.tab:first').attr('id');
				}
				if (this.id == id) {
					$('#' + pid).scrollTo('#' + nextid, 150, {});
				}
			});
		});
	});
}
