﻿var $S = jQuery.noConflict();


$S(function() // Register the menu
{
    // Add the click event handler on the list item with sub list
    $S('#mymenu li:has(ul)').load(
function(event) {
    if (this == event.target) {
        // Hide all the children of the other lists
        $S('#mymenu li:has(ul)').children().slideUp();
        // Make the animation
        //$(this).children().animate({height:'toggle'},'fast');
        $S(this).children().slideToggle();
    }
    return true;
}
)
    // Change the cusrsor.
//.css({ cursor: 'pointer' })
    // Hide all the nested lists (on the first tinm only).
.children().hide();


    $S('#mymenu li:has(ul)').click(
function(event) {
    if (this == event.target) {
        // Hide all the children of the other lists

        $S('#mymenu li:has(ul)').children().slideUp();
        $S('#mymenu li').removeClass('active');
        // Make the animation
        //$(this).children().animate({height:'toggle'},'fast');
        if ($S(this).children().is(":visible")) {
            $S(this).children().slideUp();
        }
        else {
         
            $S(this).addClass('active');
            $S(this).children().slideDown();
        }
    }
    return true;
}
)

}
);

// Second navigation 

$S(function() // Register the menu
{
    // Add the click event handler on the list item with sub list
    $S('#mymenu1 li:has(ul)').load(
function(event) {
    if (this == event.target) {
        // Hide all the children of the other lists
        $S('#mymenu1 li:has(ul)').children().slideUp();
        // Make the animation
        //$(this).children().animate({height:'toggle'},'fast');
        $S(this).children().slideToggle();
    }
    return true;
}
)
    // Change the cusrsor.
//.css({ cursor: 'pointer' })
    // Hide all the nested lists (on the first tinm only).
.children().hide();


    $S('#mymenu1 li:has(ul)').click(
function(event) {
    if (this == event.target) {
        // Hide all the children of the other lists

        $S('#mymenu1 li:has(ul)').children().slideUp();
        $S('#mymenu1 li').removeClass('active');
        // Make the animation
        //$(this).children().animate({height:'toggle'},'fast');
        if ($S(this).children().is(":visible")) {
            $S(this).children().slideUp();
        }
        else {
         
            $S(this).addClass('active');
            $S(this).children().slideDown();
        }
    }
    return true;
}
)

}
);


