$(document).ready(
	function()
	{
		$('#window2Open').bind(
			'click',
			function() {
				if($('#window2').css('display') == 'none') {
					document.getElementById('window2').style.top = tempY+'px';
					document.getElementById('window2').style.left = (tempX-100)+'px';
					$(this).TransferTo(
						{
							to:'window2',
							className:'transferer2',
							duration: 400,
							complete: function()
							{
								$('#window2').show();
							}
						}
					);
				}
				this.blur();
				return false;
			}
		);
		$('#window2Close').bind(
			'click',
			function()
			{
				$('#window2').TransferTo(
					{
						to:'window2Open',
						className:'transferer2',
						duration: 400
					}
				).hide();
			}
		);
		$('#window2Min').bind(
			'click',
			function()
			{
				$('#window2Content').SlideToggleUp(300);
				$('#window2Bottom, #window2BottomContent').animate({height: 10}, 300);
				$('#window2').animate({height:40},300).get(0).isMinimized = true;
				$(this).hide();
				$('#window2Resize').hide();
				$('#window2Max').show();
			}
		);
		$('#window2Max').bind(
			'click',
			function()
			{
				var windowSize = $.iUtil.getSize(document.getElementById('window2Content'));
				$('#window2Content').SlideToggleUp(300);
				$('#window2Bottom, #window2BottomContent').animate({height: windowSize.hb + 13}, 300);
				$('#window2').animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;
				$(this).hide();
				$('#window2Min, #window2Resize').show();
			}
		);
		$('#window2').Resizable(
			{
				minWidth: 200,
				minHeight: 60,
				maxWidth: 700,
				maxHeight: 400,
				dragHandle: '#window2Top',
				handlers: {
					se: '#window2Resize'
				},
				onResize : function(size, position) {
					$('#window2Bottom, #window2BottomContent').css('height', size.height-33 + 'px');
					var windowContentEl = $('#window2Content').css('width', size.width - 25 + 'px');
					if (!document.getElementById('window2').isMinimized) {
						windowContentEl.css('height', size.height - 48 + 'px');
					}
				}
			}
		);
	}
);
