<!--

function openXMLDoc(theXMLDoc)
{
	var xmlDocTemp = new ActiveXObject("Microsoft.XMLDOM");
	xmlDocTemp.async = false;
	xmlDocTemp.load(theXMLDoc);
	return xmlDocTemp;
}

function closeXMLDoc(theXMLDoc)
{
	theXMLDoc.Close;
}

function insertRecord2FF(theXMLDoc, theAgentID, thePropType, theSearchType, theSnippet, theString, theValue1, theValue2, theViewName)
{
	var temproot;
	var currNode;
	var newNode
	var intRowRef;
	var newElem;
	var Count

	try{
	var test=theXMLDoc.getElementsByTagNameNS("*","row");
	Count = test.length;
	}
	catch(e)  
	{
	Count = '0';
	}

	
	if (Count == '0')
	{
	var newXML = new XMLHttpRequest();    
	newXML.open('GET', "XML/search_temp_crit.xml", false);        
    newXML.send(null);    
    var xmlDoc  = newXML.responseXML;

	var y=xmlDoc.getElementsByTagNameNS("*","row");

    intRowRef = y.length - 1;
    
	y.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	y.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	y.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
	y.item(intRowRef).setAttribute("SNIPPET", theSnippet);
	y.item(intRowRef).setAttribute("STRING", theString);
	y.item(intRowRef).setAttribute("VALUE1", theValue1);
	y.item(intRowRef).setAttribute("VALUE2", theValue2);
	y.item(intRowRef).setAttribute("VIEW_NAME", theViewName);
//	alert("here1:"+theValue1+ " " +theValue2);
	rstSearchTemp = xmlDoc;
	//alert('done');
	}
	else
	{

	var x=theXMLDoc.getElementsByTagNameNS("*","row")[0];
    var cloneNode=x.cloneNode(true);
    theXMLDoc.getElementsByTagNameNS("*","data")[0].appendChild(cloneNode);

	var i
	var y=theXMLDoc.getElementsByTagNameNS("*","row");

    intRowRef = y.length - 1;
	 //alert(intRowRef);    
	y.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	y.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	y.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
	y.item(intRowRef).setAttribute("SNIPPET", theSnippet);
	y.item(intRowRef).setAttribute("STRING", theString);
	y.item(intRowRef).setAttribute("VALUE1", theValue1);
	y.item(intRowRef).setAttribute("VALUE2", theValue2);
	y.item(intRowRef).setAttribute("VIEW_NAME", theViewName);
//	alert("here2:"+theValue1+ " " +theValue2)
	}

}

function insertRecord2(theXMLDoc, theAgentID, thePropType, theSearchType, theSnippet, theString, theValue1, theValue2, theViewName)
{
	var temproot;
	var currNode;
	var newNode
	var intRowRef;
	var newElem;

	temproot = theXMLDoc.documentElement
	newElem = theXMLDoc.createElement("z:row");
	temproot.childNodes.item(1).appendChild(newElem);

	temproot = theXMLDoc.getElementsByTagName("z:row");
	
	intRowRef = temproot.length - 1;
	
	temproot = theXMLDoc.documentElement
	
	
	newNode = theXMLDoc.createNode(2, "AGENT_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "PROP_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SNIPPET", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "STRING", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VALUE1", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VALUE2", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VIEW_NAME", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)

	
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SNIPPET", theSnippet);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("STRING", theString);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE1", theValue1);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE2", theValue2);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VIEW_NAME", theViewName);
	//<z:row SEARCH_ID='17' SNIPPET=' and (BATHS between 5 and 7)' STRING='Bathrooms = 5 to 7' VALUE1='5' VALUE2='7' VIEW_NAME='BATHS' PROP_TYPE='1'/>
	//alert("after 1: " + theXMLDoc.documentElement.xml)
}


