document.write('<script type="text/javascript" src="' + Exmay.path.js + '/exmay-libraries.js"></script>');

var currentModel = "";
$(function() {

	$("#exmay-channel-id").exmayCombobox( {
		onChange : function(nodeId, oldId) {
			var nodeJson = $("div[node-id=" + nodeId + "]").attr("json");
			var nodeData = eval("(" + nodeJson + ")");
			var nodeModel = nodeData.model;
			var model = $(this).attr("model");
			var modelName = $(this).attr("modelName");
			if (nodeModel != undefined) {
				var nodeName = nodeData.modelName;
				currentModel = nodeModel;
				if (nodeModel != model) {
					$.exmayMessagebox.confirm("提示", "当前内容模型为<label style='color:red'>" + modelName + "</label>,是否切换到<label style='color:red;'>" + nodeName + "</label>,继续切换会丢失当前输入数据,确定切换吗?", function(ok) {
						if (ok) {
							parent.reloadFrame("#mainFrame", Exmay.path.admin + "/content/" + nodeModel + "/add/?channelId=" + nodeId);
						}
					})
				}
			}
		}
	});

	/* 标题字体样式 */
	$(".exmay-ui-title").find("span").each(function() {
		$(this).css( {
			"font-size" : ""
		});
	});
	
	$("#exmay-pager-combobox").change(function(){
		var mode = $(this).val();
		$(".exmay-ui-pager").hide();
		$("#exmay-pager-" + mode).show();
	});

	$("#exmay-length-pager").click(function() {
		var length = $("#exmay-pager-length").val();
		$("#exmay-content").exmayEditor("lengthPager",  length);
	});
	
	$("#exmay-size-pager").click(function() {
		var size = $("#exmay-pager-size").val();
		$("#exmay-content").exmayEditor("sizePager",  size);
	});
	
	$("#exmay-editor-pager").click(function() {
		/*$.exmayMessagebox.prompt("内容分页", "请输入分页子标题：", function(title){
			if(title == undefined) {
				title = "";
			}
			$("#exmay-content").exmayEditor("pager",title);
		});*/
		$("#exmay-content").exmayEditor("pager");
		//$("#exmay-pager-combobox").exmayCombobox("select", "3");
	});
	
});