/**
 * 点服务项到服务单位列表页面
 */
function goServeList(serve_type) {
    window.open("liveserve.go?flag=goServeList&_eq_n_serve_type="
                +serve_type+"&_rl_c_unit_id="+getUnit()+"&unit_class="
                +unit_class+"&unit_id="+unit_id+"&li=2");//li=2即调用8090101_2.sql
}
/**
 *  得到查询参数并请求，打开页面
 *  
 */
function queryServer(){
    var li = 2; //用来指定执行那个sql语句
    getUnit_id();
    if(serverForm._eq_n_serve_type.value == "") {
      serverForm._eq_n_serve_type.options.length = 1;
      serverForm._eq_n_serve_type.options[0] = new Option("", "");
      serverForm._eq_n_serve_type.selectedIndex = 0;
    }
    var termStr= packForm(serverForm);
    if(serverForm._eq_n_serve_type.value == "" || serverForm._eq_n_serve_type.value == "-1"){
        li = 3;
    }
    if(serverForm._eq_n_ptype_id.value == "" || serverForm._eq_n_ptype_id.value == "-1"){
        li = 4;
    }    
    window.open("liveserve.go?flag=goServeList&unit_class="
                +unit_class+"&unit_id="+unit_id+"&li="+li+"&"+termStr);
}
/**
 * 在goSearch()函数中调用
 * 设置unit_id值
 */
function getUnit_id(){
    var unit1 = document.serverForm.no_unit_class_6.value;
    var unit2 = document.serverForm.no_unit_class_5.value;
    var unit3 = document.serverForm.no_unit_class_4.value;
    if (unit1 != "" && unit1 != "-1") { // 选择了居委会
        document.getElementById("_rl_c_unit_id").value = unit1;
    } else if (unit2 != "" && unit2 != "-1") { // 选择到办事处
        document.getElementById("_rl_c_unit_id").value = unit2.substring(0,8);
    } else if (unit3 != "" && unit3 != "-1") { //只选择了旗县区
        document.getElementById("_rl_c_unit_id").value = unit3.substring(0,6);
    } else { // 未进行选择，默认为登录账号
        document.getElementById("_rl_c_unit_id").value = unit_id.substring(0,10 - (6 - unit_class) * 2)
    }
}

function getUnit(){
    var unit;
    if(unit_class==3){
        unit = unit_id.substring(0,4);
    }else if(unit_class ==4) {
        unit = unit_id.substring(0,6); 
    }else if(unit_class == 5) {
        unit = unit_id.substring(0,8);
    }else {
        unit = unit_id;
    }
    return unit;
}
