function getCookie(myName)
{
	var offset, end;
	var search = myName + "=";
	if (document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;	
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
			{
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return null;
}
function extractValue(valToExtract, str)
{
	var i, j, tmp, start, retstr;
	retstr = "";
	start = str.indexOf(valToExtract + '=');
	if (start != -1)
	{
		i = start;
		while ((str.charAt(i) != '&') && (i<=str.length)) { i++; }
		tmp = str.substr(start, i-1);
		j = tmp.indexOf('=');
		if (j != -1)
		{
			retstr = tmp.substr(j+1, tmp.length - (j+1));
		}
	}
	return retstr;
}
function att_land()
{
	var i, kw, src, tmp;
	i = document.location.search.indexOf("src=overture");
	if (i != -1)
	{
		src = extractValue('src', document.location.search);
		kw = extractValue('OVRAW', document.location.search);
	}
	else
	{
		i = document.location.search.indexOf("referrer=Google");
		if (i != -1)
		{
			src = extractValue('referrer', document.location.search);
			kw = extractValue('kw', document.location.search);
		}
		else
		{
			i = document.location.search.indexOf("src=");
			if (i != -1)
			{
				src = extractValue('src', document.location.search);
				kw = extractValue('keywords', document.location.search);
			}
			else
			{
				i = document.location.search.indexOf("Source=");
				if (i != -1)
				{
					src = extractValue('Source', document.location.search);
					kw = extractValue('keywords', document.location.search);
				}
			}
		}
	}
	
	if (i != -1)
	{
		tmp = getCookie('sesrc');
		if ((tmp == null) || (tmp.length == 0))
		{
			document.cookie='sesrc=' + src + '; path=/; domain=.moremoviesdirect.com; ';
		}
		tmp = getCookie('sekw');
		if ((tmp == null) || (tmp.length == 0))
		{
			document.cookie='sekw=' + kw + '; path=/; domain=.moremoviesdirect.com; ';
		}
	}

	tmp = getCookie('seref');
	if ((tmp == null) || (tmp.length == 0))
	{
		document.cookie='seref=' + escape(document.referrer) + '; path=/; domain=.moremoviesdirect.com; ';
	}

	return;
}
