jQuery(document).ready(function(){
	jQuery('#comment-email').blur(function(){
		if(jQuery(this).attr('value')!=''){
			jQuery.ajax({
				type: "POST",
				url: ajaxurl,
				data: "action=get_gravatar&email="+jQuery(this).attr('value'),
				success: function(result){
					if(result==0){
						jQuery('#gravatar-preview').empty().append('\
						<div id="no-gravatar">\
							<img src="'+template_url+'/images/no-gravatar.png" /> \
							<div class="add_button"><a href="http://en.gravatar.com/site/signup/" class="button" target="_blank">Need a Gravatar?</a></div> \
						</div>\
						');
					} else {
						jQuery('#gravatar-preview').empty().append('\
						<div id="the-gravatar">\
							<img src="'+result+'" /> \
						</div>\
						');
					}
				}
			});
		}
	});
	jQuery('.thumbpopup li').mouseenter(function(){
		var no=jQuery(this).index(),posleft,postop,pos=jQuery(this).position(),desc=jQuery(this).find('.description');
		if(no==0){
			posleft=pos.left-13; postop=pos.top+70;
		} else {
			posleft=pos.left-99; postop=pos.top+70;
		}
		desc.css({
			'position':'absolute',
			'left':posleft+'px',
			'top':postop+'px'
		}).fadeIn();
	}).mouseleave(function(){
		jQuery(this).find('.description').fadeOut();
	});
	
	
	jQuery('.portfolio-container').hover(function(){
		var jthis=jQuery(this);
		jQuery('.opacity',jthis).animate({'opacity':'.7'},'fast');
		jQuery('.pv_title',jthis).animate({'top':'0px'},'fast',function(){});
		jQuery('.pv_description .description',jthis).animate({'bottom':'0px'},'fast');
	},function(){
		var jthis=jQuery(this);
		jQuery('.pv_title',jthis).animate({'top':'-24%'},'fast',function(){});
		jQuery('.pv_description .description',jthis).animate({'bottom':'-25%'},'fast');
		jQuery('.opacity',jthis).animate({'opacity':'0'},'fast');
	});

});
