/*** The window which will show all the error msg ***/

	var AW_iMaxDuration = 1000;
	var AW_iCurrentDuration = 0;
	var AW_iStepMove = 50;
	var AW_iStepOpacity = 10;
	var AW_iCurrentDurationOpacity = 0;
	var AW_iMaxDurationOpacity = 500;
	var AW_isHiding = 0;
	var AW_oForm;
	var AW_oFormTopInit;
	var AW_oFormTopCurrent;

	function AW_Init()
	{
		AW_oForm = document.getElementById("assert-form");
		AW_oFormTopCurrent = 30;
		AW_oFormTopInit = 30;
		AW_oForm.style.opacity = 0;
		AW_oForm.style.filter = 'alpha(opacity:0)';
	}

	function AW_DelayMove()
	{
		if (AW_iCurrentDuration > 0)
		{
			AW_iCurrentDuration = AW_iCurrentDuration + AW_iStepMove;
			if (AW_iCurrentDuration < AW_iMaxDuration)
			{
				//AW_oForm.style.left = 'px';
				AW_oFormTopCurrent = AW_oFormTopCurrent + 1;
				AW_oForm.parentNode.style.top = AW_oFormTopCurrent + document.body.scrollTop;
				setTimeout('AW_DelayMove()', AW_iStepMove);
			}
			else
			{
				AW_iCurrentDuration = 0;
				AW_Hide();
			}
		}
	}

	function AW_DelayOpacity()
	{
		if (AW_iCurrentDurationOpacity > 0)
		{
			AW_iCurrentDurationOpacity = AW_iCurrentDurationOpacity + AW_iStepOpacity;
			if (AW_iCurrentDurationOpacity < AW_iMaxDurationOpacity)
			{
				if (AW_isHiding == 0)
				{
					// Firefox 0 -> 1
					AW_oForm.style.opacity = AW_iCurrentDurationOpacity / AW_iMaxDurationOpacity;
					 // Explorer 0 -> 100
					AW_oForm.style.filter = 'alpha(opacity=' + AW_iCurrentDurationOpacity * 100/ AW_iMaxDurationOpacity + ')';
				}
				else
				{
					// Firefox 0 -> 1
					AW_oForm.style.opacity = 1 - AW_iCurrentDurationOpacity / AW_iMaxDurationOpacity;
					 // Explorer 0 -> 100
					AW_oForm.style.filter = 'alpha(opacity=' + (100 - AW_iCurrentDurationOpacity * 100/ AW_iMaxDurationOpacity) + ')';
				}
				setTimeout('AW_DelayOpacity()', AW_iStepOpacity);
			}
			else
			{
				AW_iCurrentDurationOpacity = 0;
				if (AW_isHiding == 1)
				{
					AW_oForm.parentNode.style.top = AW_oFormTopInit;
					AW_oForm.parentNode.style.display='none';
				}
				AW_isHiding = 0;
			}
		}
	}

	function AW_Show(sText, _bError)
	{
		if (sText == "")
		return;
		var img = "<img src='./img/assert_valid.gif' id='assertWindowIcon'>";
		if (_bError)
			img = "<img src='./img/assert_error.png' id='assertWindowIcon'>";
			
		AW_oForm.innerHTML = img + sText;
		/*var img = document.getElementById('top_open_close');
		AW_oFormTopInit = img.getAttribute('closeState')=="false"? 130 : 30;*/
		AW_oFormTopCurrent = AW_oFormTopInit;
		AW_iCurrentDuration = 1;
		AW_DelayMove();
		AW_oForm.parentNode.style.display='block';
		AW_oForm.style.display='inline-block';
		AW_isHiding = 0;
		AW_iCurrentDurationOpacity = 1;
		// Centrer
		//var arrayPageSize = getPageSize();
		//AW_oForm.parentNode.style.left = (((arrayPageSize[0] - AW_oForm.parentNode.offsetWidth) / 2) + 'px');

		/*if (_bError)
			setTimeout('AW_DelayOpacity()', 2000);
		else*/
		g_currentAWbError = _bError;
		AW_DelayOpacity();
	}
	var g_currentAWbError = false;
	function AW_Hide()
	{
		AW_isHiding = 1;
		AW_iCurrentDurationOpacity = 1;
		if (g_currentAWbError)
			setTimeout('AW_DelayOpacity()', 2000);
		else
			AW_DelayOpacity();
	}
