$(document).ready(function () {
        var $div = $('#loc1');
        var height = $('#loc2').height();
        $('#loc3').hide();
        //$('#loc2').hide().css({ height : 0 });
        $("#loc1").text('ocultar');
        //$('#desplegar').text('');
        $("#desplegar").mouseover(function() {
            $('#desplegar').text('Ocultar localización');
        });
        $("#desplegar").mouseout(function() {
            $('#desplegar').text('');
        });
        //$('#desplegar').css("background-image", "url(wp-content/themes/UXlearn/images/replegar.jpg)");
        
    
        $('#loc1').click(function () {
            if ($('#loc2').is(':visible')) {
                $('#loc2').animate({ height: 0 }, { duration: 500, complete: function () {
                    $('#loc2').hide();     
                } });
                $('#loc3').show('1500');
                $("#loc1").text('mostrar');
                $('#desplegar').css("background-image", "url(http://www.uxlearn.com/wp-content/themes/UXlearn/images/replegar_hover.jpg)");
                $('#desplegar').text('');
                $("#desplegar").mouseover(function() {
                    $('#desplegar').text('Mostrar localización');
                });
            } else {
                $('#loc3').hide();
                $("#loc1").text('ocultar');
                $('#loc2').show().animate({ height : height }, { duration: 500 });
                $('#desplegar').css("background-image", "url(http://www.uxlearn.com/wp-content/themes/UXlearn/images/replegar_hover.jpg)");
                $('#desplegar').text('');
                $("#desplegar").mouseover(function() {
                    $('#desplegar').text('Ocultar localización');
                });
            }
            
            return false;
        });
        $('#desplegar').click(function () {
            if ($('#loc2').is(':visible')) {
                $('#loc2').animate({ height: 0 }, { duration: 500, complete: function () {
                    $('#loc2').hide();
                    
                } });
                $('#loc3').show('1500');
                $("#loc1").text('mostrar');
                $('#desplegar').css("background-image", "url(http://www.uxlearn.com/wp-content/themes/UXlearn/images/replegar_hover.jpg)");
                $('#desplegar').text('Mostrar localización');
                $("#desplegar").mouseover(function() {
                    $('#desplegar').text('Mostrar localización');
                });
            } else {
                $('#loc3').hide();
                $("#loc1").text('ocultar');
                $('#loc2').show().animate({ height : height }, { duration: 500 });
                $('#desplegar').css("background-image", "url(http://www.uxlearn.com/wp-content/themes/UXlearn/images/replegar_hover.jpg)");
                $('#desplegar').text('Ocultar localizacion');
                $("#desplegar").mouseover(function() {
                    $('#desplegar').text('Ocultar localización');
                });
            }
            
            return false;
        });


        /*$('#desplegar').qtip(
            {
                content: 'Ocultar localización',
                position: { adjust: { x: -198, y: -34 } },
                show: 'mouseover',
                hide: 'mouseout',
                fixPng: true,
                show: { delay: 0, effect: { type: 'fade', length: 0 } },
                style: { 
                  width: 165,
                  height: 17,
                  paddingTop: 8,
                  paddingLeft: 15,
                  background: 'url(wp-content/themes/UXlearn/images/bgtooltip.png)',
                  color: 'white',
                  textAlign: 'left',
                  border: {
                     width: 0,
                     radius: 0
                  }
               }
        });        */
    });

