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.GC.CID.value=escape(CID);
	document.GC.Addr.value=escape(newCurUrl);
	document.GC.SArgs.value=escape(CurArray[1]);
	document.GC.FUrl.value=escape(CurArray[0]);
	document.GC.Cook.value=escape(CE);
 }
 else
 {
  var CurArray = CurPage.split('?');
	document.GC.CID.value=escape(CID);
	document.GC.Addr.value=escape(newCurUrl);
	document.GC.SArgs.value="";
	document.GC.FUrl.value=escape(CurArray[0]);
	document.GC.Cook.value=escape(CE);
 } 
