
			function map()
			{
				if (!$('.mapa').length)
				{
					$('body').prepend('<div class="mapa pointer" onclick="javascript:$(this).remove();"></div>');
				}
				$('.mapa').animate({marginLeft: + ($(window).width() - 666) / 2 + 'px', marginTop: + ($(window).scrollTop() + (($(window).height() - 500)/2)) + 'px'}, function(){
					$(this).animate({opacity: 1});
				});
			}

			var ex = {
				current_page:	1,
				li_width:		113,
				size: 			0,
				pages:			0,
				min: 			6,
				configure : function(fn)
				{
					ex.size 	= $('ul.expositor > li').length;
					ex.pages 	= Math.ceil(ex.size / ex.min);
					if (typeof(fn) == 'function')
					{
						fn.call();	
					}
				},
				next : function()
				{
					ex.configure(function(){
						if (ex.current_page < ex.pages)
						{
							$('ul.expositor > li').eq(0).animate({marginLeft:'-' + ((ex.li_width * ex.min) * ex.current_page)  + 'px'}, 0);
							ex.current_page++;
						}
					});
				},
				prev : function()
				{
					ex.configure(function(){
						if (ex.current_page > 1)
						{
							var m = $('ul.expositor > li').eq(0).css('marginLeft').replace('-', '').replace('px', '');
							$('ul.expositor > li').eq(0).animate({marginLeft:'' + ((ex.li_width * ex.min) - m) + 'px'}, 0);
							ex.current_page--;
						}
					});
				}
			}
			
			function ler(id)
			{
				
				$.getJSON('home.php', {acao:'ler',id:id},function(data){
					
					$('.noticias-box').fadeOut(function(){
						
						if(data['response'] === true)
						{
							
							$('.noticias-box').html('<p class="txt2">' + data['titulo'] + '</p><br/>' + data['noticia'] + '').fadeIn(function(){

								$('.paness2').jScrollPane({scrollbarWidth:10, dragMinHeigh:23, dragMaxHeight: 23});
								
							});
							
						}else{
							
							$('.noticias-box').html('<p class="txt2">Notícia não encontrada.</p>').fadeIn();
							
						}
						
					});
					
				});
			}
			
			$(document).ready(function(){

				
				$(".twitter-txt").tweet({
					username: "AmchamBDay",
					avatar_size: 0,
					count: 1,
					loading_text: "carregando tweets..."
				});
				
				// scroll
				$('.pane, .paness, .paness2').jScrollPane({scrollbarWidth:10, dragMinHeigh:23, dragMaxHeight: 23});

				// agenda
				$('.agenda-list li:odd').css({background:'#ffe28c'});

				// start
				win.configure();
				win.bind_menu();
				
				// item submenu is clicked?
				is_clicked = false;
				
				$('div.menu-lateral ul li a').not('.external').each(function(){
				
					$(this).click(function(){

						if(is_clicked === false && !$(this).parent().hasClass('current-menu-lateral'))
						{
						
							is_clicked = true;
											
							var ths = $(this);
							
							// makeup prev item
							if (ths.parent().parent().find('li.current-menu-lateral').length)
							{
								var prev2 = win.get_dimensions(ths.parent().parent().find('.current-menu-lateral'), 1);
								var prev = win.get_dimensions(ths.parent().parent().find('.current-menu-lateral'), 0);
								ths.parent().parent().find('.current-menu-lateral').css({backgroundPosition: '-' + prev[2] + 'px -' + (parseInt(parseInt(prev2[2]) + parseInt(prev2[0]))) + 'px'}).removeClass('current-menu-lateral');
							}
							
							// pos do item do submenu em relação ao ul
							var pos = ths.parent().parent().parent().find('ul > li').not('.external').index(ths.parent()) * 31;
							
							// makeup item
							ths.parent().parent().parent().find('.menu-lateral-back').animate({marginTop: pos + 'px'}, function(){
								ths.parent().parent().parent().find('.menu-lateral-back').fadeIn();
								var current2 = win.get_dimensions(ths.parent(), 1);
								var current = win.get_dimensions(ths.parent(), 0);
								ths.parent().css({backgroundPosition: '-' + current[2] + 'px -' + (parseInt(parseInt(current2[2]) - parseInt(current2[0]))) + 'px'}).addClass('current-menu-lateral');
							});
							
							var id = ths.parent().attr('id');
							
							// show content box + active pane
							ths.parent().parent().parent().parent().next().find('div.menu-lateral-box-current').fadeOut(function(){						
								$(this).removeClass('menu-lateral-box-current');
								$(this).parent().find('div.'+ id).fadeIn(function(){
									$(this).find('div.pane' + ((pos/31) + 2)).jScrollPane({scrollbarWidth:10, dragMinHeigh:23, dragMaxHeight: 23});
									is_clicked = false;
								}).addClass('menu-lateral-box-current');
							});
							
						}
						
					});
				
				});
				
			});
			
			$(window).bind('resize', function() {
				win.configure();
			});
			
			var win = {

				is_clicked : false,
				current : -1,
				
				configure : function ()
				{
					var wh = $(window).height(), ww	= $(window).width();					

					$('.wrapper').each(function(){
						$(this).height(wh).width(ww-1);
						var wrapper1 = $(this).find('div.wrapper-1');
						var mt = wh - wrapper1.innerHeight();
						var ml = ww - wrapper1.innerWidth();
						if (mt > 0)
						{
							wrapper1.css({marginTop: + (wh - wrapper1.innerHeight()) / 2 + 'px'});
						}ml
						if (mt > 0)
						{
							wrapper1.css({marginLeft: + (ml) / 2 + 'px'});
						}
					});
					
					$('#menu-wrapper').css({marginTop: + ((wh - $('#menu-wrapper').height()) / 2) - 197 + 'px', marginLeft: + ((ww - $('#menu-wrapper').width()) / 2) - 14 + 'px'});

					var bgw = ww > 1300 ? 1300 : ww;
					var bgh = $('div.wrapper-1').innerHeight() + 15;
					
					$('.background').width(bgw - 1).height(bgh + ((wh - bgh) / 2)).css({marginLeft: (ww - bgw - 1)/2 + 'px'});
					
				},

				bind_menu : function ()
				{
					
					$('ul.menu > li > p > a').not('.external').each(function(){
						$(this).click(function(){
							var el = $(this).parent().parent();
							if (win.is_clicked === false && !el.hasClass('current-menu'))
							{
								win.go($('ul.menu > li').not('.external').index(el));
							}
						});
					});
					
					win.makeup($('ul.menu > li').eq(0));
									
				},
				
				makeup : function(el)
				{
				
					if ($('.current-menu').length)
					{
						var current 	= win.get_dimensions($('.current-menu'), 0);
						$('.current-menu').css({backgroundPosition: '-' + current[2] + 'px 0px'}).removeClass('current-menu');
					}
					
					if (el.length)
					{
						var next = win.get_dimensions(el, 0);
						el.css({backgroundPosition: '-' +  next[2] + 'px -18px'}).addClass('current-menu');
					}
				
				},
				
				get_dimensions : function(el, k)
				{
					k = typeof(k) === 'undefined' ? 0 : k == 0 ? 0 : 1;
					var bg = k == 0 ? 'x' : 'y';
					var pos = el.css('background-position');
					pos = typeof(pos) === 'undefined' ? el.css('background-position-' + bg) : pos.split(' ')[k];
					return [el.height(),el.width(),pos.replace('px', '').replace('-', '')];
				},
				
				go : function (to, fn)
				{
					win.is_clicked = true;
				
					t = ((to - win.current) * ($(window).height() + 700));
					
					$('#menu-wrapper').fadeOut(function(){
					
						win.makeup($('ul.menu > li').not('.external').eq(to));
						
						//easing:'BackEaseOut', 
						$.scrollTo($('div.wrapper').not('.external').eq(to), (t < 0 ? t * (-1) : t), {onAfter:function(){ 
							win.is_clicked = false; 
							to = to < 0 ? 1 : to + 1;
							$('#menu-wrapper').css({marginTop:(to * $('.wrapper').eq(0).height()) + ((($(window).height() - $('#menu-wrapper').height()) / 2) - 197) + 'px'});
							
							$('#menu-wrapper').fadeIn(); 
							if (typeof(fn) == 'function')
							{
								fn.call();
							}
						}});
						
						win.current = to;
						
					});
					
				}, 
				
				index : function(index)
				{
					
					if (win.current > -1)
					{
					
						win.is_clicked = true;
					
						t = ((-1 - win.current) * ($(window).height() + 700));
						
						$('#menu-wrapper').fadeOut(function(){
						
							win.makeup($('ul.menu > li').eq(0));
							
							//easing:'BackEaseOut', 
							$.scrollTo($('div.wrapper').eq(index), (t < 0 ? t * (-1) : t), {onAfter:function(){ 
								win.is_clicked = false; 
								index = index == 0 ? 0 : (index + 1) * $('.wrapper').eq(0).height();
								$('#menu-wrapper').css({marginTop:(index + ((($(window).height() - $('#menu-wrapper').height()) / 2) - 197)) + 'px'});
								$('#menu-wrapper').fadeIn(); 
							}});
							win.current = -1;
							
						});
				
					}
					
				}
				
			}
			
			
			jQuery.easing['BackEaseOut'] = function(p, t, b, c, d)
			{	
				var c=b+c;
				var s = 1.70158;
				return c*((p=p/1-1)*p*((s+1)*p + s) + 1) + b;
			};
