function troca_fundo(parametro){

			document.getElementById('fundo').style.background="#000000 url("+parametro+") repeat-y";
			/*fundo1_ = new OpacityTween(document.getElementById('fundo'),Tween.linear, 100, 0, 1);
			fundo1_.start()
			fundo1_.onMotionFinished = function(){
				document.getElementById('fundo').style.background="#000000 url("+parametro+") repeat-y";
				fundo2_ = new OpacityTween(document.getElementById('fundo'),Tween.linear, 0, 100, 1);
				fundo2_.start()
			
			}*/
			
	}


// *************************** Seleccionar o menu de produtos *************************

	 function seleccionar(id){
	 	
		if(id_antigo){
			
			document.getElementById(id_antigo).className='filho';
		}
		
		document.getElementById(id).className='seleccao';
		id_antigo=id;
	 }



	
// *************************** desliza menu produtos *******************************
	
function desliza_menus(parametro){

		if (parametro=='sim'){
		
			document.getElementById('listagem_produtos').className='listagem_produtos_on'; 
			home_ = new Tween(document.getElementById('home').style,'top',Tween.strongEaseOut,0,-200,1,'px');
			empresa_ = new Tween(document.getElementById('empresa').style,'top',Tween.strongEaseOut,0,-200,1,'px');
			produtos_ = new Tween(document.getElementById('produtos').style,'top',Tween.strongEaseOut,0,-200,1,'px');
			produtos_.onMotionFinished = function(){
				listagem_ = new OpacityTween(document.getElementById('listagem_produtos'),Tween.linear, 1, 100, 1);
				listagem_.start()
				}
			home_.start();
			empresa_.start();
			produtos_.start();
		}else{
			listagem1_ = new OpacityTween(document.getElementById('listagem_produtos'),Tween.linear, 70, 0, 1);
			listagem1_.start()
			listagem1_.onMotionFinished = function(){
				document.getElementById('listagem_produtos').className='listagem_produtos';
				home1_ = new Tween(document.getElementById('home').style,'top',Tween.strongEaseOut,-200,0,1,'px');
				empresa1_ = new Tween(document.getElementById('empresa').style,'top',Tween.strongEaseOut,-200,0,1,'px');
				produtos1_ = new Tween(document.getElementById('produtos').style,'top',Tween.strongEaseOut,-200,0,1,'px');
				//produtos_.onMotionFinished = function(){alert( 'onMotionFinished' )};
				home1_.start();
				empresa1_.start();
				produtos1_.start();
				
			}

		}


}	


//******************************* area Reservada *************************
function mostra_mapa(parametro) {
	
	if (parametro =='sim') {
		
		document.getElementById('area').className='area_escondida_on'; 
		document.getElementById('flash_area').className='flash_area_on'; 
		opacityTween11 = new OpacityTween(document.getElementById('area'),Tween.linear, 1, 70, 1);
		opacityTween11.start();
		opacityTween22 = new OpacityTween(document.getElementById('flash_area'),Tween.linear, 0, 100, 1);
		opacityTween22.start();
		
		
	}else{
   		
		opacityTween = new OpacityTween(document.getElementById('area'),Tween.linear, 70, 0, 1);
		opacityTween.start();
		opacityTween2 = new OpacityTween(document.getElementById('flash_area'),Tween.linear, 100, 0, 1);
		opacityTween2.start()
		opacityTween2.onMotionFinished = function(){
			document.getElementById('area').className='area_escondida';
			document.getElementById('flash_area').className='flash_area';
			};

	}
}
	
	
	 function alertar(frame) {
	 
	 	alert(frame);
	 
	 }

	 function getFlashMovie(movieName) {
	  var isIE = navigator.appName.indexOf("Microsoft") != -1;
	  return (isIE) ? window[movieName] : document[movieName];
	 }
	 
	 function desativa_menu(menu){
	 	
		if(menu2){
			
			getFlashMovie(menu2).activaFlash();
		}
		
		getFlashMovie(menu).activaFlash();
		menu2=menu;
		
	/* desliza menu produtos */
		if (menu=='produtos_flash' & produto_activo=='nao' ){
			desliza_menus('sim');
			produto_activo='sim'
			
			if(id_antigo){
				document.getElementById(id_antigo).className='filho';
				id_antigo=null;
			}
			
		}
		
		if(menu!='produtos_flash' & produto_activo=='sim'){
			desliza_menus('nao');
			produto_activo='nao';
			
		}
		
	/* fim desliza menu produtos */	
	/* troca o fundo */
		switch(menu)
		{
		case 'home_flash':
		  troca_fundo(fundo_home);
		  break;    
		case 'empresa_flash':
		  troca_fundo(fundo_empresa);
		  break;
		case 'produtos_flash':
		  troca_fundo(fundo_produtos);
		  break;
		case 'galeria_flash':
		  troca_fundo(fundo_galeria);
		  break;
		case 'contactos_flash':
		  troca_fundo(fundo_contactos);
		  break;
		}
	
	/* fim de troca o fundo */
	
	
	//alert(produto_activo);	
	 }
	 
	 	function formSend(hiperligacao, framee, titulo) {
	  	getFlashMovie('info_direito').sendTextToFlash(hiperligacao, framee, titulo);
		
	
		
	 }
	 
	 function getTextFromFlash(str) {
	  document.htmlForm.receivedField.value = "From Flash: " + str;
	  return str + " received";
	 }
