
function initContent(href) {
	if (href.match("#funcionalidades")){
		window.location.hash="#funcionalidades"; 
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("funcionalidades.html",
			function(){
				initScroller();
				$("#scrollContainer").fadeIn("slow");
       			$('#galeriaFunc a').lightBox();
			});
		});
	}
	else if (href.match("#clientes")){
		window.location.hash="#clientes"; 
		var tmp = new Image();
		tmp.src = "imagens/fundo_boxclient.gif";
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("clientes.html",
			function(){
				initScroller(true);
				$("#scrollContainer").fadeIn("slow");
			});
		});			
	}
	else if (href.match("#contactos")){
		window.location.hash="#contactos"; 
		var tmp = new Image();
		tmp.src = "imagens/fundo_contactos.gif";
		//$("#scrollContainer").css("left",0);
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("contacto.html",
			function(){
				$.getScript("js/initContactos.js");
				initScroller();
				var myimages=new Array();
				//specify random images below. You can have as many as you wish
				myimages[1]="verifica1.jpg";
				myimages[2]="verifica2.jpg";
				myimages[3]="verifica3.jpg";
				myimages[4]="verifica4.jpg";
				myimages[5]="verifica5.jpg";
				myimages[6]="verifica6.jpg";
				var ry = Math.floor(Math.random()* myimages.length);
				if (ry==0) ry=1;
				$("#captcha").html('<img src="imagens/verificacao/'+myimages[ry]+'" border=0 />');
				$("#scrollContainer").fadeIn("slow");
			});
		});			
   	}
	else if (href.match("#download")){
		window.location.hash="#download"; 
		var tmp = new Image();
		tmp.src = "imagens/fundo_youtube.gif";
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("download.html",
			function(){
				$.getScript("js/thickbox.js");
				initScroller();
				$("#scrollContainer").fadeIn("slow");
			});
		});
	}
	else if (href.match("#apoio")){
		window.location.hash="#apoio"; 
		var tmp = new Image();
		tmp.src = "imagens/apoio_fl.jpg";		
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("apoio.html",
			function(){
				initScroller(true);
				$("#scrollContainer").fadeIn("slow");
			});
		});
	}
	else if (href.match("#quemsomos")){
		window.location.hash="#quemsomos"; 
		var tmp = new Image();
		tmp.src = "imagens/quemsomos.jpg";		
		$("#scrollContainer").fadeOut("slow",
		function(){
			$("#scrollContainer").load("quemsomos.html",
			function(){
				initScroller(true);
				$("#scrollContainer").fadeIn("slow");
			});
		});
	}
}

$(function() {
	$('#galeriaFunc a').lightBox();
	$('#conteudosTabs ul').tabs({ fxFade: true, fxSpeed: 'fast',
		click: function(tab) {
			initContent(tab.href);
		}
	});
	initContent(window.location.href);
});
