$(function() {
    //FAQ
	$(".accordion .faq-content").hide();
	$(".accordion h2").click(function(){
		$(this).next(".faq-content").slideToggle().siblings(".faq-content:visible").slideUp();
		$(this).toggleClass("active");
		$(this).siblings("h2").removeClass("active");
	});
/*
    $('#footer .logo').hover(function () {
            $('#logo-hover span').css('display','block');
        },function () {
            $('#logo-hover span').css('display','none');
        }
    );*/

    $('textarea.resizable:not(.processed)').each(function() {
        var textarea = $(this).addClass('processed'), staticOffset = null;

        // When wrapping the text area, work around an IE margin bug.  See:
        // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout
        $(this).wrap('<div class="resizable-textarea"><span></span></div>')
          .parent().append($('<div class="grippie"></div>').mousedown(startDrag));

        var grippie = $('div.grippie', $(this).parent())[0];
        grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px';

        function startDrag(e) {
          staticOffset = textarea.height() - mousePosition(e).y;
          textarea.css('opacity', 0.25);
          $(document).mousemove(performDrag).mouseup(endDrag);
          return false;
        }

        function performDrag(e) {
          textarea.height(Math.max(32, staticOffset + mousePosition(e).y) + 'px');
          return false;
        }

        function endDrag(e) {
          $(document).unbind("mousemove",performDrag);
          textarea.css('opacity', 1);
        }
    });
    /**
     * Return the dimensions of an element on the screen
     */
    dimensions = function (el) {
      return { width: el.offsetWidth, height: el.offsetHeight };
    };

    /**
     *  Returns the position of the mouse cursor based on the event object passed
     */
    mousePosition = function(e) {
      return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + document.documentElement.scrollTop };
    };

});
