function bindJQueryEvents_PopUp(jobid, buttonid){

	$('#' + buttonid.toString()).bind(
		'click',
		function() {
		if($('#window' + jobid.toString()).css('visibility') == 'hidden') 
		{
			$('#window' + jobid.toString()).css('z-index','100');
			
			$('#window' + jobid.toString()).css('left','100px');

			$(this).TransferTo(
				{
					to:'window' + jobid.toString(),
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#window' + jobid.toString()).css('visibility','visible');
					}
				}
			);
		}
		this.blur();
		return false;
	}
	);

	$('#windowClose' + jobid.toString()).bind(
			'click',
			function()
			{
				resetPopupDiv(jobid.toString());
				$('#window' + jobid.toString()).TransferTo(
					{
						to:buttonid,
						className:'transferer2', 
						duration: 400
					}
				).css('visibility','hidden');

				$('#window' + jobid.toString()).css('z-index','-1000');
				$('#window' + jobid.toString()).css('left','-1000px');
			}
	);
	
	$('#windowMin' + jobid.toString()).bind(
		'click',
		function()
		{
			$('#windowContent' + jobid.toString()).SlideToggleUp(300);
			$('#windowBottom' + jobid.toString(), '#windowBottomContent' + jobid.toString()).animate({height: 10}, 300);
			$('#window' + jobid.toString()).animate({height:40},300).get(0).isMinimized = true;
			$(this).css('visibility','hidden');
			$('#windowResize' + jobid.toString()).css('visibility','hidden');
			$('#windowMax' + jobid.toString()).css('visibility','visible');
		}
	);
	
	$('#windowMax' + jobid.toString()).bind(
		'click',
		function()
		{
			var windowSize = $.iUtil.getSize(document.getElementById('windowContent' + jobid.toString()));
			$('#windowContent' + jobid.toString()).SlideToggleUp(300);
			$('#windowBottom' + jobid.toString(), '#windowBottomContent' + jobid.toString()).animate({height: windowSize.hb + 13}, 300);
			$('#window' + jobid.toString()).animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;
			$(this).css('visibility','hidden');
			$('#windowMin' + jobid.toString(), '#windowResize' + jobid.toString()).css('visibility','visible');
		}
	);
	
	$('#window' + jobid.toString()).Resizable(
	{
		minWidth: 200,
		minHeight: 60,
		maxWidth: 900,
		maxHeight: 600,
		dragHandle: '#windowTop' + jobid.toString(),
		handlers: {
			se: '#windowResize' + jobid.toString()
		},
		onResize : function(size, position) {
			$('#windowBottom' + jobid.toString(), '#windowBottomContent' + jobid.toString()).css('height', size.height-33 + 'px');
			var windowContentEl = $('#windowContent' + jobid.toString()).css('width', size.width - 25 + 'px');
			if (!document.getElementById('window' + jobid.toString()).isMinimized) {
				windowContentEl.css('height', size.height - 48 + 'px');
			}
		}
	});			
}
