
// Social links fader
$(document).ready(function() {
	$('.social-links li a, #sponsorWrap li').each(function() {
		$(this).animate({ opacity:0.6})
		$(this).hover(function() {
			$(this).animate({ opacity: 1.0 }, 500);
		},
	   function() {
		   $(this).animate({ opacity: 0.6 }, 500);
	   });
	});
});
  
// popup
jQuery(window).load(function() {
	jQuery("#directionsLink, .directions-link").fancybox({
		'titlePosition'		: 'inside'
		, 'hideOnContentClick':'false'
		, 'type':'iframe'
		, 'width' : '75%'
		, 'height' : '75%'
	});
	jQuery(".sessions-link").fancybox({
		'titlePosition'		: 'inside'
		, 'hideOnContentClick':'false'
		, 'type':'iframe'
		, 'width' : 890
		, 'height' : 500
	});
	jQuery("#keynoteLink").fancybox({
		'titlePosition'		: 'inside'
		, 'hideOnContentClick':'false'
		, 'transitionIn' : 'elastic'
		, 'transitionOut' : 'elastic'
	});
});

/* easy list splitter */
$(document).ready(function () {
		$('.split-me-2').easyListSplitter({ 
			colNumber: 2
		});
});


/* session list dynamic styles */
$(document).ready(function () {
	$(".session-invisible:contains('Design')").parent().addClass("session-design");
	$(".session-invisible:contains('Development')").parent().addClass("session-development");
	$(".session-invisible:contains('Administration')").parent().addClass("session-admin");
});

$(function (){
	$('.session-item-wrap, .speaker-list').each(function () {
		var distance = 10;
		var time =  250; // 1/4 sec
		var hideDelay = 400;
		var hideDelayTimer = null;
		var beingShown = false;
		var visible = false;
		var trigger = $('.session-visible, .speaker-visible', this)
		var popup = $('.session-invisible, .speaker-invisible', this);
        var info = $('.session-invisible, .speaker-invisible', this).css('opacity', 0);
		
		$([trigger.get(0), popup.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);

			if (beingShown || visible) {
				return;
			} else {
				beingShown = true;
				
				popup.css ({
					display: 'block'
				}).animate({
					opacity: 1
					, left: '-=' + distance + 'px'
				}, '', function () {
					beingShown = false;
					visible = true;
				});
			}
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			
			hideDelayTimer = setTimeout(function (){
				hideDelayTimer = null;
				popup.animate ({
					top: '-=' + distance + 'px'
					, opacity: 0
					, display: 'none'
				}, '', function (){
					visible = false;
					info.css('display', 'none');
				})
			}, hideDelay);
 		});
		
	});
	
}); 
