/* Evento window.onstopscroll */
window.intervalstopscroll = null;
window.onstopscroll2 = function(){
	SA.alinha();	
}
window.onscroll = function() {
	clearTimeout(window.intervalstopscroll);
	window.intervalstopscroll = setTimeout('window.onstopscroll2();window.onstopscroll();', 50);
};
window.onstopscroll = new Function();
// Fundo preto do site 
var bgSite = {
	'show': function() {
		setAlpha('bgSite', 80);
		$('bgSite').style.height = getDocSize().y+13+'px';
		$('bgSite').style.display = 'block';
		var obj = document.getElementsByTagName('SELECT');
		for (var i = 0; i < obj.length; i++) {
			obj[i].style.display = "none";
		}
	},
	'hide': function() {
		$('bgSite').style.display = 'none';
		var obj = document.getElementsByTagName('SELECT');
		for (var i = 0; i < obj.length; i++) obj[i].style.display = "block";
	},
	'alinha': function(){
		var newY;
		newY = (getDocVisibleSize().y > getDocSize().y)?getDocVisibleSize().y:getDocSize().y;
		$('bgSite').style.width = getDocSize().x+'px';
		$('bgSite').style.height = newY+'px';
	}
};

var SA = {
	'opened': false,
	'show': function(txt) {
		this.opened = true;
		bgSite.show();
		
		$('alertError').innerHTML = txt;
		$('alertSite').style.display = 'block';
		
		this.onClick = function(bt){ this.hide(); }
		
		this.alinha();
	},
	'open': function(txt){ this.show(txt); },
	'alinha' : function(){
		if(!this.opened) return;
		var SC = getScroll();
		var VS = getDocVisibleSize();
		var SZ = getSize('alertSite');
		newX = (VS.x-SZ.x)/2;
		newY = (VS.y-(SZ.y))/2;
		$('alertSite').style.top = (newY+SC.y)+"px";
		$('alertSite').style.left = (newX+SC.x)+"px";
		bgSite.alinha();
	},
	'hide': function(){
		this.opened = false;
		
		$('alertError').innerHTML = '';
		 
		$('alertSite').style.top = "-1000px";
		$('alertSite').style.lef = "-1000px";
		$('alertSite').style.display = "none";
		bgSite.hide();
	},
	'onClick': function(bt){ this.hide(); }
}