/**
 * 退改签规定
 * @param {Object} airlineCode
 * @param {Object} seatClassCode
 */
function alertChangeConditions(airlineCode, seatClassCode) {
	richAlert(getChangeConditions(airlineCode, seatClassCode));
}

/**
 * 获得运价规定
 */
function getChangeConditions(airlineCode, seatClassCode) {
	var str = "网络异常";
	dwr.engine.setAsync(false);
	try{
		seatClassService.getSeatClass(airlineCode, seatClassCode, function(json) {
			if(json == null) {
				str = "没有数据";
			}else {
				str = json.modifyStipulateZh + json.refundStipulateZh;
//				str = "成人: " + json.modifyStipulateZh + json.refundStipulateZh + "<br/>" + "儿童: " + json.childModifyStipulateZh + json.childRefundStipulateZh;
			}
		});
	}finally {
		dwr.engine.setAsync(true);
	}
	return str
}

/**
 * 解析国际的运价规定
 * |分割中韩文 ^标识换行
 * @param {Object} str
 */
function reverseIntChangeConditions(str) {
	if(str == null || $.trim(str) == "") {
		return "";
	}else {
		var strArray = str.split('|');
		if(strArray[0] == null || $.trim(strArray[0]) == "") {
			return "";
		}else {
			return strArray[0].replace(/\^/g, '<br/>');
		}
	}
}
/**
 * "富"alert
 */
function richAlert(str, width) {
	if(str == null || $.trim(str) == "") {
		str = "没有数据";
	}
	var a = $('<div style="color: gray;">' + str + '</div>').dialog({
				modal: true,
				title:'系统提示',
				closeOnEscape:true,
				"resizable": false,
//				show: "drop",
				hide: "drop",
				buttons: {
					"确定": function() { 
						$(this).dialog("close"); 
					}
				}
			});
	if(width != null && width != 0) {
		a.dialog({ width: width });
	}
	a.dialog('open');
}

/**
 * "富"confirm
 */
function richConfirm(str, yesCallBack, noCallBack) {
	if(str == null || $.trim(str) == "") {
		str = "没有数据";
	}
	var a = $('<div style="color: gray;">' + str + '</div>').dialog({
				modal: true,
				title:'系统提示',
				closeOnEscape:true,
				"resizable": false,
//				show: "drop",
				hide: "drop",
				buttons: {
					"确定": function() {
						if(yesCallBack != null) {
							yesCallBack();
						}
						$(this).dialog("close"); 
					},
					"取消": function() {
						if(noCallBack != null) {
							noCallBack();
						}
						$(this).dialog("close"); 
					}
				}
			});
	a.dialog('open');
}
