/*  variable que controla si esta algun boton marcado para que al estar dentro de una seccion que tiene que aparecer como selecionada no se quite la seleccion al pasar x encima */
var seleccionado=0;


/*  al apuntar sobre los botones de la cambecera */
	$('#servicios').mouseenter(function cabEnter(){
		$('#submenuServicios').css ({'display' : 'block'});
		if ($(this).attr("src")=="/asp/plantillas/imagenes/pymes/cabnew_servicios2.gif")
			seleccionado=1;
		else
			{
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_servicios2.gif")
			seleccionado=0;
			}
		
	});
	$('#congresos').mouseenter(function cabEnter(){
		$('#submenuCongresos').css ({'display' : 'block'});
		if ($(this).attr("src")=="/asp/plantillas/imagenes/pymes/cabnew_congresos2.gif")
			seleccionado=1;
		else
		{
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_congresos2.gif")
			seleccionado=0;
		}
	});
	
	$('#incentivos').mouseenter(function cabEnter(){
		$('#submenuIncentivos').css ({'display' : 'block'});
		if ($(this).attr("src")=="/asp/plantillas/imagenes/pymes/cabnew_incentivos2.gif")
			seleccionado=1;
		else
		{
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_incentivos2.gif")
			seleccionado=0;
		}
	});
	
	$('#eventosdeportivos').mouseenter(function cabEnter(){
		$('#submenuEventosdeportivos').css ({'display' : 'block'});
		if ($(this).attr("src")=="/asp/plantillas/imagenes/pymes/cabnew_eventosdeportivos2.gif")
			seleccionado=1;
		else
		{
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_eventosdeportivos2.gif")
			seleccionado=0;
		}
	});
	
	$('#efactura').mouseenter(function cabEnter(){
		$('#submenuEfactura').css ({'display' : 'block'});
		if ($(this).attr("src")=="/asp/plantillas/imagenes/pymes/cabnew_servicios2.gif")
			seleccionado=1;
		else
		{
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_efactura2.gif")
			seleccionado=0;
		}
	});
	

/*  al  apuntar fuera de los botones de la cabecera*/
	$('#servicios').mouseleave(function cabLeave(){
		$('#submenuServicios').css ({'display' : 'none'});
		if (seleccionado==0)
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_servicios.gif")
	});
	
	$('#congresos').mouseleave(function cabLeave(){
		$('#submenuCongresos').css ({'display' : 'none'});
		if (seleccionado==0)
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_congresos.gif")
	});
	
	$('#incentivos').mouseleave(function cabLeave(){
		$('#submenuIncentivos').css ({'display' : 'none'});
		if (seleccionado==0)
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_incentivos.gif")
	});
	
	$('#eventosdeportivos').mouseleave(function cabLeave(){
		$('#submenuEventosdeportivos').css ({'display' : 'none'});
		if (seleccionado==0)
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_eventosdeportivos.gif")
	});
	
	$('#efactura').mouseleave(function cabLeave(){
		$('#submenuEfactura').css ({'display' : 'none'});
		if (seleccionado==0)
			$(this).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_efactura.gif")
	});

/*  al desplazarte sobre el submenu*/	
	
	$('.submenu li').mouseenter(function cabEnter(){
		var lista=$(this).parent().parent().parent();
		var imagen=$('a',lista);
		var ident=$('img',imagen).attr("id");
 		$('img',imagen).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_" + ident + "2.gif");
		$(this).parent().parent().css ({'display' : 'block'});
		$(this).css({'background':'#cccccc'});
		$(this).css({'color':'#ffffff'});
	});
	
	$('.submenu li').mouseleave(function cabLeave(){
		var lista=$(this).parent().parent().parent();
		var imagen=$('a',lista);
		var ident=$('img',imagen).attr("id");
		$(this).parent().parent().css ({'display' : 'none'});
		$(this).css({'background':'#edecec'});
		$(this).css({'color':'#007c51'});
 		if (seleccionado==0)
			$('img',imagen).attr("src", "/asp/plantillas/imagenes/pymes/cabnew_" + ident + ".gif");
	});
	

