


		function getCampaign()
		{
			var index1 = window.location.href.indexOf("&campaign=");
			if (index1 < 0) return "";
			var index2 = window.location.href.indexOf("&", index1);
			return window.location.href.substring(index1, index2);
		}

		function fixPageName(address)
		{
			var result = address;
			while (result.indexOf("#") >= 0 || result.indexOf("?") >= 0 || result.indexOf("&") >= 0 || result.indexOf("'") >= 0)
				result = result.replace("#", " ").replace("?", " ").replace("&", " ").replace( "'", "\'");
		}


		function incrementPTListing(listingBranded2, listingAgentID2,listingAgent2, listingListingID2, listingColistID2, listingAddress2, page, sbhomes)
		{
			//somehow increment sbhomes tables if playing from sbhomes
			var fileName='/' + listingAgentID2 + '.awstats'; 
			var addressName= listingAddress2 + " - " + listingAgent2 + getCampaign();
			if (listingBranded2 == 1) addressName += " (Branded) "; else addressName += " (Unbranded) ";
			if (listingColistID2 > 0)
			{
				var image = new Image();
				image.src = fileName + "." + listingColistID2 + '.awstats.PhotoTour?pageName=' + addressName;
			}
			else
			{
				var image = new Image();
				image.src = fileName + ".PhotoTour?pageName=" + addressName;
			}
			var image2 = new Image();
			image2.src = "/includes/incrementPT.php?branded=" + listingBranded2 + "&AgentID=" + listingAgentID2 + "&ListingID=" + 
				listingListingID2 + getCampaign();
		}
