function AddSavedProduct(product_id)
{
	try
	{
					
		url = 'http://www.seriousbats.com/modify_saved_products.php?add_id=' + product_id.toString();
		_MakeCall(url);				

	}
	catch(e)
	{
		
	}
	
}

function RemoveSavedProduct(product_id)
{
	try
	{
		url = 'http://www.seriousbats.com/modify_saved_products.php?remove_id=' + product_id.toString();
		_MakeCall(url);				

	}
	catch(e)
	{
		
	}
	
}

function ToggleSavedProduct(product_id)
{
	try
	{
					
		url = 'http://www.seriousbats.com/modify_saved_products.php?toggle_id=' + product_id.toString();
		_MakeCall(url);				

	}
	catch(e)
	{
		
	}
	
}

function _MakeCall(url)
{
	try
	{
					
		httpLoad = createRequestObject();
		httpLoad.open('get', url);
		httpLoad.onreadystatechange = ReturnSavedProducts;
		httpLoad.send(null);
		
	}
	catch(e)
	{
		
	}
}

function ReturnSavedProducts()
{
	
	if(httpLoad.readyState == 4){ //Finished loading the response
		try
		{
			var response = httpLoad.responseXML;
			var stg = response.getElementsByTagName('saved');
			
			if(stg.length > 0){
				/* this means I received a response from the server */
				if(document.getElementById('SavedProductCount'))
				{
					document.getElementById('SavedProductCount').innerText = stg[0].childNodes.length.toString();	
				}
				
				if(stg[0].getAttribute("firsttime") == "1")
				{
					if(window.NotifyFirstSavedProduct)
					{
						NotifyFirstSavedProduct();	
					}
				}
			}
		}
		catch(e)
		{
		}
	}
}
