$(document).ready(function() { 
    
  // Replace fonts
  Cufon.replace('h1,h2,h3');
	
	// Set up the "Advanced Search" drop-down panel
	$('#search-options').dropDown({panel: '#search-menu', transition: 'slide'});
	
	// Automatically clear the search box
	$('#search #keywords').autoClear();

	// Set up live search on the People index page
	$('.people').listFilter('#live_filter');
	
	// Create the map on the Visit Our Office page
	setupMaps();
	
	// Set up tabs on the Client page
	$("#client-tabs").tabs({ 
		cache: true,
		preload: true,
		spinner: 'Loading...', 
		fx: { opacity: 'toggle' },
		show: function() { $('.listColumn').listSplit(); }
	});
	
	// Load Flash map on the Client page
	setupClientMap();
	
	// Open external links in a new window
	$('a[href^="http://"]')
    .filter(function() { return this.hostname && this.hostname !== location.hostname; })
    .attr("target", "_blank");
	
	// Split lists into two columns
	$('.listColumn').listSplit();
});


// Set up mapping functions for the "Visit Our Office" page
function setupMaps() {	
	if (($('#map').length > 0) && GBrowserIsCompatible()) {
		var point = new GLatLng(38.892250,-77.013179);
		var map = new GMap2(document.getElementById("map"));
		var marker = new GMarker(point);
		var directionsPanel = document.getElementById("directions");
		var directions = new GDirections(map, directionsPanel);
		
		map.setCenter(point, 15);
		map.setMapType(G_PHYSICAL_MAP);
		map.addControl(new GSmallMapControl());
		map.addControl(new GScaleControl());
		map.removeMapType(G_SATELLITE_MAP);
		map.addMapType(G_PHYSICAL_MAP);
		map.addControl(new GMapTypeControl());
		map.addOverlay(marker);
		
		// Hijack the form to display directions on this page
		$(':submit', '#get-directions').click(loadDirections);
		
		function loadDirections (event) {
			//if ($(event.target).is(':submit')) {
				$('#directions').slideUp(100);
				map.removeOverlay(marker);
				directions.load("from: "+$('#saddr').val()+" to: "+$('#daddr').val());
				
				return false;
			//}
		}
		
		function handleErrors() {
			switch (directions.getStatus().code)
			{
				case G_GEO_UNKNOWN_ADDRESS:
		     		var error_msg = "That address could not be located. This may be due to the fact that the address is relatively new, or it may be entered incorrectly.";
		     		break;
				case G_GEO_SERVER_ERROR:
					var error_msg = "A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.";
					break;
				case G_GEO_MISSING_QUERY:
					var error_msg = "You need to enter a starting address.";
					break;
				case G_GEO_BAD_KEY:
					var error_msg = "The given key is either invalid or does not match the domain for which it was given.";
					break;
				case G_GEO_BAD_REQUEST:
					var error_msg = "The directions request could not be understood.";
					break;
				default:
					var error_msg = "An unknown error occurred.";
		   }
		   alert(error_msg + "\nError code: " + directions.getStatus().code);
		}
			
        GEvent.addListener(directions, "error", handleErrors);
        GEvent.addListener(directions, "addoverlay", (function() { $('#directions, #print-directions').slideDown(1000); }) );
	}
}


// Shows a list of clients when a state is clicked on in the Flash map
function setupClientMap() {
	$('#client-map').flash({
		swf: '/scripts/ammap/ammap.swf',
		hasVersion: 8,
		width: '99%',
		height: '500px',
		bgcolor: '#f3f0eb',
		flashvars: {
			path: "/scripts/ammap/",
			data_file: "/clients/map_data/",
			settings_file: "/scripts/ammap/ammap_settings.xml"
		}
	
	});
	
	// There is probably a better way to check if the Flash map loaded,
	// but this seems to work fine.
	if ($('p', '#client-map').length == 0) {
		$('#state-clients > li').hide().css('position', 'absolute');
	} else {
		$('#client-map').removeClass('col-10 first-child').addClass('col-6 right last-child');
		$('#state-clients').removeClass('col-2 last-child').addClass('col-6 first-child');
	}
}
function showClients(state) {
	var clientList = $('#'+state);
	
	$('#hint').hide();
	$('#state-clients > li').fadeOut(400);
	$(clientList).fadeIn(400);
}


//
// AutoClear plugin
// Clears an input box when it is entered and returns the original text if nothing is entered
//
(function($) {

	$.fn.autoClear = function() {
		
		// iterate each matched element
		return this.each(function() {
			obj = $(this);
			
			obj.focus(function() {
				if( this.value == this.defaultValue ) {
					this.value = "";
				}
			})
			.blur(function() {
				if( !this.value.length ) {
					this.value = this.defaultValue;
				}
			});
		});
	};
	
})(jQuery);


//
// listSplit plugin
// Splits a list into two columns
//
(function($) {

	$.fn.listSplit = function() {
		
		// iterate each matched element
		return this.each(function() {
			list = $(this);
			listItems = list.children('li:visible');
			var listItemCount = listItems.length;
			var col1Count = Math.ceil(listItemCount/2);
            
      var i = 0;
      listItems.each(function() {
          i++;
          
          if (i <= col1Count) {
              $(this).css({'float': 'left', 'clear': 'left', 'margin-left': '0', 'width': '45%'});
              if ($.browser.mozilla) { $(this).css('margin-right', '-50%'); }
          } else {
              $(this).css({'margin-left': '50%', 'float': 'none', 'clear': 'none', 'width': '45%'});
          }
      });
		});
	};
	
})(jQuery);


//
// dropDown plugin
// Set an element's onClick handler to show or hide another element, i.e. a dropdown menu
//
(function($) {

	$.fn.dropDown = function(options) {
	
		// build main options before element iteration
		var opts = $.extend({}, $.fn.dropDown.defaults, options);
		
		// iterate each matched element
		return this.each(function() {
			obj = $(this);
			var panel = $(opts.panel);
			
			obj.click(function () {
				// Show the panel using the appropriate transition
				switch (opts.transition)
				{
					case  'toggle':
						panel.toggle(200);
						break;
					case  'slide':
						panel.slideToggle(200);
						break;
					case  'fade':
						if ($(this).hasClass(opts.active_class)) {
							panel.fadeOut(200);
						} else {
							panel.fadeIn(200);
						}
						break;	
				}

				$(this).toggleClass(opts.active_class);
				return false;
			});

		});
	};

	// Default options
	$.fn.dropDown.defaults = {
		panel: '#menu',
		transition: 'toggle',  // toggle, slide, or fade
		active_class: 'active'
	};

})(jQuery);


