/* Grower Class */

		function Grower(target_id,amount) {
			
			/* establish core object variables */
			
			this.id = target_id.toString();
			this.height = parseInt(jQuery("#" + this.id + " > img").css("height"));
			this.width = parseInt(jQuery("#" + this.id + " > img").css("width"));
			this.amount = Math.abs(amount);
			this.cg_dir = 2;
			this.cg_height = this.height;
			this.cg_width = this.width;

				
			this.displayAttributes = function () {
				alert ("id: " + this.id + "; height: " + this.height + "; width: " + this.width + ";");
			}
			
			this.preSize = function () {
				jQuery("#" + this.id + " > img").css("height",(this.height - this.amount) + "px");
				jQuery("#" + this.id + " > img").css("width",(this.width - this.amount) + "px");
			}
			
			if (amount <= 0) {
				/* Negative amount value pre-shrinks img and grows to original size. */
				this.preSize();
			}
			else {
				/* Positive amount value starts img at original size and grows bigger. */
			}
			
			this.grow = function (grow_time,shrink_time,direction) {
			
				/* Starts below original img size and grows to 100%. 
				Works on an id'ed div with img as child. */
			
				var growth_amount = this.amount;
				var growth_offset = growth_amount * (0.6);
				var growth_duration = grow_time;
				var shrink_duration = shrink_time;
				
				/* actions */
				
				if (direction == 1) {
					jQuery("#" + this.id).animate({left:"-=" + growth_offset + "px",top:"-=" + growth_offset + "px"},growth_duration);
					jQuery("#" + this.id + " > img").animate({height:"+=" + growth_amount + "px",width:"+=" + growth_amount + "px"},growth_duration);
				}
			
				else {
					jQuery("#" + this.id).animate({left:"+=" + growth_offset + "px",top:"+=" + growth_offset + "px"},shrink_duration);
					jQuery("#" + this.id + " > img").animate({height:"-=" + growth_amount + "px",width:"-=" + growth_amount + "px"},shrink_duration);	
				}		
			}
			
			this.controlledGrow = function (grow_time,shrink_time,ratio,direction,offset) {
			
			
				var growth_amount = this.amount;
				var height_amount = growth_amount * ratio;
				if (offset == 1) {
					var growth_offset = growth_amount * (0.6 * ratio);
				}
				else {
					offset = 0;
				}
				var growth_duration = grow_time;
				var shrink_duration = shrink_time;
				
				/* actions */
				
				if (direction == 1) {
					jQuery("#" + this.id).animate({left:"-=" + growth_offset + "px",top:"-=" + growth_offset + "px"},growth_duration);
					jQuery("#" + this.id + " > img").animate({height:"+=" + height_amount + "px",width:"+=" + growth_amount + "px"},growth_duration);
					this.height = this.height + height_amount;
					this.width = this.width + growth_amount;
					this.cg_dir = 1;
				}
			
				else {
					jQuery("#" + this.id).animate({left:"+=" + growth_offset + "px",top:"+=" + growth_offset + "px"},shrink_duration);
					jQuery("#" + this.id + " > img").animate({height:"-=" + height_amount + "px",width:"-=" + growth_amount + "px"},shrink_duration);	
					this.cg_height = this.height - height_amount;
					this.cg_width = this.width - growth_amount;
					this.cg_dir = 0;
				}		
			}
			
			this.revControlledGrow = function(duration) {
				if(this.cg_dir == 0) {
					
					jQuery("#" + this.id + " > img").animate({height:"+=" + (this.height - this.cg_height - 30) + "px",width:"+=" + (this.width - this.cg_width - 30) + "px"},duration);
				}
				else if(this.cg_dir == 1) {
					
					jQuery("#" + this.id + " > img").animate({height:"-=" + (this.cg_height - this.height - 30) + "px",width:"-=" + (this.cg_width - this.width - 30) + "px"},duration);
				}
				else {
				
				}
			}
			
		}
		
		
				
		
