ppc_track_clicks();

function ppc_track_clicks()
{
	var listingid, CTRflag;	
	
	listingid = ppc_getCookie("lid");	
	
	
	if (listingid != null)
	{
	
		CTRflag = ppc_getCookie("CTRFlag");

	
		if (CTRflag == null || CTRflag == "0")
		{
			var dtDate;
			dtDate = new Date();
			//JIRA WEB:693 - Change PPC Cookie duration to 30 days
			//dtDate.setMonth(dtDate.getMonth() + 6);
			dtDate.setDate(dtDate.getDate() + 30);

			ppc_setCookie("CTRFlag", "1", dtDate);

			var url;
			url = "https://ppc.hotelclub.com/tracking/CTR.aspx?lid=" + listingid;	

			document.write('<i' + 'mg height="1" width="1" border="0"' + 'src="' + url + '" />');
		}
	}
	
	return;
}

function ppc_setCookie(sName, sValue, dtExpirationDate)
{
	document.cookie = sName + "=" + escape(sValue) + "; expires=" + dtExpirationDate.toGMTString();
	return;
}

function ppc_getCookie(sName)
{
	var aCookie = document.cookie.split("; ");

	for (var i=0; i < aCookie.length; i++)
	{
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]) 
			return unescape(aCrumb[1]);
	}

	return null;
}