/*jquery.cascade.ui.ext.js */
/*
 * jQuery UI cascade
 * version: 1.1 (5/20/2008)
 * @requires: jQuery v1.2 or later
 * adapted from Yehuda Katz, Rein Henrichs autocomplete plugin
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *  depends on templating  plugin if using with templateText
 * Copyright 2008 Mike Nichols
 */

;(function($) {
	$.ui = $.ui || {};
	$.ui.cascade = $.ui.cascade || {};
	$.ui.cascade.ext = $.ui.cascade.ext || {};
	$.ui.cascade.event = $.ui.cascade.event || {};
	$.ui.cascade.ext.templateText = function(opt) {
		var template = $.makeTemplate(opt.templateText, "<%", "%>");
		return { template: function(obj) { return template(obj); } };
	};
	$.ui.cascade.event.loading = function(e,source) {
		$(this).empty();
		var position = {
			'z-index':'6000',
			'position':'absolute',
			'width':'206px'
		};
		$.extend(position,$(this).offset());
		position.top = position.top;
		position.left = position.left;
		//if(parseInt($(source).find(":selected").val())>0) {
			$("<div class='cascade-loading'>&nbsp;</div>").appendTo("body").css(position);

		//}
        $(this).hide();
	};
	$.ui.cascade.event.loaded = function(e,source) {
		//$(this)[0].disabled = false;
		//if(parseInt($(source).find(":selected").val())) {
			$(this).show();
		//}
		$(".cascade-loading").remove();
	};
})(jQuery);
