/*
Use like this:

<script language="JavaScript" src="loading.js"></script>

<a href="#" onclick="visi('loading');">Click</a>

or put it on a form tag:

<form name="form1" method="post" action="index.cgi" id="Form1" onsubmit="visi('loading');">

*/


/*
document.write('<p id="loading" style="background-image: url(semi-transparent.gif); background-repeat: repeat; background-position: left top; padding: 350px 0px 0px 0px; text-align: center; width: 100%; height: 100px; visibility: hidden; float: left; z-index: 0; position: absolute; left: 0px; top: 0px;">');
document.write('<table width="300" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#00CCFF" style="border: 2px solid #000000; ">');
document.write('<tr>');
document.write('<td width="40"><img src="loading.gif"></td>');
document.write('<td><font color="#FFFFFF" size="4">Loading, Please Wait...</font></td>');
document.write('</tr>');
document.write('</table>');
document.write('</p>');
*/


function visi(nr) {

// Get width and height of current page

if( window.innerHeight && window.scrollMaxY ) {
pageWidth = window.innerWidth + window.scrollMaxX;
pageHeight = window.innerHeight + window.scrollMaxY;
} else if( document.body.scrollHeight > document.body.offsetHeight ) {
pageWidth = document.body.scrollWidth;
pageHeight = document.body.scrollHeight;
} else { 
pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
pageHeight = document.body.offsetHeight + document.body.offsetTop; 
}

// Scroll to the top of the page

window.scroll(0,0);

// Set loading layer to visible

	if (document.layers)
	{
		vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
		document.layers[nr].height = pageHeight;
		document.layers[nr].visibility = vista;
	}
	else if (document.all)
	{
		vista = (document.all[nr].style.visibility == 'hidden') ? 'visible'	: 'hidden';
		document.all[nr].style.height = pageHeight;
		document.all[nr].style.visibility = vista;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
		document.getElementById(nr).style.height = pageHeight;
		document.getElementById(nr).style.visibility = vista;

	}
}