function updateRecord2(theXMLRecord, theAgentID, thePropType, theSearchType, theSnippet, theString, theValue1, theValue2, theViewName)
{

	theXMLRecord.setAttribute("AGENT_ID", theAgentID);
	theXMLRecord.setAttribute("PROP_TYPE", thePropType);
	theXMLRecord.setAttribute("SEARCH_TYPE", theSearchType);
	theXMLRecord.setAttribute("SNIPPET", theSnippet);
	theXMLRecord.setAttribute("STRING", theString);
	theXMLRecord.setAttribute("VALUE1", theValue1);
	theXMLRecord.setAttribute("VALUE2", theValue2);
	theXMLRecord.setAttribute("VIEW_NAME", theViewName);

}


  
function updateRecord(whichRecord, theSearchID, theSnippet, theString, theValue1, theValue2, theViewName, thePropType)
{
	var currNode;
	var newNode
	var intRowRef;
	currNode = xmlDoc.documentElement.childNodes.item(1).childNodes.item(whichRecord)
	currNode.setAttribute("SEARCH_ID", theSearchID);
	currNode.setAttribute("SNIPPET", theSnippet);
	currNode.setAttribute("STRING", theString);
	currNode.setAttribute("VALUE1", theValue1);
	currNode.setAttribute("VALUE2", theValue2);
	currNode.setAttribute("VIEW_NAME", theViewName);
	currNode.setAttribute("PROP_TYPE", thePropType);
	//<z:row SEARCH_ID='17' SNIPPET=' and (BATHS between 5 and 7)' STRING='Bathrooms = 5 to 7' VALUE1='5' VALUE2='7' VIEW_NAME='BATHS' PROP_TYPE='1'/>
	//alert("after 1: " + xmlDoc.documentElement.xml)
}

function insertSavedSearchRecord(theXMLDoc, theAgentID, thePropType, theSearchID, theSearchName, theSearchType)
{
	var temproot;
	var currNode;
	var newNode
	var intRowRef;
	var newElem;

	temproot = theXMLDoc.documentElement
	newElem = theXMLDoc.createElement("z:row");
	temproot.childNodes.item(1).appendChild(newElem);

	temproot = theXMLDoc.getElementsByTagName("z:row");
	
	intRowRef = temproot.length - 1;
	
	temproot = theXMLDoc.documentElement
	
	
	newNode = theXMLDoc.createNode(2, "AGENT_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "PROP_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_NAME", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)

	
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_ID", theSearchID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_NAME", theSearchName);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
}

function getFieldValue(theXMLDoc, theFieldName)
{
	var tempRoot;
	tempRoot = theXMLDoc.getElementsByTagName("z:row");
	return tempRoot.item(0).getAttributeNode(theFieldName).text;
}

function deleteRecord(theXMLDoc, whichRecord)
{
	var oldRow;
	var currNode;
	var oldChild;
	var temproot;
	
	if (!window.ActiveXObject)
	{
	currNode=theXMLDoc.getElementsByTagNameNS("*","row")[whichRecord];
	currNode.parentNode.removeChild(currNode); 
	}else{
	temproot = theXMLDoc.documentElement
	currNode = temproot.childNodes.item(1)
	oldChild = currNode.removeChild(currNode.childNodes.item(whichRecord))
	}
	//alert(theXMLDoc.xml);
}

function insertRecord(theXMLDoc, theSearchID, theSnippet, theString, theValue1, theValue2, theViewName, thePropType)
{
	var temproot;
	var currNode;
	var newNode
	var intRowRef;
	var newElem;

	temproot = theXMLDoc.documentElement
	newElem = theXMLDoc.createElement("z:row");
	temproot.childNodes.item(1).appendChild(newElem);

	temproot = theXMLDoc.getElementsByTagName("z:row");
	
	intRowRef = temproot.length - 1;
	
	temproot = theXMLDoc.documentElement
	
	
	newNode = theXMLDoc.createNode(2, "SEARCH_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SNIPPET", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "STRING", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VALUE1", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VALUE2", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "VIEW_NAME", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "PROP_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)

	
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_ID", theSearchID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SNIPPET", theSnippet);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("STRING", theString);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE1", theValue1);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE2", theValue2);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VIEW_NAME", theViewName);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("PROP_TYPE", thePropType);


}


