function HandleAffiliateCookie()
{
		DebugDisplay();
		
		if ( QString("DC") != "" )
		{
				//
				//  If there is a DC query string param, then we are linking from an
				//  email or other site where the affiliate code was supplied.
				//  MC will set the DC cookie, and we set the DCINUSE cookie
				//
				SetDCInUseCookie()
		}
		else
		{
				//
				//  No DC param.  If the DCINUSE cookie is also gone, then
				//  DROP the DC cookie.
				//
				var sDCInUse = GetCookie("DCINUSE")
				if ( sDCInUse == null )
				{
						DeleteCookie("DC", "/");
						window.status="DC cookie removed.";
				}
		}

}

function SetDCInUseCookie()
{
		//
		//  Create either a transient or expiring cookie
		//
		//  SetCookie("DCINUSE", "true", null, "/" )		// transient cookie
		
		//
		//  Regular cookie, expiring in one week.
		//
		var expdate = new Date ();
		FixCookieDate (expdate); 
		expdate.setTime (expdate.getTime() + ( 7 * 24 * 60 * 60 * 1000)); // 7 days from now 
		SetCookie( "DCINUSE", "true", expdate, "/" );
		
}


function DebugDisplay()
{
		bTest = QString("DisplayCookie");
		if ( bTest == "true" )
		{
				alert( "document.cookie DebugDisplay = " + document.cookie);			
		}
}

