<!--//---------------------------------+
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
function carrega(){
	verLink('index2.asp');
	clicked_menu_head = $('#header1');
	var speed = 1;
	if (clicked_menu_head.next().is(':visible')) {
		clicked_menu_head.next().slideUp();
		clicked_menu_head.css({background:"url(images\vazio.jpg)"});
		clicked_menu_head.css({color:"#CCCCCC"});
	}

	// if clicked menu head is submenu, check if there are any submenus in it, then hide
	clicked_menu_head.next().find('p.menu_head').each(function () {
		$(this).next().slideUp(speed);
		$(this).css({background:"url(images\vazio.jpg)"});
		$(this).css({color:"#CCCCCC"});
	});

	parent_menu_head = clicked_menu_head.parents('div.menu_body').prev(clicked_menu_head.parents('div.menu_body').size()-1);

	if (clicked_menu_head.next('div.menu_body').is(':visible')){
	
	} else {
			clicked_menu_head.css({background:"url(images/botao1.jpg) no-repeat"}).next('div.menu_body').slideDown(speed);
			clicked_menu_head.css({color:"#333333"});
	}


	$('#firstpane').children('p').siblings('p').each(function() {
		// loop through each main menu, if not equal, hide all sub menu
		if (parent_menu_head.attr('id')) {
			if (parent_menu_head.attr('id') != $(this).attr('id')) {
				$(this).children('div.menu_body').slideUp(speed)
				$(this).css({color:"#CCCCCC"});		
			}
		} else {
			if (clicked_menu_head.attr('id') != $(this).attr('id')) {
				$(this).css({background:"url(images\vazio.jpg)"})
				$(this).css({color:"#CCCCCC"})
				
				$(this).next().slideUp(speed).find('p.menu_head').each(function() {
					$(this).next().slideUp(speed);
					$(this).css({color:"#CCCCCC"})
				});
			}
		}
	});
	
	
}


$(document).ready(function() {
						   
	$('.menu_head').click(function() {
		var clicked_menu_head;
		var speed = 1;
		clicked_menu_head = $(this);
		if (clicked_menu_head.next().is(':visible')) {
			clicked_menu_head.next().slideUp();
			clicked_menu_head.css({background:"url(images\vazio.jpg)"});
			clicked_menu_head.css({color:"#CCCCCC"});
		}
 
		// if clicked menu head is submenu, check if there are any submenus in it, then hide
		clicked_menu_head.next().find('p.menu_head').each(function () {
			$(this).next().slideUp(speed);
			$(this).css({background:"url(images\vazio.jpg)"});
			$(this).css({color:"#CCCCCC"});
		});
 
		parent_menu_head = clicked_menu_head.parents('div.menu_body').prev(clicked_menu_head.parents('div.menu_body').size()-1);
 
		if (clicked_menu_head.next('div.menu_body').is(':visible')){
		
		} else {
			if(clicked_menu_head.attr('id')=="submenu2"){
				clicked_menu_head.css({background:"url(images/botao2.jpg) 20 5 no-repeat"}).next('div.menu_body').slideDown(speed);
				clicked_menu_head.css({color:"#333333"});
			}
			else{
				clicked_menu_head.css({background:"url(images/botao1.jpg) no-repeat"}).next('div.menu_body').slideDown(speed);
				clicked_menu_head.css({color:"#333333"});
			}
		}
 
 
		$('#firstpane').children('p').siblings('p').each(function() {
			// loop through each main menu, if not equal, hide all sub menu
			if (parent_menu_head.attr('id')) {
				if (parent_menu_head.attr('id') != $(this).attr('id')) {
					$(this).children('div.menu_body').slideUp(speed)
					$(this).css({color:"#CCCCCC"});		
				}
			} else {
				if (clicked_menu_head.attr('id') != $(this).attr('id')) {
					$(this).css({background:"url(images\vazio.jpg)"})
					$(this).css({color:"#CCCCCC"})
					
					$(this).next().slideUp(speed).find('p.menu_head').each(function() {
						$(this).next().slideUp(speed);
						$(this).css({color:"#CCCCCC"})
					});
				}
			}
		});
	});
});	