function insertRecordFF(theXMLDoc, theSearchID, theSnippet, theString, theValue1, theValue2, theViewName, thePropType)
{
	var intRowRef;

	var x=theXMLDoc.getElementsByTagNameNS("*","row")[0];
	var cloneNode=x.cloneNode(true);
	theXMLDoc.documentElement.appendChild(cloneNode);

	var i
	var y=theXMLDoc.getElementsByTagNameNS("*","row");

     // alert(name_list.length);
    intRowRef = y.length - 1;
	 //alert(intRowRef);
	temproot = theXMLDoc.documentElement
    
	y.item(intRowRef).setAttribute("SEARCH_ID", theSearchID);
	y.item(intRowRef).setAttribute("SNIPPET", theSnippet);
	y.item(intRowRef).setAttribute("STRING", theString);
	y.item(intRowRef).setAttribute("VALUE1", theValue1);
	y.item(intRowRef).setAttribute("VALUE2", theValue2);
	y.item(intRowRef).setAttribute("VIEW_NAME", theViewName);
	y.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	
}
  
function insertRecord3(theXMLDoc, theAgentID, thePropType, theSearchID, theSearchName, theSearchType)
{
	var temproot;
	var currNode;
	var newNode
	var intRowRef;
	var newElem;

	temproot = theXMLDoc.documentElement
	newElem = theXMLDoc.createElement("z:row");
	temproot.childNodes.item(1).appendChild(newElem);

	temproot = theXMLDoc.getElementsByTagName("z:row");
	
	intRowRef = temproot.length - 1;
	
	temproot = theXMLDoc.documentElement
	
	
	newNode = theXMLDoc.createNode(2, "AGENT_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "PROP_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_ID", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_NAME", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)
	newNode = theXMLDoc.createNode(2, "SEARCH_TYPE", "")
	temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode)

	
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_ID", theSearchID);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_NAME", theSearchName);
	temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
}


function insertRecord3FF(theXMLDoc, theAgentID, thePropType, theSearchID, theSearchName, theSearchType)
{
	var intRowRef;

	var x=theXMLDoc.getElementsByTagNameNS("*","row")[0];
	var cloneNode=x.cloneNode(true);
	theXMLDoc.documentElement.appendChild(cloneNode);

	var i
	var y=theXMLDoc.getElementsByTagNameNS("*","row");

     // alert(name_list.length);
    intRowRef = y.length - 1;
	 //alert(intRowRef);
	temproot = theXMLDoc.documentElement
    
	y.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
	y.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
	y.item(intRowRef).setAttribute("SEARCH_ID", theSearchID);
	y.item(intRowRef).setAttribute("SEARCH_NAME", theSearchName);
	y.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);

}
  
function truncateXMLDoc(theXMLDoc)
{
	try 
		{
			if (!window.ActiveXObject)
			{
			var temproot = theXMLDoc.getElementsByTagNameNS("*","row");
			}else{
			var temproot = theXMLDoc.getElementsByTagName("z:row");
			}
		}
	catch(e)
		{
		var temproot = null;
		}
	if(temproot != null)
	{
	for(var x=temproot.length - 1;x>=0;x--)
		deleteRecord(theXMLDoc, x)
	}
}

