/******************************************

gklinsing - Not setup for non rounded box elements

*******************************************/
AVE.summaryToggle = ({
	// ieHide & ieShow control the rounded corners in IE - Bug with position: relative
	ieHide: function( exp, con ) {
		if (Prototype.Browser.IE) {
			$(exp).down('.ave-dynamic-rounding').setStyle({ position: 'static' }),
			$(exp).down('.ave-rounded-top').hide(),
			$(exp).down('.ave-rounded-bottom').hide(),
			$(con).down('.ave-dynamic-rounding').setStyle({ position: 'static' }),
			$(con).down('.ave-rounded-top').hide(),
			$(con).down('.ave-rounded-bottom').hide()
		}
	},
	
	ieShow: function( exp, con ) {
		if (Prototype.Browser.IE ) {
			$(exp).down('.ave-dynamic-rounding').setStyle({ position: 'relative' }),
			$(exp).down('.ave-rounded-top').show(),
			$(exp).down('.ave-rounded-bottom').show(),
			$(con).down('.ave-dynamic-rounding').setStyle({ position: 'relative' }),
			$(con).down('.ave-rounded-top').show(),
			$(con).down('.ave-rounded-bottom').show()
		}
	},
	
	expand: function( exp, con ) {
		this.ieHide( exp, con );
		new Effect.Parallel([
			new Effect.BlindUp( exp, { sync: true }),
			new Effect.Opacity( exp, { sync: true, from: 1, to: 0 })
		], {
			duration: .5,
			afterFinish: function() {
				new Effect.Parallel([
					new Effect.BlindDown( con, { sync: true }),
					new Effect.Opacity( con, { sync: true, from: 0, to: 1})
				], {
					duration: 1.0,
					afterFinish: function() {
						this.ieShow( exp, con );
					}.bind(this)
				});
			}.bind(this)
		});
	},
	
	contract: function( exp, con ) {
		this.ieHide( exp, con );
		new Effect.Parallel([
			new Effect.BlindUp( exp, { sync: true }),
			new Effect.Opacity( exp, { sync: true, from: 1, to: 0 })
		], {
			duration: 1.0,
			afterFinish: function() {
				new Effect.Parallel([
					new Effect.BlindDown( con, { sync: true }),
					new Effect.Opacity( con, { sync: true, from: 0, to: 1})
				], {
					duration: .75,
					afterFinish: function(){
						AVE.summaryToggle.ieShow( exp, con );
					}
				});
			}
		});
	},
	footerExpand: function( exp ) {
		new Effect.Parallel([
			new Effect.Move(exp, { sync: true, y: -200 }),
			//new Effect.BlindDown( exp, { sync: true, scaleFrom: 100, scaleTo: 700 })
		], {
			duration: .5
		});
	},
	footerContract: function( exp, con ) {
		new Effect.Parallel([
			new Effect.BlindUp( exp, { sync: true }),
			new Effect.Opacity( exp, { sync: true, from: 1, to: 0 })
		], {
			duration: 1.0,
			afterFinish: function() {
				new Effect.Parallel([
					new Effect.BlindDown( con, { sync: true }),
					new Effect.Opacity( con, { sync: true, from: 0, to: 1})
				], {
					duration: .75,
					afterFinish: function(){
						AVE.summaryToggle.ieShow( exp, con );
					}
				});
			}
		});
	}
});
