var selectedCell;
function HighlightSelection(currentObject){
	if(selectedCell == null)
	{	
		var parentTable = currentObject; 
		while(parentTable.tagName != 'TABLE')
		{
			parentTable = parentTable.parentNode; 
		}
		if(parentTable.rows != null)
		{
			for(var ii = 0; ii < parentTable.rows.length; ii++)
			{
				if(parentTable.rows[ii].cells != null)
				{
					for(var jj = 0; jj < parentTable.rows[ii].cells.length; jj++)
					{
						if(parentTable.rows[ii].cells[jj].className == "SelectedItem")
						{
							parentTable.rows[ii].cells[jj].className = "Item";
						}
					}
				}
			}
		}
	}
	else
	{
		selectedCell.className = "Item";
	}
	currentObject.parentNode.className = "SelectedItem";
	selectedCell = currentObject.parentNode;
}

function updateGalleryImage(captionId,imageId,caption,photoUrl,gallery){
	document.getElementById(captionId).innerHTML = caption;
	document.getElementById(imageId).src = photoUrl;
	HighlightSelection(gallery);
	// window.event is undefined in Firefox, Nescape 4.74, Nescape 6.1 and Nescape 7.1, 
	// need a check if e is undefined before calling subsequent methods using e
	if(typeof(window.event) != 'undefined') 
	{
	    e = window.event;
	    e.cancelBubble = true;
	    if (e.stopPropagation) e.stopPropagation();
	 }
	return false;
}

function ListingOfInterestStat(webContactID, listingID, portalID, sequence){

	Colpa.Service.ListingsOfInterestService.AddListingsOfInterestStat(webContactID, listingID, portalID, sequence, OnComplete, OnTimeOut, OnError);
	return(true);
}

function OnComplete(args){
	//alert("Complete");
}

function OnTimeOut(args){
	//alert("Service call timed out");
}

function OnError(args){
	//alert("Error calling service method")
}
