jQuery(function($){ 
	/********/
	/* MENU */
	/********/
	$('.dropdown').css({ visibility : "visible", display : "none" }).each(function () {
		$(this).parent().eq(0).hover(function () {
			$('.dropdown:eq(0)', this).show(); // muestra dropdown menu
			$(this).find("a").eq(0).addClass('selected'); // mantiene el boton seleccionado
		}, function () {
			$('.dropdown:eq(0)', this).hide(); // esconde dropdown menu
			$(this).find("a").eq(0).removeClass('selected'); // deselecciona el boton seleccionado
		});
	});
	ajustaBarraLogo();
	
	$("#background-autos").fadeIn(1000);
	
	
	
	
	$("#contacto-btn,#wrap_asistente_btn,#padre_asistente_btn,#padre_asistente_btn2").fancybox(
 							{							 
								padding: 0,
								margin: 0,
								overlayColor: '#000000',
								overlayOpacity: '0.6',
								'width': 802, 
								'height': 592, 
								'autoScale': false, 
								scrolling: 'no',
								type: 'iframe',
								href: 'contacto/contacto/index.php'
							 
 	});//fancy
	
	
	
});

$(window).resize(function() {     
		ajustaBarraLogo();
});
function ajustaBarraLogo(){
	    // ajusta la barra del logo
	    var anchototal = $('#html').width();			
		var anchoMargen=  ((anchototal-990)/2);		
		if(anchoMargen>0)	
		  {
			$("#background-logo-repeat").css({width:anchoMargen});
			$("#background-autos").css({width:anchototal, 'margin-left':-(anchototal/2)});
		  }	
		if(anchoMargen<=0)	
		  {
			$("#background-logo-repeat").css({width:10});  
			$("#background-autos").css({width:1010,'margin-left':-505});
		  }	
	  
}
function abrirPruebaManejo()
{
	$.fancybox(
 							{							 
								padding: 0,
								margin: 0,
								overlayColor: '#000000',
								overlayOpacity: '0.6',
								'width': 795, 
								'height': 480, 
								'autoScale': false, 
								scrolling: 'no',
								type: 'iframe',
								href: 'contacto/prueba/index.php'
							 
 	});//fancy
} 
/*
* Funcion llamada desde el flash asesor para el envio de la respuesta
*/
function enviaAsesoria(nombre,mail,tel,concesionaria,tipo,edad,vacaciones,ambiente,civil,sexo,res)
{
	  $.ajax({
			  type: "POST",
			  url:  "asesor/send.php",
			  data: "nombre="+nombre+"&mail="+mail+"&tel="+tel+"&concesionaria="+concesionaria+"&tipo="+tipo+"&edad="+edad+"&vacaciones="+vacaciones+"&ambiente="+ambiente+"&civil="+civil+"&sexo="+sexo+"&res="+res,
			  async: false,		
			  success: function(datos){}//success: 
		 })
} 
