function Bloqueador(visible, padre)
{
	this.bloqueador=null;
	this.mensaje=null;
	this.visible=false;
	
	if(document.all)	//IE...
	{
		var extra_css='filter:alpha(opacity=80);';
	}
	else
	{
		var extra_css='-moz-opacity: 0.8; opacity: 0.8;';
	}

	this.texto_css='.bloqueador_visible {background-color: transparent; position: fixed; left:0px; top: 0px; display: block; z-index: 9999; text-align: left;}';
	this.texto_css+='.bloqueador_invisible {display: none;}';
	this.texto_css+='.bloqueador_visible .mensaje {position: relative; top: 20px; left: 20px; border: 1px black solid; padding: 4px; background-color: #91231B; color: white; font-weight: bold; '+extra_css+'}';

	this.crear(visible, padre);
}

Bloqueador.prototype.crear=function(visible, padre)
{
	var temp_clase='';

	//Calculando el estilo y el padre...

	if(visible)
	{
		this.visible=true;
		temp_clase='bloqueador_visible';		
	}
	else
	{
		this.visible=false;
		temp_clase='bloqueador_invisible';
	}

	if(!padre)
	{
		var padre=document.body;
	}

	//Creando estilos css...
	var estilo=document.createElement('style');
	estilo.type="text/css";
	if(estilo.styleSheet)
	{
		estilo.styleSheet.cssText=this.texto_css;
	}
	else
	{
		estilo.appendChild(document.createTextNode(this.texto_css));
	}

	document.getElementsByTagName('head')[0].appendChild(estilo);


	//Ensamblar...
	this.bloqueador=montar_elemento('div', temp_clase, null, padre);
	this.mensaje=montar_elemento('span', 'mensaje', 'Cargando...', this.bloqueador);
	this.calcular_dimensiones(); 
}

Bloqueador.prototype.calcular_dimensiones=function()
{
	var dimensiones=this.obtener_dimensiones_chrome();

	this.bloqueador.style.width=dimensiones[0]+'px';
	this.bloqueador.style.height=dimensiones[1]+'px';
}

Bloqueador.prototype.obtener_dimensiones_chrome=function()
{
	var alto;
	var ancho;

	if(window.innerWidth) 
	{
		ancho=window.innerWidth;
		alto=window.innerHeight;
	} 
	else if(document.documentElement && document.documentElement.clientWidth) 
	{
		ancho=document.documentElement.clientWidth;
		alto=document.documentElement.clientHeight;
	} 
	else if(document.body) 
	{
		ancho=document.body.clientWidth;
		alto=document.body.clientHeight;
	}

	var resultado=Array(ancho, alto);

	return resultado;
}

Bloqueador.prototype.conmutar=function()
{
	if(this.visible)
	{
		this.visible=false;
		this.bloqueador.className='bloqueador_invisible';
	}
	else
	{
		this.visible=true;
		this.bloqueador.className='bloqueador_visible';
		this.calcular_dimensiones(); 	
	}
}
