jQuery(document).ready(function()
{
	jQuery('#windowOpen').bind('click',function()
	{		//jQuery('#window').css({'left':window.width+'px'});
		if(jQuery('#window').css('display') == 'none')
		{
			jQuery(this).TransferTo({to:'window',className:'transferer2', duration: 400,complete: function()
			{
				jQuery('#window').show();
			}
		});
	}
	this.blur();
	return false;

});

jQuery('#windowClose').bind('click',function()
{
	jQuery('#window').TransferTo({to:'windowOpen',className:'transferer2', duration: 400}).hide();

});

jQuery('#windowMin').bind('click',function()
{
	jQuery('#windowContent').SlideToggleUp(300);
	jQuery('#windowBottom, #windowBottomContent').animate({height: 10}, 350);
	jQuery('#window').animate({height:40},350).get(0).isMinimized = true;
	jQuery(this).hide();
	jQuery('#windowResize').hide();
	jQuery('#windowMax').show();
});

jQuery('#windowMax').bind('click',function()
{
	var windowSize = jQuery.iUtil.getSize(document.getElementById('windowContent'));
	jQuery('#windowContent').SlideToggleUp(300);
	jQuery('#windowBottom, #windowBottomContent').animate({height: windowSize.hb + 13}, 350);
	jQuery('#window').animate({height:windowSize.hb+43}, 350).get(0).isMinimized = false;
	jQuery(this).hide();
	jQuery('#windowMin, #windowResize').show();
});

jQuery('#window').Resizable(
	{
	minWidth: 350,minHeight: 60,maxWidth: 700,maxHeight: 400,dragHandle: '#windowTop',handlers:
		{se: '#windowResize'},
		onResize : function(size, position)
		{
			jQuery('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px');
			var windowContentEl = jQuery('#windowContent').css('width', size.width - 25 + 'px');
			if (!document.getElementById('window').isMinimized)
			{
				windowContentEl.css('height', size.height - 48 + 'px');
			}
		}
	});
});



jQuery(document).ready(function()
{
	jQuery('#windowOpen2').bind('click',function()
	{
		if(jQuery('#window2').css('display') == 'none')
		{
			jQuery(this).TransferTo({to:'window2',className:'transferer2', duration: 400,complete: function()
			{
				jQuery('#window2').show();
			}
		});
	}
	this.blur();
	return false;

});

jQuery('#windowClose2').bind('click',function()
{
	jQuery('#window2').TransferTo({to:'windowOpen2',className:'transferer2', duration: 400}).hide();

});

jQuery('#windowMin2').bind('click',function()
{
	jQuery('#windowContent2').SlideToggleUp(300);
	jQuery('#windowBottom2, #windowBottomContent2').animate({height: 10}, 300);
	jQuery('#window2').animate({height:40},300).get(0).isMinimized = true;
	jQuery(this).hide();
	jQuery('#windowResize2').hide();
	jQuery('#windowMax2').show();
});

jQuery('#windowMax2').bind('click',function()
{
	var windowSize = jQuery.iUtil.getSize(document.getElementById('windowContent2'));
	jQuery('#windowContent2').SlideToggleUp(300);
	jQuery('#windowBottom2, #windowBottomContent2').animate({height: windowSize.hb + 13}, 300);
	jQuery('#window2').animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;
	jQuery(this).hide();
	jQuery('#windowMin2, #windowResize2').show();
});

jQuery('#window2').Resizable(
	{
	minWidth: 200,minHeight: 60,maxWidth: 700,maxHeight: 400,dragHandle: '#windowTop2',handlers:
		{se: '#windowResize2'},
		onResize : function(size, position)
		{
			jQuery('#windowBottom2, #windowBottomContent2').css('height', size.height-33 + 'px');
			var windowContentEl = jQuery('#windowContent2').css('width', size.width - 25 + 'px');
			if (!document.getElementById('window2').isMinimized)
			{
				windowContentEl.css('height', size.height - 48 + 'px');
			}
		}
	});
});