var GB = {
	text_labels: function (){
    $('#siteSearch, #registerForm').find('input[type=text], textarea').each(function () {
      if (!this.placeholder) {
        this.placeholder = this.value;
      }

      $(this).focus(function () {
        if (this.placeholder === this.value) {
          this.value = '';
        }
      });

      $(this).blur(function () {
        if (!this.value) {
          this.value = this.placeholder;
        }
      })
		});
	},

	close_overlay: function (){
		$('#contactOverlay, #overlay_container, #overlay').remove();
		return false
	}
};


$(function (){
	//$('.module').mouseover(function (){ $(this).addClass('hover') });
	//$('.module').mouseout(function (){ $(this).removeClass('hover') });

	$('.botWidget').click(function (){
		var $div = $(this.parentNode);

		if ($div.hasClass('open'))
		{
			$div.removeClass('open');
		}
		else if (!$div.hasClass('open'))
		{
			$div.addClass('open');
		}
	});

	$('#subNav h2').click(function (){
		var $div = $(this.parentNode);
		if ($div.hasClass('open'))
		{
			$div.removeClass('open')
		}
		else {
			$(this.parentNode.parentNode).find('.open').removeClass('open');
			$(this.parentNode).addClass('open');
		}
	});

	$('p.fullbioLink a').click(function (){
		$('.fullbioLink').toggleClass('hide');
		return false
	});

	//to automatically erase text in a search field
	GB.text_labels()

	//cycle through li's
		//find active
		//keep track of position
		//match with image in same position
		//remove
		// add active class to image

	$('#thumbNails img').click(function (){
		$('#thumbNails li.active, #bigImage img.active').removeClass('active');
		$(this.parentNode).addClass('active');

		var count = 0;
		$('#thumbNails li').each(function (){
			if ($(this).hasClass('active'))
				$('#bigImage img:eq('+count+')').addClass('active');
			count++;
		});
	});

	$('#contactOverlay, .close_overlay, #overlay').live('click',function (){
		GB.close_overlay();
		return false
	});

});




