function showResponse(originalRequest)
{
//	var debug;
//	if(debug)
//	{
//		alert(originalRequest.responseText);
//	}
//	setCookie('debug',originalRequest.responseText,1);
	if( 'xml vers'!=originalRequest.responseText.substring(2,10))
	{ 
		if(originalRequest.responseText.length!=0)
		{
			alert(originalRequest.responseText);
		}
	}
	var xmlDoc = originalRequest.responseXML; 
// update values
	var x = xmlDoc.getElementsByTagName('newvalue');
	for (i=0;i<x.length;i++)
	{ // first field is idname - 2nd is idvalue
		idname=x[i].childNodes[0].firstChild.nodeValue;
		if(x[i].childNodes[1].firstChild)
		{
			idvalue=x[i].childNodes[1].firstChild.nodeValue;
		}
		else
		{
			idvalue='';
		}
		document.getElementById(idname).value = idvalue; 
	}
// do user messages
	var x = xmlDoc.getElementsByTagName('usermessage');
	for (i=0;i<x.length;i++)
	{ // first field is idname - 2nd is idvalue
		idname=x[i].childNodes[0].firstChild.nodeValue;
//		idvalue=x[i].childNodes[1].firstChild.nodeValue;
//		document.getElementById(idname).innerHTML = idvalue; 
//		document.getElementById(idname).innerHTML += idvalue; this will not do the whole string if it's greater than 4096 characters.
		var idvalue = ' '; 
		try {
			for (var q = 0; q<60; q++) 
			{ var pointer = (q==0) ? x[i].childNodes[1].firstChild : pointer.nextSibling ; idvalue += pointer.data;}
			} catch (e) {}
		document.getElementById(idname).innerHTML = idvalue; 
	}
// do idreplace - replace an id
	var x = xmlDoc.getElementsByTagName('idreplace');
	for (i=0;i<x.length;i++)
	{ // first field is idname - 2nd is idvalue
		idname=x[i].childNodes[0].firstChild.nodeValue;
//		idvalue=x[i].childNodes[1].firstChild.nodeValue;
//		document.getElementById(idname).innerHTML = idvalue; 
		var idvalue = ''; 
		try {
			for (var q = 0; q<60; q++) 
			{ var pointer = (q==0) ? x[i].childNodes[1].firstChild : pointer.nextSibling ; idvalue += pointer.data;}
			} catch (e) {}
		$(idname).replace(idvalue);
	}
// do error messages
	var x = xmlDoc.getElementsByTagName('errormessage');
	for (i=0;i<x.length;i++)
	{ // first field is idname - 2nd is idvalue
		idname=x[i].childNodes[0].firstChild.nodeValue;
		if(x[i].childNodes[1].firstChild)
		{
			idvalue=x[i].childNodes[1].firstChild.nodeValue;
		}
		else
		{
			idvalue=' ';
		}
		if( document.getElementById(idname)!=null )
		{
			document.getElementById(idname).innerHTML = idvalue; 
		}
	}
// go to a new page
	var x = xmlDoc.getElementsByTagName('gotopage');
	for (i=0;i<x.length;i++)
	{ // first field is idname - 2nd is idvalue
		idname=x[i].childNodes[0].firstChild.nodeValue;
//jump locations come with ^ - replace with &
		idname=replaceCharacters(idname,'^','&');
//		location.href = "http://www.nclworldwide.com"+idname;
		location.href = idname;
	}
// hide a field
	var x = xmlDoc.getElementsByTagName('hidefield');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		document.getElementById(idname).style.display = 'none'; 
	}
// show a field
	var x = xmlDoc.getElementsByTagName('showfield');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		document.getElementById(idname).style.display = ''; 
	}
// set the focus
	var x = xmlDoc.getElementsByTagName('setfocus');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		document.getElementById(idname).focus(); 
		if (document.getElementById(idname).select)
		  document.getElementById(idname).select();
	}
// set background color
	var x = xmlDoc.getElementsByTagName('setbackgroundcolor');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		idvalue=x[i].childNodes[1].firstChild.nodeValue;
		document.getElementById(idname).style.background = idvalue; 
	}
// set select field selected option number
	var x = xmlDoc.getElementsByTagName('setselectnum');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		idvalue=x[i].childNodes[1].firstChild.nodeValue;
		$(idname).selectedIndex = idvalue; 
	}
// set a javascript variable
	var x = xmlDoc.getElementsByTagName('setvariable');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		idvalue=x[i].childNodes[1].firstChild.nodeValue;
		eval( idname + " = " + idvalue ); 
	}
// run a javascript function
	var x = xmlDoc.getElementsByTagName('runfunction');
	for (i=0;i<x.length;i++)
	{ // first field is idname
		idname=x[i].childNodes[0].firstChild.nodeValue;
		eval( idname ); 
	}

}



function replaceCharacters(conversionString,inChar,outChar)
{
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}
