var cookie_Domain = "fiduciary-trust.com";
var cookie_Path = "/";

function Set_PublicWebSite_Cookie() {
  //alert('Setting PublicWebSite Cookie');	
  //var date = new Date();
  //date.setTime(date.getTime()+(15*60*1000));
  //var expires = date.toGMTString();
  var curCookie = "publicwebsite=login; path=/; domain=fiduciary-trust.com";
  document.cookie = curCookie;
}

function Delete_Cookie(name, path, domain) {
    // Deletes a cookie - needs cookie name, path and domain
    if (Get_Cookie(name)) document.cookie = name + "=" +
	((path) ? ";path=" + path : "") +
	((domain) ? ";domain=" + domain : "") +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function Set_Cookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

//function setMachineRegistrationCookie() {
//    //alert('running setMachineRegistrationCookie()');
//    var isSelectMachineRegistration = "no";
//    if (document.getElementById('remyes').checked == true) {
//        //alert('yes');
//        isSelectMachineRegistration = "yes"
//    }
//    var expireDate = new Date();
//    var year = expireDate.getYear();
//    if (year < 1000) year = year + 1900;
//    expireDate.setYear(year + 10);
//    Set_Cookie("SelectMachineRegistration", isSelectMachineRegistration, expireDate, cookie_Path, cookie_Domain, "");
//    if (isSelectMachineRegistration == "no") {
//        Delete_Cookie("IGMachine", cookie_Path, cookie_Domain);
//    }
//}

function Get_Cookie(Cookie_Name) {
    var search = Cookie_Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        // if cookie exists
        if (offset != -1) {
            offset += search.length
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1) end = document.cookie.length;
            returnvalue = unescape(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}

//function checkMacRegCookie() {
//    //alert('running checkMacRegCookie()');
//    var rc = Get_Cookie("SelectMachineRegistration");
//    // Turn selectMachineRegistration checkbox on or off
//    if (rc == "yes") {
//        document.getElementById('remyes').checked = true;
//    } else {
//        document.getElementById('remyes').checked = false;
//    }
//}
