﻿   //当前类别序号.
   var currentCategoryIndex = 1;
   //显示类别个数.
   var categorySize = 6;
   //上一个分类信息
   function UP(){
       currentCategoryIndex = currentCategoryIndex < 3 ? 1 : currentCategoryIndex - 1 ;
       showCurrentCategory();
   }
   //下一个分类信息
   function DOWN(){
       currentCategoryIndex = currentCategoryIndex + categorySize > 14 ? 15 - categorySize : currentCategoryIndex + 1 ;
       showCurrentCategory();
   } 
   //显示当前应显示的
   function showCurrentCategory(){
      var imgLists = document.getElementById('leftBody').childNodes;
      for(var i = 0;i< imgLists.length - 1;i++){
           imgLists.item(i).style.display = imgLists.item(i).childNodes[0].style.display = i >= currentCategoryIndex && i <= currentCategoryIndex + categorySize ? "block" : "none";
           imgLists.item(i).style.display = imgLists.item(i).childNodes[0].style.display = i == 0 || i == 16 ? "block" : imgLists.item(i).childNodes[0].style.display;
      }
   }
   //根据大类获取小类.
   function GetCategorys(obj){
        var name = obj.alt;
        document.getElementById('HiddenField1').value = name;
        document.getElementById('btnGetCategory').click();
   }
   //定位信息.
   function LocateInformation(id){
        var comName = CategorySearch.GetCompanyName(id).value;
        var locateonclick = CategorySearch.CompanyLocation(id).value;
        
        if (locateonclick != null && locateonclick != "") {
            loca(locateonclick,comName);
        }else{
            alert('not found.');
        }
   }
   //定位
   function loca(str,comName){  
       var x = str.split(',');
       var param = {x:x[0],y:x[1]};
       parent.parent.MapMethod.go(param);
       var params = {x:x[0],y:x[1],text:comName};
       parent.parent.MapMethod.printInco(params);            
   }   
   //打开企业E店.
   function GotoEshop(eshopID){
       var eshopurl = GetEshoperUrl() + '?id=' + eshopID;
       openNewFrom(eshopurl);
   } 
   var as = document.createElement('a');
   //网站定位.
   function LocateUrl(id){
       var enterSitehref = CategorySearch.CompanySiteurl(id).value; 
       if (enterSitehref != null && enterSitehref != "") {
               if(enterSitehref.split('http://').length <2)
               enterSitehref = 'http://' + enterSitehref;
               openNewFrom(enterSitehref);
               
       }else{
           alert('该信息没有网站!');
       } 
   }
   //openNewWeb
   function openNewFrom(siteURl){
       as.setAttribute('target',"_blank");
       as.setAttribute('href',siteURl);
       document.appendChild(as);
       as.click();
   }
   //关闭显示详细信息.
   function closeDetail(){        
       var o = parent.parent.document.getElementById('detail');
       o.style.display = 'none';
   }
   //显示企业详细信息.
   function showers(object) {/*--打开--*/
       var img = object.childNodes[0];
       var detailtop = img.offsetTop + img.height + 14 + 66 + 105;
       var o = parent.parent.document.getElementById('detail');
       if(o.style.display != "block" && detailtop != o.style.top){
           o.style.display = "block";
           var detailleft =  parent.parent.document.getElementById('MapPanel').offsetWidth - 206;
           var detailheight = parent.parent.document.getElementById('detail').style.height.replace('px','');
           o.style.overflow = "auto";
           o.style.top = detailtop;
           o.style.left = detailleft;
           o.style.display = 'block';
           o.style.width = '249px';
           o.style.height = '260px';           
           filldetail(object);
       }
   }
   //填充企业详细信息.
   function filldetail(object) {
        var comid = object.childNodes[0].id;

        var img = parent.parent.document.getElementById("img");
        var content = parent.parent.document.getElementById("content");
        
        var imgsrc = CategorySearch.CompanyImgurl(comid).value;
        var contentinnerHTML = CategorySearch.CompanyContent(comid).value;
        
        if (imgsrc != null && imgsrc != "") {   
	    img.src =  "http://mapres.0577emap.com/wz/owcomimg/" + imgsrc;
        }else{
            img.src = "images/Default.PNG";
        }
        if (contentinnerHTML != null && contentinnerHTML != "") {
            content.innerHTML = contentinnerHTML;
        }
    }