
$(function () {
    
    /* main menu */
    // toggle submenu on mouse over
    $(".h_menu li").hoverIntent({
        sensitivity: 1,
        interval: 50,
        over: function() { toggleSubmenu(this); },
        timeout: 300,
        out: function() { toggleSubmenu(this); }
    });
    // set active menu item
    var url = window.location.href;
    var urlp = url.split('/');
    if (typeof(urlp[3]) != 'string') urlp[3] = false;
    if (typeof(urlp[4]) != 'string') urlp[4] = false;
    $(".h_menu .mainmenu > li > a").each(function() {
        var href = $(this).attr('href').split('/');
        if (urlp[3] == href[1] && urlp[4] == href[2])
            $(this).addClass('h_menu_active');
        else if (urlp[3] == href[1] && href[1] != 'cikkek') 
            $(this).addClass('h_menu_active');
    });
        
    /* content */
    $('#tabs').tabs();
    
    /* share */
    $('.share').share({
        services:		['facebook', 'iwiw', 'google', 'twitter'],
        a_target:		'_blank'
    });
    $('.share a').click(function() {
        window.open($(this).attr('href'),'','width=800, height=600, toolbar=0, resizable=yes, scrollbars=yes');
        return false;
    });
    
});

function toggleSubmenu(element) {
    $(element)
        .toggleClass('h_menu_active')
        .find('ul.submenu, div.subNavContainer').fadeToggle();
}

