﻿//url = window.location.pathname.toLowerCase();
//_linkname = ''
//__ = '            <div style="margin-top: -10px;" class="hl_left_bg">'+
//        '</div>'+
//        '<div style="margin-top: -10px;" class="hl_mid_bg">'+
//         '   <span>#TITLE</span>'+
//        '</div>';

//if(url.indexOf('/agents') == -1){        
//        __ = __ + '<div style="margin-top: -10px;" class="hl_right_bg">'+
//        '</div>';                 
//}

//function GetSelected()
//{  
//    _nav = document.getElementById('nav_mid_bg');                     
//    for(i in _nav.childNodes){            
//        if(_nav.childNodes[i].nodeType == 1){                                
//            _name = _nav.childNodes[i].getAttribute('class');
//            if(!_name){//for ie
//                _name = _nav.childNodes[i].attributes['class'].value;
//            }                             
//                       
//            if(_name && _name.indexOf('top_10') != -1){                    
//                return _nav.childNodes[i];                                   
//            }
//        }
//    }
//}           

//function GetLinkName(node)
//{                        
//    for(i in node.childNodes){
//        if(node.childNodes[i].nodeType == 1 
//            && node.childNodes[i].nodeName == 'SPAN'){                
//            _linkname = node.childNodes[i].innerHTML;                
//            break;
//        }
//        else{
//            GetLinkName(node.childNodes[i]);                
//        }            
//    }               
//}

//function CancelSelected()
//{            
//try{
//    _selected = GetSelected();         
//    
//    GetLinkName(_selected);    
//            
//    _selected.setAttribute('class', 'dingwei');    
//    _selected.innerHTML = '<a style="margin-left:5px;" href="/">'+_linkname+'</a><img src="/images/nav_duanxian.gif" />';        
//    
//    }
//catch(err)
//{
//txt="There was an error on this page.\n\n";
//txt+="Error description: " + err.description + "\n\n";
//txt+="Click OK to continue.\n\n";
//alert(txt);
//}
//}

//function SetSelected(divId,title){
//       _about = document.getElementById(divId)
//    _about.innerHTML=__.replace('#TITLE',title);
//    _about.setAttribute('class', 'dingwei');         
////        _about.setAttribute('style', '*top:1px'); 
//    _about.style.top = '-10px';     
//    
//    if(_about.id == 'hezuo'){
//        _about.style.marginTop = '0px';                 
//    }           
//}        
//CancelSelected();    

function set_selected(div_id) {
    $('.home-head-nav-item').removeClass('home-head-nav-item-selected');
    $('#home-head-nav-item-' + div_id).addClass('home-head-nav-item-selected');
}            

var url = window.location.pathname.toLowerCase();

if(url.indexOf('/about/') != -1){                
    set_selected(1);            
}else if(url.indexOf('/product-introduce/') != -1){
    set_selected(2);        
}else if(url == '/' || url.indexOf('/default') != -1){
    set_selected(0);        
}else if(url.indexOf('/solutions/product.aspx') != -1 ||
url.indexOf('control_solutions.aspx') != -1){
    set_selected(3);        
}else if(url.indexOf('/solutions/product-list.aspx') != -1 ||
   url.indexOf('office_network_solutions.aspx') != -1){
    set_selected(4);        
}else if(url.indexOf('activitys') != -1){
    set_selected(5);        
}else if(url.indexOf('/templates/') != -1){
    set_selected(6);        
}else if(url.indexOf('guestbook.aspx') != -1){
    set_selected(7);        
}else if(url.indexOf('/agents') != -1){
    set_selected(10);        
}else if(url.indexOf('/customer') != -1){
    set_selected(9);        
}
