﻿//this one is customized, goes in diff file, INDIVIDUAL FORM FIELDS, and FILE NAME   
function watchListItemAdd(divId,id)
{
	//we pass the PLACE id
	//store_row_color(divId);
	//set_bg_color(divId,'#ff0000');
	
  var url = '/ajax/watchListItemAdd.php?divId=' + divId + '&id=' + id;
	ajaxConn = new AjaxConnection();
	ajaxConn.url = url;
	ajaxConn.next_function = 'get_result';
	ajaxConn.process_url();
}

//function with MAJOR customizatioin each time
function get_result(xmlDoc)
{
  //no loop, we only update one record at at time
  var i = 0;
  // do a check to make sure we got result set back...
  while(xmlDoc.getElementsByTagName('id').item(i))
  {
    var tempId = xmlDoc.getElementsByTagName('id').item(i).firstChild.data;
    var tempResult = xmlDoc.getElementsByTagName('result').item(i).firstChild.data;
    var tempDivId = xmlDoc.getElementsByTagName('divId').item(i).firstChild.data;
		i++;
		if(tempResult != "ERROR")
		{
			set_inner_html(tempDivId,"<a href=\"/products/watchList/\"><img src=\"/products/images/watching.gif\" class=\"cleanImg\"></a>");
			//fade_color(tempDivId,'bg');
  	}
  }
}					
