var Site = {
	projetos: [
		//{ nome: "", background: "#131313 url(img/) no-repeat center top", html: "projetos/" },
		{ nome: "Itautec Descomplica", background: "#1E1E1E url(img/banner_destaque_itautec-descomplica.jpg) no-repeat center top", html: "projetos/itautec-descomplica.asp" },
		{ nome: "Honda", background: "#1E1E1E url(img/banner_destaque_honda.jpg) no-repeat center top", html: "projetos/honda.asp" },
		{ nome: "Streamer", background: "#1E1E1E url(img/banner_destaque_streamer.jpg) no-repeat center top", html: "projetos/streamer.asp" },
		{ nome: "Crysbel", background: "#1E1E1E url(img/banner_destaque_crysbel.jpg) no-repeat center top", html: "projetos/crysbel.asp" },
		{ nome: "Marketing 18", background: "#1E1E1E url(img/banner_destaque_marketing-18.jpg) no-repeat center top", html: "projetos/marketing-18.asp" },
		{ nome: "Destina", background: "#1E1E1E url(img/banner_destaque_destina.jpg) no-repeat center top", html: "projetos/destina.asp" },
		{ nome: "Cielo", background: "#1E1E1E url(img/banner_destaque_cielo.jpg) no-repeat center top", html: "projetos/cielo.asp" },
		{ nome: "Bradesco", background: "#1E1E1E url(img/banner_destaque_bradesco.jpg) no-repeat center top", html: "projetos/bradesco.asp" },
		{ nome: "Puma", background: "#1E1E1E url(img/banner_destaque_puma.jpg) no-repeat center top", html: "projetos/puma.asp" },
		{ nome: "To the Top", background: "#1E1E1E url(img/banner_destaque_to-the-top.jpg) no-repeat center top", html: "projetos/to-the-top.asp" },
		{ nome: "Barganha Urbana", background: "#1E1E1E url(img/banner_destaque_barganha_urbana.jpg) no-repeat center top", html: "projetos/barganha_urbana.asp" },
		{ nome: "Estre", background: "#1E1E1E url(img/banner_destaque_estre.jpg) no-repeat center top", html: "projetos/estre.asp" },
		{ nome: "Itautec Net", background: "#1E1E1E url(img/banner_destaque_itautec-net.jpg) no-repeat center top", html: "projetos/itautec-net.asp" },
		{ nome: "Autolex 2", background: "#1E1E1E url(img/banner_destaque_autolex2.jpg) no-repeat center top", html: "projetos/autolex2.asp" },
		{ nome: "Social Figures", background: "#1E1E1E url(img/banner_destaque_social-figures.jpg) no-repeat center top", html: "projetos/social-figures.asp" },
		{ nome: "Gequimica", background: "#1E1E1E url(img/banner_destaque_ge-quimica.jpg) no-repeat center top", html: "projetos/ge-quimica.asp" },
		
		{ nome: "H3 Hotel", background: "#1E1E1E url(img/banner_destaque_h3hotel.jpg) no-repeat center top", html: "projetos/h3hotel.asp" },
		
		{ nome: "Carreira Fashion", background: "#1E1E1E url(img/banner_destaque_carreira-fashion.jpg) no-repeat center top", html: "projetos/carreira-fashion.asp" },
		{ nome: "Autolex", background: "#1E1E1E url(img/banner_destaque_autolex.jpg) no-repeat center top", html: "projetos/autolex.asp" },
		{ nome: "Credicard Citi", background: "#1E1E1E url(img/banner_destaque_credicard-citi.jpg) no-repeat center top", html: "projetos/credicard-citi.asp" },
		{ nome: "Okupe", background: "#1E1E1E url(img/banner_destaque_okupe.jpg) no-repeat center top", html: "projetos/okupe.asp" }
	],
    Init: function() {
				
        //Busca por todos os links que possuem a classe '.external-modal' para abrir janela modal
        $('body').delegate(".external-modal", "click", function() {
            var id = $(this).attr('id');
            var source = $(this).attr('href');
            var dimensoes = $(this).attr('rel');
            dimensoes = dimensoes.split('x');
            var w = dimensoes[0];
            var h = dimensoes[1];
			Site.Generics.GoScrollTo('#header');
            Site.Generics.OpenExternalModal(id, source, w, h);
            return false;
        });
		
		$('a.logo').click(function(){
			Site.Generics.GoToSlide(1);
			return false;
		});
		
		$('.topo, ul.nav li').delegate("a.noticias", "click", function(){
			var position = $(this).attr('href');
            Site.Generics.GoScrollTo(position);
		});
		
		$('body').delegate(".button-project-details", "click", function(){
			var nomeProjeto = $(this).attr('rel');
			
			/*
			$('.'+nomeProjeto+' div.conteudo').slideDown(700, function(){
				var tamanhoSlide = $('.activePage .'+nomeProjeto+' div.conteudo').height();
					//Soma ao tamanho do slide o padding-top da div
					tamanhoSlide = tamanhoSlide+695;
				$('.anythingSlider, .anythingWindow, .activePage').animate({ height: tamanhoSlide }, { duration: 750, queue: false, complete: function(){Site.Generics.GoScrollTo('.menu');}});
			});
			*/
			
			$('.'+nomeProjeto+' div.conteudo').slideDown(700, function(){
				
				var tamanhoSlide = $('.activePage .'+nomeProjeto+' div.conteudo').height();
					//Soma ao tamanho do slide o padding-top da div
					tamanhoSlide = tamanhoSlide+650;
				$('.anythingSlider, .anythingWindow, #slider, li.activePage').animate({ height: tamanhoSlide }, { duration: 750, queue: false });
				Cufon.refresh();
				Site.Generics.GoScrollTo('.menu');
			});
			return false;
		});

        $('body').delegate("a[href^=http]:not(.external-modal)", "click", function () {
			window.open(this.href);
			return false;
		});
    },
    Generics: {
        OpenExternalModal: function(id, source, w, h) {
            ModalWindow.windowId = id;
            ModalWindow.width = w;
            ModalWindow.height = h;
            ModalWindow.content = '<iframe width=\"' + w + '\" height=\"' + h + '\" frameborder=\"0\" scrolling=\"no\" allowtransparency=\"true\" src=\"' + source + '\"></iframe>';
            ModalWindow.Open();
        },
		GoScrollTo: function(position) {
            $.scrollTo($(position).offset().top, { duration: 750, queue: false, easing: "easeOutBack" });
        },
		GoToSlide: function(slide){
			var numeroProjeto = slide-1;
			$('#slider').anythingSlider(slide);
			$('#slider li.activePage').css('background', Site.projetos[numeroProjeto].background).load(Site.projetos[numeroProjeto].html);
			Site.Generics.GoScrollTo('#header');
		},
        FormsEffects: function() {
            $('input[type=text], textarea, select').focus(function() {
                $(this).addClass('on');
            });
            $('input[type=text], textarea, select').blur(function() {
                $(this).removeClass('on');
            });
        }
	},
	Home: function() {
		
		$('#slider').anythingSlider({
			theme				: 'twist',
			resizeContents      : false,
			hashTags            : true,
			onSlideComplete: function() {
            	//Site.Generics.GoScrollTo('#content');
				var numeroProjeto = $('#slider').data('AnythingSlider').currentPage-1;
				//alert('Nome:'+Site.projetos[numeroProjeto].nome+'\nHtml:'+Site.projetos[numeroProjeto].html);
				$('#slider li.activePage').css('background', Site.projetos[numeroProjeto].background).load(Site.projetos[numeroProjeto].html);
        	}
			
		}).bind('slide_complete', function(event, slider){
			window.location.hash = '#&panel' + slider.runTimes + '-' + slider.currentPage;
			//pageTracker._trackPageview('/home/slide/'+slider.currentPage+'/');
		});
		
		var numeroProjeto = $('#slider').data('AnythingSlider').currentPage-1;
		//alert('Nome:'+Site.projetos[numeroProjeto].nome+'\nHtml:'+Site.projetos[numeroProjeto].html);
		$('#slider li.activePage').css('background', Site.projetos[numeroProjeto].background).load(Site.projetos[numeroProjeto].html);
		
		$("#tweets").getTwitter({
			userName: "agenciaTwist",
			numTweets: 15,
			loaderText: "Carregando tweets...",
			slideIn: true,
			showHeading: true,
			headingText: "as últimas",
			showProfileLink: false
		});
		
		Cufon.replace('ul.especificacoes li h2', { fontFamily: 'LubalinBook' });
		Cufon.replace('.cufon', { fontFamily: 'Georgia' });
		
		$('.skype_pnh_container').html('');
		$('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
		
		$('.nav-footer li:last').css('border-right', 'none');
		$('#footer .conteudo p:first').css('margin-top', '7px');
		$('#footer .conteudo p:first').css('border-right', '1px solid #9db1af');
		$('#footer .conteudo p:first').css('padding-right', '40px');
		
		/*
		window.setTimeout(function() {
			$('.skype_pnh_container').html('');
			$('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
		}, 800);
		*/
	},
	Trabalhos: function(){
		$('a.external-modal-close').click(function(){
			parent.ModalWindow.Close();
			return false;
		});
		
		$('ul li a').click(function(){
			var slide = $(this).attr('rel');
			parent.Site.Generics.GoToSlide(slide);
			parent.ModalWindow.Close();
			return false;
		});
		
		$('ul li').hover(function(){
			$("div", this).stop().animate({bottom: 0},{queue:false,duration:300});
		}, function() {
			$("div", this).stop().animate({bottom: '-94px'},{queue:false,duration:300});
		});
	},
	Telas: function(){
		$('#slider').anythingSlider({
			showMultiple		: 1,
			theme				: 'twist-projetos',
			resizeContents      : false,
			infiniteSlides		: false
		});
		$('a.external-modal-close').click(function(){
			parent.ModalWindow.Close();
			return false;
		});
	}
}
