jQuery(document).ready(
	function() {
		var $ = jQuery;
        
        $('.directory_info').hide();
        //the beloved close buttom
        
            $('<div id="close" class="close"><img title="Cierra Recuadro" src="/iberius-theme/images/custom/close_button.gif"></div>')
            .css({cursor:'pointer',
                  float:'right',
                  width:'40px',
                  height:'40px'
            })
            .click(function(){
                $('.directory_info').fadeOut(1000);
                return false;
            })
            .prependTo('.directory_data')
            

        $('.directorio_paises_wrapper span').click( function(){
			$('.directorio_paises_wrapper span')
            .css({border:"none"});
			var $this = $(this);
			$this.css({border:"1px solid #a58686"});
			var pais = $this.attr("rel");
			var $divPais = "#"+pais+"_NonFilteredList_WAR_es_";
			var isHidden = $($divPais).is(':hidden');
			if(isHidden){
			$('.directory_info').fadeOut(400);
			$($divPais).show(1600);
			}else {$($divPais).fadeOut(1000);
			$this.css({border:"none"});
			       $.end();}
        })

        //show hide country names
        $(".directory_flags .nombre_pais").hide();

        $('.directory_flags').hoverIntent(
				{
					interval: 25,
					timeout: 0,
					over: function () {
					$(this).css({width: "700px",color:'#555'});
                    $(".directory_flags .nombre_pais").fadeIn(1500);
					},
					out: function (){
					$(this).css({width: "320px"});
                    $(".directory_flags .nombre_pais").hide();
					}

				}

		);
    });

