/**
 * @author Admin
 */
function Shield(){
	this.body;
	this.formContainer;
	this.style;
	this.size;
	this.normalWidth 	= '798px';
	this.normalHeight 	= '400px';
	this.normalTop		= '124px';
	this.normalZIndex 	= '995';
	this.protectionImage = '<img src="images/Shield.gif" border="0" width="113" height="158">';
	this.loaderImage = '<img src="images/container-loader.gif" border="0" width="50" height="50">';
	this.defaultLogo = this.loaderImage;
	
	this.initialize = function(){
		this.body = document.createElement('div');
		this.body.id = 'Shield';
		this.body.style.position = 'absolute';
		this.body.style.visibility = 'hidden';
		this.body.style.display = 'block';
		this.body.style.backgroundColor = '#000000';
		if (Core.client.browser.name == 'IE') 
			this.body.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=60);"
		else {
			this.body.style.opacity = '0.6'
			this.body.style.mozOpacity = '0.6';
		}
		this.body.style.width		= this.normalWidth;
		this.body.style.height		= this.normalHeight;
		this.body.style.maxWidth 	= this.normalWidth;
		this.body.style.maxHeight	= this.normalHeight;
		this.body.style.top 		= this.normalTop;
		this.body.style.zIndex 		= this.normalZIndex;

		this.style = this.body.style;
		this.body.innerHTML = 
		'<table width="100%" height="100%" border="0"><tr><td valign="center" align="center" dir="rtl">'+
		'	<div id="ShieldLogo" class="ShieldLogo"></div>'+
		'	<div>&nbsp;</div>'+
		'	<div id="ShieldStatus" class="ShieldStatus" style="direction: '+lang.info['Dir']+';">dfdf</div>'+
		'</td></tr></table>'
		document.body.appendChild(this.body);
		
		this.size = 'normal';
	}
	
	this.show = function(StatusMessage){
		if (this.style.visibility != 'visible') {
			this.setLogo();
			this.style.visibility = 'visible';
		}
		if(typeof StatusMessage == undefined)
			this.setStatus('');
		else
			this.setStatus(StatusMessage);
		this.fix();
	}
	
	this.hide = function(){
		this.style.visibility = 'hidden';
	}
	
	this.setStatus = function(msg){
		document.getElementById('ShieldStatus').innerHTML = msg;
	}
	
	this.setLogo = function(img){
		var Logo = document.getElementById('ShieldLogo');
		if (typeof img != undefined && img != null)
			Logo.innerHTML = img;
		else
			Logo.innerHTML = this.defaultLogo;
	}
	
	this.fix = function(){
		var vpw = Core.viewport.width;
		var vph = Core.viewport.height;
		
		if (this.size == 'normal') {
			this.style.top 		= this.normalTop;
			this.style.width	= this.normalWidth;
			this.style.height	= this.normalHeight;
			this.style.maxWidth	= this.normalWidth;
			this.style.maxHeight= this.normalHeight;
			if (vpw > 900) {
				var margin = (Core.client.browser.name == 'IE')? 98: 91;
				this.style.right = Math.round((vpw - 900) / 2) + margin + 'px';
			}
			else 
				this.style.right = '98px';
			this.style.zIndex = this.normalZIndex;
		}
		else {
			this.style.top 		= '0px';
			this.style.width	= vpw + 'px';
			this.style.height	= vph + 'px';
			this.style.maxWidth	= vpw + 'px';
			this.style.maxHeight= vph + 'px';
			this.style.right 	= '0px';
			this.style.zIndex 	= '998';
		}
	}
	
	this.maximize = function(){
		this.size = 'maximized';
		this.fix();
	}
	
	this.normalize = function(){
		this.size = 'normal';
		this.fix();
	}
	

	this.initialize();
}