// liveFilter narrows down a list based on specified criteria
// This is based on liveUpdate, originally by John Nunemaker and revised by John Resig
//
// $('listToFilter').liveFilter('criteriaForm', {listElement: 'li', transition: 'toggle|slide|fade', speed: 500});
// listToFilter (req.) - The container element of the items you want to filter, usually a <ul> or a <ol>
// criteriaForm (req.) - A form containing the options for filtering. <input />, <textarea>, or <select>. Each item should have an ID matching the class-name of an item in the list, but ending in '_filter'. For instance, if there is a subelement of the list items with class="name", you can filter it with <input type="text" id="name_filter".
// listElement (optional) - The direct child element of #listToFilter that represents an individual item. Defaults to 'li'.
// transition (optional) - The effect used for showing and hiding the items as they are filtered. Can be 'toggle', 'slide', or 'fade'. Defaults to 'toggle'.
// speed (optional) - The speed at which the effect happens. Set this to 0 for no transition. Defaults to 500

(function($) {
	$.fn.listFilter = function(form, options) {
	
		var opts = $.extend({}, $.fn.listFilter.defaults, options);
		list = $(this);
	    form = $(form);
	    
	    // Cache the list to filter
		if ( list.length ) {
			var rows = list.children(opts.listElement);	      
			form.submit(function() {
					return false;
				});
			$(':input', form).keyup(filter).change(filter);
			
			filter();	
		}
	    
		return this;
		
		function filter() {
	    	var scores = [], terms = [];
	    	
	    	// Get all the terms we are sorting by
	    	$("[id$='_filter']", form).each(function() {
	    		terms[$(this).attr('id').toLowerCase().replace('_filter','')] = $(this).val().toLowerCase();
	    	});
	    
			// Check each list element against the filter terms
			rows.each(function(i) {
				var score = true;
				for (term in terms) {
					score = score && ( $('.'+term, $(this)).text().toLowerCase().indexOf(terms[term]) >= 0 );
				}
				scores.push([score, i]);
			});

			// Show or hide each item as necessary
			$.each(scores, function() {
				switch (opts.transition)
				{
					case  'toggle':
						(this[0]) ? $(rows[ this[1] ]).show(opts.speed) : $(rows[ this[1] ]).hide(opts.speed);
						break;
					case  'slide':
						(this[0]) ? $(rows[ this[1] ]).slideDown(opts.speed) : $(rows[ this[1] ]).slideUp(opts.speed);
						break;
					case  'fade':
						(this[0]) ? $(rows[ this[1] ]).fadeIn(opts.speed) : $(rows[ this[1] ]).fadeOut(opts.speed);
						break;
				}
			});
			
			$('.listColumn').listSplit();
		}
	};
	
	// Default options
	$.fn.listFilter.defaults = {
		listElement: 'li',
		transition: 'toggle',  // auto, toggle, slide, or fade
		speed: 500
	};
	
})(jQuery);


