jQuery(document).ready(function(){ 

	$("button, a.button, input:submit").button();

	$.loading({
		onAjax:true, 
		delay: 1500,
		img: ajaxloading,
		mask: true,
		align: 'center'
	});

	if ( $('#edit-dialog').length )
	{
		$("#edit-dialog").dialog({ 
			autoOpen	:false, 
			resizable	:true,
			draggable	:true,
			height		:550,
			width		:850,
			minHeight	:550,
			minWidth	:850,
			modal		:true,
			zIndex		:50
		});
	}
})

function resizeGrid(name)
{
	var contentAreaHeight = $('#bottomMarker').position().top - $('.content-area').offset().top - 20;
	var grigHeight = contentAreaHeight - $('#pagemenu').height() - $('.ui-state-default.ui-jqgrid-hdiv').height() - $('#pager').height();
	$('.content-area').height(contentAreaHeight);
	//alert($('.ui-state-default.ui-jqgrid-hdiv').height());
	/*var of = $('.content-area').offset();
	alert($('.content-area').height());
	//alert($('#bottomMarker').position().top);
	var nh = $('#bottomMarker').position().top - 275;*/
//alert($('.ui-jqgrid-bdiv div:first').width());
	$("#"+ name).jqGrid('setGridHeight', grigHeight);
	//$('.ui-jqgrid-bdiv').width($('.ui-jqgrid-bdiv').width() + 8);
	$("#"+ name).jqGrid('setGridWidth', $('.content-area').width() );
}

function closeDialog(dialog)
{
	$('#'+ dialog +'-dialog').attr('title', '');
	$('#'+ dialog +'-dialog-content').html('');
	$('#'+ dialog +'-dialog').dialog('close');
}

function setDialogContent(dialog, content)
{
	$('#'+ dialog +'-dialog-content').html(content);
	$("button, a.button, input:submit").button();
}
