/**
extend object from fisheye
**/

var verticalFishEyeToolBar = Class.create( FishEyeItem, {
 setOriginalProperties : function(){
		this.originalHeight = Math.ceil( parseInt( this.ele.getStyle( "height" )) / 2 );
		this.originalWidth = Math.ceil( parseInt( this.ele.getStyle( "width" ).replace( /[^0-9]/gi, "") ) / 2 ); 
		this.originalMarginBottom = parseInt(this.ele.getStyle("margin-bottom").replace(/[^0-9]/gi, "") );
		this.originalMarginTop = parseInt( this.ele.getStyle( "margin-top" ).replace(/[^0-9]/gi, "" ) );
		this.scaleElement( 1 );
	},
	handleFishEye : function( p ){
		var offset = this.getCenterAxis();
		position_Y = document.getElementById( 'side_content' ).scrollTop;
 		var distance = Math.abs( p.y - offset + position_Y );
		if( distance > this.options.scaleThrottle ){
			this.resetElement();
			return true;
		}
		var scale = Math.abs( this.options.scaleThrottle - distance ) / ( this.options.scaleThrottle ) + 1;
		this.lastScale = scale ;
		this.scaleElement( scale );
		//console.log(scale,this.escaleElement);
	},
 	scaleElement : function( scale ){
		this.ele.setStyle( { //zIndex : scale * 100,
		//marginTop : this.originalMarginTop - ((scale * this.originalHeight) - this.originalHeight) + "px",
		//marginBottom : this.originalMarginBottom - ((scale * this.originalHeight) - this.originalHeight) + "px",
		height : ( scale * this.originalHeight ) + "px",
		width : ( scale * this.originalWidth ) + "px" } );
	},
	resetElement : function(){
		this.ele.setStyle( { zIndex : 1,
		marginBottom :  this.originalMarginBottom + "px",
		//marginTop: this.originalMarginTop + "px",
		height : this.originalHeight  + "px",
		width : this.originalWidth + "px" } );
	},
	getCenterAxis : function(){
		return Math.floor( Position.cumulativeOffset( this.ele ).last() +
											( ( ( this.originalHeight/2 ) ) * this.lastScale ));
	}		
});
