$(function() {
	$("article.post").hover(function() {
        	$(this).find("div.meta-social a").css({'opacity':0,'visibility':'visible'}).animate({opacity:1});
    	}, function() {
        	$(this).find("div.meta-social a").animate({opacity:0}, function(){
            	$(this).css({'visibility':'hidden'});
        	});
    	});
});

//

var newWin = null;  
function popUp(strURL, strType) {
	
	var left = (screen.width/2)-(550/2);
	var top = (screen.height/2)-(450/2);
	
 if (newWin != null && !newWin.closed)  
   newWin.close();  
 var strOptions="";  
 if (strType=="console")  
   strOptions="resizable,height=450,width=550,top="+top+", left="+left;  
 if (strType=="fixed")  
   strOptions="status,height=450,width=550,top="+top+", left="+left;  
 if (strType=="elastic")  
   strOptions="toolbar,menubar,scrollbars,"+  
     "resizable,location,height=450,width=550,top="+top+", left="+left;  
 newWin = window.open(strURL, 'newWin', strOptions);  
 newWin.focus();  
}

//

$(document).ready(function(){
	$('#iconography li img').each(function(){
		var distance = 15;
		var time = 100;
		var hideDelay = 20;
		var hideDelayTimer = null;
		var $popup = $('.' + $(this).attr('class').replace(/trigger/, 'popup'));

		$(this).mouseover(function(){	
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (!$popup.hasClass('showing')) {
				$popup.css({
					top : 20,
					display : 'block'
				}).animate({
					top : '-=' + distance + 'px',
					opacity : 0.9
				}, time, 'swing', function(){
					$popup.addClass('showing');
				})
			}
		}).mouseout(function(){
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				$popup.animate({
					top: '+=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					shown = false;
					$popup.css('display', 'none');
					$popup.removeClass('showing');
				});
			 }, hideDelay);
			 return false;
		});

	});	
});
