var xmlHttp

function dynamicProfile(str)
{ 
	xmlHttp=getAJAXHandler();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="/js/_teamProfileServer.cfm";
	url=url+"?profileid="+str;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	function stateChanged() 
	{ 
		if (xmlHttp.readyState==4)
		{ 
			getElementWithID(profilediv).innerHTML=xmlHttp.responseText;
			if(profilediv == 'profilea'){ profilediv = 'profileb'; }
			else { profilediv = 'profilea'; }
			// alert('content:'+trim(xmlHttp.responseText)+'Next Profile div: '+profilediv);
			getstyle("prof"+newprofile).visibility = "visible";
			getstyle("baby"+newprofile).visibility = "hidden";
			if (currentprofile != 0){
				getstyle("baby"+currentprofile).visibility = "hidden";
				if (document.getElementById("thumb"+currentprofile).className == "thumb last curr"){
					document.getElementById("thumb"+currentprofile).className = "thumb last";
				}else{
					document.getElementById("thumb"+currentprofile).className = "thumb";
				}
			}
			if (document.getElementById("thumb"+newprofile).className == "thumb last"){
				document.getElementById("thumb"+newprofile).className = "thumb last curr";
			}else{
				document.getElementById("thumb"+newprofile).className = "thumb curr";
			}
			animate();
		}
	}
}

function getAJAXHandler()
{
	var ajaxHandler = false;
	try	//Good browsers
	{		ajaxHandler = new XMLHttpRequest();		}
	catch(e1)
	{
		try	//Some versions of IE
		{			ajaxHandler = new ActiveXObject("Msxml2.XMLHTTP");		}
		catch(e2)
		{	
			try	//Some other versions of IE
			{				ajaxHandler = new ActiveXObject("Microsoft.XMLHTTP");			}
			catch(e3)	//No dice?  What a drag.
			{				return false;			}
		}
	}
	return ajaxHandler;
}

function getElementWithID(id)
{
	var elementPtr = false;
	if (document.getElementById)
		elementPtr = document.getElementById(id);
	else if (document.all)
		elementPtr = document.all[id];
	else if (document.layers)
		elementPtr = document.layers[id];
	return elementPtr;
}

function toggleDisplay(id)
{
	var box = getElementWithID(id);
	if(box == null)
	{
		alert(id + " not found in page");
		return false;
	}
	if(box.style.display.toLowerCase() == "none")
		box.style.display = "block";
	else
		box.style.display = "none";
	return false;
}

function setDisplay(id, flag)
{
	var box = getElementWithID(id);
	if(box == null)
	{
		alert(id + " not found in page");
		return false;
	}
	//Ensure that flag is a valid value
	flag = flag.toLowerCase();
	switch(flag)
	{
		case 'none':
		case 'block':
		case 'inline':
			break;

		default:
			flag = 'none';
			break;
	}
	box.style.display = flag;
	return false;
}

function toggleVisibility(id)		{	return toggleDisplay(id);	}
function setVisibility(id, flag)	{	return setDisplay(id, flag);	}
