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 (){
    //to automatically erase text in a search field
	GB.text_labels()
	$('#rightCol').css('min-height',$('#leftCol').height());

 	$('.mainImagesNumbers li').click(function (){
		$('.mainImagesNumbers li.active, .mainSponImages li.active').removeClass('active');
		$(this).addClass('active');

		var count = 0;
		$('.mainImagesNumbers li').each(function (){
			if ($(this).hasClass('active'))
				$('.mainSponImages li:eq('+count+')').addClass('active');
			count++;
		});
	});


     $('p.shortLong .viewFull').click(function (){
         $('.shortLong').toggleClass('show');
         return false;
    });
    
    $("div.content p a").click(function(){
    	var curid = $(this).attr('id');
    	$('div.practice-areas-narrative').hide();
    	$('div#box'+curid).fadeIn('fast');
    	return false;	
    });
    $("div.practice-areas-narrative").hide();
	$("div.collapsible").prepend('<div class="toggle"></div>');
    $("div.collapsible .toggle").click(function() {
    	$("div.practice-areas-narrative").hide();
    	$("div.content").slideToggle();
    	$("div.content2").slideToggle();
		$("div.toggle").toggleClass('closed');
		/*
curBackground = $(this).css('background-position');
		alert(curBackground);
		if(curBackground == "410px 7px"){
			curBackground = "410px -40px";
		} else {
			curBackground = "410px 7px";
		}
*/

    });

});

function viewAllCaseStudies(){
	$("li.hiddenCase").removeClass("hiddenCase");
	$("a.viewFull").hide();
}

function viewAllPros(){
	$("li.hiddenPro").removeClass("hiddenPro");
	$("a.viewPros").hide();
}

