// JavaScript Document

var params={wmode:"transparent"};
swfobject.embedSWF("swf/logo2.swf", "logo", "333", "111", "10.0.0","swf/expressInstall.swf", null, params, null);

$(document).ready(function(){
	function getPage(){
		var url = String(window.location).split('#')
		url = url[url.length-1]
		
		if(url == window.location || url==""){
			url='home';
		}
		
		return url;
	}
	
	function abrePagina(){
		var url = getPage();
		
		$.ajax({
			type:'get',
			datatype:'html',
			url:getPage(),
			success:function(){
				var url = getPage();
				
				$('.recebe_pag').stop().animate({opacity: 0}, 1000, function(){														  
																			 
					switch(url) {
						case 'home': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'perfil': $('#quad_cinza').stop().animate({width: 800}, 1000,function(){coloca_pag()});break;
						case 'comerciais': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'residenciais': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'coorporativos': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'restauracao': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'mostra': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;
						case 'servicos': $('#quad_cinza').stop().animate({width: 700}, 1000,function(){coloca_pag()});break;
						case 'imprensa': $('#quad_cinza').stop().animate({width: 800}, 1000,function(){coloca_pag()});break;
						case 'clientes': $('#quad_cinza').stop().animate({width: 900}, 1000,function(){coloca_pag()});break;						
						case 'contato': $('#quad_cinza').stop().animate({width: 750}, 1000,function(){coloca_pag()});break;												
					}
				});
				
				function coloca_pag(){
					$('.recebe_pag').empty();
					$('.recebe_pag').load(url,null,function(){});
					$('.recebe_pag').stop().animate({opacity: 1}, 1000);
				}
	
			}
		})//ajax
	}
	abrePagina();
	
	$('#menu li a').click(function(){
		window.location = String(window.location).split('#')[0] + $(this).attr('href');
		if(getPage()!="projetos"){
			abrePagina();
		}
		else{
			$('#subprojetos').slideToggle();
		}
		return false;
	});
		
	if(typeof adj !="undefined"){
		adj();
	}
	
});
