﻿    var tmr = new Object();
    function ShowSub(el,cc)
    {
        window.clearTimeout(tmr[cc]);
        pos = Position.cumulativeOffset(el);
        pos2 = Position.cumulativeOffset($('clock'));
        //alert(h);
        //$('Menu').innerHTML = $(cc).innerHTML;
        ShowHMenu(cc);
        Element.setStyle('hmenu',{left:'0px'});
        var w = Element.getWidth('hmenu');
        //alert(pos2[0]);
        var alpha = pos2[0] - pos[0] - w;
        if(alpha < 0)
            w = pos[0] + alpha;
        else
            w = pos[0]
        Element.setStyle('hmenu',{left:w + 'px', top: (pos[1] + 27) + 'px'});
//        Element.setStyle(cc,{left:pos[0] + 'px', top: (pos[1] - h) + 'px'});
//        Effect.Appear(cc);
    }
    function ShowSub1(el,cc)
    {
        return;
        window.clearTimeout(tmr[cc]);
        pos = Position.cumulativeOffset(el);
        var h = Element.getHeight(cc);
        //alert(h);
        if($(cc).innerHTML=='')
            Element.hide('Menu');
        else
        {
            $('Menu').innerHTML = $(cc).innerHTML;
            Element.show('Menu');
        }
        //Element.scrollTo('Menu');
    
    }
    function Show(cc)
    {
        window.clearTimeout(tmr[cc]);
        Element.show(cc);
    }
    function HideSub(cc)
    {
        //tmr[cc] = window.setTimeout("Element.hide('"+cc+"');", 100);
        tmr['hmenu'] = window.setTimeout("Element.hide('hmenu');", 100);
    }
    
    function Hide()
    {
        tmr['hmenu'] = window.setTimeout("Element.hide('hmenu');", 100);
    }
    
    function Nav(el)
    {
        if(el.value=='0' || !el.value) return;
        window.open(el.value);
        el.options[0].selected = true;
    }

    var Submenus = {
        news: [
            {href: '#News,/Vietnam/Vi-tinh/',title: 'Vi tính'},
            {href: '#News,/Vietnam/Xa-hoi/',title: 'Xã hội'},
            {href: '#News,/Vietnam/Kinh-doanh/',title: 'Kinh doanh'},
            {href: '#News,/Vietnam/Van-hoa/',title: 'Văn hóa'},
            {href: '#News,/Vietnam/Vi-tinh/Giai-tri/',title: 'Giải trí'},
            {href: '#DpsCat,3',title: 'Truyện cười'}
        ],
        prds:[
            {href: '#Detail,ECOMMERCE',title: 'ECOMMERCE'},
            {href: '#Detail,SalStaffDetail',title: 'Quản lý nhân sự'},
            {href: '#Detail,QLBH',title: 'Quản lý bán hàng'},
            {href: '#Detail,QLVT',title: 'Quản lý vật tư'}
        ],
        rc:[
            {href: '#Detail,Tuyendung/Kinhdoanh',title: 'Kinh doanh'},
            {href: '#Detail,Tuyendung/Dohoa',title: 'Đồ họa'},
            {href: '#Detail,Tuyendung/Kythuat',title: 'Kỹ thuật'}
        ]
        
    }
    
    function abc()
    {
        alert(Submenus["sub1"][0].title);
    }
    
    function ShowHMenu(subid)
    {
        var str = '';
        //alert(Submenus[subid].length);
        if(Submenus[subid])
        {
            for(var i=0;i<Submenus[subid].length;i++)
            {
                str += '<a href="'+Submenus[subid][i].href+'">'+Submenus[subid][i].title+'</a>';
            }
        }
        window.clearTimeout(tmr['hmenu']);
        Element.update('hmenu', str);
        //Element.show('hmenu');
        Effect.Appear('hmenu')
    }