$(document).ready(function(){

$("#avanza").click(function(){avanzaimagen();});
$("#retrocede").click(function(){retrocedeimagen();});

$(".col_mainb").find('form').hide();

	$("#mundial").hover(function(){ 
		$("#lc").val(1);
		$("#divchilena").hide();
		$("#divbbva").hide();
		$("#divmundial").show();
		$("#slidercontainer").css('height','200px');
		setTimeout (  $("#slider").css({'left':'63px','width':'828px', 'height':'160px' }).slideDown('fast'),  800  ); 
	}, function(){
		$("#lc").val(0);
	});
	
	$("#ligachilena").hover(function(){ 
		$("#lc").val(1);
		$("#divbbva").hide();
		$("#divmundial").hide();
		$("#divchilena").show();
		$("#slidercontainer").css('height','200px');
		setTimeout (  $("#slider").css({'left':'185px','width':'644px','height':'130px' }).slideDown('fast'),  800  ); 
	}, function(){
		$("#lc").val(0);
	});
	$("#ligabbva").hover(function(){ 
		$("#lc").val(1);
		$("#divchilena").hide();
		$("#divmundial").hide();
		$("#divbbva").show();
		$("#slidercontainer").css('height','200px');
		setTimeout (  $("#slider").css({'left':'287px','width':'644px','height':'130px' }).slideDown('fast'),  800  ); 
	}, function(){
        $("#lc").val(0);
	});

	$("#slider").hover(function(){ 
		$("#lc").val(1);
	}, function(){
		$("#lc").val(0);
	});

	
	
	
       $('#btn_linkref').focus(function()
               {
                               $(this).select();
                      
               });
  
});



jQuery.fn.dropDown = function() {
  return this.each(function() {
	
	  jQuery(this).children('li').each(function(i) {
		  var item = jQuery(this);
		  if(item.hasClass('active')) {
			  item.parent().css('top', -1 * i * 24);
			
			  item.click(function() {
			    if(item.parent().hasClass('open')) {
			      jQuery(document).trigger('click');
			      return;
			    }	

				  jQuery(this).parent().children('li').not('li.active').css({'visibility':'visible', 'height':'23px'});
				  //jQuery(this).parent().children('li.active').addClass('opened');
				  jQuery(this).parent().addClass('open');
			  });
			
		  } else {
			  item.css('visibility', 'hidden');
		  }
	  });
		
	  jQuery(this).parent().click(function(e) {
		  e.stopPropagation();
	  });
		
	  var ref = jQuery(this);

	  jQuery(document).click(function() {
		  ref.children('li').not('li.active').css({'visibility': 'hidden', 'height':'1px'});
		  ref.removeClass('open');
	  });	

  	jQuery(this).trigger('mouseleave');
  	
  });
};


