/* Browser detect code: */
var isDOM2 = false;
var isNS4  = false;
var isIE4  = false;
var isFireFox = false;

//identify the browser
if ( window.document.getElementById )
	{
	isDOM2 = true;
	}

if ( window.document.layers )
	{
	isNS4 = true;
	}

if ( window.document.all && !(window.document.getElementById) )
	{
	isIE4 = true;
	}

 if ( ( i = navigator.userAgent.indexOf ("Gecko" ) ) >= 0 ) 
	{
	isFireFox = true;
	}
	
/* Browser detect code End here */

var intCurrentCell = 0;
var objTimer;


//*******************************************************************
//*
//*******************************************************************
function getObj ( id ) 
{
	var obj;
		
	if ( isNS4 ) 
		{
		obj = eval ( 'document.layers["' + id + '"]' );
		}
	else if ( isIE4 ) 
		{
		obj = eval ( 'document.all["' + id + '"].style' );
		}
	else if ( isDOM2 ) 
		{
		obj = eval ( 'document.getElementById("' + id + '").style' );
		}
		
	return obj;
}


//*******************************************************************
//*
//*******************************************************************
function objHide ( obj )
{
	if ( isNS4 )
		{
		obj.visibility = "hide";
		}
	else if ( isIE4 || isDOM2 )
		{
		obj.display = "none";
		}
}


//*******************************************************************
//*
//*******************************************************************
function objShow ( obj )
{
	if ( isNS4 )
		{
		obj.visibility = "show";
		}
	else if ( isIE4 || isDOM2 )
		{
		obj.display = "";
		}
}




//*****************************************************
//*
//*****************************************************
function ShowWait()
{
	if ( document.getElementById ( "divWait" ) != null )
		{
		document.getElementById ( "divWait" ).style.display = "";
		}
		

	SetUpdateLook();
	window.setTimeout ( "SetUpdateLook();", 200 );
}


//*******************************************************************
//*
//*******************************************************************
function UpdateProgressBar()
{
	ResetProgressBar();
	
	var strMovingColor1 = "#6388C0";    //Light
	var strMovingColor2 = "#4F77B3";    //Medium
	var strMovingColor3 = "#244F8F";    //Dark
    var intTotalCells = document.getElementById ( "tblPleaseWait" ).rows[0].cells.length;
    var aColors = "strMovingColor1,strMovingColor2,strMovingColor3".split(",");
    var intTotalColors = aColors.length - 1;

    if ( intCurrentCell > intTotalCells + intTotalColors )
        {
        intCurrentCell = 0;
        }

    var intTempCell = intCurrentCell;

    for ( var z = intTotalColors; z > -1; z-- )
        {
        if ( intTempCell > -1 && intTempCell < intTotalCells )
            {
            document.getElementById ( "tblPleaseWait" ).rows[0].cells[intTempCell].style.backgroundColor = eval ( aColors[z] );
            }
        intTempCell--;
        }

    intCurrentCell++;

    objTimer = window.setTimeout("UpdateProgressBar();", 100);
}


//*******************************************************************
//*
//*******************************************************************
function ResetProgressBar()
{
    clearTimeout(objTimer);
    
    for ( var x = 0; x < document.getElementById ( "tblPleaseWait" ).rows[0].cells.length; x++ )
        {
        document.getElementById ( "tblPleaseWait" ).rows[0].cells[x].style.backgroundColor = "#9db5d9"; //
        }
}

//*******************************************************************
//*
//*******************************************************************
function SetUpdateLook()
{
	document.body.style.cursor = "wait";
	UpdateProgressBar();
}




