//选中父类标签 生成子类Div
    function showsub(obj)
    {
        var ID = obj.parnetid;
       // alert(obj.parnetid);
        //设置父类标签背景与CURSOR
        obj.parentElement.style.background  = "#99ffff";
        obj.parentElement.style.cursor = "default";

        //从GetSubCategory.aspx页面获取子类详细信息
        var address = "../../../GRFW/WebPage/Aspx/GetSubCategory.aspx?PARENTID=" + ID;
        var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
        var oDoc = new ActiveXObject("MSXML2.DOMDocument");
        var subcatename = new Array();//1子类名称数组
        var subcateid = new Array();//子类ID数组
        var parcateid = new Array();//父类ID数组
        var jobcount = new Array();//父类ID数组
        
        oHttpReq.open("POST",address,false);
        oHttpReq.send("");
        var result = oHttpReq.responseText;
        //将结果放入DOMDocument
        oDoc.loadXML(result);
       // alert(result);
        //遍历DOMDocument将子类名称及子类ID 存入相应数组
        var items = oDoc.selectNodes("//NewDataSet/Table1/JobTypeName");
        for (var index=0;index<items.length;index++)
        {
           subcatename.push(items[index].text);
        }
     
        items = oDoc.selectNodes("//NewDataSet/Table1/JobType");
        for (index=0;index<items.length;index++)
        {
           subcateid.push(items[index].text);
        }
        
        items = oDoc.selectNodes("//NewDataSet/Table1/JobFlag");
        for (index=0;index<items.length;index++)
        {
           parcateid.push(items[index].text);
        }
        
        items = oDoc.selectNodes("//NewDataSet/Table1/JobCount");
        for (index=0;index<items.length;index++)
        {
           jobcount.push(items[index].text);
        }
           

        var div = document.getElementById("ShowChild");
        var html="";       
        var parentPSV = "{" + ID + "-";
        //根据子类名称及子类ID 生成DIV 内部innerHTML
        html = "<table border='1' style='backgrond-color:black; width:400px'>" +
                    "<tr style='background-color:white'>" +
                        "<td valign='top'>"+
                            "<table style='width:400px;' cellpadding='2' cellspacing='4' >"+
                                "<tr style='background:#d8e4f8'>" +
                                     "<td colspan='2' >" +
                                         "<span style='cursor:hand;color:blue;font-size:13px;font-weight:bold' onclick=\"PCategoryView('"+parentPSV+"');\">" + obj.innerText + "</span>" +
                                      "</td>" +
                                "</tr>";

        var subcatecount = subcatename.length;
        if(subcatecount == 1)
        {
                 html+= "<tr><td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[0]+"');\">"+subcatename[0]+ "(" + jobcount[0] + ")" + "</span></td><td></td></tr>";
        }
        else if(subcatecount %2==0)
        {
            for(var i=0;i<subcatecount-1;i+=2)
            {
                html+= "<tr><td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[i]  +"');\">"+subcatename[i] + "(" + jobcount[0] + ")" +"</span></td>"+
                          " <td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[i+1]+"');\">"+subcatename[i+1] + "(" + jobcount[i+1] + ")" +"</span></td></tr>";
            }
        }
        else if(subcatecount %2==1)
        {
            for(var i=0;i<subcatecount-2;i+=2)
            {
                html+= "<tr><td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[i]+"');\">"+subcatename[i]+ "(" + jobcount[i] + ")" +"</span></td>"+
                " <td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[i+1]+"');\">"+subcatename[i+1] + "(" + jobcount[i+1] + ")" +"</span></td></tr>";
            }
            html+= "<tr><td width='50%'><span style='cursor:hand' onmouseover='subselect(this);' onmouseout='subunselect(this);' onclick=\"SubCategoryView('"+subcateid[subcatecount-1]+"');\">"+subcatename[subcatecount-1] + "(" + jobcount[subcatecount-1] + ")" +"</span></td><td></td></tr>";
        }
        
        html += "</table></td></tr></table>";
      
     
        div.innerHTML  = html;
        
        //根据DIV 实际高度设定其绝对位置 Left，Top
        div.style.left = getLeft(obj)+60;
        
        if(getTop(obj)+div.offsetHeight<document.body.offsetHeight)
        {
            div.style.top = getTop(obj)+obj.offsetHeight;
        }
        else
        {
            div.style.top = document.body.offsetHeight-div.offsetHeight-20;
        }     
    }


    
    //鼠标离开父类标签时置背景为空
    function unshowsub(obj)
    {
        obj.parentElement.style.color="#000000";
        obj.parentElement.style.background = "";       
    }
    
    //子类标签选择时样式
   function subselect(obj)
    {
        obj.parentElement.style.background="#99ffff";
        obj.style.color = "red";
    }
    
    //鼠标离开子类标签时样式清空
    function subunselect(obj)
    {
        obj.parentElement.style.background="";
        obj.style.color = "";
    }
    
    //显示子类详细信息页面
    function SubCategoryView(PSV)
    {
        window.parent.self.location = "SearchResult.aspx?JobType=" + PSV;
        //window.alert(parid+"-"+subid);
    }
    
    //显示父类详细信息页面
    function PCategoryView(parid)
    {
        window.parent.self.location = "SearchResult.aspx?JobType=" + parid;
        //window.alert("0-"+parid);
    }
    
    //显示行业详细信息页面
    function industryView(obj)
    {
        window.parent.self.location = "SearchResult.aspx?Industry={"+obj.IndustryID+"-";
        //window.alert(obj.IndustryID);
    }
    
    //根据鼠标位置判定子类Div的显示与消失
    document.onmousemove = function(e){
    var x,y;
    if(!document.all){ x = e.clientX; y = document.documentElement.scrollTop+ e.clientY; }else{ x = event.x; y =document.documentElement.scrollTop+ event.y; }
        if(document.getElementById("showdiv")!=null)
        {
            var div = document.getElementById("showdiv");
            if(x< getLeft(div)-65|| x>getLeft(div)+div.offsetWidth+20 ||y<getTop(div)-20 ||y>getTop(div)+div.offsetHeight+20)
             unshowdiv();
        }
    }
    
    //Div消失
    function unshowdiv()
    {
        if(document.getElementById("showdiv")!=null)
        {
           var div = document.getElementById("showdiv");
           div.parentNode.removeChild(div);
        }
    }
    
    //取得对象绝对位置 Left
     function getLeft(obj){
        if(obj.offsetParent){
        return obj.offsetLeft+getLeft(obj.offsetParent);
        }else{
        return obj.offsetLeft;
        }
    }
    
    //取得对象绝对位置 Top
    function getTop(obj){
        if(obj.offsetParent){
        return obj.offsetTop+getTop(obj.offsetParent);
        }else{
        return obj.offsetTop;
        }
    }


