function setTrackCookie(form) { var CookieName = "RefTrackN"; form.x_RefTrackFree.value = ""; var allcookies = document.cookie; if (allcookies == "") return false; // Now extract just the named cookie from that list. var start = allcookies.indexOf(CookieName + '='); // Cookie defined for this page? if (start != -1) { start += CookieName.length + 1; // skip name and equals sign. var end = allcookies.indexOf(';', start); if (end == -1) end = allcookies.length; var cookieval = allcookies.substring(start, end); form.x_RefTrackPay.value = cookieval; } }