$(document).ready(function(){				
	// ANIM OR NOT THE INTRODUCTION NOT IE
	if(anime && navigator.appName != 'Microsoft Internet Explorer'){
		$('#fadeIn').show();
		$('#home_menu').css('display','none');
		$('#footer').css('display','none');
		setTimeout(function(){
			$('#fadeIn').fadeOut(1300,'easeInExpo',function(){
				$('#home_menu').show('drop',{direction:'left',easing:'easeOutExpo'},1000);
				$('#footer').show('drop',{direction:'down',easing:'easeOutExpo'},1000);
			});
		},500);
	}
	// ANIM HOME MENU
	$('.title').mouseover(function(){
		if(!$(this).next().is(':visible'))
			$(this).next().show('blind',{easing:'easeOutExpo'},800);
	});
	// ANIM HOME SUBMENU
	if(navigator.appName != 'Microsoft Internet Explorer'){
		$('#home_menu li').hover(function(){
		  $(this).animate({'margin-left':'15px'},100);
		},function(){
		  $(this).animate({'margin-left':'0px'},100);
		});
	}
	// HOME_MENU LEFT FIX
//	if($(window).width() > 1600){
//		$('#home_menu').css('left',(($(window).width()-1600)/2)+'px');
//	}
	// ARTICLE SIZE FIX
	h = $(window).height()-(131+46);
	w = ($(window).width()/2);
	$('#article').css({
		//'background-color':'red',
		'width':(w-60)+'px',
		'height':h+'px'
	});
	if($(window).width() > 1600) w = 600;
	$('#article h2,#article p').width(w-120);
	$('#article iframe').width(w-120).height(parseInt(390/640*w));
	if($(window).height() < 637){
		$('#article .markers .img').height($('#article .markers .img').height()-240).css('margin-top','0');
		$('#article .markers a').each(function(){
			var mt = parseInt($(this).css('margin-top'));
			$(this).css('margin-top',mt-240);
		});
	}
	// ARTICLE OPENNER
	var actual,pic,anim=false;;
	$('.navigation a[open]').click(function(){
		if(anim) return false;
		var open = $(this).attr('open');
		var wait = 0;
		if(actual == open) return false;
		anim = true;
		if($('#article .section h2').is(':visible')){
			wait = 300;
			$('#'+actual).fadeOut(300);
		}
		var iv = setTimeout(function(){
			clearInterval(iv);
			var opts = {direction:'right',easing:'easeOutExpo'};
			var time = 1500;
			switch(open){
				case 'about':
				case 'contact':
				case 'workus':
				case 'promos':
				case 'aboutus':
					$('#'+open).show().children().each(function(){$(this).show('drop',opts,time,function(){anim = false})})
				break;
				case 'location':
					$('#'+open).show().children().each(function(){$(this).show('drop',opts,time,function(){anim = false})})
					setTimeout(function(){
						var opts = {'opacity':'1','margin-left':'206px',easing:'easeOutExpo'};
						var time = 500;
						var elem = '#location .markers ';
						$(elem+'.estrela').animate(opts,time,function(){
							$(elem+'.coracao').animate(opts,time,function(){
								$(elem+'.regina').animate(opts,time,function(){
									$(elem+'.cruz').animate(opts,time);
								})
							})
						});
					},1200);
				break;
			}
		},wait);
		actual = open;
		return false;
	});
	//END
});
$.fn.disableSelection=function(){$(this).attr('unselectable', 'on').css({'-webkit-user-select':'none','-khtml-user-select':'none','-moz-user-select':'none','-o-user-select':'none','user-select':'none'}).each(function(){this.onselectstart =function(){return false;};});};