/* jquery.swfobject http://jquery.thewikies.com/swfobject */
(function(A){A.flashPlayerVersion=function(){var D,B=null,I=false,H="ShockwaveFlash.ShockwaveFlash";if(!(D=navigator.plugins["Shockwave Flash"])){try{B=new ActiveXObject(H+".7")}catch(G){try{B=new ActiveXObject(H+".6");D=[6,0,21];B.AllowScriptAccess="always"}catch(F){if(D&&D[0]===6){I=true}}if(!I){try{B=new ActiveXObject(H)}catch(E){D="X 0,0,0"}}}if(!I&&B){try{D=B.GetVariable("$version")}catch(C){}}}else{D=D.description}D=D.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[D[1]*1,D[3]*1,D[5]*1]}();A.flashExpressInstaller="expressInstall.swf";A.hasFlashPlayer=(A.flashPlayerVersion[0]!==0);A.hasFlashPlayerVersion=function(C){var B=A.flashPlayerVersion;C=(/string|integer/.test(typeof C))?C.toString().split("."):C;return(C)?(B[0]>=(C.major||C[0]||B[0])&&B[1]>=(C.minor||C[1]||B[1])&&B[2]>=(C.release||C[2]||B[2])):(B[0]!==0)};A.flash=function(M){if(!A.hasFlashPlayer){return false}var C=M.swf||"",K=M.params||{},E=document.createElement("body"),B,L,H,D,J,I,G,F;M.height=M.height||180;M.width=M.width||320;if(M.hasVersion&&!A.hasFlashPlayerVersion(M.hasVersion)){A.extend(M,{id:"SWFObjectExprInst",height:Math.max(M.height,137),width:Math.max(M.width,214)});C=M.expressInstaller||A.flashExpressInstaller;K={flashvars:{MMredirectURL:window.location.href,MMplayerType:(A.browser.msie&&A.browser.win)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}if(M.flashvars&&typeof K==="object"){A.extend(K,{flashvars:M.flashvars})}for(J in (I=["swf","expressInstall","hasVersion","params","flashvars"])){delete M[I[J]]}B=[];for(J in M){if(typeof M[J]==="object"){L=[];for(I in M[J]){L.push(I.replace(/([A-Z])/,"-$1").toLowerCase()+":"+M[J][I]+";")}M[J]=L.join("")}B.push(J+'="'+M[J]+'"')}M=B.join(" ");if(typeof K==="object"){B=[];for(J in K){if(typeof K[J]==="object"){L=[];for(I in K[J]){if(typeof K[J][I]==="object"){H=[];for(G in K[J][I]){if(typeof K[J][I][G]==="object"){D=[];for(F in K[J][I][G]){D.push(F.replace(/([A-Z])/,"-$1").toLowerCase()+":"+K[J][I][G][F]+";")}K[J][I][G]=D.join("")}H.push(G+"{"+K[J][I][G]+"}")}K[J][I]=H.join("")}L.push(window.escape(I)+"="+window.escape(K[J][I]))}K[J]=L.join("&amp;")}B.push('<PARAM NAME="'+J+'" VALUE="'+K[J]+'">')}K=B.join("")}if(!(/style=/.test(M))){M+=' style="vertical-align:text-top;"'}if(!(/style=(.*?)vertical-align/.test(M))){M=M.replace(/style="/,'style="vertical-align:text-top;')}if(A.browser.msie){M+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';K='<PARAM NAME="movie" VALUE="'+C+'">'+K}else{M+=' type="application/x-shockwave-flash" data="'+C+'"'}E.innerHTML="<OBJECT "+M+">"+K+"</OBJECT>";return A(E.firstChild)};A.fn.flash=function(C){if(!A.hasFlashPlayer){return this}var B=0,D;while((D=this.eq(B++))[0]){D.html(A.flash(A.extend({},C)));if(D[0].firstChild.getAttribute("id")==="SWFObjectExprInst"){B=this.length}}return this}}(jQuery));


/*
 * Copyright (c) 2009 Simo Kinnunen.
 * Licensed under the MIT license.
 *
 * @version 1.09
 */
var Cufon=(function(){var m=function(){return m.replace.apply(null,arguments)};var x=m.DOM={ready:(function(){var C=false,E={loaded:1,complete:1};var B=[],D=function(){if(C){return}C=true;for(var F;F=B.shift();F()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",D,false);window.addEventListener("pageshow",D,false)}if(!window.opera&&document.readyState){(function(){E[document.readyState]?D():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");D()}catch(F){setTimeout(arguments.callee,1)}})()}q(window,"load",D);return function(F){if(!arguments.length){D()}else{C?F():B.push(F)}}})(),root:function(){return document.documentElement||document.body}};var n=m.CSS={Size:function(C,B){this.value=parseFloat(C);this.unit=String(C).match(/[a-z%]*$/)[0]||"px";this.convert=function(D){return D/B*this.value};this.convertFrom=function(D){return D/this.value*B};this.toString=function(){return this.value+this.unit}},addClass:function(C,B){var D=C.className;C.className=D+(D&&" ")+B;return C},color:j(function(C){var B={};B.color=C.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(E,D,F){B.opacity=parseFloat(F);return"rgb("+D+")"});return B}),fontStretch:j(function(B){if(typeof B=="number"){return B}if(/%$/.test(B)){return parseFloat(B)/100}return{"ultra-condensed":0.5,"extra-condensed":0.625,condensed:0.75,"semi-condensed":0.875,"semi-expanded":1.125,expanded:1.25,"extra-expanded":1.5,"ultra-expanded":2}[B]||1}),getStyle:function(C){var B=document.defaultView;if(B&&B.getComputedStyle){return new a(B.getComputedStyle(C,null))}if(C.currentStyle){return new a(C.currentStyle)}return new a(C.style)},gradient:j(function(F){var G={id:F,type:F.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},C=F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var E=0,B=C.length,D;E<B;++E){D=C[E].split("=",2).reverse();G.stops.push([D[1]||E/(B-1),D[0]])}return G}),quotedList:j(function(E){var D=[],C=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,B;while(B=C.exec(E)){D.push(B[3]||B[1])}return D}),recognizesMedia:j(function(G){var E=document.createElement("style"),D,C,B;E.type="text/css";E.media=G;try{E.appendChild(document.createTextNode("/**/"))}catch(F){}C=g("head")[0];C.insertBefore(E,C.firstChild);D=(E.sheet||E.styleSheet);B=D&&!D.disabled;C.removeChild(E);return B}),removeClass:function(D,C){var B=RegExp("(?:^|\\s+)"+C+"(?=\\s|$)","g");D.className=D.className.replace(B,"");return D},supports:function(D,C){var B=document.createElement("span").style;if(B[D]===undefined){return false}B[D]=C;return B[D]===C},textAlign:function(E,D,B,C){if(D.get("textAlign")=="right"){if(B>0){E=" "+E}}else{if(B<C-1){E+=" "}}return E},textShadow:j(function(F){if(F=="none"){return null}var E=[],G={},B,C=0;var D=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(B=D.exec(F)){if(B[0]==","){E.push(G);G={};C=0}else{if(B[1]){G.color=B[1]}else{G[["offX","offY","blur"][C++]]=B[2]}}}E.push(G);return E}),textTransform:(function(){var B={uppercase:function(C){return C.toUpperCase()},lowercase:function(C){return C.toLowerCase()},capitalize:function(C){return C.replace(/\b./g,function(D){return D.toUpperCase()})}};return function(E,D){var C=B[D.get("textTransform")];return C?C(E):E}})(),whiteSpace:(function(){var D={inline:1,"inline-block":1,"run-in":1};var C=/^\s+/,B=/\s+$/;return function(H,F,G,E){if(E){if(E.nodeName.toLowerCase()=="br"){H=H.replace(C,"")}}if(D[F.get("display")]){return H}if(!G.previousSibling){H=H.replace(C,"")}if(!G.nextSibling){H=H.replace(B,"")}return H}})()};n.ready=(function(){var B=!n.recognizesMedia("all"),E=false;var D=[],H=function(){B=true;for(var K;K=D.shift();K()){}};var I=g("link"),J=g("style");function C(K){return K.disabled||G(K.sheet,K.media||"screen")}function G(M,P){if(!n.recognizesMedia(P||"all")){return true}if(!M||M.disabled){return false}try{var Q=M.cssRules,O;if(Q){search:for(var L=0,K=Q.length;O=Q[L],L<K;++L){switch(O.type){case 2:break;case 3:if(!G(O.styleSheet,O.media.mediaText)){return false}break;default:break search}}}}catch(N){}return true}function F(){if(document.createStyleSheet){return true}var L,K;for(K=0;L=I[K];++K){if(L.rel.toLowerCase()=="stylesheet"&&!C(L)){return false}}for(K=0;L=J[K];++K){if(!C(L)){return false}}return true}x.ready(function(){if(!E){E=n.getStyle(document.body).isUsable()}if(B||(E&&F())){H()}else{setTimeout(arguments.callee,10)}});return function(K){if(B){K()}else{D.push(K)}}})();function s(D){var C=this.face=D.face,B={"\u0020":1,"\u00a0":1,"\u3000":1};this.glyphs=D.glyphs;this.w=D.w;this.baseSize=parseInt(C["units-per-em"],10);this.family=C["font-family"].toLowerCase();this.weight=C["font-weight"];this.style=C["font-style"]||"normal";this.viewBox=(function(){var F=C.bbox.split(/\s+/);var E={minX:parseInt(F[0],10),minY:parseInt(F[1],10),maxX:parseInt(F[2],10),maxY:parseInt(F[3],10)};E.width=E.maxX-E.minX;E.height=E.maxY-E.minY;E.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")};return E})();this.ascent=-parseInt(C.ascent,10);this.descent=-parseInt(C.descent,10);this.height=-this.ascent+this.descent;this.spacing=function(L,N,E){var O=this.glyphs,M,K,G,P=[],F=0,J=-1,I=-1,H;while(H=L[++J]){M=O[H]||this.missingGlyph;if(!M){continue}if(K){F-=G=K[H]||0;P[I]-=G}F+=P[++I]=~~(M.w||this.w)+N+(B[H]?E:0);K=M.k}P.total=F;return P}}function f(){var C={},B={oblique:"italic",italic:"oblique"};this.add=function(D){(C[D.style]||(C[D.style]={}))[D.weight]=D};this.get=function(H,I){var G=C[H]||C[B[H]]||C.normal||C.italic||C.oblique;if(!G){return null}I={normal:400,bold:700}[I]||parseInt(I,10);if(G[I]){return G[I]}var E={1:1,99:0}[I%100],K=[],F,D;if(E===undefined){E=I>400}if(I==500){I=400}for(var J in G){if(!k(G,J)){continue}J=parseInt(J,10);if(!F||J<F){F=J}if(!D||J>D){D=J}K.push(J)}if(I<F){I=F}if(I>D){I=D}K.sort(function(M,L){return(E?(M>=I&&L>=I)?M<L:M>L:(M<=I&&L<=I)?M>L:M<L)?-1:1});return G[K[0]]}}function r(){function D(F,G){if(F.contains){return F.contains(G)}return F.compareDocumentPosition(G)&16}function B(G){var F=G.relatedTarget;if(!F||D(this,F)){return}C(this,G.type=="mouseover")}function E(F){C(this,F.type=="mouseenter")}function C(F,G){setTimeout(function(){var H=d.get(F).options;m.replace(F,G?h(H,H.hover):H,true)},10)}this.attach=function(F){if(F.onmouseenter===undefined){q(F,"mouseover",B);q(F,"mouseout",B)}else{q(F,"mouseenter",E);q(F,"mouseleave",E)}}}function u(){var C=[],D={};function B(H){var E=[],G;for(var F=0;G=H[F];++F){E[F]=C[D[G]]}return E}this.add=function(F,E){D[F]=C.push(E)-1};this.repeat=function(){var E=arguments.length?B(arguments):C,F;for(var G=0;F=E[G++];){m.replace(F[0],F[1],true)}}}function A(){var D={},B=0;function C(E){return E.cufid||(E.cufid=++B)}this.get=function(E){var F=C(E);return D[F]||(D[F]={})}}function a(B){var D={},C={};this.extend=function(E){for(var F in E){if(k(E,F)){D[F]=E[F]}}return this};this.get=function(E){return D[E]!=undefined?D[E]:B[E]};this.getSize=function(F,E){return C[F]||(C[F]=new n.Size(this.get(F),E))};this.isUsable=function(){return !!B}}function q(C,B,D){if(C.addEventListener){C.addEventListener(B,D,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){return D.call(C,window.event)})}}}function v(C,B){var D=d.get(C);if(D.options){return C}if(B.hover&&B.hoverables[C.nodeName.toLowerCase()]){b.attach(C)}D.options=B;return C}function j(B){var C={};return function(D){if(!k(C,D)){C[D]=B.apply(null,arguments)}return C[D]}}function c(F,E){var B=n.quotedList(E.get("fontFamily").toLowerCase()),D;for(var C=0;D=B[C];++C){if(i[D]){return i[D].get(E.get("fontStyle"),E.get("fontWeight"))}}return null}function g(B){return document.getElementsByTagName(B)}function k(C,B){return C.hasOwnProperty(B)}function h(){var C={},B,F;for(var E=0,D=arguments.length;B=arguments[E],E<D;++E){for(F in B){if(k(B,F)){C[F]=B[F]}}}return C}function o(E,M,C,N,F,D){var K=document.createDocumentFragment(),H;if(M===""){return K}var L=N.separate;var I=M.split(p[L]),B=(L=="words");if(B&&t){if(/^\s/.test(M)){I.unshift("")}if(/\s$/.test(M)){I.push("")}}for(var J=0,G=I.length;J<G;++J){H=z[N.engine](E,B?n.textAlign(I[J],C,J,G):I[J],C,N,F,D,J<G-1);if(H){K.appendChild(H)}}return K}function l(D,M){var C=D.nodeName.toLowerCase();if(M.ignore[C]){return}var E=!M.textless[C];var B=n.getStyle(v(D,M)).extend(M);var F=c(D,B),G,K,I,H,L,J;if(!F){return}for(G=D.firstChild;G;G=I){K=G.nodeType;I=G.nextSibling;if(E&&K==3){if(H){H.appendData(G.data);D.removeChild(G)}else{H=G}if(I){continue}}if(H){D.replaceChild(o(F,n.whiteSpace(H.data,B,H,J),B,M,G,D),H);H=null}if(K==1){if(G.firstChild){if(G.nodeName.toLowerCase()=="cufon"){z[M.engine](F,null,B,M,G,D)}else{arguments.callee(G,M)}}J=G}}}var t=" ".split(/\s+/).length==0;var d=new A();var b=new r();var y=new u();var e=false;var z={},i={},w={autoDetect:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},ignore:{applet:1,canvas:1,col:1,colgroup:1,head:1,iframe:1,map:1,optgroup:1,option:1,script:1,select:1,style:1,textarea:1,title:1,pre:1},printable:true,selector:(window.Sizzle||(window.jQuery&&function(B){return jQuery(B)})||(window.dojo&&dojo.query)||(window.Ext&&Ext.query)||(window.YAHOO&&YAHOO.util&&YAHOO.util.Selector&&YAHOO.util.Selector.query)||(window.$$&&function(B){return $$(B)})||(window.$&&function(B){return $(B)})||(document.querySelectorAll&&function(B){return document.querySelectorAll(B)})||g),separate:"words",textless:{dl:1,html:1,ol:1,table:1,tbody:1,thead:1,tfoot:1,tr:1,ul:1},textShadow:"none"};var p={words:/\s/.test("\u00a0")?/[^\S\u00a0]+/:/\s+/,characters:"",none:/^/};m.now=function(){x.ready();return m};m.refresh=function(){y.repeat.apply(y,arguments);return m};m.registerEngine=function(C,B){if(!B){return m}z[C]=B;return m.set("engine",C)};m.registerFont=function(D){if(!D){return m}var B=new s(D),C=B.family;if(!i[C]){i[C]=new f()}i[C].add(B);return m.set("fontFamily",'"'+C+'"')};m.replace=function(D,C,B){C=h(w,C);if(!C.engine){return m}if(!e){n.addClass(x.root(),"cufon-active cufon-loading");n.ready(function(){n.addClass(n.removeClass(x.root(),"cufon-loading"),"cufon-ready")});e=true}if(C.hover){C.forceHitArea=true}if(C.autoDetect){delete C.fontFamily}if(typeof C.textShadow=="string"){C.textShadow=n.textShadow(C.textShadow)}if(typeof C.color=="string"&&/^-/.test(C.color)){C.textGradient=n.gradient(C.color)}else{delete C.textGradient}if(!B){y.add(D,arguments)}if(D.nodeType||typeof D=="string"){D=[D]}n.ready(function(){for(var F=0,E=D.length;F<E;++F){var G=D[F];if(typeof G=="string"){m.replace(C.selector(G),C,true)}else{l(G,C)}}});return m};m.set=function(B,C){w[B]=C;return m};return m})();Cufon.registerEngine("canvas",(function(){var b=document.createElement("canvas");if(!b||!b.getContext||!b.getContext.apply){return}b=null;var a=Cufon.CSS.supports("display","inline-block");var e=!a&&(document.compatMode=="BackCompat"||/frameset|transitional/i.test(document.doctype.publicId));var f=document.createElement("style");f.type="text/css";f.appendChild(document.createTextNode(("cufon{text-indent:0;}@media screen,projection{cufon{display:inline;display:inline-block;position:relative;vertical-align:middle;"+(e?"":"font-size:1px;line-height:1px;")+"}cufon cufontext{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}"+(a?"cufon canvas{position:relative;}":"cufon canvas{position:absolute;}")+"}@media print{cufon{padding:0;}cufon canvas{display:none;}}").replace(/;/g,"!important;")));document.getElementsByTagName("head")[0].appendChild(f);function d(p,h){var n=0,m=0;var g=[],o=/([mrvxe])([^a-z]*)/g,k;generate:for(var j=0;k=o.exec(p);++j){var l=k[2].split(",");switch(k[1]){case"v":g[j]={m:"bezierCurveTo",a:[n+~~l[0],m+~~l[1],n+~~l[2],m+~~l[3],n+=~~l[4],m+=~~l[5]]};break;case"r":g[j]={m:"lineTo",a:[n+=~~l[0],m+=~~l[1]]};break;case"m":g[j]={m:"moveTo",a:[n=~~l[0],m=~~l[1]]};break;case"x":g[j]={m:"closePath"};break;case"e":break generate}h[g[j].m].apply(h,g[j].a)}return g}function c(m,k){for(var j=0,h=m.length;j<h;++j){var g=m[j];k[g.m].apply(k,g.a)}}return function(V,w,P,t,C,W){var k=(w===null);if(k){w=C.getAttribute("alt")}var A=V.viewBox;var m=P.getSize("fontSize",V.baseSize);var B=0,O=0,N=0,u=0;var z=t.textShadow,L=[];if(z){for(var U=z.length;U--;){var F=z[U];var K=m.convertFrom(parseFloat(F.offX));var I=m.convertFrom(parseFloat(F.offY));L[U]=[K,I];if(I<B){B=I}if(K>O){O=K}if(I>N){N=I}if(K<u){u=K}}}var Z=Cufon.CSS.textTransform(w,P).split("");var E=V.spacing(Z,~~m.convertFrom(parseFloat(P.get("letterSpacing"))||0),~~m.convertFrom(parseFloat(P.get("wordSpacing"))||0));if(!E.length){return null}var h=E.total;O+=A.width-E[E.length-1];u+=A.minX;var s,n;if(k){s=C;n=C.firstChild}else{s=document.createElement("cufon");s.className="cufon cufon-canvas";s.setAttribute("alt",w);n=document.createElement("canvas");s.appendChild(n);if(t.printable){var S=document.createElement("cufontext");S.appendChild(document.createTextNode(w));s.appendChild(S)}}var aa=s.style;var H=n.style;var j=m.convert(A.height);var Y=Math.ceil(j);var M=Y/j;var G=M*Cufon.CSS.fontStretch(P.get("fontStretch"));var J=h*G;var Q=Math.ceil(m.convert(J+O-u));var o=Math.ceil(m.convert(A.height-B+N));n.width=Q;n.height=o;H.width=Q+"px";H.height=o+"px";B+=A.minY;H.top=Math.round(m.convert(B-V.ascent))+"px";H.left=Math.round(m.convert(u))+"px";var r=Math.max(Math.ceil(m.convert(J)),0)+"px";if(a){aa.width=r;aa.height=m.convert(V.height)+"px"}else{aa.paddingLeft=r;aa.paddingBottom=(m.convert(V.height)-1)+"px"}var X=n.getContext("2d"),D=j/A.height;X.scale(D,D*M);X.translate(-u,-B);X.save();function T(){var x=V.glyphs,ab,l=-1,g=-1,y;X.scale(G,1);while(y=Z[++l]){var ab=x[Z[l]]||V.missingGlyph;if(!ab){continue}if(ab.d){X.beginPath();if(ab.code){c(ab.code,X)}else{ab.code=d("m"+ab.d,X)}X.fill()}X.translate(E[++g],0)}X.restore()}if(z){for(var U=z.length;U--;){var F=z[U];X.save();X.fillStyle=F.color;X.translate.apply(X,L[U]);T()}}var q=t.textGradient;if(q){var v=q.stops,p=X.createLinearGradient(0,A.minY,0,A.maxY);for(var U=0,R=v.length;U<R;++U){p.addColorStop.apply(p,v[U])}X.fillStyle=p}else{X.fillStyle=P.get("color")}T();return s}})());Cufon.registerEngine("vml",(function(){var e=document.namespaces;if(!e){return}e.add("cvml","urn:schemas-microsoft-com:vml");e=null;var b=document.createElement("cvml:shape");b.style.behavior="url(#default#VML)";if(!b.coordsize){return}b=null;var h=(document.documentMode||0)<8;document.write(('<style type="text/css">cufoncanvas{text-indent:0;}@media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}cufoncanvas{position:absolute;text-align:left;}cufon{display:inline-block;position:relative;vertical-align:'+(h?"middle":"text-bottom")+";}cufon cufontext{position:absolute;left:-10000in;font-size:1px;}a cufon{cursor:pointer}}@media print{cufon cufoncanvas{display:none;}}</style>").replace(/;/g,"!important;"));function c(i,j){return a(i,/(?:em|ex|%)$|^[a-z-]+$/i.test(j)?"1em":j)}function a(l,m){if(m==="0"){return 0}if(/px$/i.test(m)){return parseFloat(m)}var k=l.style.left,j=l.runtimeStyle.left;l.runtimeStyle.left=l.currentStyle.left;l.style.left=m.replace("%","em");var i=l.style.pixelLeft;l.style.left=k;l.runtimeStyle.left=j;return i}function f(l,k,j,n){var i="computed"+n,m=k[i];if(isNaN(m)){m=k.get(n);k[i]=m=(m=="normal")?0:~~j.convertFrom(a(l,m))}return m}var g={};function d(p){var q=p.id;if(!g[q]){var n=p.stops,o=document.createElement("cvml:fill"),i=[];o.type="gradient";o.angle=180;o.focus="0";o.method="sigma";o.color=n[0][1];for(var m=1,l=n.length-1;m<l;++m){i.push(n[m][0]*100+"% "+n[m][1])}o.colors=i.join(",");o.color2=n[l][1];g[q]=o}return g[q]}return function(ac,G,Y,C,K,ad,W){var n=(G===null);if(n){G=K.alt}var I=ac.viewBox;var p=Y.computedFontSize||(Y.computedFontSize=new Cufon.CSS.Size(c(ad,Y.get("fontSize"))+"px",ac.baseSize));var y,q;if(n){y=K;q=K.firstChild}else{y=document.createElement("cufon");y.className="cufon cufon-vml";y.alt=G;q=document.createElement("cufoncanvas");y.appendChild(q);if(C.printable){var Z=document.createElement("cufontext");Z.appendChild(document.createTextNode(G));y.appendChild(Z)}if(!W){y.appendChild(document.createElement("cvml:shape"))}}var ai=y.style;var R=q.style;var l=p.convert(I.height),af=Math.ceil(l);var V=af/l;var P=V*Cufon.CSS.fontStretch(Y.get("fontStretch"));var U=I.minX,T=I.minY;R.height=af;R.top=Math.round(p.convert(T-ac.ascent));R.left=Math.round(p.convert(U));ai.height=p.convert(ac.height)+"px";var F=Y.get("color");var ag=Cufon.CSS.textTransform(G,Y).split("");var L=ac.spacing(ag,f(ad,Y,p,"letterSpacing"),f(ad,Y,p,"wordSpacing"));if(!L.length){return null}var k=L.total;var x=-U+k+(I.width-L[L.length-1]);var ah=p.convert(x*P),X=Math.round(ah);var O=x+","+I.height,m;var J="r"+O+"ns";var u=C.textGradient&&d(C.textGradient);var o=ac.glyphs,S=0;var H=C.textShadow;var ab=-1,aa=0,w;while(w=ag[++ab]){var D=o[ag[ab]]||ac.missingGlyph,v;if(!D){continue}if(n){v=q.childNodes[aa];while(v.firstChild){v.removeChild(v.firstChild)}}else{v=document.createElement("cvml:shape");q.appendChild(v)}v.stroked="f";v.coordsize=O;v.coordorigin=m=(U-S)+","+T;v.path=(D.d?"m"+D.d+"xe":"")+"m"+m+J;v.fillcolor=F;if(u){v.appendChild(u.cloneNode(false))}var ae=v.style;ae.width=X;ae.height=af;if(H){var s=H[0],r=H[1];var B=Cufon.CSS.color(s.color),z;var N=document.createElement("cvml:shadow");N.on="t";N.color=B.color;N.offset=s.offX+","+s.offY;if(r){z=Cufon.CSS.color(r.color);N.type="double";N.color2=z.color;N.offset2=r.offX+","+r.offY}N.opacity=B.opacity||(z&&z.opacity)||1;v.appendChild(N)}S+=L[aa++]}var M=v.nextSibling,t,A;if(C.forceHitArea){if(!M){M=document.createElement("cvml:rect");M.stroked="f";M.className="cufon-vml-cover";t=document.createElement("cvml:fill");t.opacity=0;M.appendChild(t);q.appendChild(M)}A=M.style;A.width=X;A.height=af}else{if(M){q.removeChild(M)}}ai.width=Math.max(Math.ceil(p.convert(k*P)),0);if(h){var Q=Y.computedYAdjust;if(Q===undefined){var E=Y.get("lineHeight");if(E=="normal"){E="1em"}else{if(!isNaN(E)){E+="em"}}Y.computedYAdjust=Q=0.5*(a(ad,E)-parseFloat(ai.height))}if(Q){ai.marginTop=Math.ceil(Q)+"px";ai.marginBottom=Q+"px"}}return y}})());


// Modified version of jQuery UI
jQuery.ui||function(a){function f(b,e,h,k){function m(g){g=a[b][e][g]||[];return typeof g=="string"?g.split(/,?\s+/):g}var j=m("getter");if(k.length==1&&typeof k[0]=="string")j=j.concat(m("getterSetter"));return a.inArray(h,j)!=-1}var i=a.fn.remove,d=a.browser.mozilla&&parseFloat(a.browser.version)<1.9;a.ui={version:"1.7.1",plugin:{add:function(b,e,h){b=a.ui[b].prototype;for(var k in h){b.plugins[k]=b.plugins[k]||[];b.plugins[k].push([e,h[k]])}},call:function(b,e,h){if((e=b.plugins[e])&&b.element[0].parentNode)for(var k=
0;k<e.length;k++)b.options[e[k][0]]&&e[k][1].apply(b.element,h)}},contains:function(b,e){return document.compareDocumentPosition?b.compareDocumentPosition(e)&16:b!==e&&b.contains(e)},hasScroll:function(b,e){if(a(b).css("overflow")=="hidden")return false;e=e&&e=="left"?"scrollLeft":"scrollTop";var h=false;if(b[e]>0)return true;b[e]=1;h=b[e]>0;b[e]=0;return h},isOverAxis:function(b,e,h){return b>e&&b<e+h},isOver:function(b,e,h,k,m,j){return a.ui.isOverAxis(b,h,m)&&a.ui.isOverAxis(e,k,j)},keyCode:{BACKSPACE:8,
CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var c=a.attr,n=a.fn.removeAttr,o=/^aria-/,p=/^wairole:/;a.attr=function(b,e,h){var k=h!==undefined;return e=="role"?k?c.call(this,b,e,"wairole:"+h):(c.apply(this,arguments)||"").replace(p,""):o.test(e)?k?b.setAttributeNS("http://www.w3.org/2005/07/aaa",
e.replace(o,"aaa:"),h):c.call(this,b,e.replace(o,"aaa:")):c.apply(this,arguments)};a.fn.removeAttr=function(b){return o.test(b)?this.each(function(){this.removeAttributeNS("http://www.w3.org/2005/07/aaa",b.replace(o,""))}):n.call(this,b)}}a.fn.extend({remove:function(){a("*",this).add(this).each(function(){a(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable",
"on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var b;b=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,
"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b}});a.extend(a.expr[":"],{data:function(b,e,h){return!!a.data(b,h[3])},focusable:function(b){var e=b.nodeName.toLowerCase(),h=a.attr(b,"tabindex");return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e||"area"==e?b.href||!isNaN(h):!isNaN(h))&&!a(b)["area"==e?"parents":"closest"](":hidden").length},tabbable:function(b){var e=a.attr(b,"tabindex");
return(isNaN(e)||e>=0)&&a(b).is(":focusable")}});a.widget=function(b,e){var h=b.split(".")[0];b=b.split(".")[1];a.fn[b]=function(k){var m=typeof k=="string",j=Array.prototype.slice.call(arguments,1);if(m&&k.substring(0,1)=="_")return this;if(m&&f(h,b,k,j)){var g=a.data(this[0],b);return g?g[k].apply(g,j):undefined}return this.each(function(){var l=a.data(this,b);!l&&!m&&a.data(this,b,new a[h][b](this,k))._init();l&&m&&a.isFunction(l[k])&&l[k].apply(l,j)})};a[h]=a[h]||{};a[h][b]=function(k,m){var j=
this;this.namespace=h;this.widgetName=b;this.widgetEventPrefix=a[h][b].eventPrefix||b;this.widgetBaseClass=h+"-"+b;this.options=a.extend({},a.widget.defaults,a[h][b].defaults,a.metadata&&a.metadata.get(k)[b],m);this.element=a(k).bind("setData."+b,function(g,l,q){if(g.target==k)return j._setData(l,q)}).bind("getData."+b,function(g,l){if(g.target==k)return j._getData(l)}).bind("remove",function(){return j.destroy()})};a[h][b].prototype=a.extend({},a.widget.prototype,e);a[h][b].getterSetter="option"};
a.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(b,e){var h=b,k=this;if(typeof b=="string"){if(e===undefined)return this._getData(b);h={};h[b]=e}a.each(h,function(m,j){k._setData(m,j)})},_getData:function(b){return this.options[b]},_setData:function(b,e){this.options[b]=e;if(b=="disabled")this.element[e?"addClass":"removeClass"](this.widgetBaseClass+
"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",e)},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(b,e,h){var k=this.options[b];b=b==this.widgetEventPrefix?b:this.widgetEventPrefix+b;e=a.Event(e);e.type=b;if(e.originalEvent){b=a.event.props.length;for(var m;b;){m=a.event.props[--b];e[m]=e.originalEvent[m]}}this.element.trigger(e,h);return!(a.isFunction(k)&&k.call(this.element[0],e,h)===false||e.isDefaultPrevented())}};
a.widget.defaults={disabled:false};a.ui.mouse={_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(e){return b._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(b._preventClickEvent){b._preventClickEvent=false;e.stopImmediatePropagation();return false}});if(a.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
a.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable)},_mouseDown:function(b){b.originalEvent=b.originalEvent||{};if(!b.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(b);this._mouseDownEvent=b;var e=this,h=b.which==1,k=typeof this.options.cancel=="string"?a(b.target).parents().add(b.target).filter(this.options.cancel).length:false;if(!h||k||!this._mouseCapture(b))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=
true},this.options.delay);if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==false;if(!this._mouseStarted){b.preventDefault();return true}}this._mouseMoveDelegate=function(m){return e._mouseMove(m)};this._mouseUpDelegate=function(m){return e._mouseUp(m)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.browser.safari||b.preventDefault();return b.originalEvent.mouseHandled=true}},
_mouseMove:function(b){if(a.browser.msie&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==false)?this._mouseDrag(b):this._mouseUp(b);return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;this._preventClickEvent=b.target==this._mouseDownEvent.target;this._mouseStop(b)}return false},_mouseDistanceMet:function(b){return Math.max(Math.abs(this._mouseDownEvent.pageX-b.pageX),Math.abs(this._mouseDownEvent.pageY-b.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}};a.ui.mouse.defaults={cancel:null,distance:1,delay:0}}(jQuery);
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined)this.options.collapsible=this.options.deselectable;this._tabify(true)},_setData:function(f,i){if(f=="selected")this.options.collapsible&&i==this.options.selected||this.select(i);else{this.options[f]=i;if(f=="deselectable")this.options.collapsible=i;this._tabify()}},_tabId:function(f){return f.title&&f.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(f)},_sanitizeSelector:function(f){return f.replace(/:/g,
"\\:")},_cookie:function(){var f=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[f].concat(a.makeArray(arguments)))},_ui:function(f,i){return{tab:f,panel:i,index:this.anchors.index(f)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var f=a(this);f.html(f.data("label.tabs")).removeData("label.tabs")})},_tabify:function(f){function i(j,g){j.css({display:""});
a.browser.msie&&g.opacity&&j[0].style.removeAttribute("filter")}this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var d=this,c=this.options,n=/^#.+/;this.anchors.each(function(j,g){var l=a(g).attr("href"),q=l.split("#")[0],r;if(q&&(q===location.toString().split("#")[0]||(r=a("base")[0])&&q===r.href)){l=g.hash;g.href=l}if(n.test(l))d.panels=d.panels.add(d._sanitizeSelector(l));else if(l!=
"#"){a.data(g,"href.tabs",l);a.data(g,"load.tabs",l.replace(/#.*$/,""));l=d._tabId(g);g.href="#"+l;g=a("#"+l);if(!g.length){g=a(c.panelTemplate).attr("id",l).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[j-1]||d.list);g.data("destroy.tabs",true)}d.panels=d.panels.add(g)}else c.disabled.push(j)});if(f){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");
this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===undefined){location.hash&&this.anchors.each(function(j,g){if(g.hash==location.hash){c.selected=j;return false}});if(typeof c.selected!="number"&&c.cookie)c.selected=parseInt(d._cookie(),10);if(typeof c.selected!="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||0}else if(c.selected===
null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=a.unique(c.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(j){return d.lis.index(j)}))).sort();a.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(a.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(c.selected>=0&&this.anchors.length){this.panels.eq(c.selected).removeClass("ui-tabs-hide");
this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[c.selected],d.panels[c.selected]))});this.load(c.selected)}c.preload&&a.each(this.panels,function(j){d.load(j)});a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs");d.lis=d.anchors=d.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");
c.cookie&&this._cookie(c.selected,c.cookie);f=0;for(var o;o=this.lis[f];f++)a(o)[a.inArray(f,c.disabled)!=-1&&!a(o).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!="mouseover"){var p=function(j,g){g.is(":not(.ui-state-disabled)")&&g.addClass("ui-state-"+j)},b=function(j,g){g.removeClass("ui-state-"+j)};this.lis.bind("mouseover.tabs",function(){p("hover",a(this))});
this.lis.bind("mouseout.tabs",function(){b("hover",a(this))});this.anchors.bind("focus.tabs",function(){p("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){b("focus",a(this).closest("li"))})}var e,h;if(c.fx)if(a.isArray(c.fx)){e=c.fx[0];h=c.fx[1]}else e=h=c.fx;var k=h?function(j,g){a(j).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");g.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){i(g,h);d._trigger("show",
null,d._ui(j,g[0]))})}:function(j,g){a(j).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");g.removeClass("ui-tabs-hide");d._trigger("show",null,d._ui(j,g[0]))},m=e?function(j,g){g.animate(e,e.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");g.addClass("ui-tabs-hide");i(g,e);d.element.dequeue("tabs")})}:function(j,g){d.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");
g.addClass("ui-tabs-hide");d.element.dequeue("tabs")};this.anchors.bind(c.event+".tabs",function(){var j=this,g=a(this).closest("li"),l=d.panels.filter(":not(.ui-tabs-hide)"),q=a(d._sanitizeSelector(this.hash));if(g.hasClass("ui-tabs-selected")&&!c.collapsible||g.hasClass("ui-state-disabled")||g.hasClass("ui-state-processing")||d._trigger("select",null,d._ui(this,q[0]))===false){this.blur();return false}c.selected=d.anchors.index(this);d.abort();if(c.collapsible)if(g.hasClass("ui-tabs-selected")){c.selected=
-1;c.cookie&&d._cookie(c.selected,c.cookie);d.element.queue("tabs",function(){m(j,l)}).dequeue("tabs");this.blur();return false}else if(!l.length){c.cookie&&d._cookie(c.selected,c.cookie);d.element.queue("tabs",function(){k(j,q)});d.load(d.anchors.index(this));this.blur();return false}c.cookie&&d._cookie(c.selected,c.cookie);if(q.length){l.length&&d.element.queue("tabs",function(){m(j,l)});d.element.queue("tabs",function(){k(j,q)});d.load(d.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
a.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var f=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var i=a.data(this,"href.tabs");if(i)this.href=i;var d=a(this).unbind(".tabs");a.each(["href","load",
"cache"],function(c,n){d.removeData(n+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});f.cookie&&this._cookie(null,f.cookie)},add:function(f,i,d){if(d===undefined)d=this.anchors.length;var c=this,n=this.options;i=a(n.tabTemplate.replace(/#\{href\}/g,
f).replace(/#\{label\}/g,i));f=!f.indexOf("#")?f.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var o=a("#"+f);o.length||(o=a(n.panelTemplate).attr("id",f).data("destroy.tabs",true));o.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(d>=this.lis.length){i.appendTo(this.list);o.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[d]);o.insertBefore(this.panels[d])}n.disabled=a.map(n.disabled,function(p){return p>=
d?++p:p});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[d],this.panels[d]))},remove:function(f){var i=this.options,d=this.lis.eq(f).remove(),c=this.panels.eq(f).remove();if(d.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(f+(f+1<this.anchors.length?1:-1));
i.disabled=a.map(a.grep(i.disabled,function(n){return n!=f}),function(n){return n>=f?--n:n});this._tabify();this._trigger("remove",null,this._ui(d.find("a")[0],c[0]))},enable:function(f){var i=this.options;if(a.inArray(f,i.disabled)!=-1){this.lis.eq(f).removeClass("ui-state-disabled");i.disabled=a.grep(i.disabled,function(d){return d!=f});this._trigger("enable",null,this._ui(this.anchors[f],this.panels[f]))}},disable:function(f){var i=this.options;if(f!=i.selected){this.lis.eq(f).addClass("ui-state-disabled");
i.disabled.push(f);i.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[f],this.panels[f]))}},select:function(f){if(typeof f=="string")f=this.anchors.index(this.anchors.filter("[href$="+f+"]"));else if(f===null)f=-1;if(f==-1&&this.options.collapsible)f=this.options.selected;this.anchors.eq(f).trigger(this.options.event+".tabs")},load:function(f){var i=this,d=this.options,c=this.anchors.eq(f)[0],n=a.data(c,"load.tabs");this.abort();if(!n||this.element.queue("tabs").length!==0&&a.data(c,
"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(f).addClass("ui-state-processing");if(d.spinner){var o=a("span",c);o.data("label.tabs",o.html()).html(d.spinner)}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:n,success:function(p,b){a(i._sanitizeSelector(c.hash)).html(p);i._cleanup();d.cache&&a.data(c,"cache.tabs",true);i._trigger("load",null,i._ui(i.anchors[f],i.panels[f]));try{d.ajaxOptions.success(p,b)}catch(e){}i.element.dequeue("tabs")}}))}},abort:function(){this.element.queue([]);
this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(f,i){this.anchors.eq(f).removeData("cache.tabs").data("load.tabs",i)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,preload:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});
a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(f,i){var d=this,c=this.options,n=d._rotate||(d._rotate=function(o){clearTimeout(d.rotation);d.rotation=setTimeout(function(){var p=c.selected;d.select(++p<d.anchors.length?p:0)},f);o&&o.stopPropagation()});i=d._unrotate||(d._unrotate=!i?function(o){o.clientX&&d.rotate(null)}:function(){t=c.selected;n()});if(f){this.element.bind("tabsshow",n);this.anchors.bind(c.event+".tabs",i);n()}else{clearTimeout(d.rotation);this.element.unbind("tabsshow",
n);this.anchors.unbind(c.event+".tabs",i);delete this._rotate;delete this._unrotate}}})})(jQuery);