// JavaScript Document

function openWindow(url) {
//alert(url);
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=610,height=600,screenX=150,screenY=150,top=150,left=150')
}

$(document).ready(

	function()

	{

		$('#windowOpen').bind(

			'click',

			function() {

				if($('#window').css('display') == 'none') {

					$(this).TransferTo(

						{

							to:'window',

							className:'transferer2', 

							duration: 400,

							complete: function()

							{

								$('#window').show();

							}

						}

					);

				}

				this.blur();

				return false;

			}

		);

		$('#windowClose').bind(

			'click',

			function()

			{

				$('#window').TransferTo(

					{

						to:'windowOpen',

						className:'transferer2', 

						duration: 400

					}

				).hide();

			}

		);

		$('#windowMin').bind(

			'click',

			function()

			{

				$('#windowContent').SlideToggleUp(300);

				$('#windowBottom, #windowBottomContent').animate({height: 10}, 300);

				$('#window').animate({height:40},300).get(0).isMinimized = true;

				$(this).hide();

				$('#windowResize').hide();

				$('#windowMax').show();

			}

		);

		$('#windowMax').bind(

			'click',

			function()

			{

				var windowSize = $.iUtil.getSize(document.getElementById('windowContent'));

				$('#windowContent').SlideToggleUp(300);

				$('#windowBottom, #windowBottomContent').animate({height: windowSize.hb + 13}, 300);

				$('#window').animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;

				$(this).hide();

				$('#windowMin, #windowResize').show();

			}

		);

		$('#window').Resizable(

			{

				minWidth: 200,

				minHeight: 60,

				maxWidth: 700,

				maxHeight: 400,

				dragHandle: '#windowTop',

				handlers: {

					se: '#windowResize'

				},

				onResize : function(size, position) {

					$('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px');

					var windowContentEl = $('#windowContent').css('width', size.width - 25 + 'px');

					if (!document.getElementById('window').isMinimized) {

						windowContentEl.css('height', size.height - 48 + 'px');

					}

				}

			}

		);
		
		$('#windowOpen2').bind(

			'click',

			function() {

				if($('#window2').css('display') == 'none') {

					$(this).TransferTo(

						{

							to:'window',

							className:'transferer2', 

							duration: 400,

							complete: function()

							{

								$('#window2').show();

							}

						}

					);

				}

				this.blur();

				return false;

			}

		);





		$('#windowClose2').bind(

			'click',

			function()

			{

				$('#window2').TransferTo(

					{

						to:'windowOpen2',

						className:'transferer4', 

						duration: 400

					}

				).hide();

			}

		);

		$('#windowMin2').bind(

			'click',

			function()

			{

				$('#windowContent2').SlideToggleUp(300);

				$('#windowBottom2, #windowBottomContent2').animate({height: 10}, 300);

				$('#window2').animate({height:40},300).get(0).isMinimized = true;

				$(this).hide();

				$('#windowResize2').hide();

				$('#windowMax2').show();

			}

		);

		$('#windowMax2').bind(

			'click',

			function()

			{

				var windowSize = $.iUtil.getSize(document.getElementById('windowContent'));

				$('#windowContent2').SlideToggleUp(300);

				$('#windowBottom2, #windowBottomContent2').animate({height: windowSize.hb + 13}, 300);

				$('#window2').animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;

				$(this).hide();

				$('#windowMin2, #windowResize2').show();

			}

		);

		$('#window2').Resizable(

			{

				minWidth: 200,

				minHeight: 60,

				maxWidth: 700,

				maxHeight: 400,

				dragHandle: '#windowTop2',

				handlers: {

					se: '#windowResize2'

				},

				onResize : function(size, position) {

					$('#windowBottom2, #windowBottomContent2').css('height', size.height-33 + 'px');

					var windowContentEl = $('#windowContent2').css('width', size.width - 25 + 'px');

					if (!document.getElementById('window2').isMinimized) {

						windowContentEl.css('height', size.height - 48 + 'px');

					}

				}

			}

		);


	}

);



