	var JanelaPopUp;

	function ActivateScroll(){
		var obj = document.getElementById('divbody');
		//alert(document.body.clientHeight + ' ' + document.body.scrollHeight + ' ' + document.body.offsetHeight);
		if(document.body.clientWidth < 1000 || document.body.clientHeight < 700){
			//obj.overFlow = 'auto'
			if(document.body.clientWidth < 1000)
				obj.style.width = 1000;
			else
				obj.style.width = '100%';
				
			if(document.body.clientHeight < 750)
				obj.style.height = 750;
			else			
				obj.style.height = '100%';
		}else{
			//obj.overFlow = 'visible'
			if(document.body.scrollWidth > document.body.clientWidth){
				obj.style.width = document.body.scrollWidth;
			}else{
				obj.style.width = '100%';
			}
			
			if(document.body.scrollHeight > document.body.clientHeight){
				obj.style.height = document.body.scrollHeight;
			}else{
				obj.style.height = '100%';
			}
			
		}
	}
	
	function AbrePopUp(arquivo,largura,altura,alinhamento,incrementoX,incrementoY){
		if(!largura)largura = 460;
		if(!altura)altura = 400;
		if(!alinhamento)alinhamento = "top-left"
		if(!incrementoX)incrementoX=0;
		if(!incrementoY)incrementoY=0;
		
		var left = 0;
		var top = 0;
		
		//TOPO
		if(alinhamento=="top-left" || alinhamento=="left-top"){
			left = 0;
			top = 0;
		}
	
		if(alinhamento=="top-center" || alinhamento=="center-top"){
			left = ((screen.width-largura)/2);
			top = 0;
		}
		
		if(alinhamento=="top-right" || alinhamento=="right-top"){
			left = (screen.width-largura);
			top = 0;
		}
	
	
		//MEIO
		if(alinhamento=="middle-left" || alinhamento=="left-middle"){
			left = 0;
			top = ((screen.height-altura)/2);
		}
	
		if(alinhamento=="middle-center" || alinhamento=="center-middle"){
			left = ((screen.width-largura)/2);
			top = ((screen.height-altura)/2);
		}
		
		if(alinhamento=="middle-right" || alinhamento=="right-middle"){
			left = (screen.width-largura);
			top = ((screen.height-altura)/2);
		}
		
		//BAIXO	
		if(alinhamento=="bottom-left" || alinhamento=="left-bottom"){
			left = 0;
			top = (screen.height-altura);
		}
	
		if(alinhamento=="bottom-center" || alinhamento=="center-bottom"){
			left = ((screen.width-largura)/2);
			top = (screen.height-altura);
		}
		
		if(alinhamento=="bottom-right" || alinhamento=="right-bottom"){
			left = (screen.width-largura);
			top = (screen.height-altura);
		}
	
		if(JanelaPopUp)JanelaPopUp.close();
		JanelaPopUp = window.open(arquivo,'JanelaPopUp','width='+largura+', height='+altura+', left='+left+', top='+top);
		JanelaPopUp.focus();
		//window.open(arquivo,'titulo');
		
		void(0);
		
	}
	
