/**
 * Creator: khastie
 * Date: Jan 19, 2009
 * Time: 9:31:27 AM
 * Contents are property of Cappex.com LLC, and strictly confidential.
 */
 
/** 
 * CLASS: TileAnimator
 * DESCR: 
 * USAGE: 
 * EXMPL: 
 */
var TileAnimator = new Class({

	showGhost : function(collegeCenter, collegeID) {

		$('ghost').setStyles({
			top : collegeCenter.confirmationWinPos.y,
			left: collegeCenter.confirmationWinPos.x
		});

		$('ghostContent').setStyles({
			width : collegeCenter.confirmationWinPos.width,
			height : collegeCenter.confirmationWinPos.height
//			,
//			'background-color' : '#fff'
		});

		$('ghost').removeClass('jsHide');

//		$('ghost').offsetLeft = collegeCenter.confirmationWinPos.x;
//		$('ghost').offsetTop = collegeCenter.confirmationWinPos.y;

/*
		$('ghost').setPosition({
			left : collegeCenter.confirmationWinPos.x,
			top : collegeCenter.confirmationWinPos.y,
//			relativeTo : $('suggestion')
//			position : 'upperLeft',
			edge : 'upperLeft',
//			offset : {x:85, y:41},
			smoothMove : true

		});
*/
	},

	expandMyCollegesGap : function (newMyCollegesElem) {

//		var shrinkContainerEffect = $('ghost').effects({
//			duration: 600,
//			transition: Fx.Transitions.Circ.easeOut
//		});
//		shrinkContainerEffect.start({
//			top : newPosition.y,
//			left : newPosition.x
//		});
	},

	addToMyColleges : function (newTile, newMyCollegesElem, confirmationWin) {

		var newPosition = newMyCollegesElem.getPagePosition();

		// shrink container
		this.shrinkContainer(newPosition);

		// shrink background content
		this.shrinkBackgroundContent(newPosition);

		// hide/remove contents of stickyWin (but not modal shim)
		$$('.suggestionConfirmation').each(function(confirmationElem) {
			if (confirmationElem.id.split('_')[2] == newTile.collegeID) {
				confirmationElem.remove();
			}
		})

		// hide the stickyWin
		confirmationWin.hide.delay(600, confirmationWin);

		// show new My Colleges Elem
		(function () { newMyCollegesElem.removeClass('jsInvisible');}).delay(600);

		// hide ghost
		$('ghost').addClass.delay(600, $('ghost'), 'jsHide');

		// pulse the new element
		this.pulseElem.delay(600, this.pulseElem, [newMyCollegesElem]);

	},

	shrinkContainer : function (newPosition) {

		var shrinkContainerEffect = $('ghost').effects({
			duration: 600,
			transition: Fx.Transitions.Circ.easeOut
		});
		shrinkContainerEffect.start({
			top : newPosition.y,
			left : newPosition.x
		});

	},

	shrinkBackgroundContent : function (newPosition) {

		var shrinkContentEffect = $('ghostContent').effects({
			duration: 600,
			transition: Fx.Transitions.Circ.easeIn
		});
		shrinkContentEffect.start({
			width : newPosition.width,
			height : newPosition.height,
//					opacity : [1, 0.1]
			opacity : [0.5, 1]
//					,
//					'background-color' :  ['#fff', '#fd0']
		});

	},

	pulseElem : function (elemToPulse) {

		new Animator().pulseElem(elemToPulse);
	}
//	,
//
//	createGhost : function(top, left, width, height) {
//
////		var myEffects = new Fx.Styles('ghost', {duration: 1000, transition: Fx.Transitions.linear});
////
////		myEffects.start({
////			'top': [top],
////			'left': [left],
////			'width': [width],
////			'height': [height]
////		});
//
////			$('ghost').setStyle({
////				top : top,
////				left : left,
////				width : width,
////				height : height,
////				'background-color' : '#f00',
////				'border' : '2px solid #0f0'
////			});
//
////		var ghost = new Element('div', {
////			top : top,
////			left : left,
////			width : width,
////			height : height,
////			'background-color' : '#f00',
////			'border' : '2px solid #0f0'
////		});
////
////		ghost.injectTop('collegeList');
//
//	}
});