//
// (c) 2007 webActive
//

var Interface = new Class(
{
	initInterface: function()
	{
		this.dragData = null;
   		//this.windowsController = new WindowsController();
		//this.windowsController.onStartDrag = delegate(this, this.startDrag);
		//this.windowsController.onStopDrag = delegate(this, this.stopDrag);
		
		addEvent(window, 'resize', delegate(this, this.resizeWindow));
		addEvent(document, 'mousemove', delegate(this, this.moveMouse));
	},
	
	resizeWindow: function()
	{
		var contentHeight = ($('PromotionsColumn') ? $('PromotionsColumn').scrollHeight : $('ProductCardDescription').scrollHeight) + $('LeftColumn').offsetTop + $('Footer').offsetHeight;
		var rightHeight = ($('RightColumn') ? $('RightColumn').scrollHeight : $('Options').scrollHeight) + $('LeftColumn').offsetTop + $('Footer').offsetHeight;
		var windowHeight = document.documentElement ? document.documentElement.clientHeight : window.innerHeight + $('LeftColumn').offsetTop;
			
		var totalHeight = Math.max(contentHeight, rightHeight, windowHeight);
		
		$('ContentContainer').style.height = totalHeight + 'px';
		$('ShadowColumn').style.height = totalHeight - $('LeftColumn').offsetTop - $('Footer').offsetHeight +'px';
	
		return 'resizeWindow';
	},
	
	startDrag: function(dragData)
	{
		this.dragData = dragData;
	},
	
	stopDrag: function(dragData)
	{
		this.dragData = null;
	},

	moveMouse: function(event)
	{
	    var e = event || window.event;

	    if (this.dragData != null)
	    {
	        this.dragData.dragObject.left = e.clientX + this.dragData.dragOffsetX;
	        this.dragData.dragObject.top = e.clientY + this.dragData.dragOffsetY;
	        this.dragData.dragObject.redraw();
	    }
	}
});

