myMenu = {
    toggle : function(obj) {
        try {
            var parent = obj.parentNode;
            if (parent.className.match('opened')) {
                parent.className = parent.className.replace(/opened/, 'closed');
                obj.innerHTML = obj.innerHTML.replace(/\−/, '+');
            } else if (parent.className.match('closed')) {
                parent.className = parent.className.replace(/closed/, 'opened');
                obj.innerHTML = obj.innerHTML.replace(/\+/, '−');
            }
        } catch (e) {
        }
        return false;
    }
};

$(document).ready(function(){
    //nothing to do with menu's, but since this is the only outside javascript we need, we put it here'
    $('#q').focus(function(){
        $(this).val('');
    });
    /**
     * handling of tree menu
     */

    if (location.href.indexOf('contact') > 0) {
        $('#sidebar-menu ul li').each(function(){
            var curlink = $(this).find('a');
            var curpage = curlink.attr('href');
            if (curpage.indexOf('contact') > 0) {
                curlink.addClass('activepage');
                curlink.text(curlink.text() + " »");
            }
        });
    }
    /**
     * handling of print page
     */
    $('#top-menu a').click(function(){
        var url = $(this).attr('href');
//        var content,sidebar;
        if (url.indexOf('print')>0) {
            window.print();
            return false;
//            $('link').each(function(){
//                var curlink = $(this).attr('href');
//                if (curlink.indexOf('content')> 0) {
//                    content = $(this);
//                }
//                if (curlink.indexOf('sidebar') > 0) {
//                    sidebar = $(this);
//                }
//            });
//            content.attr('href','/layout/css/print.css');
//            sidebar.attr('href','');
//            return false;
        }
    });

    $('a.link-download img').hover(function(){
        $(this).attr('src','/layout/icon/download_over.png');
    },function(){
        $(this).attr('src','/layout/icon/download.png');
    });

    $('.required').append('<span style="color:red">&nbsp;*</span>');

});

