// Detecting theme switcher switching, from http://bililite.com/blog/2009/06/24/copying-jquery-ui-styles-and-detecting-css-loading/
(function($){
	var noCache = function() {return '?'+Math.random()}; 
	var href = 'http://example.com/Idontexitst.css'; 
	$('<img />').attr('src', href).error(function() { 
		$.noCache = function() {return '' }; 
		$(this).remove(); 
	}).appendTo('body')
	$.fn.themeswitcher2 = function(opts){
		if (opts.onSelect){
			var onSelect = opts.onSelect;
			opts.onSelect = function(){
				var self = this, args = arguments, href = $('link.ui-theme:last').attr('href')+noCache(); 
				$('<img />').attr('src', href).error(function() { 
					onSelect.apply(self, args); 
					$(this).remove(); 
				}).appendTo('body'); 
			}
		}
		return this.themeswitcher(opts);
	};
})(jQuery);