(function($){

		var limitX = 900;
		var limitY = 734;

		home = {
			init : function(){
				home.findXY();
				//home.checkHeight();
			},

			findXY : function(){
				pageX = $('#super').width();
				pageY = $('#super').height();
			},
			checkHeight : function(){
				$(window).bind('resize', function(){
					var alt = $(window).height();
					if(alt<800){
						$('body').css({'overflow-y':'scroll', 'height':750})
						$('#links-topo').stop().animate({'bottom':'300px'})
 					}else{
						$('body').css({'overflow-y':'hidden', 'height':'100%'})
						$('#links-topo').css({'bottom:':'3%'})
						$('#links-topo').stop().animate({'bottom':'3%'})
					}
				})
			},
			lockSize : function(){
				$(window).bind({
					load : function(){
						home.findXY();
						alterado = false;
						
						if (pageX < limitX){
							$('#super').width(limitX);
							alterado = true;
						}
						if(pageY < limitY){
							$('#super').height(limitY);
							alterado = true;
						}
						if(alterado == false){
							$('#super').width('100%');
							$('#super').height('100%');
						}
						
						//home.resizeBg();
					}
				});
				
				$(document).bind({
					resize : function(){
						$('#super').width('100%');
						$('#super').height('100%');
						//home.resizeBg();
					}
				})
			},

			resizeBg : function(){
				bgX = $('#left').width();
				bgY = $('#left').height();

				$('#left .bg').width(bgX);
				$('#left .bg').height(bgY);
			},

			initialAnimation : function(){
				$('#links-topo, #chamada, #post-home, #filiacao').css('opacity','0');

				$('#left').animate({
					'left':0
				},1400,'easeinout',function(){
					$('#links-topo').animate({
						'opacity':'1'
					},400);
				});

				$('#right').animate({
					'left':'50%'
				},1700,'easeinout', function(){
					$('footer').animate({
						'height':'13%'
					},700,'bounceout',function(){
						$('#chamada, #post-home, #filiacao').animate({
							'opacity':'1'
						},700);
					});
				});
			},

			hoverIE8 : function(){
				$('#links-topo a').hover(function(){
					$(this).css('background','#ee1c24');
				},function(){
					$(this).css('background','transparent');
				});
			}
		};
	
	
		home.init();
		home.lockSize();
		home.initialAnimation();
		//home.hoverIE8();
		//home.mouseTrail();
})(window.jQuery)
