var onoff = 0;
var tippycon = "click for details";

$(document).ready(function() {

jQuery(function( $ ){
	$.localScroll.defaults.axis = 'xy';
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#content', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#content', // could be a selector or a jQuery object too.
		queue:true,
		duration:2000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
  

  // content show/hide
//  $("h2").click(function(event){
  $(".questions").click(function(event){
    if ( onoff === 1 ) {
      $("p.peekaboo").slideUp();
      onoff = 0;
    } else {
      $("p.peekaboo").show("slow");
      onoff = 1;
    }
  }); // end content show/hide function  
  // tooltips to let them know to click the titles
//  $('#container h2[tooltip]').each(function() {
  $('.questions').each(function() {
    $(this).qtip({
      // content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
      content: tippycon,
      style: {
        width: 160,
        background: 'white',
        color: '#616161',
        border: {
          width: 3,
          radius: 10,
          color: 'black'
        },
        tip: 'bottomLeft',
        name: 'dark'
      },
      position: {
        corner: {
          target: 'topMiddle',
          tooltip: 'bottomMiddle'
        } // end corner
      }, // end position
      api: {
        onHide: function() {
          if (onoff === 0) {
            tippycon = "click for details";
          } else {
            tippycon = "click to collapse";
          }
          this.updateContent( tippycon );
        }
      }
    }); //end qtip
  }); // end tooltip function
}); // end of jquery init
}); // END DOCUMENT READY (MAIN)

