﻿// JScript 文件

//取得子分类
function CategoryParentChange(childId, parent_value, action, default_message)
{
    var $obj_wucg_child = $('#' + childId);
    $obj_wucg_child.get(0).options.length = 0;
    var url = '/PositionCategoryHandler.ashx?action=' + action + '&ParentID=' + parent_value;
    $.ajax({ 
        url: url,
        type:'get',           
        dataType:'json',
        data: 'name=John&location=Boston',
        success:function(msg){ 
             var result = msg;
             if(result.success){ 
                if($.trim(default_message) != '') 
                {
                    $('<option value="0">' + default_message + '</option>').appendTo($obj_wucg_child);
                }
                for(var i=0;i<result.data.length;i++){
                    $('<option value="'+result.data[i].id+'">'+result.data[i].name+'</option>').appendTo($obj_wucg_child);
                }
             }
        } 
    });
}

//弹出窗口
function popWindow(url)
{
    var s_time = (new Date()).getTime();
    var sUrl ;
    if(url.indexOf('?')>0)
    {
        sUrl = url + '&tmp=' + s_time;
    }
    else
    {
        sUrl = url + '?tmp=' + s_time;
    }
    set_msg_box(
        sUrl,
        {action:'show'});
    return false;
}

//批量应聘职位
$(document).ready(function(){
    $('#aApplyPosition').click(function(){
    if(confirm('确认要批量应聘吗？'))
    {
        //列出选中checkbox的值
        var idList = '';
        $('input[name^="openIDPosition"]').each(function(){
            if($(this).attr('checked'))
            {
                idList += $(this).val() + ',';
            }
        });
        if(idList == '')
        {
            alert('请选择');
            return false;
        }
        idList = idList.substring(0,idList.length-1);
        
        var url = '/PositionApplyHandler.ashx?action=apply&positionID=' + idList;
        $.ajax({
            url : url,
            type:"get",           
            dataType:"json",
            data: "name=John&location=Boston",
            success:function(msg){
                alert(msg.data);
            }
        });
     }
     else
     {
        return false;
     }
    });
});


//批量面试邀请
function MulInterview(checkName)
{
    var personalID = '';
    //列出选中checkbox的值
    var idList = '';
    $('input[name^="' + checkName + '"]').each(function(){
        if($(this).attr('checked'))
        {
            idList += $(this).attr('personalID') + ',';
        }
    });
    if(idList == '')
    {
        alert('请选择');
        return false;
    }
    idList = idList.substring(0,idList.length-1);
    set_msg_box('../InterviewAdd.aspx?positionID=0&SendResumeID=0&personalID=' + idList,{action:'show'});
}