﻿$(document).ready(
	function() {
	  $('#windowOpen2').bind(
			'click',
			function() {
			  if ($('#window02').css('display') == 'none') {
			    $(this).TransferTo(
						{
						  to: 'window',
						  className: 'transferer202',
						  duration: 400,
						  complete: function() {
						    $('#window02').show();
						  }
						}
					);
			  }
			  this.blur();
			  return false;
			}
		);
	  $('#windowClose02').bind(
			'click',
			function() {
			  $('#window02').TransferTo(
					{
					  to: 'windowOpen2',
					  className: 'transferer202',
					  duration: 400
					}
				).hide();
			}
		);
	  $('#windowMin02').bind(
			'click',
			function() {
			  $('#windowContent02').SlideToggleUp(300);
			  $('#windowBottom02, #windowBottomContent02').animate({ height: 10 }, 300);
			  $('#window02').animate({ height: 40 }, 300).get(0).isMinimized = true;
			  $(this).hide();
			  $('#windowResize02').hide();
			  $('#windowMax02').show();
			}
		);
	  $('#windowMax02').bind(
			'click',
			function() {
			  var windowSize = $.iUtil.getSize(document.getElementById('windowContent02'));
			  $('#windowContent02').SlideToggleUp(300);
			  $('#windowBottom02, #windowBottomContent02').animate({ height: windowSize.hb + 13 }, 300);
			  $('#window02').animate({ height: windowSize.hb + 43 }, 300).get(0).isMinimized = false;
			  $(this).hide();
			  $('#windowMin02, #windowResize02').show();
			}
		);
	  $('#window02').Resizable(
			{
			  minWidth: 150,
			  minHeight: 150,
			  maxWidth: 800,
			  maxHeight: 550,
			  dragHandle: '#windowTop02',
			  handlers: {
			    se: '#windowResize02'
			  },
			  onResize: function(size, position) {
			    $('#windowBottom02, #windowBottomContent02').css('height', size.height - 33 + 'px');
			    var windowContentEl = $('#windowContent02').css('width', size.width - 25 + 'px');
			    if (!document.getElementById('window02').isMinimized) {
			      windowContentEl.css('height', size.height - 48 + 'px');
			    }
			  }
			}
		);
	}
);