function in_place_edit( ipe_id )
{
	var iObj = document.getElementById( 'i' + ipe_id );
	var sObj = document.getElementById( 's' + ipe_id );
	var cObj = document.getElementById( 'c' + ipe_id );
	var tObj = document.getElementById( 't' + ipe_id );
	var pObj = document.getElementById( 'p' + ipe_id );
	if( iObj && sObj && cObj && tObj && pObj )
	{
		iObj.style.display = "";
		sObj.style.display = "";
		cObj.style.display = "";
		tObj.style.display = "none";
		pObj.style.display = "none";
	}
	else
	{
		alert("failed to find something for " + ipe_id +":\ni: " + iObj + "\ns: " + sObj + "\nc: " + cObj + "\nt: " + tObj + "\np: " + pObj);
	}
}

function in_place_save( ipe_id, url, arg, extra_args )
{
	var iObj = document.getElementById( 'i' + ipe_id );
	var sObj = document.getElementById( 's' + ipe_id );
	var cObj = document.getElementById( 'c' + ipe_id );
	var tObj = document.getElementById( 't' + ipe_id );
	var pObj = document.getElementById( 'p' + ipe_id );
	if( iObj && sObj && cObj && tObj && pObj )
	{
		iObj.style.display = "none";
		sObj.style.display = "none";
		cObj.style.display = "none";
		tObj.style.display = "none";
		pObj.style.display = "";
		//alert("would save '" + iObj.value + "' as '" + arg + "' to '" + url + "' here");
		var params = { 'ipe':ipe_id };
		params[arg] = iObj.value;
		AjaxRequest.post(
			{
				'url': url,
				'queryString':extra_args,
				'parameters':params,
				'onSuccess':in_place_success,
				'onError':in_place_error
			}
		);
	}
	else
	{
		alert("failed to find something for " + ipe_id +":\ni: " + iObj + "\ns: " + sObj + "\nc: " + cObj + "\nt: " + tObj + "\np: " + pObj);
	}
}

function in_place_cancel( ipe_id )
{
	var iObj = document.getElementById( 'i' + ipe_id );
	var sObj = document.getElementById( 's' + ipe_id );
	var cObj = document.getElementById( 'c' + ipe_id );
	var tObj = document.getElementById( 't' + ipe_id );
	var pObj = document.getElementById( 'p' + ipe_id );
	if( iObj && sObj && cObj && tObj && pObj )
	{
		iObj.style.display = "none";
		sObj.style.display = "none";
		cObj.style.display = "none";
		tObj.style.display = "";
		pObj.style.display = "none";
	}
	else
	{
		alert("failed to find something for " + ipe_id +":\ni: " + iObj + "\ns: " + sObj + "\nc: " + cObj + "\nt: " + tObj + "\np: " + pObj);
	}
}

function in_place_success( req )
{
	ipe_id = req.parameters['ipe'];
	var iObj = document.getElementById( 'i' + ipe_id );
	var tObj = document.getElementById( 't' + ipe_id );
	var pObj = document.getElementById( 'p' + ipe_id );
	if( iObj && tObj && pObj )
	{
		if( req.responseText.substr( 0, 7) == 'SUCCESS' )
		{
			while( tObj.hasChildNodes() )
				tObj.removeChild( tObj.firstChild );
			tObj.appendChild( document.createTextNode( iObj.value ) );
		}
		else
		{
			alert("not a success: " + req.responseText);
		}
		
		pObj.style.display = "none";
		tObj.style.display = "";
	}
}

function in_place_error( req )
{
	ipe_id = req.parameters['ipe'];
	var tObj = document.getElementById( 't' + ipe_id );
	var pObj = document.getElementById( 'p' + ipe_id );
	if( tObj && pObj )
	{
		pObj.style.display = "none";
		tObj.style.display = "";
	}
}
