var GB = {
	text_labels: function(){
		//to automatically erase text in a search field
		$('input[type=text], textarea').each(function(){
			var $input = $(this);
			if(!$input.attr('placeholder'))
				$input.attr('placeholder', this.value);
			$input.focus(function(){
				if(this.value == $input.attr('placeholder'))
				this.value = '';
				$input.addClass('focus');
			});
			$input.blur(function(){
				if(this.value == '')
				this.value = $input.attr('placeholder');
			$input.removeClass('focus'); 
			});
		});
	},
	close_overlay: function(){
		$('#contactOverlay, #overlay_container, #overlay').remove();
		return false
	}
};

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

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

*/

     $('.widget .toggleButton').click(function(){
   
      $(this).parent().find('h4').toggleClass('open');
     $(this).parent().find('.articleResults').toggleClass('hide');
       return false;
    });
	 



    //to automatically erase text in a search field
	GB.text_labels()
    
	$('#contactOverlay, .close_overlay, #overlay').live('click',function(){
		GB.close_overlay();
		return false
	});

});
