function menu(a){
	document.getElementById("mo"+a).style.background = "#8d0478";
	document.getElementById("mo"+a).style.color = "#fff";
	document.getElementById("mo"+a).href = "javascript:void(null)";
	document.getElementById("mo"+a).style.cursor = "default";
}
function submenu(a){
	document.getElementById("so"+a).style.background = "#757575";
	document.getElementById("so"+a).style.color = "#fff";
	document.getElementById("so"+a).href = "javascript:void(null)";
	document.getElementById("so"+a).style.cursor = "default";
}
var actual;
var vieja;
var smActual;
var smOld;
$(document).ready(function(){
						   
	$(".divMenuOfertas a").click(function () {	
		var orden = $(".divMenuOfertas a").index(this);
		vieja=actual;
		actual=orden;
		$("#mo"+actual).css({'background' : '#8d0478', 'color' : '#fff'});
		$("#sm_"+actual).animate({ 
			left: 153
		  }, 600 );
		if(vieja!=undefined&&vieja!=actual){
			$("#sm_"+vieja).animate({ 
				left: -28
			  }, 600 );
			$("#mo"+vieja).css({'background' : 'url(images/puntos_hori.gif) bottom repeat-x', 'color' : '#000'});	
		}
    });

	$(".divSubOfertas a:not(.pdf2)").click(function () {	
		var orden =$(".divSubOfertas a").index(this);
		smOld = smActual;
		smActual = orden;
		var page = $(this).attr("href");
		$.ajax({
			method: "get",	
			url: page,
			error: function(event, request, settings){
alert("Error requesting page " + settings.url );},
			beforeSend: function(){$("#cargador").html("<table width='25%' border='0' cellspacing='0' cellpadding='0' height='100'><tr><td align='center'>Cargando...</td></tr></table>");},
			success: function(html){ 
				$("#cargador").html(html);
			}
		 }); //close $.ajax	
		$("#so"+smActual).css({'background' : '#7f757b url(images/bg_sub_ofertas_on2.gif) 6px 4px no-repeat', 'color' : '#fff'});
		if(smOld!=undefined&&smOld!=smActual){
			$("#so"+smOld).css({'background' : 'url(images/puntos_hori.gif) bottom repeat-x', 'color' : '#000'});
		}
		return false;
    });

}); 