/* funzioni menu */

var menu_timeout;

$(document).ready( function() {

	$('#accordion-orange li div:not(a.has-child)').click(function() {
		
		var el = this;
		$('#accordion-orange li div:has(a.menu-open)').each( function() {
			if (this != el) {
				$(this).animate({ height: "34px" });
				$('a.has-child', this).removeClass('menu-open');
			}
		});
		
		
		var el_len = $('li', this).length;
		if (el_len > 0) {
			var newh = (el_len * 24) + 60;
			$(el).animate({ height: newh+"px" });
			$('a.has-child', el).addClass('menu-open');
		}
		
	})/*.bind( 'mouseleave', function() {
		clearTimeout(menu_timeout);
		var el = this;
		setTimeout(function() {
			$(el).animate({ height: "34px" });
			$('a.has-child', el).removeClass('menu-open');
		}, 300 );
		
	})*/;
	
	$('.ibox-username').focus( function() {
		$('.inputbox-username-c').removeClass('inputbox-username');
	}). blur( function() {
		if ($(this).val() == '') {
			$('.inputbox-username-c').addClass('inputbox-username');
		}
	});
	
	$('.ibox-password').focus( function() {
		$('.inputbox-password-c').removeClass('inputbox-password');
	}).blur( function() {
		if ($(this).val() == '') {
			$('.inputbox-password-c').addClass('inputbox-password');
		}
	});
	
});