function WM_readCookie(name) 
{
   if (document.cookie == '') 
		{ // there's no cookie, so go no further
			return false; 
		} 
		else 
		{ // there is a cookie
			var firstChar, lastChar;
			var theBigCookie = document.cookie;
			firstChar = theBigCookie.indexOf(name);	
			// find the start of 'name'
			var NN2Hack = firstChar + name.length;
		if ((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '='))
			{ // if you found the cookie
				firstChar += name.length + 1; // skip 'name' and '='
				lastChar = theBigCookie.indexOf(';', firstChar); 
				// Find the end of the value string (i.e. the next ';').
	    		if (lastChar == -1) lastChar = theBigCookie.length;
	    		return unescape(theBigCookie.substring(firstChar, lastChar));
			} 
			else 
			{ // If there was no cookie of that name, return false.
				return false;
			}
		}	
} // WM_readCookie


//check if cookie enabled
var CE=(navigator.cookieEnabled)? true : false
//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled=="undefined" && !CE)
{ 
 document.cookie="cookieson=true"
 var CE=(document.cookie=="cookieson=true")? true : false
}

if (CE)
{
var CkVal = WM_readCookie('CID');
 if (!CkVal)
 {
 var CID = 0;
 }
 else
 {
 var CID = CkVal;
 }
}
else
{
 var CID = -1;
}

var myReg = /\"/g;
//Referrer Parse
var CurUrl = new String(document.referrer);
var unescRef = unescape(CurUrl);
var newCurUrl = unescRef.replace(myReg,'');
//URL Parse
var CurPage = new String(document.URL);
var unescURL = unescape(CurPage);
var newCurPage = unescURL.replace(myReg,'');
if (newCurPage.indexOf('?') > 0)
 {
  var CurArray = CurPage.split('?');
  document.writeln('<img src=\"\\Embed.taf?CID='+escape(CID)+'&Addr='+escape(newCurUrl)+'&SArgs='+escape(CurArray[1])+'&FUrl='+escape(CurArray[0])+'&Cook='+escape(CE)+'\" width=\"10\" height=\"10\" alt=\"\" border=\"0\">');
 }
 else
 {
  var CurArray = CurPage.split('?');
  document.writeln('<img src=\"\\Embed.taf?CID='+escape(CID)+'&Addr='+escape(newCurUrl)+'&FUrl='+escape(CurArray[0])+'&Cook='+escape(CE)+'\" width=\"10\" height=\"10\" alt=\"\" border=\"0\">');
 } 
