//getAbsoluteScreensize necessária
document.write("<link rel = 'stylesheet' type = 'text/css' href = 'source/script/DVDarkMask/DVDarkMask.css' />");

function DVDarkMask(_this)
{	
	this.screen = new getAbsoluteScreenSize();
	arguments[0] = this;
	this.visible = false;
	this.obj = null;
	this.adjust = 100;
	this.constructor = function()
	{
		document.body.style.overflow='hidden';
		var fla = document.getElementsByTagName('object');
		for(i=0; i<fla.length; i++)
			fla[i].style.visibility = 'hidden';
		var s = document.createElement('div'); // container box
		s.className = 'DVDarkMask';
		this.obj = s;
		this.setBackgroundColor("#000");
		this.setOpacity(0.7);
		this.setZIndex(5);
		document.body.appendChild(s);
		this.showMask(true);
		this.showSelects(false);
	}
	
	this.setOpacity = function(val)
	{
		var o = document.ISGECKO ? val : (val*100); 
		document.ISGECKO ? this.obj.style.MozOpacity = o : this.obj.style.filter = 'alpha(opacity='+o+')';
	}
	
	this.setBackgroundColor= function(cor){this.obj.style.backgroundColor = cor;}
	this.setZIndex= function(z){this.obj.style.zIndex = z}

	this.showSelects = function(bool)
	{
		var selects = document.getElementsByTagName('select');
	      
	    for(var i = 0; i< selects.length; i++)
			selects[i].style.visibility=(!bool) ? 'hidden' : 'visible';
	}
	this.removeMask = function(bool)
	{
		this.showSelects(true);
		document.body.removeChild(this.obj);
		document.body.style.overflow='scroll';
		var fla = document.getElementsByTagName('object');
		for(i=0; i<fla.length; i++)
			fla[i].style.visibility = 'visible';
	}
	this.showMask = function(bool)
	{
		this.obj.style.display = (bool) ? 'block': 'none';
		this.visible = bool;
		if(bool)
		{
			window.scrollTo(0,0)
			//document.body.style.overflow='hidden';
			this.obj.style.width= this.screen.getWidth() + 'px';
			this.obj.style.height= this.screen.getHeight() + 'px';
			document.body.focus();
		}
		else
		{
			//document.body.style.overflow='scroll';
			this.showSelects(true);
		}
	}

	this.constructor();
}
