
function searchMyUser() {
	document.my_user_list.submit();
}

function searchOceanUser() {
	document.ocean_user_list.submit();
}

function searchUserUseCoupon() {
	document.user_use_coupon_list.submit();
}

function doSendPoint() {
	//积分判断
	var point = $("[name=point]").val();
	if(point.length<1) {
		alert ("积分不能为空！");
		return false;
	}
	//数字
	if(!checknum(point)) {
		alert ("积分必须为整数数字！");
		return false;
	}
	//范围
	if(point < 1 || point > 10000) {
		alert ("积分范围异常！");
		return false;
	}
	
	document.user_send_point.submit();
}

function doSendCoupon() {
	document.user_send_coupon.submit();
}

function doUseCouponExec() {
	//必须添加备注
	var comment = $("[name=comment]").val();
	if(comment.length<1) {
		alert ("备注不能为空！");
		return false;
	}
	document.user_use_coupon.submit();
}

function dateToUnixTime(date){
	var f = date.split(' ', 2);
    var d = (f[0] ? f[0] : '').split('-', 3);
    var t = (f[1] ? f[1] : '').split(':', 3);
    return (new Date(
    	parseInt(d[0], 10) || null,
    	(parseInt(d[1], 10) || 1) - 1,
    	parseInt(d[2], 10) || null,
    	parseInt(t[0], 10) || null,
    	parseInt(t[1], 10) || null,
    	parseInt(t[2], 10) || null
    )).getTime() / 1000;
}

var tempUserId;
var nickname;

function getAgent(id,nickname){
    tempUserId=id;
    nickname=nickname;
    $('#nickname').text(nickname);

}

$(function () {
    $('.go').colorbox({inline:true, width:"50%"});
})

function updateParent() {
    if($.trim($('#parentId').val())==''){
        alert('请输入上级ID!');
        return;
    }

    if($('#parentId').val()==tempUserId){
        alert('上级不能为自己!');
        return;
    }

    var appid = $("*[name='appid']").val();
    console.log('appid:'+appid);
    $.post('/miniplay_set_parent.php',{appid:appid,userId:tempUserId,parentUserId:$('#parentId').val()},function (resp) {
        console.log(resp);
        var data = JSON.parse(resp);
        if(data.status=='OK'){
            alert('提交成功!');
        }else{
            alert(data.message);
        }
    })
}