var DELAY_MENU = 400; //Minimo=300

function menuselection(){
	var thisurl = window.location.href;
	thisurl = thisurl.split("/");
	thisurl = thisurl[thisurl.length-1];
	switch(thisurl)
	{
		case "amigos.htm":
		case "equipos.htm":
		case "equipos_detail.htm":
		case "equipos_result.htm":
		case "planes.htm":
		case "planes_detail.htm":
		case "planes_result.htm":
		case "promociones.htm":
		case "roaming.htm":
		case "roaming_results.htm":
		case "servicios.htm":
		case "servicios_detail.htm":
			$("#menu ul li a.personas").addClass("overPersonas");
			break;
		case "empresas.htm":
			$("#menu ul li a.empresas").addClass("overEmpresas");
			break;
		case "mi_telcel.htm":
			$("#menu ul li a.mitelcel").addClass("overMitelcel");
			break;
	}
}
function sliderJquery_events(){
	$("#slider_events").easySlider({
		controlsBefore:	'<p id="controls1">',
		controlsAfter:	'</p>',		
		prevId: 'prevBtn_events',
		nextId: 'nextBtn_events'	
	});	
}
function sliderJquery_phones(){
	$("#slider_phones").easySlider({
		controlsBefore:	'<p id="controls2">',
		controlsAfter:	'</p>',	
		prevId: 'prevBtn_phones',
		nextId: 'nextBtn_phones'	
	});	
}
function sliderJquery_module(){
	$("#slider_module").easySlider({
		controlsBefore:	'<p id="controls3">',
		controlsAfter:	'</p>',		
		prevId: 'prevBtn_module',
		nextId: 'nextBtn_module'	
	});	
}
function sliderJquery_module2(){
	$("#slider_module2").easySlider({
		controlsBefore:	'<p id="controls4">',
		controlsAfter:	'</p>',		
		prevId: 'prevBtn_module2',
		nextId: 'nextBtn_module2'	
	});	
}
function mainmenu()
{	
	var config = {    
     over: function(){		 
		$(this).find('ul:first').show();
	 },     
     timeout: DELAY_MENU,  
     interval: DELAY_MENU-250,
     sensitivity: 5,
     out: function(){		 		 		 
		 $(this).find('ul:first').hide();
     }    
	};

	$("#menu li").hoverIntent(config);
	
	
	//$("#menu li").hover(
	//function(){;
		//$("a:first",this).addClass("over");
		//$(this).find('ul:first').show();			
	//},		
	//function(){
		//$("a:first",this).removeClass("over");		
		//$(this).find('ul:first').hide();			
	//}	
	//);	
	
	menuselection();
}

function showOtrosSitios(){
	$(this).children("ul").show();
}
function hideOtrosSitios(){
	$(this).children("ul").hide();
}
function roundedModules(selector){
	$(selector).wrapInner("<div class=\"vBorder\"></div>");
	$(selector).prepend("<div class=\"vBorderTop\"><div class=\"vBorderLeft\"></div><div class=\"vBorderRight\"></div><div class=\"clear\"></div></div>");
	$(selector).append("<div class=\"vBorderBottom\"><div class=\"vBorderLeft\"></div><div class=\"vBorderRight\"></div><div class=\"clear\"></div></div>");
}
$(document).ready(function(){	
	sliderJquery_phones();
	sliderJquery_module();
	sliderJquery_module2();
	mainmenu();
	$("#header_menu li.first").hover(showOtrosSitios,hideOtrosSitios);
	$(".tooltip").tooltip({
		cssClass: "tooltip-1",
		delay : 0,
		xOffset : 15,
		yOffset : -45,
		opacity : 0,
		fadeDuration: 200 
	});
	roundedModules(".module_in:not(.no_border)");
});

