var tsIFrameObj; // our IFrame object

function getTeamStandings(tag, refresh)
{
	if (!document.createElement) {return true};
	var IFrameDoc;
	var URL = '/ajax/getTeamStandings.php?tag='+tag+'&refresh='+refresh;
	
	if (!tsIFrameObj && document.createElement)
	{
		// create the IFrame and assign a reference to the
		// object to our global variable tsIFrameObj.
		// this will only happen the first time 
		// callToServer() is called
		try
		{
			var tempIFrame=document.createElement('iframe');
			tempIFrame.setAttribute('id','RSIFrame');
			tempIFrame.style.border='0px';
			tempIFrame.style.width='0px';
			tempIFrame.style.height='0px';
			tsIFrameObj = document.body.appendChild(tempIFrame);
			
			if (document.frames)
			{
				// this is for IE5 Mac, because it will only
				// allow access to the document object
				// of the IFrame if we access it through
				// the document.frames array
				tsIFrameObj = document.frames['RSIFrame'];
			}
		}
		catch(exception)
		{
			// This is for IE5 PC, which does not allow dynamic creation
			// and manipulation of an iframe object. Instead, we'll fake
			// it up by creating our own objects.
			iframeHTML='<iframe id="RSIFrame" style="';
			iframeHTML+='border:0px;';
			iframeHTML+='width:0px;';
			iframeHTML+='height:0px;';
			iframeHTML+='"><\/iframe>';
			document.body.innerHTML+=iframeHTML;
			tsIFrameObj = new Object();
			tsIFrameObj.document = new Object();
			tsIFrameObj.document.location = new Object();
			tsIFrameObj.document.location.iframe = document.getElementById('RSIFrame');
			tsIFrameObj.document.location.replace = function(location)
			{
				this.iframe.src = location;
			}
		}
	}
	
	if (navigator.userAgent.indexOf('Gecko') !=-1 && !tsIFrameObj.contentDocument)
	{
		// we have to give NS6 a fraction of a second
		// to recognize the new IFrame
		var callbackname = 'getTeamStandings('+tag+','+refresh+')';
		setTimeout(callbackname,10);
		return false;
	}
	
	if (tsIFrameObj.contentDocument)
	{
		// For NS6
		IFrameDoc = tsIFrameObj.contentDocument; 
	}
	else if (tsIFrameObj.contentWindow)
	{
		// For IE5.5 and IE6
		IFrameDoc = tsIFrameObj.contentWindow.document;
	}else if (tsIFrameObj.document)
	{
		// For IE5
		IFrameDoc = tsIFrameObj.document;
	}
	else
	{
		return true;
	}
	
	IFrameDoc.location.replace(URL);
	return false;
}
	
function showStandings(tag, standings)
{
	document.getElementById(tag).innerHTML = standings;
}