$(function(){
				if ($.browser.msie && $.browser.version.substr(0,1)<7) {
					alert('Você deve atualizar seu navegador');
				}
				
				$('#sliderin li').css('width',$(window).width());
				var para='', velho='',l_geral = $("#geral").width(), menu_fechado=true;
				window.onload = function(){
					if(window.location.hash!=""){
						if(window.location.hash!="#home"){
							$("#geral").load("paginas/"+window.location.hash.replace('#','')+".php",function(){
									$.getScript("js/paginas/"+window.location.hash.replace('#','')+".js",function(){
										$("#geral").animate({left:0},1000);
									});
							});
						}
					};
				};
				
				$("#geral").css('left',-l_geral);
				$.ajaxSetup({
   					timeout: 9000
					
 				});

				$("#xxx_menu").click(function(){
					if(menu_fechado==true){
						$("#menu ul").animate({width: '610px'},1000,function(){
							$("#xxx_menu").css('backgroundPosition','0 -34px');	
						});
						$("#menu").animate({right: '0',width:'680px'},1000);
						$("#xxx_menu span").fadeOut("slow");
						menu_fechado=false;
					}
					else{
						$("#menu ul").animate({width: '0'},1000,function(){
							$("#xxx_menu").css('backgroundPosition','0 0');
						});
						$("#menu").animate({right: '0',width:'100px'},1000);
						$("#xxx_menu span").fadeIn("slow");
						menu_fechado=true;
					}
				})
				if($(window).height()<700 && window.location.hash==""){
					$('#slider').css('height','400px');
					var pequeno = true;
				}
				else var pequeno=false;
				$("#menu a:not([href=area-restrita])").click(function(){
						var esse = this; 
						$("#menu a").removeClass('marcado');
						$(esse).addClass('marcado');
						velho = para;
						l_geral = $("#geral").width(); 
						para = $(this).attr('href');
						if(velho!=para){
						$("#loader").show();
						if($("#geral").width()==300) $("#slider").fadeTo('slow',0,function(){
							$("#slider").load("includes/slider.php",function(){
								$("#slider").addClass('capa');
								$("#slider").width(parseInt($(window).width())-7 +'px');
								 $("#slider").fadeTo('slow',1);
								 $('#sliderin').cycle({
									fx: 'fade'
								});
								});
						});
						
						window.location.hash = para;
						_gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);
						$("#geral").animate({
							left:-l_geral+'px'
							},1000,function(){
								if(para!='home'){
									if($("#geral").width()==300){
										$("#geral").width("50%");
										$("#geral").css('left',-$("#geral").width());
									}
									$("#geral").load("paginas/"+para+".php",function(){
												//$('#slider').height($('#geral').height()+30);
												$.getScript("js/paginas/"+para+".js",function(){
															$("#loader").hide();
															if(pequeno==true){
															$('#slider').animate({height:'550px'},1000)
															pequeno =false;
															}
															$("#geral").animate({left:0},1000);
															$("#menu a").removeClass('marcado');
															$(esse).addClass('marcado');
												});
									});
								}else{
									$("#loader").hide();
									
									
								}
						});
						}
						return false;	
				})
				
				$(document).ajaxError(function(){
					$("#geral").animate({left:0},1000);
					$("#loader").hide();
					$("#menu a").removeClass('marcado');
					
				});
				 $('#sliderin').cycle({
					fx: 'fade'
				});
			function is_email(email){er=/^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/;if(er.exec(email)){return true}else{return false}}	
			$('#news').submit(function(){var email=$('#email_news').attr('value');$('#email_news').attr('value',' Enviando...');
			if(is_email(email)){$.ajax({url:'actions/news.php',data:'email='+email,type:'GET',success:function(data){if(data=='1'){$('#email_news').attr('value',' Email cadatrado com sucesso!');}else{$('#email_news').attr('value','');alert('Esse e-mail já consta em nossa base de dados');}},error:function(data){alert('OOps, ocorreu um erro')}})}else{$('#email_news').attr('value','  Digite um e-mail válido');}return false});	
			
			$('#email_news').focus(function(){if($(this).attr('value')=='  Digite um e-mail válido'){$(this).attr('value','')}});
			})
