


jQuery.preloadImages = function() {
  for(var i = 0; i<arguments.length; i++) {
    jQuery("<img>").attr("src", arguments[i]);
  }
}


jQuery.preloadImages("/images/menu-residencial-bottom-bg.jpg", "/images/menu-empresarial-bottom-bg.jpg", "/images/menu-movil-bottom-bg.jpg", "/images/menu-tv-bottom-bg.jpg");




jQuery(document).ready(function(){

   jQuery("#header ul.menu li a").mouseenter(function(){
        jQuery(this).next().slideDown("slow");

        jQuery(this).addClass("active");
        jQuery(this).next().children("ul").addClass("active");
        
        // Asignarle un alto fijo al UL  
           var losLis = jQuery(this).next().children().children("li").length;
           var elAltura = (34 * losLis);
           jQuery(this).next().children("ul").css({ "height": "" + elAltura + "px" });
   });
   
   
   
   jQuery("#header ul li").mouseleave(function(){
        
       jQuery(this).children("div").slideUp("slow", function () {
            jQuery(this).siblings("a").removeClass("active"); /* Para que haga el cambio despues de esconder el submenu */
       });

   });

		
			
			
   if ( jQuery('#accordion1').length ) {
   
       jQuery('#accordion1').accordion({
			autoheight: false,
			active: '.selected',
			event: 'mouseover',
			header: '.head'

		});

   }
   
   
   
   if ( jQuery('#accordion2').length ) {
   
       jQuery('#accordion2').accordion({
			active: '.selected',
			header: '.head'

		});

   }   
   
   
   
  if ( jQuery('#tabs').length ) {
   
  jQuery('#tabs').tabs(); 
  if(document.location.hash!='') {
        //get the index from URL hash
      	tabSelect = document.location.hash.substr(1,document.location.hash.length);
	jQuery("#tabs").tabs('select',tabSelect-1);
	}
  
  }
  
  
  
  
  
}); // document.ready


