function chooseIndArea(theLink)
{
	indDiv = document.getElementById("indAreas");
	indDiv.style.display = 'block';

	/* Because of IE bug, we have to bring the parent "mRight" (with position:relative) to front! */
	obj = indDiv;
	if (obj.parentNode)
	{
		while (obj = obj.parentNode)
		{
			if (obj.className=='mRight') {
				obj.style.zIndex='300';
				obj.style.position='relative'; // ..we also have to remind that it's position:relative!
				obj=window; //ends the loop
			}
		}
	}
	// Below: we don't use "addEvent". Otherwise the event will be added everytime we click on the link!
	theLink.onblur=hideIndArea;
}

function hideIndArea()
{
	// Set a little delay to prevent the div to be hidden before the browser fires the link!
	setTimeout("indDiv.style.display='none';",200);
}

function showHideDet(mySpan)
{
	myDiv = mySpan.parentNode;
	myTable = myDiv.getElementsByTagName("table")[0];
	if (myTable.style.display=='block') {myTable.style.display='none'; myDiv.style.background='none'; mySpan.style.backgroundImage='url("../im/ico_ar_rx.gif")';}
	else {myTable.style.display='block'; myDiv.style.background='#e0e0e0'; mySpan.style.backgroundImage='url("../im/ico_ar_dn.gif")';}
}

function showHideAddress()
{
	myCheck = document.getElementById('liveChinaCheck');
	myTR = document.getElementById('chinaAddTR');
	if (myCheck.checked) {
		myTR.style.display = (document.all) ? 'block' : 'table-row';
		arrayOrigLengh = reqFields.length;
		reqFields.push('province0'); //add array item
		reqFields.push('address'); //add array item
	}
	else {
		myTR.style.display = 'none';
		reqFields.splice(arrayOrigLengh,2); //remove array items
		document.getElementById('province0').options[0].selected=true;
		document.getElementById('city0').options.length=0;
		document.getElementById('address').value='';
	}
}

function showHideLoading(what2do)
{
	/* THIS is the current Window object, or the Opener Window object, when this function is called from a popup */
	myIframe = this.document.getElementById("loadingIframe");
	myDiv = this.document.getElementById("loadingDiv");
	mySpan = this.document.getElementById("loadingSpan");

	currTop = (this.innerHeight) ? this.pageYOffset : ( (document.documentElement && document.documentElement.scrollTop) ? this.document.documentElement.scrollTop : ((document.body) ? this.document.body.scrollTop : "") );

	/*** Height of the current window's inner area: IE=document.documentElement.clientHeight, Moz=document.body.clientHeight; ***/
	/*** Height of the whole page content: IE=document.body.scrollHeight, Moz=document.documentElement.scrollHeight; ***/
	myWinHeight = (document.all) ? this.document.body.scrollHeight : this.document.documentElement.scrollHeight;
	myWinWidth = (document.all) ? this.document.body.scrollWidth : this.document.documentElement.scrollWidth-16;
	
	if (what2do == 2) { myIframe.style.display="none"; myDiv.style.display="none"; mySpan.style.display="none"; }
	else
	{
		// First of all, let's prepare the loadingIframe (for select-one fields and other Iframes to stay on the background)
		myIframe.style.filter = "alpha(opacity=0)";
		myIframe.style.MozOpacity = 0;
		myIframe.style.opacity = 0;
		myIframe.style.height = myWinHeight + "px";
		myIframe.style.width = myWinWidth + "px";

		// Then, prepare loadingDiv and loadingSpan
		myDiv.style.filter = "alpha(opacity=60)";
		myDiv.style.MozOpacity = 0.6;
		myDiv.style.opacity = 0.6;
		myDiv.style.height = myIframe.style.height;

		mySpan.style.left = (myWinWidth/2 - 80) + "px";
		mySpan.style.top = (currTop+200) + "px";

		myIframe.style.display="block";
		myDiv.style.display="block";
		mySpan.style.display="block";
	}
}
document.write('<iframe id="loadingIframe"></iframe> <div id="loadingDiv"></div> <span id="loadingSpan"><img src="/im/ico_load.gif"/> Please wait...<br/>DO NOT REFRESH!</span>');

function showBalance()
{
	myBal=document.getElementById("balance");
	myBal.style.display = (myBal.style.display=='block') ? "none" : "block";
}
