//ajaxform参数
var ajax_options = {
	success: message,
	resetForm: false,
	dataType: 'json'
};

//表单默认提交
/* $('#form1').submit(function() {
	$(this).ajaxSubmit(options);
	return false;
});
  */
  

function message(res) {
    if (res.status == 0) {
        icon = 'error';
    } else if (res.status == 1) {
        icon = 'succeed';
    } else {
        icon = 'warning';
    }

    window.art.dialog({
        id: 'message',
        title: '提示',
        content: res.info,
        icon: icon,
        time: res.time,
		opacity: 0.2,
		lock: true,
		background: '#000'
    }); //提示消息
    if (res.url) {
        //如果有跳转页面，进行跳转       
        setTimeout(
			function() {
				window.location.href = res.url;
			},res.time * 1000);
    }
    if (res.win) {
        setTimeout(function() {
            window.parent.location.reload();
        }, res.time * 1000);
    }
}


function yesno(m, url) {
    art.dialog.confirm(m, function() {
        $.ajax({
            type: "post",
            url: url,
            dataType: 'json',
            success: function(data) {
                message(data);
            },
            error: function() {
                alert("出错了");
            }
        });
    }, function() {
//    art.dialog.tips('执行取消操作');
    });

}
//返回
function metreturn(url) {
    if (url) {
        location.href = url;
    } else if ($.browser.msie) {
        history.go(-1);
    } else {
        history.go(-1);
    }
}

/*dialog_tips*/
function dialog_tips(status,message) {
    if (status == 0) {
        icon = 'error';
    } else if (status == 1) {
        icon = 'succeed';
    } else {
        icon = 'warning';
    }
	
    window.art.dialog({
        id: 'dialog_tips',
        title: '提示',
        content: message,
        icon: icon,
        time: 2,
		opacity: 0.2,
		lock: true,
		background: '#000'
    });
	return false;
}
