//Tooltip
$(window).load(function () {
	$("#photos .entry").each(function(){
		var imgCenter = ($(this).height() - $(this).find('img').height()) / 2;
		$(this).find("a").css({
			width: $(this).find('img').width()+2
		});
		$(this).find(".image").css({
			width: $(this).find('img').width()+10,
			height: $(this).find('img').height()+10,
			marginTop:imgCenter + "px"
		});
		
		$(this).find(".image").hover(function(){
			$(this).find(".toolTip").css({
				display: "block",
				top: -$(this).find(".toolTip").height() + imgCenter - 15
			});
			
		}, function() {
			$(this).find(".toolTip").css("display", "none");
		});
	});
	
	// Fixes if hovered over the info div
	$("#photos .entry .image .toolTip").mouseover(function () {
			$(this).css("display", "none");													  
	  });				 
	
	/*$("#photos .entry").each(function(){							  
		$(this).find(".image").hover(function(){
			$(this).find(".toolTip").css({
				display: "block",
				top: -$(this).find(".toolTip").height()  - 15
			});
			
		}, function() {
			$(this).find(".toolTip").css("display", "none");
		});
	});
	
	// Fixes if hovered over the info div
	$("#photos .entry .image .toolTip").mouseover(function () {
			$(this).css("display", "none");													  
	  });
	
	var imgWidth = $("#photos .entry .image img").width()+8;
	$("#photos .entry .image").css({
		width: imgWidth
	});
	var imgWidth = $("#tourPhotos .entry h3 img").width()+8;
	$("#tourPhotos .entry h3").css({
		width: imgWidth
	});*/
});

//Nav active styles.
$(document).ready(function() {
	if (document.title == "The Rocket Summer Official Website :: Photos") 
	{
		$("#photosHeader li.allPhotos a").css("background-position", "0 -25px");	
	}
	else if (document.title == "The Rocket Summer Official Website :: Photos | By Album")
	{
		$("#photosHeader li.byAlbum a").css("background-position", "-173px -25px");	
	}
	else if (document.title == "The Rocket Summer Official Website :: Photos | By Popularity")
	{
		$("#photosHeader li.byPopularity a").css("background-position", "-322px -25px");	
	}
	
	//Populate the album title into the tool tips.
	$('.toolTip h3 em').each(function() {
		$(this).append($('.folderTitle').text());
	});
	
	
	/*//Make the Album breadcrumb functional in photo single.
	if ($('a.albumTitle').length != 0) { //Check to make sure the a.albumTitle element exists before running script.
	
		var x = window.location.href; //Get full URL.
	
		var y = x.split("/"); // Split url at the /'s.
		var z = y[3].split("&"); //Take the tail end of the URL and split it at the &'s.
	
		var gid = z[2]; //Grab the gid.
		
		var phidCheck = gid.search("phid");  //Checks if the variable gid accidentally contains the phid.  If it doesn't, it picks a different chunk.
		if (!phidCheck) {
			var gid = z[1];	
		}
	
		var a = z[0].split("?"); //splits the remaining url to find the fid.
		var fid = a[1];
		var galleryLink = "gallery.aspx?" + fid + "&" + gid;  //Assemble the new url.
		//alert(galleryLink);
		
		$('a.albumTitle').attr('href', galleryLink);  //Assign to photo.aspx
	}*/
});