function SaveLastSearch(theXMLDoc, theAgentID, theSearchType, thePropType)
{

	var root = theXMLDoc.getElementsByTagName("z:row");
	var temproot;
		
	temproot = rstSearchLast.getElementsByTagName("rs:data/z:row[@AGENT_ID = '" + theAgentID + "']");
	//alert('temproot=' + temproot.length + '   root=' + root.length);
	if(true && temproot.length > 0)
		{
		
		while(temproot.length>root.length)
			{
			var oldChild;
			var newroot = rstSearchLast.documentElement;
			var currNode = newroot.childNodes.item(1);
			//alert('currNode=' + currNode);
			currNode.removeChild(temproot.item(0));
			temproot = rstSearchLast.getElementsByTagName("rs:data/z:row[@AGENT_ID = '" + theAgentID + "']");
			//alert('temproot=' + temproot.length);
			}
		

		for(var x=0;x<temproot.length;x++)
			{
	
			temproot.item(x).setAttribute("AGENT_ID", theAgentID);
			temproot.item(x).setAttribute("PROP_TYPE", thePropType);
			temproot.item(x).setAttribute("SEARCH_TYPE", root.item(x).getAttributeNode("SEARCH_TYPE").text);
			temproot.item(x).setAttribute("SNIPPET", root.item(x).getAttributeNode("SNIPPET").text);
			temproot.item(x).setAttribute("STRING", root.item(x).getAttributeNode("STRING").text);
			temproot.item(x).setAttribute("VALUE1", root.item(x).getAttributeNode("VALUE1").text);
			temproot.item(x).setAttribute("VALUE2", root.item(x).getAttributeNode("VALUE2").text);
			temproot.item(x).setAttribute("VIEW_NAME", root.item(x).getAttributeNode("VIEW_NAME").text);
			
			}
			
		for(var x=temproot.length;x<root.length;x++)
			{
			
			temproot = rstSearchLast.documentElement
			newElem = rstSearchLast.createElement("z:row");
			temproot.childNodes.item(1).appendChild(newElem);
	
			newNode = rstSearchLast.createNode(2, "AGENT_ID", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "PROP_TYPE", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "SEARCH_TYPE", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "SNIPPET", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "STRING", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VALUE1", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VALUE2", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VIEW_NAME", "");
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).attributes.setNamedItem (newNode);

			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("AGENT_ID", theAgentID);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("PROP_TYPE", intPropType);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("SEARCH_TYPE", theSearchType);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("SNIPPET", root.item(x).getAttributeNode("SNIPPET").text);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("STRING", root.item(x).getAttributeNode("STRING").text);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("VALUE1", root.item(x).getAttributeNode("VALUE1").text);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("VALUE2", root.item(x).getAttributeNode("VALUE2").text);
			temproot.childNodes.item(1).childNodes.item(temproot.childNodes.item(1).childNodes.length - 1).setAttribute("VIEW_NAME", root.item(x).getAttributeNode("VIEW_NAME").text);
			
			}
		
		}
	else
		{
		var currNode;
		var newNode;
		var intRowRef;
		var newElem;
		for(var x=0;x<root.length;x++)
			{
			temproot = rstSearchLast.documentElement;
			newElem = rstSearchLast.createElement("z:row");
			temproot.childNodes.item(1).appendChild(newElem);

			temproot = rstSearchLast.getElementsByTagName("z:row");
	
			intRowRef = temproot.length - 1;
	
			temproot = rstSearchLast.documentElement;
	
			newNode = rstSearchLast.createNode(2, "AGENT_ID", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "PROP_TYPE", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "SEARCH_TYPE", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "SNIPPET", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "STRING", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VALUE1", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VALUE2", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);
			newNode = rstSearchLast.createNode(2, "VIEW_NAME", "");
			temproot.childNodes.item(1).childNodes.item(intRowRef).attributes.setNamedItem (newNode);

	
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("AGENT_ID", theAgentID);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("PROP_TYPE", thePropType);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SEARCH_TYPE", theSearchType);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("SNIPPET", root.item(x).getAttributeNode("SNIPPET").text);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("STRING", root.item(x).getAttributeNode("STRING").text);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE1", root.item(x).getAttributeNode("VALUE1").text);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VALUE2", root.item(x).getAttributeNode("VALUE2").text);
			temproot.childNodes.item(1).childNodes.item(intRowRef).setAttribute("VIEW_NAME", root.item(x).getAttributeNode("VIEW_NAME").text);
			//<z:row SEARCH_ID='17' SNIPPET=' and (BATHS between 5 and 7)' STRING='Bathrooms = 5 to 7' VALUE1='5' VALUE2='7' VIEW_NAME='BATHS' PROP_TYPE='1'/>
			//alert("after 1: " + rstSearchLast.documentElement.xml)
			
			}
		
		}
	/*
	//root = rstSearchLast.documentElement.selectNodes("rs:data/z:row[@SEARCH_TYPE='PROP']");
	root = rstSearchLast.documentElement.selectNodes("rs:data/z:row");
	textstuff = '';
	for(var x=0;x<root.length;x++)
		textstuff += root.item(x).xml + '\n';
	alert('rstSearchLast Done\n' + textstuff);
	*/
	//alert('rstSearchLast=\n' + rstSearchLast.xml);
}


//-->
