//case study call to action
var hoveringOverCaption = false

var config = {    
     over: cs_over, // function = onMouseOver callback (REQUIRED)    
     timeout: 0, // number = milliseconds delay before onMouseOut    
     out: cs_out // function = onMouseOut callback (REQUIRED)    
};


$(".cs li a").hoverIntent( config );



function cs_out(){

		if (hoveringOverCaption==false){
			
			//$(".cs div.cs-caption").fadeOut();
			$(".cs div.cs-caption").hide();
		}
}		
		
		
function cs_over(){

	

	$(".cs div.cs-caption-top").removeClass("cs-tip-1");
	$(".cs div.cs-caption-top").removeClass("cs-tip-2");
	$(".cs div.cs-caption-top").removeClass("cs-tip-0");
			
	content =  $(this).next("div").html();
	
	var i = $(this).parent().index();
			
			
	$(".cs div.cs-caption-txt").html( content );
			
	
	
	
	cs_cp_position();
	
	//$(".cs div.cs-caption").fadeIn();
	$(".cs div.cs-caption").show();
	
	$(".cs div.cs-caption-top").addClass("cs-tip-"+i);
	
	

}

function cs_cp_position(){

	t = $(".cs ul").position().top ;
	l = $(".cs ul").position().left;
	h =  $(".cs ul").height();
	t=t+h;
	//trim
	l=l-12;
	t=t-16;
	$(".cs div.cs-caption").css({"top":t+"px","left":l+"px"});
	
}

function cs_cp_over(){
									
	$(this).show();
	hoveringOverCaption=true;
}

function cs_cp_out(){
									
	//$(this).fadeOut("slow");
	$(this).hide();
	hoveringOverCaption=false;
}



$(".cs div.cs-caption").hover(cs_cp_over,cs_cp_out)
								
		
		
$("#locationLinks a").hover( function(){
		$("#locationLinks .locationInfo").html("/ " + $(this).attr("title"));
		},
		function(){
		$("#locationLinks .locationInfo").html("/ Portal Sites");
		});

		
$(document).ready(function(){

	var cs_height=0;
	var orig_height = new Array();
	$("#caseStudy-dimensions li").each( 
		function(index){
			orig_height[index]=  $(this).height();
			if( $(this).height() > cs_height){
				cs_height = $(this).height();
				
			};
		}
	)
	
	$("#caseStudy-dimensions li").height(cs_height);
	$("#caseStudy-dimensions li a").each( 
						
		function(index){
			
			
				var ah = $(this).height();
				var ph = $(this).parent().height();
				var mh = Math.ceil((ph-ah) / 2);
				var nh = ph-mh-ah-1
				$(this).css('padding-top', mh);
					
				$(this).css( "padding-bottom",nh) ;
			
		}
	)

});	


$(document).ready(function(){
	
	$('#map_canvas_').hover( function(){
				i = $(this).attr("id");
				m = gMaps[i]
				
				$(this).addClass("mapEnlarge");
				$('.mapContainer .c2').hide();
				$('.mapContainer .c3').hide();
				google.maps.event.trigger(m, "resize");
				m.setZoom( m.getZoom() );
			


			},
			function(){
				$(this).removeClass("mapEnlarge");
				$('.mapContainer .c2').show();
				$('.mapContainer .c3').show();
			
			})

});		
