tb_pathToImage = "/wp-content/themes/top-frog/carrington-core/lightbox/img/loadingAnimation.gif";
jQuery(function($) {
	$("a.thickbox[href*=flickr.com]").each(function() {
		_this = $(this);
		_this.attr("title", _this.attr("title") + " <div id=\"tb-flickr-page\"><a href=\"" + _this.attr("href") + "\">View Flickr photo page</a></div>");
	});
	
	$('a.thickbox').each(function() {
		_this = $(this);
		link_img = _this.children('img');
		
		// stolen from thickbox code to sniff url type
		var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	    var urlType = link_img.attr('rel').toLowerCase().match(urlString);
		
		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){
			_this.attr('href', link_img.attr('rel'));
		}
	})

	// open all offsite links in a new window
	$('a:not([href*=' + window.location.protocol + '//' + window.location.host + '/])')
		.not('[href^=#]')
		.not('[href^=/]')
		.not('[href=""]')
		.not('.thickbox')
			.addClass('external')
			.click(function(){
				window.open(this.href); // pop a new window
				return false; // return false to keep the actual link click from actuating
	});	
	
	// slide toggle the allowed tags on the comment form
	$('abbr#allowed-tags-def').click(function(){
		$('p#allowed-tags').slideToggle();
	});
	
	// make a pretty search url
	$('#searchform').submit(function(){
		var s = $(this).find('input#s').val();
		var url = window.location.protocol + '//' + window.location.host + '/search/' + s + '/';
		window.location.href = url;
		return false;
	});
	
	$('.sociable').hover(function() {
			var _s = $('ul', this);
			_s.fadeTo('fast', 1.0);
		},
		function() {
			var _s = $('ul', this);
			_s.fadeTo('slow', 0.2);
	})
	.find('ul').fadeTo('fast', 0.2);

});
