var sti = {
	microsite: {
		resize: function() {
			$('.microsite:visible').each(function() {
				var dh = $(window).height();
				var dw = $(window).width();
				var margin = ((dh - $(this).height()) / 2);
				var left = ((dw - $(this).width()) / 2);
				
				$(this).css('top', margin < 0 ? 0 : margin);
				$(this).css('left', left < 0 ? 0 : left);
			});
		},
		
		pop: function(id, ulid) {
			
			$('#' + ulid).quickPager({
				pageSize: 9,
				holder: '#' + ulid + '_pagenav',
				pagerLocation: 'after',
				microsite: true
			});
			$('#microsite_' + id).fadeIn();
			sti.microsite.resize();
		},
		
		hide: function(id) {
			$('#microsite_' + id).fadeOut();
		},
		
		adherent: function(id) {
			var m = $('.microsite:visible');

			if (m.find('li .active').attr('id') != 'li_' + id)
			{
				m.find('li a.active').animate({width: 220});
				m.find('li a.active').removeClass('active');
				
				m.find('a#li_' + id).animate({width: 243});
				m.find('a#li_' + id).addClass('active');
				
				m.find('div.microsite_adherent:visible').hide(0);
				m.find('div#a_' + id).show(0);
			}
		}
	}
}

$(document).ready(function() {
	window.onresize = sti.microsite.resize;
});

