// ===========================================
// Master enthaelt die Funktionen
// SetCookie, SaveStats, CloseWindow
// ===========================================

function setCookie(nme, vlue, expres)
	{
	var strDomain = '';

	if (self.location.protocol != 'file:')
		{
		strDomain = self.location.hostname;

		var cokie = nme + '=' + escape(vlue);
		var expiration = new Date();

		if (expres == - 1)
			{
			expiration.setYear(2010);
			expiration.setMonth(01);
			expiration.setDate(01);
			}

		if (expres > 0)
			{
			var t = expiration.getTime();
			var msPerDay = 24 * 60 * 60 * 1000;
			t += (msPerDay * expres);
			expiration.setTime(t);
			}

		if (expres == 0)
			{
			cokie = nme + '=';
			}

		if ((expres == - 1) || (expres > 0))
			{
			cokie += '; expires=' + expiration.toGMTString();
			}

		cokie += '; path=/';

		if (strDomain != '')
			{
			cokie += '; domain=' + strDomain;
			}

		document.cookie = cokie;
		}
	}

function SaveStats()
	{
	var ref = document.referrer;

	if (ref != '')
		{
		if ((ref.indexOf(UrlNoWWW) == - 1) && (ref.indexOf('avalonstreasury.com') == - 1))
			{
			for (i = 0; i < ForbiddenCharacters1.length; i++)
				{
				ref = ref.replace(/ForbiddenCharacters1[i]/g, ForbiddenCharacters2[i]);
				}

			setCookie('Stats', ref, - 1);
			}
		}
	}
function CloseWindow()
	{
         document.write('<a href=\"javascript:window.close();\" onMouseOver=\"filter(\'a999\',\'a004\');\" onMouseOut=\"filter(\'a999\',\'a003\');\">');
        document.write('<img src=\"http://www.avalonstreasury.com/Avalons-Treasury-Details-Windows-Info-Subpages/Images/Details-Windows/Avalons-Treasury-Close-Windows.gif\" name=\"a999\" width=\"145\" height=\"40\" border=\"0\" title=\"\" alt=\"Detail Window: Close Window - www.avalonstreasury.com\"></a>');
	}

