/*
* http://www.thinkhu.com/ 
* Copyright (c) 2011 ThinkHu @hzpyy@foxmail.com
* Date: 20011-05-07 09:19:21 QQ:415480171
* v 1.1 job.thk.js,
*/
 
var hotkeystr = "会计、外贸、销售";
$(function () {
    $("#resume_search_post").bind("click", { target: "posts", soure: "postData", id: "posts", swidth: 363, title: "请选择职能", width: 568, num: 3 }, category.show);
    $("#search_area").bind("click", { soure: "areaData", id: "areas", target: "areas", width: 632, title: "地区", num: 1 }, category.show);
    $("#resume_search_trade").bind("click", { soure: "tradeData", id: "trades", target: "trade", width: 550, title: "请选择行业", num: 3 }, category.show);
    $("#resume_search_hk").bind("click", { soure: "areaData", id: "areas", target: "hk", width: 632, title: "请选择户口所在地", num: 1 }, category.show);
    $("input[name='keywords']").bind("focus", function () {
        $(this).addClass("kfocus");
        if ($(this).val() == ("热门关键词：" + hotkeystr)) $(this).val("");
    }).bind("blur", function () {
        if ($(this).val() == "") $(this).val("热门关键词：" + hotkeystr).removeClass("kfocus");
    });     
    //选择搜索器时间
    $("#sel_search_q").bind("change", function () {
        var id = $(this).val();
        load_searchcondition_byid(id);
    });
//    viewpostsmethod();
});
 
//按职能搜索
function gopost(post_id) {
    $("input[name='condition[posts]']").val(post_id);
    $("#search_form").submit();
}
//按行业搜索
function gotrade(trade_id) {
    $("input[name='condition[trade]']").val(trade_id);
    $("#search_form").submit();
}
//选择列表项目操作
function postopmore(type, isqzx) {
    var isqzx = typeof isqzx == "undefined" ? 0 : isqzx;
    if (type == "apply") {
        if (isqzx == 0) {
            if ($("input[name='postids[]'][checked='true']", $("#search_result_form")).length > 0) {
                $("input[name='optype']").val(type);
                App.form($("#search_result_form")[0], function (res) {
                    if (res.type == "login") {
                        App.redirect("index.php?s=login/person&refer=" + $("input[name='refer']").val());
                    } else if (res.type == "qzx") {
                        POPS["qzx"] = App.html(res.content, "申请职位", 500);
                    } else {
                        alert("操作未完成，您没有注册，或者您不是个人会员");
                    }
                });
                return false;
            } else {
                alert("对不起，你没有选择任何操作项");
            }
        } else if (isqzx == 1) {
            $("#div_qzx").find("input[type='submit']").attr("disabled", true);
            App.form($("#form_qzx")[0], function (res) {
                if (res.error == 1) {
                    alert(res.message);
                } else {
                    POPS["qzx"].close();
                    POPS["ok"] = App.html(res.content, "申请结果", 500);
                }
            });
            return false;
        }
    } else if (type == "fav") {
        if ($("input[name='postids[]'][checked='true']", $("#search_result_form")).length > 0) {
            $("input[name='optype']").val(type);
            App.form($("#search_result_form")[0], function (res) {
                if (res.type == "login") {
                    App.redirect("index.php?s=login/person&refer=" + $("input[name='refer']").val());
                } else {
                    if (res.error == 1) {
                        alert(res.message);
                    } else {
                        alert(res.content);
                    }
                }
            });
        } else {
            alert("对不起，你没有选择任何操作项");
        }
    }
}
