var sxUtil = sxUtil || {};
sxUtil['dialog'] = {
		window: function(option){
			
			var index = layer.load(1, {time: 30*1000,shade: [0.5, '#393D49']});
			var layerOption = {type:1,area: ['600px', '480px']}
			
			$.ajax({
				url: option.url,
				data: option.data || {},
				type: 'POST',
				success:function(data){
					if( data && data.success == false){
						layer.msg(data.msg, { icon : 0 });//提示信息
					}else{
						layer.close(index);
						layer.open($.extend(layerOption, option.layer, { content : data }));
					}
				}
			});
			
		},
		confirm: function(option){
			
			var defaultOption = {icon: 0,btn: ['确定','取消']};
			
			return layer.confirm(
				option.msg || '确定继续操作？',
				$.extend(defaultOption,option.option),
				function(index){
					option.yes?option.yes():layer.close(index);
				}, 
				function(){
					option.cancel?option.cancel():'';
				}
			);
			
		},
		close: function(index){
			
			layer.close(index);
			
		}
}
