/* chip and trace javascript - stuart sillitoe - pulse8 2007 */


function addToWatchlist(containerID, canvasID, chip_id)
{
	if ( confirm('Are you sure you want to add this chip to the watchlist? Clicking \'OK\' will publish the details immediately.') )
	{
		var x = new Hijax();
		x.setContainer(document.getElementById(containerID));
		x.setUrl("php/addToWatchlist.php");
		x.setCanvas(document.getElementById(canvasID));
		x.captureData();
	}
}



function removeFromWatchlist(containerID, canvasID, chip_id)
{
	if ( confirm('Are you sure you want to remove this chip from the watchlist? Clicking \'OK\' will remove the details from the watchlist immediately.') )
	{
		var x = new Hijax();
		x.setContainer(document.getElementById(containerID));
		x.setUrl("php/removeFromWatchlist.php");
		x.setCanvas(document.getElementById(canvasID));
		x.captureData();
		
	}
}



function swapImg(exImg)
{
	var d = document;

	var smallImg = d.getElementById(exImg);
	var smallImgSrc = smallImg.getAttribute('src');
		
	var bigImg = d.getElementById('watchlistImageLarge');
	var bigImgSrc = bigImg.getAttribute('src');

	// set the big image src to this thumbnails src
	d.getElementById(exImg).setAttribute('src', bigImgSrc);
	
	// set the thumbnail src to the big image
	bigImg.setAttribute('src', smallImgSrc.replace(/small/, "large"));
	
}




function confirmDelete(theText)
{
	return confirm(theText);
}










