var expires = new Date();
expires.setTime (expires.getTime() + 24 * 60 * 60 * 30 * 1000);
var expiryDate = expires.toGMTString();

var thisCookie = ((document.cookie != "") && (document.cookie != null));
var LastName = (thisCookie) ? getCookie("LastName") : "";
var FirstName = (thisCookie) ? getCookie("FirstName") : "";
var Title = (thisCookie) ? getCookie("Title") : "";
var email = (thisCookie) ? getCookie("email") : "";
var Phone = (thisCookie) ? getCookie("Phone") : "";
var Country = (thisCookie) ? getCookie("Country") : "";
var State = (thisCookie) ? getCookie("State") : "";
var Company = (thisCookie) ? getCookie("Company") : "";
var Location = (thisCookie) ? getCookie("Location") : "";
var Fax = (thisCookie) ? getCookie("Fax") : "";
var key = (thisCookie) ? getCookie("key") : "";
var scankey = (thisCookie) ? getCookie("scankey") : "";
var Address = (thisCookie) ? getCookie("Address") : "";
var City = (thisCookie) ? getCookie("City") : "";
var Zip = (thisCookie) ? getCookie("Zip") : "";


function newCookie(name,value) {
  if (value.length > 1) {
  document.cookie = name + "=" + value + "; expires=" + expiryDate;
  }
  }
function getCookie(name) {
  var cookieFound = false;
  var start = 0;
  var end = 0;
  var cookieString = document.cookie;
  
  var i = 0;
  // document.write("The cookieString is " + cookieString);

  
  // SCAN THE COOKIE FOR name
  while (i <= cookieString.length) {
    start = i;
    end = start + name.length;

    if (cookieString.substring(start,end) == name) {
      cookieFound = true;
      break;
    }
    i++;
   }
   
   // IS name FOUND?
   if (cookieFound) {
     start = end + 1;
     end = document.cookie.indexOf(";",start);
     if (end < start)
       end = document.cookie.length;
     return document.cookie.substring(start,end);
   }
   return "";
 }

