function Set_whereiwas(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

var today = new Date();
var expires = new Date(today.getTime() + (56 * 86400000));
  
function set_it() {
    // Set_whereiwas("wherewasi",document.whereiwasForm.whereiwas.value,expires);
    Set_whereiwas("wherewasi",document.URL,expires);

}

function Get_whereiwas(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function get_it() {
    whereiwas = Get_whereiwas("wherewasi");
location.href = whereiwas;
//return whereiwas;
    if (whereiwas == null) {
         location.href = 'test2.htm';
    }
}

