function actionUp(val,obj){
	Hanchao.actionUp(val,obj);
}
function actionDown(val,obj){
	Hanchao.actionDown(val,obj);
}
function actionEdit(val,obj){
	Hanchao.actionEdit(val);
}
function actionDel(val){
	Hanchao.actionDel(val);
}
function HCsubmit(url){
	Hanchao.sortdatalist(url);
}
function changeRange(obj,index){
	Hanchao.changeRange($(obj).attr('data'),0,$(obj).parent().attr('index'),$(obj).parent().attr('type'),$(obj).attr('name'));
}
function getgoodslist(page){
	Hanchao.getgoodslist(page);
}
function tab_default(){
	Hanchao.currentID=0;
}
function UpOrDownShow(){
	//判断计算上下移按钮是否显示
	if ($(".drag .diy-conitem-action-btns").length < 2) {
		$(".drag .j-Down").hide();
		$(".drag .j-Up").hide();
	} else if ($(".drag .diy-conitem-action-btns").length == 2) {
		$(".drag .j-Down").eq(0).show();
		$(".drag .j-Up").eq(0).hide();
		$(".drag .j-Down").eq(1).hide();
		$(".drag .j-Up").eq(1).show();
	} else {
		$(".drag .j-Down").show();
		$(".drag .j-Up").show();
		$(".drag .j-Down").eq(0).show();
		$(".drag .j-Up").eq(0).hide();
		$(".drag .j-Down").eq($(".drag .diy-conitem-action-btns").length - 1).hide();
		$(".drag .j-Up").eq($(".drag .diy-conitem-action-btns").length - 1).show();
	}
}
function eventdroplist(){
	//显示公共列表
	$(document).on("mouseover", ".droplist .j-droplist-toggle",function () {$(this).siblings(".droplist-menu").show()}),
	$(document).on("mouseleave", ".droplist .droplist-menu",function () {$(this).hide()}),
	$(document).on("mouseleave", ".droplist",function () {$(this).find(".droplist-menu").hide()}),
	$(document).on("click", ".droplist .droplist-menu a",function () {$(this).parents(".droplist-menu").hide()})
}
$(function() {
	$( "#sortable" ).sortable({
		revert: true,
		placeholder: "ui-state-highlight",
		stop: function (event, ui) {
			UpOrDownShow();
			Hanchao.reposition(Hanchao.currentID); //重置ctrl的位置
		}
	});
	$( "#sortable" ).disableSelection();
	Hanchao.init();
});